aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-12-22 08:31:49 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-22 08:31:49 -0800
commitfa1e8a7cefd71f7b75f0b85f8eefe111814dd86f (patch)
treeb25e8e69ef237cc77915c87e3679f4b50a0aeb29 /src/gpu/gl
parent2d73d80d68bc4b358eaa6da9f725d83f390af96a (diff)
Add sRGB texture support.
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp26
-rw-r--r--src/gpu/gl/GrGLDefines.h2
-rw-r--r--src/gpu/gl/GrGpuGL.cpp10
3 files changed, 38 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index cfb9558c76..b729820ca5 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -478,6 +478,23 @@ void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) {
}
}
+ if (this->fRGBA8RenderbufferSupport && this->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) {
+ if (kGL_GrGLStandard == standard) {
+ if (ctxInfo.version() >= GR_GL_VER(3,0) ||
+ ctxInfo.hasExtension("GL_ARB_framebuffer_sRGB") ||
+ ctxInfo.hasExtension("GL_EXT_framebuffer_sRGB")) {
+ fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kNo_MSAA] = true;
+ fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kYes_MSAA] = true;
+ }
+ } else {
+ if (ctxInfo.version() >= GR_GL_VER(3,0) ||
+ ctxInfo.hasExtension("GL_EXT_sRGB")) {
+ fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kNo_MSAA] = true;
+ fConfigRenderSupport[kSRGBA_8888_GrPixelConfig][kYes_MSAA] = true;
+ }
+ }
+ }
+
if (this->isConfigTexturable(kRGBA_float_GrPixelConfig)) {
if (kGL_GrGLStandard == standard) {
fConfigRenderSupport[kRGBA_float_GrPixelConfig][kNo_MSAA] = true;
@@ -560,6 +577,15 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig);
}
+ // Check for sRGBA
+ if (kGL_GrGLStandard == standard) {
+ fConfigTextureSupport[kSRGBA_8888_GrPixelConfig] =
+ (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_texture_sRGB"));
+ } else {
+ fConfigTextureSupport[kSRGBA_8888_GrPixelConfig] =
+ (version >= GR_GL_VER(3,0) || ctxInfo.hasExtension("GL_EXT_sRGB"));
+ }
+
// Compressed texture support
// glCompressedTexImage2D is available on all OpenGL ES devices...
diff --git a/src/gpu/gl/GrGLDefines.h b/src/gpu/gl/GrGLDefines.h
index 0eb5149a8c..fc44252515 100644
--- a/src/gpu/gl/GrGLDefines.h
+++ b/src/gpu/gl/GrGLDefines.h
@@ -770,6 +770,8 @@
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GR_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GR_GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GR_GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
#define GR_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
#define GR_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
#define GR_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index b36e8870cd..96af8af47f 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2310,6 +2310,16 @@ bool GrGLGpu::configToGLFormats(GrPixelConfig config,
*externalFormat = GR_GL_BGRA;
*externalType = GR_GL_UNSIGNED_BYTE;
break;
+ case kSRGBA_8888_GrPixelConfig:
+ *internalFormat = GR_GL_SRGB_ALPHA;
+ *externalFormat = GR_GL_SRGB_ALPHA;
+ if (getSizedInternalFormat) {
+ *internalFormat = GR_GL_SRGB8_ALPHA8;
+ } else {
+ *internalFormat = GR_GL_SRGB_ALPHA;
+ }
+ *externalType = GR_GL_UNSIGNED_BYTE;
+ break;
case kRGB_565_GrPixelConfig:
*internalFormat = GR_GL_RGB;
*externalFormat = GR_GL_RGB;