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

Side by Side Diff: src/gpu/gl/GrGLProgramDataManager.cpp

Issue 635533005: Revert of Cleanup of shader building system (Closed) Base URL: https://skia.googlesource.com/skia.git@solo_gp
Patch Set: Created 6 years, 2 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/gl/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLProgramDesc.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 "gl/builders/GrGLProgramBuilder.h"
8 #include "gl/GrGLPathRendering.h" 9 #include "gl/GrGLPathRendering.h"
10 #include "gl/GrGLProgram.h"
9 #include "gl/GrGLUniformHandle.h" 11 #include "gl/GrGLUniformHandle.h"
10 #include "gl/GrGpuGL.h" 12 #include "gl/GrGpuGL.h"
11 #include "SkMatrix.h" 13 #include "SkMatrix.h"
12 14
13 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \ 15 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \
14 SkASSERT(arrayCount <= uni.fArrayCount || \ 16 SkASSERT(arrayCount <= uni.fArrayCount || \
15 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun t)) 17 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun t))
16 18
17 GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu, const UniformInfoAr ray& uniforms) 19 GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu,
18 : fGpu(gpu) { 20 GrGLProgram* program,
19 int count = uniforms.count(); 21 const GrGLProgramBuilder& builder )
22 : fGpu(gpu),
23 fProgram(program) {
24 int count = builder.getUniformInfos().count();
20 fUniforms.push_back_n(count); 25 fUniforms.push_back_n(count);
21 for (int i = 0; i < count; i++) { 26 for (int i = 0; i < count; i++) {
22 Uniform& uniform = fUniforms[i]; 27 Uniform& uniform = fUniforms[i];
23 const UniformInfo& builderUniform = uniforms[i]; 28 const GrGLProgramBuilder::UniformInfo& builderUniform = builder.getUnifo rmInfos()[i];
24 SkASSERT(GrGLShaderVar::kNonArray == builderUniform.fVariable.getArrayCo unt() || 29 SkASSERT(GrGLShaderVar::kNonArray == builderUniform.fVariable.getArrayCo unt() ||
25 builderUniform.fVariable.getArrayCount() > 0); 30 builderUniform.fVariable.getArrayCount() > 0);
26 SkDEBUGCODE( 31 SkDEBUGCODE(
27 uniform.fArrayCount = builderUniform.fVariable.getArrayCount(); 32 uniform.fArrayCount = builderUniform.fVariable.getArrayCount();
28 uniform.fType = builderUniform.fVariable.getType(); 33 uniform.fType = builderUniform.fVariable.getType();
29 ); 34 );
30 // TODO: Move the Xoom uniform array in both FS and VS bug workaround he re. 35 // TODO: Move the Xoom uniform array in both FS and VS bug workaround he re.
31 36
32 if (GrGLProgramBuilder::kVertex_Visibility & builderUniform.fVisibility) { 37 if (GrGLProgramBuilder::kVertex_Visibility & builderUniform.fVisibility) {
33 uniform.fVSLocation = builderUniform.fLocation; 38 uniform.fVSLocation = builderUniform.fLocation;
34 } else { 39 } else {
35 uniform.fVSLocation = kUnusedUniform; 40 uniform.fVSLocation = kUnusedUniform;
36 } 41 }
37 if (GrGLProgramBuilder::kFragment_Visibility & builderUniform.fVisibilit y) { 42 if (GrGLProgramBuilder::kFragment_Visibility & builderUniform.fVisibilit y) {
38 uniform.fFSLocation = builderUniform.fLocation; 43 uniform.fFSLocation = builderUniform.fLocation;
39 } else { 44 } else {
40 uniform.fFSLocation = kUnusedUniform; 45 uniform.fFSLocation = kUnusedUniform;
41 } 46 }
42 } 47 }
48
49 count = builder.getSeparableVaryingInfos().count();
50 fVaryings.push_back_n(count);
51 for (int i = 0; i < count; i++) {
52 Varying& varying = fVaryings[i];
53 const GrGLProgramBuilder::SeparableVaryingInfo& builderVarying =
54 builder.getSeparableVaryingInfos()[i];
55 SkASSERT(GrGLShaderVar::kNonArray == builderVarying.fVariable.getArrayCo unt());
56 SkDEBUGCODE(
57 varying.fType = builderVarying.fVariable.getType();
58 );
59 varying.fLocation = builderVarying.fLocation;
60 }
43 } 61 }
44 62
45 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const { 63 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const {
46 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; 64 const Uniform& uni = fUniforms[u.toProgramDataIndex()];
47 SkASSERT(uni.fType == kSampler2D_GrSLType); 65 SkASSERT(uni.fType == kSampler2D_GrSLType);
48 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); 66 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
49 // FIXME: We still insert a single sampler uniform for every stage. If the s hader does not 67 // FIXME: We still insert a single sampler uniform for every stage. If the s hader does not
50 // reference the sampler then the compiler may have optimized it out. Uncomm ent this assert 68 // reference the sampler then the compiler may have optimized it out. Uncomm ent this assert
51 // once stages insert their own samplers. 69 // once stages insert their own samplers.
52 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLo cation); 70 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLo cation);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 matrix.get(SkMatrix::kMPersp0), 269 matrix.get(SkMatrix::kMPersp0),
252 matrix.get(SkMatrix::kMSkewX), 270 matrix.get(SkMatrix::kMSkewX),
253 matrix.get(SkMatrix::kMScaleY), 271 matrix.get(SkMatrix::kMScaleY),
254 matrix.get(SkMatrix::kMPersp1), 272 matrix.get(SkMatrix::kMPersp1),
255 matrix.get(SkMatrix::kMTransX), 273 matrix.get(SkMatrix::kMTransX),
256 matrix.get(SkMatrix::kMTransY), 274 matrix.get(SkMatrix::kMTransY),
257 matrix.get(SkMatrix::kMPersp2), 275 matrix.get(SkMatrix::kMPersp2),
258 }; 276 };
259 this->setMatrix3f(u, mt); 277 this->setMatrix3f(u, mt);
260 } 278 }
279
280 void GrGLProgramDataManager::setProgramPathFragmentInputTransform(VaryingHandle i,
281 unsigned compo nents,
282 const SkMatrix & matrix) const {
283 const Varying& fragmentInput = fVaryings[i.toProgramDataIndex()];
284 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgram->prog ramID(),
285 fragmentInput. fLocation,
286 GR_GL_OBJECT_L INEAR,
287 components,
288 matrix);
289 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698