OLD | NEW |
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/builders/GrGLProgramBuilder.h" |
9 #include "gl/GrGLPathRendering.h" | 9 #include "gl/GrGLPathRendering.h" |
10 #include "gl/GrGLProgram.h" | 10 #include "gl/GrGLProgram.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 SkASSERT(GrGLShaderVar::kNonArray == builderVarying.fVariable.getArrayCo
unt()); | 55 SkASSERT(GrGLShaderVar::kNonArray == builderVarying.fVariable.getArrayCo
unt()); |
56 SkDEBUGCODE( | 56 SkDEBUGCODE( |
57 varying.fType = builderVarying.fVariable.getType(); | 57 varying.fType = builderVarying.fVariable.getType(); |
58 ); | 58 ); |
59 varying.fLocation = builderVarying.fLocation; | 59 varying.fLocation = builderVarying.fLocation; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const
{ | 63 void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const
{ |
64 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; | 64 const Uniform& uni = fUniforms[u.toProgramDataIndex()]; |
65 SkASSERT(uni.fType == kSampler2D_GrSLType); | 65 SkASSERT((uni.fType == kSampler2D_GrSLType) || |
| 66 (uni.fType == kSampler3D_GrSLType)); |
66 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); | 67 SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount); |
67 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not | 68 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not |
68 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert | 69 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert |
69 // once stages insert their own samplers. | 70 // once stages insert their own samplers. |
70 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLo
cation); | 71 // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLo
cation); |
71 if (kUnusedUniform != uni.fFSLocation) { | 72 if (kUnusedUniform != uni.fFSLocation) { |
72 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); | 73 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); |
73 } | 74 } |
74 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 75 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
75 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); | 76 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void GrGLProgramDataManager::setProgramPathFragmentInputTransform(VaryingHandle
i, | 281 void GrGLProgramDataManager::setProgramPathFragmentInputTransform(VaryingHandle
i, |
281 unsigned compo
nents, | 282 unsigned compo
nents, |
282 const SkMatrix
& matrix) const { | 283 const SkMatrix
& matrix) const { |
283 const Varying& fragmentInput = fVaryings[i.toProgramDataIndex()]; | 284 const Varying& fragmentInput = fVaryings[i.toProgramDataIndex()]; |
284 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgram->prog
ramID(), | 285 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgram->prog
ramID(), |
285 fragmentInput.
fLocation, | 286 fragmentInput.
fLocation, |
286 GR_GL_OBJECT_L
INEAR, | 287 GR_GL_OBJECT_L
INEAR, |
287 components, | 288 components, |
288 matrix); | 289 matrix); |
289 } | 290 } |
OLD | NEW |