blob: ba99be57e26ddb44b30a3728ee5ef1dda417c6ca [file] [log] [blame]
jvanverthcba99b82015-06-24 06:59:57 -07001/*
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
egdanielb7e7d572015-11-04 04:23:53 -080011#include "GrContextOptions.h"
12
jvanverthcba99b82015-06-24 06:59:57 -070013////////////////////////////////////////////////////////////////////////////////////////////
14
15GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) {
jvanverth98a83a92015-06-24 11:07:07 -070016 fGLSLGeneration = k330_GrGLSLGeneration;
17
jvanverthcba99b82015-06-24 06:59:57 -070018 fDropsTileOnZeroDivide = false;
19 fFBFetchSupport = false;
20 fFBFetchNeedsCustomOutput = false;
21 fBindlessTextureSupport = false;
egdanielf5294392015-10-21 07:14:17 -070022 fUsesPrecisionModifiers = false;
egdaniel472d44e2015-10-22 08:20:00 -070023 fCanUseAnyFunctionInShader = true;
egdaniel8dcdedc2015-11-11 06:27:20 -080024 fCanUseMinAndAbsTogether = true;
25 fMustForceNegatedAtanParamToFloat = false;
cdaltonc08f1962016-02-12 12:14:06 -080026 fFlatInterpolationSupport = false;
27 fNoPerspectiveInterpolationSupport = false;
egdaniel472d44e2015-10-22 08:20:00 -070028 fVersionDeclString = nullptr;
egdaniel574a4c12015-11-02 06:22:44 -080029 fShaderDerivativeExtensionString = nullptr;
egdaniel8dcdedc2015-11-11 06:27:20 -080030 fFragCoordConventionsExtensionString = nullptr;
31 fSecondaryOutputExtensionString = nullptr;
bsalomon7ea33f52015-11-22 14:51:00 -080032 fExternalTextureExtensionString = nullptr;
cdaltonc08f1962016-02-12 12:14:06 -080033 fNoPerspectiveInterpolationExtensionString = nullptr;
halcanary96fcdcc2015-08-27 07:41:13 -070034 fFBFetchColorName = nullptr;
35 fFBFetchExtensionString = nullptr;
jvanverth98a83a92015-06-24 11:07:07 -070036 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
jvanverthcba99b82015-06-24 06:59:57 -070037}
38
39SkString GrGLSLCaps::dump() const {
40 SkString r = INHERITED::dump();
41
42 static const char* kAdvBlendEqInteractionStr[] = {
43 "Not Supported",
44 "Automatic",
45 "General Enable",
46 "Specific Enables",
47 };
48 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction);
49 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction);
50 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction);
51 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction);
52 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
53
54 r.appendf("--- GLSL-Specific ---\n");
55
56 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO"));
57 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
58 r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO"));
egdanielf5294392015-10-21 07:14:17 -070059 r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO"));
egdaniel8dcdedc2015-11-11 06:27:20 -080060 r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO"));
egdaniel8dcdedc2015-11-11 06:27:20 -080061 r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogether ? "YES" : "NO"));
62 r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegatedAtanParamToFloat ?
63 "YES" : "NO"));
cdaltonc08f1962016-02-12 12:14:06 -080064 r.appendf("Flat interpolation support: %s\n", (fFlatInterpolationSupport ? "YES" : "NO"));
65 r.appendf("No perspective interpolation support: %s\n", (fNoPerspectiveInterpolationSupport ?
66 "YES" : "NO"));
jvanverthcba99b82015-06-24 06:59:57 -070067 r.appendf("Advanced blend equation interaction: %s\n",
68 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
69 return r;
70}
71
egdanielb7e7d572015-11-04 04:23:53 -080072void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
egdanielb7e7d572015-11-04 04:23:53 -080073}
74