| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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/GrGLUniformHandler.h" | 8 #include "gl/GrGLUniformHandler.h" |
| 9 | 9 |
| 10 #include "gl/GrGLCaps.h" | 10 #include "gl/GrGLCaps.h" |
| 11 #include "gl/GrGLGpu.h" | 11 #include "gl/GrGLGpu.h" |
| 12 #include "gl/builders/GrGLProgramBuilder.h" | 12 #include "gl/builders/GrGLProgramBuilder.h" |
| 13 | 13 |
| 14 #define GL_CALL(X) GR_GL_CALL(this->glGpu()->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(this->glGpu()->glInterface(), X) |
| 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->glGpu()->glInterface(), R, X) | 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->glGpu()->glInterface(), R, X) |
| 16 | 16 |
| 17 GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( | 17 GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( |
| 18 uint
32_t visibility, | 18 uint
32_t visibility, |
| 19 GrSL
Type type, | 19 GrSL
Type type, |
| 20 GrSL
Precision precision, | 20 GrSL
Precision precision, |
| 21 cons
t char* name, | 21 cons
t char* name, |
| 22 bool
mangleName, | 22 bool
mangleName, |
| 23 int
arrayCount, | 23 int
arrayCount, |
| 24 cons
t char** outName) { | 24 cons
t char** outName) { |
| 25 SkASSERT(name && strlen(name)); | 25 SkASSERT(name && strlen(name)); |
| 26 SkDEBUGCODE(static const uint32_t kVisibilityMask = kVertex_Visibility | kFr
agment_Visibility); | 26 SkDEBUGCODE(static const uint32_t kVisibilityMask = kVertex_Visibility | kFr
agment_Visibility); |
| 27 SkASSERT(0 == (~kVisibilityMask & visibility)); | 27 SkASSERT(0 == (~kVisibilityMask & visibility)); |
| 28 SkASSERT(0 != visibility); | 28 SkASSERT(0 != visibility); |
| 29 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); | 29 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)); |
| 30 | 30 |
| 31 UniformInfo& uni = fUniforms.push_back(); | 31 UniformInfo& uni = fUniforms.push_back(); |
| 32 uni.fVariable.setType(type); | 32 uni.fVariable.setType(type); |
| 33 uni.fVariable.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier); | 33 uni.fVariable.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier); |
| 34 // TODO this is a bit hacky, lets think of a better way. Basically we need
to be able to use | 34 // TODO this is a bit hacky, lets think of a better way. Basically we need
to be able to use |
| 35 // the uniform view matrix name in the GP, and the GP is immutable so it has
to tell the PB | 35 // the uniform view matrix name in the GP, and the GP is immutable so it has
to tell the PB |
| 36 // exactly what name it wants to use for the uniform view matrix. If we pre
fix anythings, then | 36 // exactly what name it wants to use for the uniform view matrix. If we pre
fix anythings, then |
| 37 // the names will mismatch. I think the correct solution is to have all GPs
which need the | 37 // the names will mismatch. I think the correct solution is to have all GPs
which need the |
| 38 // uniform view matrix, they should upload the view matrix in their setData
along with regular | 38 // uniform view matrix, they should upload the view matrix in their setData
along with regular |
| 39 // uniforms. | 39 // uniforms. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 const GrGLGpu* GrGLUniformHandler::glGpu() const { | 85 const GrGLGpu* GrGLUniformHandler::glGpu() const { |
| 86 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder; | 86 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder; |
| 87 return glPB->gpu(); | 87 return glPB->gpu(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| OLD | NEW |