1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 9 #include "GrGLSLCaps.h" 10 11 #include "GrContextOptions.h" 12 13 //////////////////////////////////////////////////////////////////////////////////////////// 14 15 GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { 16 fGLSLGeneration = k330_GrGLSLGeneration; 17 18 fDropsTileOnZeroDivide = false; 19 fFBFetchSupport = false; 20 fFBFetchNeedsCustomOutput = false; 21 fBindlessTextureSupport = false; 22 fUsesPrecisionModifiers = false; 23 fCanUseAnyFunctionInShader = true; 24 fCanUseMinAndAbsTogether = true; 25 fMustForceNegatedAtanParamToFloat = false; 26 fFlatInterpolationSupport = false; 27 fNoPerspectiveInterpolationSupport = false; 28 fSampleVariablesSupport = false; 29 fSampleMaskOverrideCoverageSupport = false; 30 fVersionDeclString = nullptr; 31 fShaderDerivativeExtensionString = nullptr; 32 fFragCoordConventionsExtensionString = nullptr; 33 fSecondaryOutputExtensionString = nullptr; 34 fExternalTextureExtensionString = nullptr; 35 fNoPerspectiveInterpolationExtensionString = nullptr; 36 fSampleVariablesExtensionString = nullptr; 37 fFBFetchColorName = nullptr; 38 fFBFetchExtensionString = nullptr; 39 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; 40 } 41 42 SkString GrGLSLCaps::dump() const { 43 SkString r = INHERITED::dump(); 44 45 static const char* kAdvBlendEqInteractionStr[] = { 46 "Not Supported", 47 "Automatic", 48 "General Enable", 49 "Specific Enables", 50 }; 51 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction); 52 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction); 53 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction); 54 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction); 55 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1); 56 57 r.appendf("--- GLSL-Specific ---\n"); 58 59 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); 60 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); 61 r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO")); 62 r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO")); 63 r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO")); 64 r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogether ? "YES" : "NO")); 65 r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegatedAtanParamToFloat ? 66 "YES" : "NO")); 67 r.appendf("Flat interpolation support: %s\n", (fFlatInterpolationSupport ? "YES" : "NO")); 68 r.appendf("No perspective interpolation support: %s\n", (fNoPerspectiveInterpolationSupport ? 69 "YES" : "NO")); 70 r.appendf("Sample variables support: %s\n", (fSampleVariablesSupport ? "YES" : "NO")); 71 r.appendf("Sample mask override coverage support: %s\n", (fSampleMaskOverrideCoverageSupport ? 72 "YES" : "NO")); 73 r.appendf("Advanced blend equation interaction: %s\n", 74 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); 75 return r; 76 } 77 78 void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { 79 } 80 81