27 std::shared_ptr<Texture> destination,
28 std::optional<IRect> source_region,
32 VALIDATION_LOG <<
"Attempted to add a texture blit with no source.";
36 VALIDATION_LOG <<
"Attempted to add a texture blit with no destination.";
40 if (source->GetTextureDescriptor().sample_count !=
41 destination->GetTextureDescriptor().sample_count) {
43 "The source sample count (%d) must match the destination sample count "
45 static_cast<int>(source->GetTextureDescriptor().sample_count),
46 static_cast<int>(destination->GetTextureDescriptor().sample_count));
49 if (source->GetTextureDescriptor().format !=
50 destination->GetTextureDescriptor().format) {
52 "The source pixel format (%s) must match the destination pixel format "
60 if (!source_region.has_value()) {
67 if (!source_region.has_value()) {
72 source_region = source_region->Intersection(
74 if (!source_region.has_value()) {
79 std::move(source), std::move(destination), source_region.value(),
80 destination_origin, std::move(label));
84 std::shared_ptr<DeviceBuffer> destination,
85 std::optional<IRect> source_region,
86 size_t destination_offset,
89 VALIDATION_LOG <<
"Attempted to add a texture blit with no source.";
93 VALIDATION_LOG <<
"Attempted to add a texture blit with no destination.";
97 if (!source_region.has_value()) {
101 auto bytes_per_pixel =
103 auto bytes_per_image = source_region->Area() * bytes_per_pixel;
104 if (destination_offset + bytes_per_image >
105 destination->GetDeviceBufferDescriptor().size) {
107 <<
"Attempted to add a texture blit with out of bounds access.";
114 if (!source_region.has_value()) {
119 source_region.value(), destination_offset,
124 std::shared_ptr<Texture> destination,
125 std::optional<IRect> destination_region,
128 bool convert_to_read) {
130 VALIDATION_LOG <<
"Attempted to add a texture blit with no destination.";
133 ISize destination_size = destination->GetSize();
134 IRect destination_region_value =
136 if (destination_region_value.
GetX() < 0 ||
137 destination_region_value.
GetY() < 0 ||
138 destination_region_value.
GetRight() > destination_size.
width ||
140 VALIDATION_LOG <<
"Blit region cannot be larger than destination texture.";
144 auto bytes_per_pixel =
146 auto bytes_per_region = destination_region_value.
Area() * bytes_per_pixel;
150 <<
"Attempted to add a texture blit with out of bounds access.";
159 destination_region_value,
160 std::move(label), slice, convert_to_read);
164 const std::shared_ptr<Texture>& texture) {
171 VALIDATION_LOG <<
"Attempted to add an invalid mipmap generation command "