aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLCaps.h
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2015-04-29 11:18:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-29 11:18:05 -0700
commite9c0fc616d2a1632c285885b9b656b68ca8d4f24 (patch)
tree70325926996eb9e0cd63db76ea5aaec288091a84 /src/gpu/gl/GrGLCaps.h
parent23c5f5137106221f9a00ac1e12740ee33e09767f (diff)
Pull out shader-specific caps into GrShaderCaps and GrGLSLCaps
Diffstat (limited to 'src/gpu/gl/GrGLCaps.h')
-rw-r--r--src/gpu/gl/GrGLCaps.h89
1 files changed, 64 insertions, 25 deletions
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 954b158809..13ba3863b1 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -16,6 +16,7 @@
#include "SkTArray.h"
class GrGLContextInfo;
+class GrGLSLCaps;
/**
* Stores some capabilities of a GL context. Most are determined by the GL
@@ -165,19 +166,6 @@ public:
kES_EXT_MsToTexture_MSFBOType == fMSFBOType;
}
- /**
- * Some helper functions for encapsulating various extensions to read FB Buffer on openglES
- *
- * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect
- */
- bool fbFetchSupport() const { return fFBFetchSupport; }
-
- bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; }
-
- const char* fbFetchColorName() const { return fFBFetchColorName; }
-
- const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
-
bool fbMixedSamplesSupport() const { return fFBMixedSamplesSupport; }
InvalidateFBType invalidateFBType() const { return fInvalidateFBType; }
@@ -265,8 +253,6 @@ public:
bool fullClearIsFree() const { return fFullClearIsFree; }
- bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
-
/**
* Returns a string containing the caps info.
*/
@@ -285,6 +271,8 @@ public:
LATCAlias latcAlias() const { return fLATCAlias; }
+ GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
+
private:
/**
* Maintains a bit per GrPixelConfig. It is used to avoid redundantly
@@ -329,9 +317,6 @@ private:
void initConfigRenderableTable(const GrGLContextInfo&);
void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*);
- // Must be called after fGeometryShaderSupport is initialized.
- void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*);
-
bool doReadPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLenum type) const;
// tracks configs that have been verified to pass the FBO completeness when
@@ -371,14 +356,8 @@ private:
bool fUseNonVBOVertexAndIndexDynamicData : 1;
bool fIsCoreProfile : 1;
bool fFullClearIsFree : 1;
- bool fDropsTileOnZeroDivide : 1;
- bool fFBFetchSupport : 1;
- bool fFBFetchNeedsCustomOutput : 1;
bool fFBMixedSamplesSupport : 1;
- const char* fFBFetchColorName;
- const char* fFBFetchExtensionString;
-
struct ReadPixelsSupportedFormat {
GrGLenum fFormat;
GrGLenum fType;
@@ -395,6 +374,66 @@ private:
typedef GrDrawTargetCaps INHERITED;
};
-typedef GrGLCaps GrGLSLCaps;
+
+class GrGLSLCaps : public GrShaderCaps {
+public:
+ SK_DECLARE_INST_COUNT(GrGLSLCaps)
+
+ /**
+ * Creates a GrGLSLCaps that advertises no support for any extensions,
+ * formats, etc. Call init to initialize from a GrGLContextInfo.
+ */
+ GrGLSLCaps();
+ ~GrGLSLCaps() override {}
+
+ GrGLSLCaps(const GrGLSLCaps& caps);
+
+ GrGLSLCaps& operator = (const GrGLSLCaps& caps);
+
+ /**
+ * Resets the caps such that nothing is supported.
+ */
+ void reset() override;
+
+ /**
+ * Initializes the GrGLSLCaps to the set of features supported in the current
+ * OpenGL context accessible via ctxInfo.
+ */
+ bool init(const GrGLContextInfo& ctxInfo, const GrGLInterface* glInterface);
+
+ /**
+ * Some helper functions for encapsulating various extensions to read FB Buffer on openglES
+ *
+ * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect
+ */
+ bool fbFetchSupport() const { return fFBFetchSupport; }
+
+ bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; }
+
+ const char* fbFetchColorName() const { return fFBFetchColorName; }
+
+ const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
+
+ bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
+
+ /**
+ * Returns a string containing the caps info.
+ */
+ SkString dump() const override;
+
+private:
+ // Must be called after fGeometryShaderSupport is initialized.
+ void initShaderPrecisionTable(const GrGLContextInfo&, const GrGLInterface*);
+
+ bool fDropsTileOnZeroDivide : 1;
+ bool fFBFetchSupport : 1;
+ bool fFBFetchNeedsCustomOutput : 1;
+
+ const char* fFBFetchColorName;
+ const char* fFBFetchExtensionString;
+
+ typedef GrShaderCaps INHERITED;
+};
+
#endif