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()) {
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 IPoint destination_origin,
128 VALIDATION_LOG <<
"Attempted to add a texture blit with no destination.";
134 auto bytes_per_image =
137 if (
source.range.length != bytes_per_image) {
139 <<
"Attempted to add a texture blit with out of bounds access.";
144 destination_origin, std::move(label));
150 VALIDATION_LOG <<
"Attempted to add an invalid mipmap generation command "
virtual bool OnCopyTextureToBufferCommand(std::shared_ptr< Texture > source, std::shared_ptr< DeviceBuffer > destination, IRect source_region, size_t destination_offset, std::string label)=0
virtual bool OnCopyBufferToTextureCommand(BufferView source, std::shared_ptr< Texture > destination, IPoint destination_origin, std::string label)=0
bool AddCopy(std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, std::optional< IRect > source_region=std::nullopt, IPoint destination_origin={}, std::string label="")
Record a command to copy the contents of one texture to another texture. The blit area is limited by ...
bool GenerateMipmap(std::shared_ptr< Texture > texture, std::string label="")
Record a command to generate all mip levels for a texture. No work is encoded into the command buffer...
void SetLabel(std::string label)
virtual void OnSetLabel(std::string label)=0
virtual bool OnGenerateMipmapCommand(std::shared_ptr< Texture > texture, std::string label)=0
virtual bool OnCopyTextureToTextureCommand(std::shared_ptr< Texture > source, std::shared_ptr< Texture > destination, IRect source_region, IPoint destination_origin, std::string label)=0
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
std::string SPrintF(const char *format,...)
constexpr const char * PixelFormatToString(PixelFormat format)
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
static constexpr TRect MakeOriginSize(const TPoint< Type > &origin, const TSize< Type > &size)
static constexpr TRect MakeSize(const TSize< U > &size)