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

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

Issue 1431433003: Move shader compiling to ProgramBuilder and various ShaderBuilder cleanups. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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
Index: src/gpu/gl/GrGLCaps.cpp
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 9879846ef20a165eda917f6fdfad2fcad63e3deb..58c08627cd5817ab0c2c2139333b1083d7dc31bd 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -27,14 +27,12 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fMaxFragmentTextureUnits = 0;
fRGBA8RenderbufferSupport = false;
fBGRAIsInternalFormat = false;
- fTextureSwizzleSupport = false;
fUnpackRowLengthSupport = false;
fUnpackFlipYSupport = false;
fPackRowLengthSupport = false;
fPackFlipYSupport = false;
fTextureUsageSupport = false;
fTexStorageSupport = false;
- fTextureRedSupport = false;
fImagingSupport = false;
fTwoFormatLimit = false;
fFragCoordsConventionSupport = false;
@@ -94,13 +92,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
}
if (kGL_GrGLStandard == standard) {
- fTextureSwizzleSupport = version >= GR_GL_VER(3,3) ||
- ctxInfo.hasExtension("GL_ARB_texture_swizzle");
- } else {
- fTextureSwizzleSupport = version >= GR_GL_VER(3,0);
- }
-
- if (kGL_GrGLStandard == standard) {
fUnpackRowLengthSupport = true;
fUnpackFlipYSupport = false;
fPackRowLengthSupport = true;
@@ -138,17 +129,6 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier");
}
- // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support GL_RED
- // and GL_RG on FBO textures.
- if (kMesa_GrGLDriver != ctxInfo.driver()) {
- if (kGL_GrGLStandard == standard) {
- fTextureRedSupport = version >= GR_GL_VER(3,0) ||
- ctxInfo.hasExtension("GL_ARB_texture_rg");
- } else {
- fTextureRedSupport = version >= GR_GL_VER(3,0) ||
- ctxInfo.hasExtension("GL_EXT_texture_rg");
- }
- }
fImagingSupport = kGL_GrGLStandard == standard &&
ctxInfo.hasExtension("GL_ARB_imaging");
@@ -489,6 +469,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
}
this->initConfigTexturableTable(ctxInfo, gli, srgbSupport);
+ // initGLSL must be called before this, so that we know if we have GL_RED/R8 support or not
this->initConfigRenderableTable(ctxInfo, srgbSupport);
this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
@@ -591,6 +572,29 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) {
glslCaps->fVersionDeclString = get_glsl_version_decl_string(standard, glslCaps->fGLSLGeneration,
fIsCoreProfile);
+
+ if (kGLES_GrGLStandard == standard && k110_GrGLSLGeneration == glslCaps->fGLSLGeneration) {
+ glslCaps->fShaderDerivativeExtensionString = "GL_OES_standard_derivatives";
+ }
+
+ if (kGL_GrGLStandard == standard) {
+ glslCaps->fTextureSwizzleSupport = version >= GR_GL_VER(3,3) ||
+ ctxInfo.hasExtension("GL_ARB_texture_swizzle");
+ } else {
+ glslCaps->fTextureSwizzleSupport = version >= GR_GL_VER(3,0);
+ }
+
+ // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support GL_RED
+ // and GL_RG on FBO textures.
+ if (kMesa_GrGLDriver != ctxInfo.driver()) {
+ if (kGL_GrGLStandard == standard) {
+ glslCaps->fTextureRedSupport = version >= GR_GL_VER(3,0) ||
+ ctxInfo.hasExtension("GL_ARB_texture_rg");
+ } else {
+ glslCaps->fTextureRedSupport = version >= GR_GL_VER(3,0) ||
+ ctxInfo.hasExtension("GL_EXT_texture_rg");
+ }
+ }
}
bool GrGLCaps::hasPathRenderingSupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
@@ -656,6 +660,7 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo, bool sr
// below already account for this).
GrGLStandard standard = ctxInfo.standard();
+ GrGLSLCaps* glslCaps = static_cast<GrGLSLCaps*>(fShaderCaps.get());
enum {
kNo_MSAA = 0,
@@ -672,8 +677,8 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo, bool sr
}
} else {
// On ES we can only hope for R8
- fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupport;
- fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSupport;
+ fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = glslCaps->fTextureRedSupport;
+ fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = glslCaps->fTextureRedSupport;
}
if (kGL_GrGLStandard != standard) {
@@ -738,7 +743,8 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo, bool sr
// for now we don't support floating point MSAA on ES
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kYes_MSAA] = false;
} else {
- if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float") && fTextureRedSupport) {
+ if (ctxInfo.hasExtension("GL_EXT_color_buffer_half_float") &&
+ glslCaps->fTextureRedSupport) {
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = true;
} else {
fConfigRenderSupport[kAlpha_half_GrPixelConfig][kNo_MSAA] = false;
@@ -1165,7 +1171,6 @@ SkString GrGLCaps::dump() const {
r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes);
r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO"));
r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO"));
- r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO"));
r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO"));
r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"));
r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO"));
@@ -1173,7 +1178,6 @@ SkString GrGLCaps::dump() const {
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("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO"));
r.appendf("Fragment coord conventions support: %s\n",

Powered by Google App Engine
This is Rietveld 408576698