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

Side by Side Diff: src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp

Issue 1693113002: Revert of Add infastructure for gl_SampleMask (Closed) Base URL: https://skia.googlesource.com/skia.git@upload7_interp
Patch Set: Created 4 years, 10 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/glsl/GrGLSLFragmentShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderBuilder.h » ('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 "GrGLSLFragmentShaderBuilder.h" 8 #include "GrGLSLFragmentShaderBuilder.h"
9 #include "GrRenderTarget.h" 9 #include "GrRenderTarget.h"
10 #include "gl/GrGLGpu.h" 10 #include "gl/GrGLGpu.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 uint8_t fragPosKey) 70 uint8_t fragPosKey)
71 : INHERITED(program) 71 : INHERITED(program)
72 , fSetupFragPosition(false) 72 , fSetupFragPosition(false)
73 , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey) 73 , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey)
74 , fCustomColorOutputIndex(-1) 74 , fCustomColorOutputIndex(-1)
75 , fHasReadDstColor(false) 75 , fHasReadDstColor(false)
76 , fHasReadFragmentPosition(false) { 76 , fHasReadFragmentPosition(false) {
77 } 77 }
78 78
79 bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { 79 bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
80 const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps();
81 switch (feature) { 80 switch (feature) {
82 case kStandardDerivatives_GLSLFeature: 81 case kStandardDerivatives_GLSLFeature: {
83 if (!glslCaps.shaderDerivativeSupport()) { 82 if (!fProgramBuilder->glslCaps()->shaderDerivativeSupport()) {
84 return false; 83 return false;
85 } 84 }
86 if (const char* extension = glslCaps.shaderDerivativeExtensionString ()) { 85 const char* extension = fProgramBuilder->glslCaps()->shaderDerivativ eExtensionString();
86 if (extension) {
87 this->addFeature(1 << kStandardDerivatives_GLSLFeature, extensio n); 87 this->addFeature(1 << kStandardDerivatives_GLSLFeature, extensio n);
88 } 88 }
89 return true; 89 return true;
90 case kPixelLocalStorage_GLSLFeature: 90 }
91 case kPixelLocalStorage_GLSLFeature: {
91 if (fProgramBuilder->glslCaps()->pixelLocalStorageSize() <= 0) { 92 if (fProgramBuilder->glslCaps()->pixelLocalStorageSize() <= 0) {
92 return false; 93 return false;
93 } 94 }
94 this->addFeature(1 << kPixelLocalStorage_GLSLFeature, 95 this->addFeature(1 << kPixelLocalStorage_GLSLFeature,
95 "GL_EXT_shader_pixel_local_storage"); 96 "GL_EXT_shader_pixel_local_storage");
96 return true; 97 return true;
97 case kSampleVariables_GLSLFeature: 98 }
98 if (!glslCaps.sampleVariablesSupport()) {
99 return false;
100 }
101 if (const char* extension = glslCaps.sampleVariablesExtensionString( )) {
102 this->addFeature(1 << kSampleVariables_GLSLFeature, extension);
103 }
104 return true;
105 case kSampleMaskOverrideCoverage_GLSLFeature:
106 if (!glslCaps.sampleMaskOverrideCoverageSupport()) {
107 return false;
108 }
109 if (!this->enableFeature(kSampleVariables_GLSLFeature)) {
110 return false;
111 }
112 if (this->addFeature(1 << kSampleMaskOverrideCoverage_GLSLFeature,
113 "GL_NV_sample_mask_override_coverage")) {
114 // Redeclare gl_SampleMask with layout(override_coverage) if we haven't already.
115 fOutputs.push_back().set(kInt_GrSLType, GrShaderVar::kOut_TypeMo difier,
116 "gl_SampleMask", 1, kHigh_GrSLPrecision ,
117 "override_coverage");
118 }
119 return true;
120 default: 99 default:
121 SkFAIL("Unexpected GLSLFeature requested."); 100 SkFAIL("Unexpected GLSLFeature requested.");
122 return false; 101 return false;
123 } 102 }
124 } 103 }
125 104
126 SkString GrGLSLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCo ordsArray& coords, 105 SkString GrGLSLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCo ordsArray& coords,
127 int index) { 106 int index) {
128 if (kVec3f_GrSLType != coords[index].getType()) { 107 if (kVec3f_GrSLType != coords[index].getType()) {
129 SkASSERT(kVec2f_GrSLType == coords[index].getType()); 108 SkASSERT(kVec2f_GrSLType == coords[index].getType());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 272 }
294 273
295 void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() { 274 void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() {
296 SkASSERT(fSubstageIndices.count() >= 2); 275 SkASSERT(fSubstageIndices.count() >= 2);
297 fSubstageIndices.pop_back(); 276 fSubstageIndices.pop_back();
298 fSubstageIndices.back()++; 277 fSubstageIndices.back()++;
299 int removeAt = fMangleString.findLastOf('_'); 278 int removeAt = fMangleString.findLastOf('_');
300 fMangleString.remove(removeAt, fMangleString.size() - removeAt); 279 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
301 } 280 }
302 281
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLFragmentShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698