aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgramDesc.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-07-13 14:09:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-13 14:09:31 -0700
commit990dbc88796f656418bcc4c196df30ed9bef6345 (patch)
tree8ce14a655fd0e98363e5eb7a895ee79516012927 /src/gpu/gl/GrGLProgramDesc.cpp
parente5de130788c8637d2f7df9ddb0241b78e04d5882 (diff)
Add Texture2D and Sampler GrSLTypes
These two new types are in support of Vulkan and the ability to send separate texture and sampler uniforms to the shader. They don't really fit well in the current system, since the current system ties together to idea of intended use and how to emit shader code into the same GrSLType enum. In vulkan, I want the GrGLSLSampler object to be used as a Sampler2D, but when appending its declaration it will emit a Texture2D and sampler object. Our query for GrSLTypeIsSamplerType refers more to the combination of texture and sampler and not just the sampler part. The GrSLTypeIs2DTextureType query is for is a a SamplerType that uses Texture2Ds. My new types don't really fit into either these categories as they are just half of the whole. In some refactoring down the road (possibly connected with SkSL), I suggest we split apart the concept of how we intend to use a GrGLSLSampler (Sampler2D, SamplerBuffer, etc.), from how we actually add it to the code (sampler, texture2D, sampler2D, etc.). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2143143002 Review-Url: https://codereview.chromium.org/2143143002
Diffstat (limited to 'src/gpu/gl/GrGLProgramDesc.cpp')
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 801224c9b6..695a46d240 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -20,8 +20,8 @@
static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShaderFlags visibility,
const GrGLSLCaps& caps) {
enum {
- kFirstSamplerType = kSampler2D_GrSLType,
- kLastSamplerType = kSamplerBuffer_GrSLType,
+ kFirstSamplerType = kTexture2DSampler_GrSLType,
+ kLastSamplerType = kTextureBufferSampler_GrSLType,
kSamplerTypeKeyBits = 4
};
GR_STATIC_ASSERT(kLastSamplerType - kFirstSamplerType < (1 << kSamplerTypeKeyBits));
@@ -52,8 +52,8 @@ static void add_sampler_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc,
}
for (; i < numSamplers; ++i) {
const GrBufferAccess& access = proc.bufferAccess(i - numTextures);
- k16[i] = sampler_key(kSamplerBuffer_GrSLType, access.texelConfig(), access.visibility(),
- caps);
+ k16[i] = sampler_key(kTextureBufferSampler_GrSLType, access.texelConfig(),
+ access.visibility(), caps);
}
// zero the last 16 bits if the number of samplers is odd.
if (numSamplers & 0x1) {