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 "GrGLPathProgramBuilder.h" | 8 #include "GrGLPathProgramBuilder.h" |
9 #include "gl/GrGLGpu.h" | 9 #include "gl/GrGLGpu.h" |
10 #include "gl/GrGLPathProgram.h" | 10 #include "gl/GrGLPathProgram.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV
arying( | 29 GrGLProgramBuilder::SeparableVaryingHandle GrGLPathProgramBuilder::addSeparableV
arying( |
30 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { | 30 const char* name, GrGLVertToFrag* v, GrSLPrecision fsPrecision) { |
31 this->addVarying(name, v, fsPrecision); | 31 this->addVarying(name, v, fsPrecision); |
32 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); | 32 SeparableVaryingInfo& varyingInfo = fSeparableVaryingInfos.push_back(); |
33 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); | 33 varyingInfo.fVariable = this->getFragmentShaderBuilder()->fInputs.back(); |
34 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; | 34 varyingInfo.fLocation = fSeparableVaryingInfos.count() - 1; |
35 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.f
Location); | 35 return SeparableVaryingHandle::CreateFromSeparableVaryingIndex(varyingInfo.f
Location); |
36 } | 36 } |
37 | 37 |
| 38 void GrGLPathProgramBuilder::bindProgramResourceLocations(GrGLuint programID) { |
| 39 this->INHERITED::bindProgramResourceLocations(programID); |
| 40 if (!fGpu->glPathRendering()->shouldBindFragmentInputs()) { |
| 41 return; |
| 42 } |
| 43 int count = fSeparableVaryingInfos.count(); |
| 44 for (int i = 0; i < count; ++i) { |
| 45 GL_CALL(BindFragmentInputLocation(programID, |
| 46 i, |
| 47 fSeparableVaryingInfos[i].fVariable.c_
str())); |
| 48 fSeparableVaryingInfos[i].fLocation = i; |
| 49 } |
| 50 } |
| 51 |
38 void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID)
{ | 52 void GrGLPathProgramBuilder::resolveProgramResourceLocations(GrGLuint programID)
{ |
39 this->INHERITED::resolveProgramResourceLocations(programID); | 53 this->INHERITED::resolveProgramResourceLocations(programID); |
40 | 54 if (fGpu->glPathRendering()->shouldBindFragmentInputs()) { |
| 55 return; |
| 56 } |
41 int count = fSeparableVaryingInfos.count(); | 57 int count = fSeparableVaryingInfos.count(); |
42 for (int i = 0; i < count; ++i) { | 58 for (int i = 0; i < count; ++i) { |
43 GrGLint location; | 59 GrGLint location; |
44 GL_CALL_RET(location, | 60 GL_CALL_RET(location, |
45 GetProgramResourceLocation(programID, | 61 GetProgramResourceLocation(programID, |
46 GR_GL_FRAGMENT_INPUT, | 62 GR_GL_FRAGMENT_INPUT, |
47 fSeparableVaryingInfos[i].fVariab
le.c_str())); | 63 fSeparableVaryingInfos[i].fVariab
le.c_str())); |
48 fSeparableVaryingInfos[i].fLocation = location; | 64 fSeparableVaryingInfos[i].fLocation = location; |
49 } | 65 } |
50 } | 66 } |
OLD | NEW |