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/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
11 #include "gl/GrGpuGL.h" | 11 #include "gl/GrGpuGL.h" |
12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
13 | 13 |
14 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \ | 14 #define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, COUNT) \ |
15 SkASSERT(arrayCount <= uni.fArrayCount || \ | 15 SkASSERT(arrayCount <= uni.fArrayCount || \ |
16 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun
t)) | 16 (1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCoun
t)) |
17 | 17 |
18 GrGLUniformManager::GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) { | 18 GrGLUniformManager::GrGLUniformManager(GrGpuGL* gpu) : fGpu(gpu) { |
19 fUsingBindUniform = fGpu->glInterface()->fBindUniformLocation != NULL; | 19 // skbug.com/2056 |
| 20 fUsingBindUniform = fGpu->glInterface()->fFunctions.fBindUniformLocation !=
NULL; |
20 } | 21 } |
21 | 22 |
22 GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType typ
e, int arrayCount) { | 23 GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType typ
e, int arrayCount) { |
23 int idx = fUniforms.count(); | 24 int idx = fUniforms.count(); |
24 Uniform& uni = fUniforms.push_back(); | 25 Uniform& uni = fUniforms.push_back(); |
25 SkASSERT(GrGLShaderVar::kNonArray == arrayCount || arrayCount > 0); | 26 SkASSERT(GrGLShaderVar::kNonArray == arrayCount || arrayCount > 0); |
26 uni.fArrayCount = arrayCount; | 27 uni.fArrayCount = arrayCount; |
27 uni.fType = type; | 28 uni.fType = type; |
28 uni.fVSLocation = kUnusedUniform; | 29 uni.fVSLocation = kUnusedUniform; |
29 uni.fFSLocation = kUnusedUniform; | 30 uni.fFSLocation = kUnusedUniform; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (GrGLShaderBuilder::kFragment_Visibility & uniforms[i].fVisibility) { | 271 if (GrGLShaderBuilder::kFragment_Visibility & uniforms[i].fVisibility) { |
271 fUniforms[i].fFSLocation = location; | 272 fUniforms[i].fFSLocation = location; |
272 } | 273 } |
273 } | 274 } |
274 } | 275 } |
275 | 276 |
276 const GrGLUniformManager::BuilderUniform& | 277 const GrGLUniformManager::BuilderUniform& |
277 GrGLUniformManager::getBuilderUniform(const BuilderUniformArray& array, UniformH
andle handle) const { | 278 GrGLUniformManager::getBuilderUniform(const BuilderUniformArray& array, UniformH
andle handle) const { |
278 return array[handle.toUniformIndex()]; | 279 return array[handle.toUniformIndex()]; |
279 } | 280 } |
OLD | NEW |