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

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

Issue 1570173004: This CL adds glTexStorage support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Adding TODO comment. Created 4 years, 10 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 | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 989c799a37c4edbf641322c88677b99a3278b8a2..792f3ed5ba63555bb4305c247531ba6790a571e3 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -33,7 +33,6 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fPackRowLengthSupport = false;
fPackFlipYSupport = false;
fTextureUsageSupport = false;
- fTexStorageSupport = false;
fTextureRedSupport = false;
fImagingSupport = false;
fVertexArrayObjectSupport = false;
@@ -107,18 +106,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
ctxInfo.hasExtension("GL_ANGLE_texture_usage");
if (kGL_GrGLStandard == standard) {
- // The EXT version can apply to either GL or GLES.
- fTexStorageSupport = version >= GR_GL_VER(4,2) ||
- ctxInfo.hasExtension("GL_ARB_texture_storage") ||
- ctxInfo.hasExtension("GL_EXT_texture_storage");
- } else {
- // Qualcomm Adreno drivers appear to have issues with texture storage.
- fTexStorageSupport = (version >= GR_GL_VER(3,0) &&
- kQualcomm_GrGLVendor != ctxInfo.vendor()) &&
- ctxInfo.hasExtension("GL_EXT_texture_storage");
- }
-
- if (kGL_GrGLStandard == standard) {
fTextureBarrierSupport = version >= GR_GL_VER(4,5) ||
ctxInfo.hasExtension("GL_ARB_texture_barrier") ||
ctxInfo.hasExtension("GL_NV_texture_barrier");
@@ -530,7 +517,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// TODO: remove after command buffer supports full ES 3.0.
if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3, 0) &&
kChromium_GrGLDriver == ctxInfo.driver()) {
- fTexStorageSupport = false;
fSupportsInstancedDraws = false;
fTextureSwizzleSupport = false;
SkASSERT(ctxInfo.hasExtension("GL_CHROMIUM_map_sub"));
@@ -1036,7 +1022,6 @@ SkString GrGLCaps::dump() const {
r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO"));
r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"));
- r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"));
r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO"));
r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO"));
r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO"));
@@ -1313,6 +1298,25 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
GrGLStandard standard = ctxInfo.standard();
GrGLVersion version = ctxInfo.version();
+ bool texStorageSupported = false;
+ if (kGL_GrGLStandard == standard) {
+ // The EXT version can apply to either GL or GLES.
+ texStorageSupported = version >= GR_GL_VER(4,2) ||
+ ctxInfo.hasExtension("GL_ARB_texture_storage") ||
+ ctxInfo.hasExtension("GL_EXT_texture_storage");
+ } else {
+ // Qualcomm Adreno drivers appear to have issues with texture storage.
+ texStorageSupported = (version >= GR_GL_VER(3,0) &&
+ kQualcomm_GrGLVendor != ctxInfo.vendor()) &&
+ ctxInfo.hasExtension("GL_EXT_texture_storage");
+ }
+
+ // TODO: remove after command buffer supports full ES 3.0
+ if (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0) &&
+ kChromium_GrGLDriver == ctxInfo.driver()) {
+ texStorageSupported = false;
+ }
+
fConfigTable[kUnknown_GrPixelConfig].fFormats.fBaseInternalFormat = 0;
fConfigTable[kUnknown_GrPixelConfig].fFormats.fSizedInternalFormat = 0;
fConfigTable[kUnknown_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] = 0;
@@ -1336,6 +1340,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= allRenderFlags;
}
}
+ if (texStorageSupported) {
+ fConfigTable[kRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalFormat[kOther_ExternalFormatUsage] =
@@ -1373,6 +1380,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
}
}
}
+ if (texStorageSupported) {
+ fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
// We only enable srgb support if both textures and FBOs support srgb.
@@ -1408,6 +1418,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag |
allRenderFlags;
}
+ if (texStorageSupported) {
+ fConfigTable[kSRGBA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kSRGBA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
fConfigTable[kRGB_565_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGB;
@@ -1428,6 +1441,16 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
} else {
fConfigTable[kRGB_565_GrPixelConfig].fFlags |= allRenderFlags;
}
+ // 565 is not a sized internal format on desktop GL. So on desktop with
+ // 565 we always use an unsized internal format to let the system pick
+ // the best sized format to convert the 565 data to. Since TexStorage
+ // only allows sized internal formats we disallow it.
+ //
+ // TODO: As of 4.2, regular GL supports 565. This logic is due for an
+ // update.
+ if (texStorageSupported && kGL_GrGLStandard != standard) {
+ fConfigTable[kRGB_565_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGB_565_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
fConfigTable[kRGBA_4444_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
@@ -1444,6 +1467,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
} else {
fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= allRenderFlags;
}
+ if (texStorageSupported) {
+ fConfigTable[kRGBA_4444_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGBA_4444_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
if (this->textureRedSupport()) {
@@ -1467,6 +1493,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
// Core profile removes ALPHA8 support, but we should have chosen R8 in that case.
fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= allRenderFlags;
}
+ if (texStorageSupported) {
+ fConfigTable[kAlpha_8_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
// Check for [half] floating point texture support
// NOTE: We disallow floating point textures on ES devices if linear filtering modes are not
@@ -1514,6 +1543,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= fpRenderFlags;
}
}
+ if (texStorageSupported) {
+ fConfigTable[kRGBA_float_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGBA_float_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
if (this->textureRedSupport()) {
@@ -1545,6 +1577,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= fpRenderFlags;
}
}
+ if (texStorageSupported) {
+ fConfigTable[kAlpha_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA;
fConfigTable[kRGBA_half_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA16F;
@@ -1564,6 +1599,9 @@ void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterfa
fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= fpRenderFlags;
}
}
+ if (texStorageSupported) {
+ fConfigTable[kRGBA_half_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
+ }
fConfigTable[kRGBA_half_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
// Compressed texture support
« no previous file with comments | « src/gpu/gl/GrGLCaps.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698