diff options
author | Brian Salomon <bsalomon@google.com> | 2018-07-30 10:24:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-30 14:54:25 +0000 |
commit | 60dd8c746428fb6218fff5f437b1b7c5256bba13 (patch) | |
tree | bc9c5c5b16de0ecf6d60452d69dbfd870126f97a /src/gpu/GrProgramDesc.cpp | |
parent | 12e42565886ac6b28cbcae40d63ee093bde3e630 (diff) |
Introduce enum class for texture type.
This represents the GL texture "target" but at the API-neutral level. It
will be needed here because proxy's that wrap imported texture's need to
know about sampling restrictions.
Change-Id: Ie811a6f6d04ba1b04faa6908422dca64e8e447c8
Reviewed-on: https://skia-review.googlesource.com/144304
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrProgramDesc.cpp')
-rw-r--r-- | src/gpu/GrProgramDesc.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp index f1524db555..b0396f9c37 100644 --- a/src/gpu/GrProgramDesc.cpp +++ b/src/gpu/GrProgramDesc.cpp @@ -22,28 +22,26 @@ enum { kSamplerOrImageTypeKeyBits = 4 }; -static inline uint16_t image_storage_or_sampler_uniform_type_key(GrSLType type ) { +static inline uint16_t texture_type_key(GrTextureType type) { int value = UINT16_MAX; switch (type) { - case kTexture2DSampler_GrSLType: + case GrTextureType::k2D: value = 0; break; - case kTextureExternalSampler_GrSLType: + case GrTextureType::kExternal: value = 1; break; - case kTexture2DRectSampler_GrSLType: + case GrTextureType::kRectangle: value = 2; break; - default: - break; } SkASSERT((value & ((1 << kSamplerOrImageTypeKeyBits) - 1)) == value); - return value; + return SkToU16(value); } -static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShaderFlags visibility, +static uint16_t sampler_key(GrTextureType textureType, GrPixelConfig config, const GrShaderCaps& caps) { - int samplerTypeKey = image_storage_or_sampler_uniform_type_key(samplerType); + int samplerTypeKey = texture_type_key(textureType); GR_STATIC_ASSERT(1 == sizeof(caps.configTextureSwizzle(config).asKey())); return SkToU16(samplerTypeKey | @@ -65,8 +63,7 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrResourc const GrResourceIOProcessor::TextureSampler& sampler = proc.textureSampler(i); const GrTexture* tex = sampler.peekTexture(); - k16[j] = sampler_key(tex->texturePriv().samplerType(), tex->config(), sampler.visibility(), - caps); + k16[j] = sampler_key(tex->texturePriv().textureType(), tex->config(), caps); } // zero the last 16 bits if the number of uniforms for samplers is odd. if (numTextureSamplers & 0x1) { |