summaryrefslogtreecommitdiff
path: root/src/mesa/main/texformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texformat.c')
-rw-r--r--src/mesa/main/texformat.c61
1 files changed, 53 insertions, 8 deletions
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 88fbd8f07c..11e7755960 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -1207,6 +1207,30 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = {
store_texel_z24_s8 /* StoreTexel */
};
+const struct gl_texture_format _mesa_texformat_s8_z24 = {
+ MESA_FORMAT_S8_Z24, /* MesaFormat */
+ GL_DEPTH_STENCIL_EXT, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 0, /* RedBits */
+ 0, /* GreenBits */
+ 0, /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 24, /* DepthBits */
+ 8, /* StencilBits */
+ 4, /* TexelBytes */
+ _mesa_texstore_s8_z24, /* StoreTexImageFunc */
+ NULL, /* FetchTexel1D */
+ NULL, /* FetchTexel2D */
+ NULL, /* FetchTexel3D */
+ fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */
+ fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */
+ fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */
+ store_texel_s8_z24 /* StoreTexel */
+};
+
const struct gl_texture_format _mesa_texformat_z16 = {
MESA_FORMAT_Z16, /* MesaFormat */
GL_DEPTH_COMPONENT, /* BaseFormat */
@@ -1421,21 +1445,27 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
case GL_COMPRESSED_INTENSITY_ARB:
return &_mesa_texformat_intensity;
case GL_COMPRESSED_RGB_ARB:
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return &_mesa_texformat_rgb_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
+#endif
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
return &_mesa_texformat_rgb_dxt1;
- else
- return &_mesa_texformat_rgb;
+#endif
+ return &_mesa_texformat_rgb;
case GL_COMPRESSED_RGBA_ARB:
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1)
return &_mesa_texformat_rgba_fxt1;
- else if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
+#endif
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */
- else
- return &_mesa_texformat_rgba;
+#endif
+ return &_mesa_texformat_rgba;
default:
; /* fallthrough */
}
@@ -1450,6 +1480,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
}
}
+#if FEATURE_texture_fxt1
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
@@ -1460,7 +1491,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
; /* fallthrough */
}
}
+#endif
+#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
@@ -1488,6 +1521,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
; /* fallthrough */
}
}
+#endif
if (ctx->Extensions.ARB_texture_float) {
switch (internalFormat) {
@@ -1640,6 +1674,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*comps = 1; /* XXX OK? */
return;
+ case MESA_FORMAT_S8_Z24:
+ *datatype = GL_UNSIGNED_INT;
+ *comps = 1; /* XXX OK? */
+ return;
+
case MESA_FORMAT_Z16:
*datatype = GL_UNSIGNED_SHORT;
*comps = 1;
@@ -1650,6 +1689,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*comps = 1;
return;
+#if FEATURE_EXT_texture_sRGB
case MESA_FORMAT_SRGB8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 3;
@@ -1666,9 +1706,13 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
+#endif
+#if FEATURE_texture_fxt1
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
+#endif
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
@@ -1677,6 +1721,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
*datatype = GL_UNSIGNED_BYTE;
*comps = 0;
return;
+#endif
case MESA_FORMAT_RGBA:
*datatype = CHAN_TYPE;