[Mesa-dev] [PATCH 5/5] i915: Add support for GL_EXT_texture_sRGB and GL_EXT_texture_sRGB_decode.
Eric Anholt
eric at anholt.net
Thu Apr 18 08:40:07 PDT 2013
This brings the driver up to GL 2.1.
---
src/mesa/drivers/dri/i915/i915_context.c | 2 ++
src/mesa/drivers/dri/i915/i915_texstate.c | 11 +++++++++++
src/mesa/drivers/dri/intel/intel_extensions.c | 4 ++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index 46fc966..65b50ea 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -104,6 +104,8 @@ intel_init_texture_formats(struct gl_context *ctx)
if (intel_screen->deviceID != PCI_CHIP_I830_M &&
intel_screen->deviceID != PCI_CHIP_845_G)
ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+ if (intel->gen == 3)
+ ctx->TextureFormatSupported[MESA_FORMAT_SARGB8] = true;
ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true;
ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true;
ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 2f32869..43c802b 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -56,6 +56,7 @@ translate_texture_format(gl_format mesa_format, GLenum DepthMode)
return MAPSURF_16BIT | MT_16BIT_ARGB1555;
case MESA_FORMAT_ARGB4444:
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
+ case MESA_FORMAT_SARGB8:
case MESA_FORMAT_ARGB8888:
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
case MESA_FORMAT_XRGB8888:
@@ -78,10 +79,14 @@ translate_texture_format(gl_format mesa_format, GLenum DepthMode)
return (MAPSURF_16BIT | MT_16BIT_L16);
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_SRGB_DXT1:
+ case MESA_FORMAT_SRGBA_DXT1:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_SRGBA_DXT3:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
case MESA_FORMAT_RGBA_DXT5:
+ case MESA_FORMAT_SRGBA_DXT5:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
case MESA_FORMAT_S8_Z24:
case MESA_FORMAT_X8_Z24:
@@ -354,6 +359,12 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
+ if (sampler->sRGBDecode == GL_DECODE_EXT &&
+ (_mesa_get_srgb_format_linear(firstImage->TexFormat) !=
+ firstImage->TexFormat)) {
+ state[I915_TEXREG_SS2] |= SS2_REVERSE_GAMMA_ENABLE;
+ }
+
/* convert border color from float to ubyte */
CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]);
CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]);
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 879d0a5..60e9d01 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -153,8 +153,6 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.EXT_texture_array = true;
ctx->Extensions.EXT_texture_integer = true;
ctx->Extensions.EXT_texture_snorm = true;
- ctx->Extensions.EXT_texture_sRGB = true;
- ctx->Extensions.EXT_texture_sRGB_decode = true;
ctx->Extensions.EXT_texture_swizzle = true;
ctx->Extensions.EXT_vertex_array_bgra = true;
ctx->Extensions.ATI_envmap_bumpmap = true;
@@ -170,6 +168,8 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_fragment_program = true;
ctx->Extensions.ARB_shadow = true;
ctx->Extensions.ARB_texture_non_power_of_two = true;
+ ctx->Extensions.EXT_texture_sRGB = true;
+ ctx->Extensions.EXT_texture_sRGB_decode = true;
ctx->Extensions.EXT_shadow_funcs = true;
ctx->Extensions.EXT_stencil_two_side = true;
ctx->Extensions.ATI_separate_stencil = true;
--
1.7.10.4
More information about the mesa-dev
mailing list