OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrGLFragmentShaderBuilder.h" | 8 #include "GrGLFragmentShaderBuilder.h" |
9 #include "GrGLShaderStringBuilder.h" | 9 #include "GrGLShaderStringBuilder.h" |
10 #include "GrGLProgramBuilder.h" | 10 #include "GrGLProgramBuilder.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 const char* GrGLFragmentShaderBuilder::dstColor() { | 166 const char* GrGLFragmentShaderBuilder::dstColor() { |
167 fHasReadDstColor = true; | 167 fHasReadDstColor = true; |
168 | 168 |
169 GrGLGpu* gpu = fProgramBuilder->gpu(); | 169 GrGLGpu* gpu = fProgramBuilder->gpu(); |
170 if (gpu->glCaps().fbFetchSupport()) { | 170 if (gpu->glCaps().fbFetchSupport()) { |
171 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur
e + 1), | 171 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur
e + 1), |
172 gpu->glCaps().fbFetchExtensionString()); | 172 gpu->glCaps().fbFetchExtensionString()); |
173 | 173 |
174 // On ES 3.0 we have to declare this, and use the custom color output na
me | 174 // Some versions of this extension string require declaring custom color
output on ES 3.0+ |
175 const char* fbFetchColorName = gpu->glCaps().fbFetchColorName(); | 175 const char* fbFetchColorName = gpu->glCaps().fbFetchColorName(); |
176 if (gpu->glslGeneration() >= k330_GrGLSLGeneration) { | 176 if (gpu->glCaps().fbFetchNeedsCustomOutput()) { |
177 this->enableCustomOutput(); | 177 this->enableCustomOutput(); |
178 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu
t_TypeModifier); | 178 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu
t_TypeModifier); |
179 fbFetchColorName = declared_color_output_name(); | 179 fbFetchColorName = declared_color_output_name(); |
180 } | 180 } |
181 return fbFetchColorName; | 181 return fbFetchColorName; |
182 } else if (fProgramBuilder->fUniformHandles.fDstCopySamplerUni.isValid()) { | 182 } else if (fProgramBuilder->fUniformHandles.fDstCopySamplerUni.isValid()) { |
183 return kDstCopyColorName; | 183 return kDstCopyColorName; |
184 } else { | 184 } else { |
185 return ""; | 185 return ""; |
186 } | 186 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ | 300 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
{ |
301 v->fFsIn = v->fVsOut; | 301 v->fFsIn = v->fVsOut; |
302 if (v->fGsOut) { | 302 if (v->fGsOut) { |
303 v->fFsIn = v->fGsOut; | 303 v->fFsIn = v->fGsOut; |
304 } | 304 } |
305 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); | 305 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v-
>fFsIn, fsPrec); |
306 } | 306 } |
OLD | NEW |