Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp

Issue 1116713002: Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up some comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrGLProgramBuilder.h" 9 #include "GrGLProgramBuilder.h"
10 #include "../GrGLGpu.h" 10 #include "../GrGLGpu.h"
(...skipping 21 matching lines...) Expand all
32 break; 32 break;
33 default: 33 default:
34 SkFAIL("Unknown precision value."); 34 SkFAIL("Unknown precision value.");
35 } 35 }
36 } 36 }
37 } 37 }
38 38
39 GrGLFragmentShaderBuilder::DstReadKey 39 GrGLFragmentShaderBuilder::DstReadKey
40 GrGLFragmentShaderBuilder::KeyForDstRead(const GrTexture* dstCopy, const GrGLCap s& caps) { 40 GrGLFragmentShaderBuilder::KeyForDstRead(const GrTexture* dstCopy, const GrGLCap s& caps) {
41 uint32_t key = kYesDstRead_DstReadKeyBit; 41 uint32_t key = kYesDstRead_DstReadKeyBit;
42 if (caps.fbFetchSupport()) { 42 if (caps.glslCaps()->fbFetchSupport()) {
43 return key; 43 return key;
44 } 44 }
45 SkASSERT(dstCopy); 45 SkASSERT(dstCopy);
46 if (!caps.textureSwizzleSupport() && GrPixelConfigIsAlphaOnly(dstCopy->confi g())) { 46 if (!caps.textureSwizzleSupport() && GrPixelConfigIsAlphaOnly(dstCopy->confi g())) {
47 // The fact that the config is alpha-only must be considered when genera ting code. 47 // The fact that the config is alpha-only must be considered when genera ting code.
48 key |= kUseAlphaConfig_DstReadKeyBit; 48 key |= kUseAlphaConfig_DstReadKeyBit;
49 } 49 }
50 if (kTopLeft_GrSurfaceOrigin == dstCopy->origin()) { 50 if (kTopLeft_GrSurfaceOrigin == dstCopy->origin()) {
51 key |= kTopLeftOrigin_DstReadKeyBit; 51 key |= kTopLeftOrigin_DstReadKeyBit;
52 } 52 }
(...skipping 19 matching lines...) Expand all
72 , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey) 72 , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey)
73 , fCustomColorOutputIndex(-1) 73 , fCustomColorOutputIndex(-1)
74 , fHasReadDstColor(false) 74 , fHasReadDstColor(false)
75 , fHasReadFragmentPosition(false) { 75 , fHasReadFragmentPosition(false) {
76 } 76 }
77 77
78 bool GrGLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { 78 bool GrGLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
79 switch (feature) { 79 switch (feature) {
80 case kStandardDerivatives_GLSLFeature: { 80 case kStandardDerivatives_GLSLFeature: {
81 GrGLGpu* gpu = fProgramBuilder->gpu(); 81 GrGLGpu* gpu = fProgramBuilder->gpu();
82 if (!gpu->glCaps().shaderDerivativeSupport()) { 82 if (!gpu->glCaps().shaderCaps()->shaderDerivativeSupport()) {
83 return false; 83 return false;
84 } 84 }
85 if (kGLES_GrGLStandard == gpu->glStandard() && 85 if (kGLES_GrGLStandard == gpu->glStandard() &&
86 k110_GrGLSLGeneration == gpu->glslGeneration()) { 86 k110_GrGLSLGeneration == gpu->glslGeneration()) {
87 this->addFeature(1 << kStandardDerivatives_GLSLFeature, 87 this->addFeature(1 << kStandardDerivatives_GLSLFeature,
88 "GL_OES_standard_derivatives"); 88 "GL_OES_standard_derivatives");
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 default: 92 default:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid()); 160 SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
161 return kCoordName; 161 return kCoordName;
162 } 162 }
163 } 163 }
164 164
165 const char* GrGLFragmentShaderBuilder::dstColor() { 165 const char* GrGLFragmentShaderBuilder::dstColor() {
166 fHasReadDstColor = true; 166 fHasReadDstColor = true;
167 167
168 GrGLGpu* gpu = fProgramBuilder->gpu(); 168 GrGLGpu* gpu = fProgramBuilder->gpu();
169 if (gpu->glCaps().fbFetchSupport()) { 169 if (gpu->glCaps().glslCaps()->fbFetchSupport()) {
170 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur e + 1), 170 this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeatur e + 1),
171 gpu->glCaps().fbFetchExtensionString()); 171 gpu->glCaps().glslCaps()->fbFetchExtensionString());
172 172
173 // Some versions of this extension string require declaring custom color output on ES 3.0+ 173 // Some versions of this extension string require declaring custom color output on ES 3.0+
174 const char* fbFetchColorName = gpu->glCaps().fbFetchColorName(); 174 const char* fbFetchColorName = gpu->glCaps().glslCaps()->fbFetchColorNam e();
175 if (gpu->glCaps().fbFetchNeedsCustomOutput()) { 175 if (gpu->glCaps().glslCaps()->fbFetchNeedsCustomOutput()) {
176 this->enableCustomOutput(); 176 this->enableCustomOutput();
177 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier); 177 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOu t_TypeModifier);
178 fbFetchColorName = declared_color_output_name(); 178 fbFetchColorName = declared_color_output_name();
179 } 179 }
180 return fbFetchColorName; 180 return fbFetchColorName;
181 } else { 181 } else {
182 return kDstCopyColorName; 182 return kDstCopyColorName;
183 } 183 }
184 } 184 }
185 185
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 } 236 }
237 237
238 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) { 238 void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) {
239 v->fFsIn = v->fVsOut; 239 v->fFsIn = v->fVsOut;
240 if (v->fGsOut) { 240 if (v->fGsOut) {
241 v->fFsIn = v->fGsOut; 241 v->fFsIn = v->fGsOut;
242 } 242 }
243 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec); 243 fInputs.push_back().set(v->fType, GrGLShaderVar::kVaryingIn_TypeModifier, v- >fFsIn, fsPrec);
244 } 244 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698