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

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

Issue 1583863002: Beginning of support for texture rectangles. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 11 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/GrGLSL.h ('k') | tests/RectangleTextureTest.cpp » ('j') | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 this->functions().append(body); 55 this->functions().append(body);
56 this->functions().append("}\n\n"); 56 this->functions().append("}\n\n");
57 } 57 }
58 58
59 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out, 59 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
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 out->appendf("%s(%s, %s)", 66 out->appendf("%s(%s, %s)",
66 GrGLSLTexture2DFunctionName(varyingType, glslCaps->generation() ), 67 GrGLSLTexture2DFunctionName(varyingType, samplerType, glslCaps- >generation()),
67 uniformHandler->getUniformCStr(sampler.fSamplerUniform), 68 uniformHandler->getUniformCStr(sampler.fSamplerUniform),
68 coordName); 69 coordName);
69 70
70 // This refers to any swizzling we may need to get from some backend interna l format to the 71 // This refers to any swizzling we may need to get from some backend interna l format to the
71 // format used in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will 72 // format used in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will
72 // be rgba. For shader prettiness we omit the swizzle rather than appending ".rgba". 73 // be rgba. For shader prettiness we omit the swizzle rather than appending ".rgba".
73 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf ig()); 74 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf ig());
74 75
75 if (configSwizzle != GrSwizzle::RGBA()) { 76 if (configSwizzle != GrSwizzle::RGBA()) {
76 out->appendf(".%s", configSwizzle.c_str()); 77 out->appendf(".%s", configSwizzle.c_str());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 this->code().append("}"); 148 this->code().append("}");
148 149
149 for (int i = 0; i <= fCodeIndex; i++) { 150 for (int i = 0; i <= fCodeIndex; i++) {
150 fCompilerStrings[i] = fShaderStrings[i].c_str(); 151 fCompilerStrings[i] = fShaderStrings[i].c_str();
151 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); 152 fCompilerStringLengths[i] = (int)fShaderStrings[i].size();
152 } 153 }
153 154
154 fFinalized = true; 155 fFinalized = true;
155 } 156 }
156 157
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSL.h ('k') | tests/RectangleTextureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698