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

Unified Diff: src/gpu/gl/GrGLCaps.h

Issue 1580003002: Hide formats in GrGLCaps and use specific getters for different GL functions. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixes Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.h
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index db60ad273a3c98c396e92138f8cc6d165904066e..c51dce173787af71e2d40c03063c4fdcfdf6fe95 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -29,24 +29,6 @@ class GrGLCaps : public GrCaps {
public:
typedef GrGLStencilAttachment::Format StencilFormat;
- /** Provides information about the mappiing from GrPixelConfig to GL formats. */
- struct ConfigFormats {
- ConfigFormats() {
- // Inits to known bad GL enum values.
- memset(this, 0xAB, sizeof(ConfigFormats));
- }
- GrGLenum fBaseInternalFormat;
- GrGLenum fSizedInternalFormat;
- GrGLenum fExternalFormat;
- GrGLenum fExternalType;
-
- // The <format> parameter to use for glTexImage and glTexSubImage.
- // This is usually the same as fExternalFormat except for kSRGBA on some GL contexts.
- GrGLenum fExternalFormatForTexImage;
- // Either the base or sized internal format depending on the GL and config.
- GrGLenum fInternalFormatTexImage;
- };
-
/**
* The type of MSAA for FBOs supported. Different extensions have different
* semantics of how / when a resolve is performed.
@@ -138,16 +120,22 @@ public:
}
}
- /** Returns conversions to various GL format parameters for a GrPixelCfonig. */
- const ConfigFormats& configGLFormats(GrPixelConfig config) const {
- return fConfigTable[config].fFormats;
- }
-
/** Returns the mapping between GrPixelConfig components and GL internal format components. */
const GrSwizzle& configSwizzle(GrPixelConfig config) const {
return fConfigTable[config].fSwizzle;
}
+ bool getTexImageFormats(GrPixelConfig surfaceConfig, GrPixelConfig externalConfig,
+ GrGLenum* internalFormat, GrGLenum* externalFormat,
+ GrGLenum* externalType) const;
+
+ bool getCompressedTexImageFormats(GrPixelConfig surfaceConfig, GrGLenum* internalFormat) const;
+
+ bool getReadPixelsFormat(GrPixelConfig surfaceConfig, GrPixelConfig externalConfig,
+ GrGLenum* externalFormat, GrGLenum* externalType) const;
+
+ bool getRenderbufferFormat(GrPixelConfig config, GrGLenum* internalFormat) const;
+
/**
* Gets an array of legal stencil formats. These formats are not guaranteed
* to be supported by the driver but are legal GLenum names given the GL
@@ -290,14 +278,10 @@ public:
bool ES2CompatibilitySupport() const { return fES2CompatibilitySupport; }
/// Can we call glDisable(GL_MULTISAMPLE)?
- bool multisampleDisableSupport() const {
- return fMultisampleDisableSupport;
- }
+ bool multisampleDisableSupport() const { return fMultisampleDisableSupport; }
/// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
- bool useNonVBOVertexAndIndexDynamicData() const {
- return fUseNonVBOVertexAndIndexDynamicData;
- }
+ bool useNonVBOVertexAndIndexDynamicData() const { return fUseNonVBOVertexAndIndexDynamicData; }
/// Does ReadPixels support the provided format/type combo?
bool readPixelsSupported(const GrGLInterface* intf,
@@ -334,6 +318,17 @@ public:
const GrGLSLCaps* glslCaps() const { return reinterpret_cast<GrGLSLCaps*>(fShaderCaps.get()); }
private:
+ enum ExternalFormatUsage {
+ kTexImage_ExternalFormatUsage,
+ kOther_ExternalFormatUsage,
+
+ kLast_ExternalFormatUsage = kOther_ExternalFormatUsage
+ };
+ static const int kExternalFormatUsageCnt = kLast_ExternalFormatUsage + 1;
+ bool getExternalFormat(GrPixelConfig surfaceConfig, GrPixelConfig memoryConfig,
+ ExternalFormatUsage usage, GrGLenum* externalFormat,
+ GrGLenum* externalType) const;
+
void init(const GrContextOptions&, const GrGLContextInfo&, const GrGLInterface*);
void initGLSL(const GrGLContextInfo&);
bool hasPathRenderingSupport(const GrGLContextInfo&, const GrGLInterface*);
@@ -396,6 +391,29 @@ private:
GrGLenum fType;
};
+ struct ConfigFormats {
+ ConfigFormats() {
+ // Inits to known bad GL enum values.
+ memset(this, 0xAB, sizeof(ConfigFormats));
+ }
+ GrGLenum fBaseInternalFormat;
+ GrGLenum fSizedInternalFormat;
+
+ /** The external format and type are to be used when uploading/downloading data using this
+ config where both the CPU data and GrSurface are the same config. To get the external
+ format and type when converting between configs while copying to/from memory use
+ getExternalFormat().
+ The kTexImage external format is usually the same as kOther except for kSRGBA on some
+ GL contexts. */
+ GrGLenum fExternalFormat[kExternalFormatUsageCnt];
+ GrGLenum fExternalType;
+
+
+ // Either the base or sized internal format depending on the GL and config.
+ GrGLenum fInternalFormatTexImage;
+ GrGLenum fInternalFormatRenderbuffer;
+ };
+
struct ConfigInfo {
ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {}
« no previous file with comments | « no previous file | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698