aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-17 11:51:13 +0100
committermarha <marha@users.sourceforge.net>2012-12-17 11:51:13 +0100
commit840c8745518b92303d40f6834e9c616587242231 (patch)
tree097a30453fb59b6a88708c3f576e824e8f237c52 /mesalib/src/mesa/swrast
parentb395c3c85251d4e8761704d8e3a3c9f9fa5b45cc (diff)
downloadvcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.gz
vcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.bz2
vcxsrv-840c8745518b92303d40f6834e9c616587242231.zip
libXft pixman mesa git update 17 dec 2012
libXft: 835cd2a6cb4aa8f89e6e7dead66483643a6e7ee8 pixman: 526dc06e5694172abf979c03a5cf530207fe2d27 mesa: 1358f3a905448f6fb546aba951e317f743a83c76
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_context.h4
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c237
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.h3
3 files changed, 129 insertions, 115 deletions
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 18353c416..f3f188e47 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -45,6 +45,7 @@
#include "main/compiler.h"
#include "main/mtypes.h"
+#include "main/texcompress.h"
#include "program/prog_execute.h"
#include "swrast.h"
#include "s_fragprog.h"
@@ -146,6 +147,9 @@ struct swrast_texture_image
GLubyte *Buffer;
FetchTexelFunc FetchTexel;
+
+ /** For fetching texels from compressed textures */
+ compressed_fetch_func FetchCompressedTexel;
};
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 86b01a0b3..1f1964172 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -88,6 +88,23 @@ nonlinear_to_linear(GLubyte cs8)
#define DIM 3
#include "s_texfetch_tmp.h"
+
+/**
+ * All compressed texture texel fetching is done though this function.
+ * Basically just call a core-Mesa texel fetch function.
+ */
+static void
+fetch_compressed(const struct swrast_texture_image *swImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ swImage->FetchCompressedTexel(swImage->Map,
+ swImage->ImageOffsets,
+ swImage->RowStride,
+ i, j, k, texel);
+}
+
+
+
/**
* Null texel fetch function.
*
@@ -426,64 +443,64 @@ texfetch_funcs[] =
},
{
MESA_FORMAT_SRGB_DXT1,
- _mesa_fetch_texel_srgb_dxt1,
- _mesa_fetch_texel_srgb_dxt1,
- _mesa_fetch_texel_srgb_dxt1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SRGBA_DXT1,
- _mesa_fetch_texel_srgba_dxt1,
- _mesa_fetch_texel_srgba_dxt1,
- _mesa_fetch_texel_srgba_dxt1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SRGBA_DXT3,
- _mesa_fetch_texel_srgba_dxt3,
- _mesa_fetch_texel_srgba_dxt3,
- _mesa_fetch_texel_srgba_dxt3
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SRGBA_DXT5,
- _mesa_fetch_texel_srgba_dxt5,
- _mesa_fetch_texel_srgba_dxt5,
- _mesa_fetch_texel_srgba_dxt5
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGB_FXT1,
- NULL,
- _mesa_fetch_texel_2d_f_rgb_fxt1,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGBA_FXT1,
- NULL,
- _mesa_fetch_texel_2d_f_rgba_fxt1,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGB_DXT1,
- _mesa_fetch_texel_rgb_dxt1,
- _mesa_fetch_texel_rgb_dxt1,
- _mesa_fetch_texel_rgb_dxt1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGBA_DXT1,
- _mesa_fetch_texel_rgba_dxt1,
- _mesa_fetch_texel_rgba_dxt1,
- _mesa_fetch_texel_rgba_dxt1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGBA_DXT3,
- _mesa_fetch_texel_rgba_dxt3,
- _mesa_fetch_texel_rgba_dxt3,
- _mesa_fetch_texel_rgba_dxt3
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGBA_DXT5,
- _mesa_fetch_texel_rgba_dxt5,
- _mesa_fetch_texel_rgba_dxt5,
- _mesa_fetch_texel_rgba_dxt5
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RGBA_FLOAT32,
@@ -976,117 +993,117 @@ texfetch_funcs[] =
},
{
MESA_FORMAT_RED_RGTC1,
- _mesa_fetch_texel_red_rgtc1,
- _mesa_fetch_texel_red_rgtc1,
- _mesa_fetch_texel_red_rgtc1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SIGNED_RED_RGTC1,
- _mesa_fetch_texel_signed_red_rgtc1,
- _mesa_fetch_texel_signed_red_rgtc1,
- _mesa_fetch_texel_signed_red_rgtc1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_RG_RGTC2,
- _mesa_fetch_texel_rg_rgtc2,
- _mesa_fetch_texel_rg_rgtc2,
- _mesa_fetch_texel_rg_rgtc2
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SIGNED_RG_RGTC2,
- _mesa_fetch_texel_signed_rg_rgtc2,
- _mesa_fetch_texel_signed_rg_rgtc2,
- _mesa_fetch_texel_signed_rg_rgtc2
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_L_LATC1,
- _mesa_fetch_texel_l_latc1,
- _mesa_fetch_texel_l_latc1,
- _mesa_fetch_texel_l_latc1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SIGNED_L_LATC1,
- _mesa_fetch_texel_signed_l_latc1,
- _mesa_fetch_texel_signed_l_latc1,
- _mesa_fetch_texel_signed_l_latc1
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_LA_LATC2,
- _mesa_fetch_texel_la_latc2,
- _mesa_fetch_texel_la_latc2,
- _mesa_fetch_texel_la_latc2
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SIGNED_LA_LATC2,
- _mesa_fetch_texel_signed_la_latc2,
- _mesa_fetch_texel_signed_la_latc2,
- _mesa_fetch_texel_signed_la_latc2
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC1_RGB8,
- NULL,
- _mesa_fetch_texel_2d_f_etc1_rgb8,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_RGB8,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_rgb8,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_SRGB8,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_srgb8,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_RGBA8_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_rgba8_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_srgb8_alpha8_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_R11_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_r11_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_RG11_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_rg11_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_SIGNED_R11_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_signed_r11_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_SIGNED_RG11_EAC,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_signed_rg11_eac,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_rgb8_punchthrough_alpha1,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1,
- NULL,
- _mesa_fetch_texel_2d_f_etc2_srgb8_punchthrough_alpha1,
- NULL
+ fetch_compressed,
+ fetch_compressed,
+ fetch_compressed
},
{
MESA_FORMAT_SIGNED_A8,
@@ -1175,9 +1192,15 @@ texfetch_funcs[] =
};
-FetchTexelFunc
-_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
+/**
+ * Initialize the texture image's FetchTexel methods.
+ */
+static void
+set_fetch_functions(const struct gl_sampler_object *samp,
+ struct swrast_texture_image *texImage, GLuint dims)
{
+ gl_format format = texImage->Base.TexFormat;
+
#ifdef DEBUG
/* check that the table entries are sorted by format name */
gl_format fmt;
@@ -1188,39 +1211,29 @@ _mesa_get_texel_fetch_func(gl_format format, GLuint dims)
STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
+ if (samp->sRGBDecode == GL_SKIP_DECODE_EXT &&
+ _mesa_get_format_color_encoding(format) == GL_SRGB) {
+ format = _mesa_get_srgb_format_linear(format);
+ }
+
assert(format < MESA_FORMAT_COUNT);
switch (dims) {
case 1:
- return texfetch_funcs[format].Fetch1D;
+ texImage->FetchTexel = texfetch_funcs[format].Fetch1D;
+ break;
case 2:
- return texfetch_funcs[format].Fetch2D;
+ texImage->FetchTexel = texfetch_funcs[format].Fetch2D;
+ break;
case 3:
- return texfetch_funcs[format].Fetch3D;
+ texImage->FetchTexel = texfetch_funcs[format].Fetch3D;
+ break;
default:
- assert(0 && "bad dims in _mesa_get_texel_fetch_func");
- return NULL;
+ assert(!"Bad dims in set_fetch_functions()");
}
-}
-
-/**
- * Initialize the texture image's FetchTexel methods.
- */
-static void
-set_fetch_functions(struct gl_sampler_object *samp,
- struct swrast_texture_image *texImage, GLuint dims)
-{
- gl_format format = texImage->Base.TexFormat;
-
- ASSERT(dims == 1 || dims == 2 || dims == 3);
-
- if (samp->sRGBDecode == GL_SKIP_DECODE_EXT &&
- _mesa_get_format_color_encoding(format) == GL_SRGB) {
- format = _mesa_get_srgb_format_linear(format);
- }
+ texImage->FetchCompressedTexel = _mesa_get_compressed_fetch_func(format);
- texImage->FetchTexel = _mesa_get_texel_fetch_func(format, dims);
ASSERT(texImage->FetchTexel);
}
diff --git a/mesalib/src/mesa/swrast/s_texfetch.h b/mesalib/src/mesa/swrast/s_texfetch.h
index 33950ce44..4e4397e13 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.h
+++ b/mesalib/src/mesa/swrast/s_texfetch.h
@@ -29,9 +29,6 @@
#include "swrast/s_context.h"
-extern FetchTexelFunc
-_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
-
void
_mesa_update_fetch_functions(struct gl_context *ctx, GLuint unit);