Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: src/gpu/glsl/GrGLSLShaderBuilder.cpp

Issue 1688233003: Add arb_texture_rectangle support properly in GLES3 shaders Base URL: https://skia.googlesource.com/skia.git@command-buffer-es3
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentShaderBuilder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrSwizzle.h" 8 #include "GrSwizzle.h"
9 #include "glsl/GrGLSLShaderBuilder.h" 9 #include "glsl/GrGLSLShaderBuilder.h"
10 #include "glsl/GrGLSLCaps.h" 10 #include "glsl/GrGLSLCaps.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 const GrGLSLTextureSampler& sample r, 60 const GrGLSLTextureSampler& sample r,
61 const char* coordName, 61 const char* coordName,
62 GrSLType varyingType) const { 62 GrSLType varyingType) const {
63 const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); 63 const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
64 GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler(); 64 GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler();
65 GrSLType samplerType = uniformHandler->getUniformVariable(sampler.fSamplerUn iform).getType(); 65 GrSLType samplerType = uniformHandler->getUniformVariable(sampler.fSamplerUn iform).getType();
66 if (samplerType == kSampler2DRect_GrSLType) { 66 if (samplerType == kSampler2DRect_GrSLType) {
67 if (varyingType == kVec2f_GrSLType) { 67 if (varyingType == kVec2f_GrSLType) {
68 out->appendf("%s(%s, textureSize(%s) * %s)", 68 out->appendf("%s(%s, textureSize(%s) * %s)",
69 GrGLSLTexture2DFunctionName(varyingType, samplerType, 69 GrGLSLTexture2DFunctionName(varyingType, samplerType,
70 glslCaps->generation()), 70 *glslCaps),
71 uniformHandler->getUniformCStr(sampler.fSamplerUniform) , 71 uniformHandler->getUniformCStr(sampler.fSamplerUniform) ,
72 uniformHandler->getUniformCStr(sampler.fSamplerUniform) , 72 uniformHandler->getUniformCStr(sampler.fSamplerUniform) ,
73 coordName); 73 coordName);
74 } else { 74 } else {
75 out->appendf("%s(%s, vec3(textureSize(%s) * %s.xy, %s.z))", 75 out->appendf("%s(%s, vec3(textureSize(%s) * %s.xy, %s.z))",
76 GrGLSLTexture2DFunctionName(varyingType, samplerType, 76 GrGLSLTexture2DFunctionName(varyingType, samplerType,
77 glslCaps->generation()), 77 *glslCaps),
78 uniformHandler->getUniformCStr(sampler.fSamplerUniform) , 78 uniformHandler->getUniformCStr(sampler.fSamplerUniform) ,
79 uniformHandler->getUniformCStr(sampler.fSamplerUniform) , 79 uniformHandler->getUniformCStr(sampler.fSamplerUniform) ,
80 coordName, 80 coordName,
81 coordName); 81 coordName);
82 } 82 }
83 } else { 83 } else {
84 out->appendf("%s(%s, %s)", 84 out->appendf("%s(%s, %s)",
85 GrGLSLTexture2DFunctionName(varyingType, samplerType, glslC aps->generation()), 85 GrGLSLTexture2DFunctionName(varyingType, samplerType, *glsl Caps),
86 uniformHandler->getUniformCStr(sampler.fSamplerUniform), 86 uniformHandler->getUniformCStr(sampler.fSamplerUniform),
87 coordName); 87 coordName);
88 } 88 }
89 89
90 // This refers to any swizzling we may need to get from some backend interna l format to the 90 // This refers to any swizzling we may need to get from some backend interna l format to the
91 // format used in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will 91 // format used in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will
92 // be rgba. For shader prettiness we omit the swizzle rather than appending ".rgba". 92 // be rgba. For shader prettiness we omit the swizzle rather than appending ".rgba".
93 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf ig()); 93 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf ig());
94 94
95 if (configSwizzle != GrSwizzle::RGBA()) { 95 if (configSwizzle != GrSwizzle::RGBA()) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 this->code().append("}"); 166 this->code().append("}");
167 167
168 for (int i = 0; i <= fCodeIndex; i++) { 168 for (int i = 0; i <= fCodeIndex; i++) {
169 fCompilerStrings[i] = fShaderStrings[i].c_str(); 169 fCompilerStrings[i] = fShaderStrings[i].c_str();
170 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); 170 fCompilerStringLengths[i] = (int)fShaderStrings[i].size();
171 } 171 }
172 172
173 fFinalized = true; 173 fFinalized = true;
174 } 174 }
175 175
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentShaderBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698