[Graphite] Add YCbCr info to DawnTextureInfo
This CL adds Dawn's YCbCrVkDescriptor as a field to DawnTextureInfo to
facilitate clients passing in this info in the context of YCbCr sampling
being used when the backend is Android/Vulkan.
Bug: b/41488897
Change-Id: If4f55d4c63d1bab27465265fda8e76a8b0f649bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/852536
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/include/gpu/graphite/dawn/DawnTypes.h b/include/gpu/graphite/dawn/DawnTypes.h
index bf95def..7067ed3 100644
--- a/include/gpu/graphite/dawn/DawnTypes.h
+++ b/include/gpu/graphite/dawn/DawnTypes.h
@@ -26,6 +26,12 @@
wgpu::TextureAspect fAspect = wgpu::TextureAspect::All;
uint32_t fSlice = 0;
+ // The descriptor of the YCbCr info (if any) for this texture. Dawn's YCbCr
+ // sampling will be used for this texture if this info is set. Setting the
+ // info is supported only on Android and only if using Vulkan as the
+ // underlying GPU driver.
+ wgpu::YCbCrVkDescriptor fYcbcrVkDescriptor = {};
+
wgpu::TextureFormat getViewFormat() const {
return fViewFormat != wgpu::TextureFormat::Undefined ? fViewFormat : fFormat;
}
@@ -50,13 +56,30 @@
wgpu::TextureUsage usage,
wgpu::TextureAspect aspect,
uint32_t slice)
+ : DawnTextureInfo(sampleCount,
+ mipmapped,
+ format,
+ viewFormat,
+ usage,
+ aspect,
+ slice,
+ /*yCbCrVkDescriptor=*/{}) {}
+ DawnTextureInfo(uint32_t sampleCount,
+ Mipmapped mipmapped,
+ wgpu::TextureFormat format,
+ wgpu::TextureFormat viewFormat,
+ wgpu::TextureUsage usage,
+ wgpu::TextureAspect aspect,
+ uint32_t slice,
+ wgpu::YCbCrVkDescriptor ycbcrVkDescriptor)
: fSampleCount(sampleCount)
, fMipmapped(mipmapped)
, fFormat(format)
, fViewFormat(viewFormat)
, fUsage(usage)
, fAspect(aspect)
- , fSlice(slice) {}
+ , fSlice(slice)
+ , fYcbcrVkDescriptor(ycbcrVkDescriptor) {}
};
} // namespace skgpu::graphite