| Index: src/gpu/vk/GrVkProgramDesc.cpp
|
| diff --git a/src/gpu/vk/GrVkProgramDesc.cpp b/src/gpu/vk/GrVkProgramDesc.cpp
|
| index 74e6bbb59d0c72b929cf30a7bf311150b7de6e66..cfd32ecdba71e123d9c136e7ed49521548f6cfd0 100644
|
| --- a/src/gpu/vk/GrVkProgramDesc.cpp
|
| +++ b/src/gpu/vk/GrVkProgramDesc.cpp
|
| @@ -19,10 +19,17 @@
|
|
|
| #include "shaderc/shaderc.h"
|
|
|
| +static uint8_t precision_key_nonzero_2_bits(GrShaderType shaderType, GrSLPrecision precision,
|
| + const GrShaderCaps& caps) {
|
| + return 1 + caps.effectiveFloatPrecision(shaderType, precision);
|
| +
|
| + GR_STATIC_ASSERT(1 + kLast_GrSLPrecision < (1 << 2));
|
| +}
|
| +
|
| static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
|
| const GrGLSLCaps& caps) {
|
| int numTextures = proc.numTextures();
|
| - // Need two bytes per key (swizzle and target).
|
| + // Need two bytes per key (swizzle, sampler type, and precision).
|
| int word32Count = (proc.numTextures() + 1) / 2;
|
| if (0 == word32Count) {
|
| return;
|
| @@ -32,6 +39,17 @@ static void add_texture_key(GrProcessorKeyBuilder* b, const GrProcessor& proc,
|
| const GrTextureAccess& access = proc.textureAccess(i);
|
| GrTexture* texture = access.getTexture();
|
| k16[i] = SkToU16(caps.configTextureSwizzle(texture->config()).asKey());
|
| + if (caps.usesPrecisionModifiers()) {
|
| + GrSLPrecision p = GrPixelConfigPrecision(texture->config());
|
| + if (access.getVisibility() & kFragment_GrShaderFlag) {
|
| + k16[i] |= precision_key_nonzero_2_bits(kFragment_GrShaderType, p, caps) << 12;
|
| + }
|
| + if (access.getVisibility() & (kVertex_GrShaderFlag | kGeometry_GrShaderFlag)) {
|
| + SkASSERT(precision_key_nonzero_2_bits(kVertex_GrShaderType, p, caps) ==
|
| + precision_key_nonzero_2_bits(kGeometry_GrShaderType, p, caps));
|
| + k16[i] |= precision_key_nonzero_2_bits(kVertex_GrShaderType, p, caps) << 14;
|
| + }
|
| + }
|
| }
|
| // zero the last 16 bits if the number of textures is odd.
|
| if (numTextures & 0x1) {
|
|
|