| 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 "GrGLSLFragmentShaderBuilder.h" | 8 #include "GrGLSLFragmentShaderBuilder.h" |
| 9 #include "GrRenderTarget.h" | 9 #include "GrRenderTarget.h" |
| 10 #include "GrRenderTargetPriv.h" | 10 #include "GrRenderTargetPriv.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 fSubstageIndices.push_back(0); | 89 fSubstageIndices.push_back(0); |
| 90 #ifdef SK_DEBUG | 90 #ifdef SK_DEBUG |
| 91 fUsedProcessorFeatures = GrProcessor::kNone_RequiredFeatures; | 91 fUsedProcessorFeatures = GrProcessor::kNone_RequiredFeatures; |
| 92 fHasReadDstColor = false; | 92 fHasReadDstColor = false; |
| 93 #endif | 93 #endif |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { | 96 bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { |
| 97 const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps(); | 97 const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps(); |
| 98 switch (feature) { | 98 switch (feature) { |
| 99 case kStandardDerivatives_GLSLFeature: | |
| 100 if (!glslCaps.shaderDerivativeSupport()) { | |
| 101 return false; | |
| 102 } | |
| 103 if (const char* extension = glslCaps.shaderDerivativeExtensionString
()) { | |
| 104 this->addFeature(1 << kStandardDerivatives_GLSLFeature, extensio
n); | |
| 105 } | |
| 106 return true; | |
| 107 case kPixelLocalStorage_GLSLFeature: | 99 case kPixelLocalStorage_GLSLFeature: |
| 108 if (glslCaps.pixelLocalStorageSize() <= 0) { | 100 if (glslCaps.pixelLocalStorageSize() <= 0) { |
| 109 return false; | 101 return false; |
| 110 } | 102 } |
| 111 this->addFeature(1 << kPixelLocalStorage_GLSLFeature, | 103 this->addFeature(1 << kPixelLocalStorage_GLSLFeature, |
| 112 "GL_EXT_shader_pixel_local_storage"); | 104 "GL_EXT_shader_pixel_local_storage"); |
| 113 return true; | 105 return true; |
| 114 case kMultisampleInterpolation_GLSLFeature: | 106 case kMultisampleInterpolation_GLSLFeature: |
| 115 if (!glslCaps.multisampleInterpolationSupport()) { | 107 if (!glslCaps.multisampleInterpolationSupport()) { |
| 116 return false; | 108 return false; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); | 380 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]
); |
| 389 } | 381 } |
| 390 | 382 |
| 391 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { | 383 void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() { |
| 392 SkASSERT(fSubstageIndices.count() >= 2); | 384 SkASSERT(fSubstageIndices.count() >= 2); |
| 393 fSubstageIndices.pop_back(); | 385 fSubstageIndices.pop_back(); |
| 394 fSubstageIndices.back()++; | 386 fSubstageIndices.back()++; |
| 395 int removeAt = fMangleString.findLastOf('_'); | 387 int removeAt = fMangleString.findLastOf('_'); |
| 396 fMangleString.remove(removeAt, fMangleString.size() - removeAt); | 388 fMangleString.remove(removeAt, fMangleString.size() - removeAt); |
| 397 } | 389 } |
| OLD | NEW |