Add support for immuatable samplers in vulkan.
For ycbcr conversions we need add immutable samplers to the creation of
the VkPipeline via the descriptor set layout.
Bug: skia:
Change-Id: I5eea6037191fd34d26d49f58533035316158cacd
Reviewed-on: https://skia-review.googlesource.com/c/171642
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index ffb7ac0..be3d86a 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -244,7 +244,7 @@
public:
TextureSampler() = default;
- TextureSampler(GrTextureType, GrPixelConfig, const GrSamplerState&);
+ TextureSampler(GrTextureType, GrPixelConfig, const GrSamplerState&, uint32_t extraSamplerKey);
explicit TextureSampler(GrTextureType, GrPixelConfig,
GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
@@ -253,22 +253,25 @@
TextureSampler(const TextureSampler&) = delete;
TextureSampler& operator=(const TextureSampler&) = delete;
- void reset(GrTextureType, GrPixelConfig, const GrSamplerState&);
+ void reset(GrTextureType, GrPixelConfig, const GrSamplerState&, uint32_t extraSamplerKey = 0);
void reset(GrTextureType, GrPixelConfig,
- GrSamplerState::Filter = GrSamplerState::Filter::kNearest,
- GrSamplerState::WrapMode wrapXAndY = GrSamplerState::WrapMode::kClamp);
+ GrSamplerState::Filter,
+ GrSamplerState::WrapMode wrapXAndY);
GrTextureType textureType() const { return fTextureType; }
GrPixelConfig config() const { return fConfig; }
const GrSamplerState& samplerState() const { return fSamplerState; }
+ uint32_t extraSamplerKey() const { return fExtraSamplerKey; }
+
bool isInitialized() const { return fConfig != kUnknown_GrPixelConfig; }
private:
GrSamplerState fSamplerState;
GrTextureType fTextureType = GrTextureType::k2D;
GrPixelConfig fConfig = kUnknown_GrPixelConfig;
+ uint32_t fExtraSamplerKey = 0;
};
const GrPrimitiveProcessor::TextureSampler& GrPrimitiveProcessor::IthTextureSampler(int i) {