summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-04-18 02:10:29 (GMT)
committerEric Anholt <eric@anholt.net>2013-04-29 18:41:33 (GMT)
commit4df1b986d3e44dc035227054000a1d0e1846ef07 (patch)
tree34c1be234a2decbc284b56a27a3eca91f10744ce
parent97217a40f97cdeae0304798b607f704deb0c3558 (diff)
i915: Add support for GL_EXT_texture_sRGB and GL_EXT_texture_sRGB_decode.
This brings the driver up to GL 2.1.
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c11
-rwxr-xr-xsrc/mesa/drivers/dri/intel/intel_extensions.c4
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 46722e1..18f19b8 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -152,8 +152,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;
@@ -169,6 +167,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;