aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-10 07:52:38 +0200
committermarha <marha@users.sourceforge.net>2011-10-10 07:52:38 +0200
commitafbd3947071a33f59dda122f1ac396442a02c128 (patch)
treee3dde5d2973697c24f73488a421327d09a9337c0 /mesalib/src/mesa
parentb520df571e0a319eae5231d09f36b98f28b8914a (diff)
downloadvcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.tar.gz
vcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.tar.bz2
vcxsrv-afbd3947071a33f59dda122f1ac396442a02c128.zip
fontconfig libX11 mesa pixman xkeyboard-config git updte 10 oct 2011
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c3
-rw-r--r--mesalib/src/mesa/main/APIspec.xml14
-rw-r--r--mesalib/src/mesa/main/context.c8
-rw-r--r--mesalib/src/mesa/main/dd.h1
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp10
-rw-r--r--mesalib/src/mesa/main/formats.c8
-rw-r--r--mesalib/src/mesa/main/get.c3
-rw-r--r--mesalib/src/mesa/main/imports.c13
-rw-r--r--mesalib/src/mesa/main/imports.h3
-rw-r--r--mesalib/src/mesa/main/mipmap.c38
-rw-r--r--mesalib/src/mesa/main/mtypes.h7
-rw-r--r--mesalib/src/mesa/main/pack.c63
-rw-r--r--mesalib/src/mesa/main/pack.h5
-rw-r--r--mesalib/src/mesa/main/shaderapi.c32
-rw-r--r--mesalib/src/mesa/main/shaderobj.c4
-rw-r--r--mesalib/src/mesa/main/state.c18
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.c9
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c16
-rw-r--r--mesalib/src/mesa/main/texformat.c204
-rw-r--r--mesalib/src/mesa/main/texstate.c18
-rw-r--r--mesalib/src/mesa/main/uniforms.c42
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp37
-rw-r--r--mesalib/src/mesa/program/prog_uniform.c74
-rw-r--r--mesalib/src/mesa/program/prog_uniform.h4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_readpixels.c40
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c453
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp44
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c9
-rw-r--r--mesalib/src/mesa/swrast/s_context.h17
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c74
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.h2
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c80
-rw-r--r--mesalib/src/mesa/swrast/s_texrender.c34
-rw-r--r--mesalib/src/mesa/tnl/t_vb_program.c14
34 files changed, 888 insertions, 513 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 4d645e200..5b73dcdfb 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -496,7 +496,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
if (ctx->Extensions.ARB_texture_cube_map)
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
+ if (ctx->Extensions.NV_texture_rectangle)
+ _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml
index 5d5fc03be..574480e28 100644
--- a/mesalib/src/mesa/main/APIspec.xml
+++ b/mesalib/src/mesa/main/APIspec.xml
@@ -41,10 +41,6 @@
<param name="plane" type="GLenum"/>
<vector name="equation" type="const GLtype *" size="4"/>
</proto>
-
- <desc name="plane">
- <range base="GL_CLIP_PLANE" from="0" to="5"/>
- </desc>
</template>
<template name="CullFace">
@@ -807,6 +803,8 @@
<value name="GL_RESCALE_NORMAL"/>
<range base="GL_CLIP_PLANE" from="0" to="5"/>
+ <value name="GL_CLIP_PLANE0+6"/>
+ <value name="GL_CLIP_PLANE0+7"/>
<value name="GL_FOG"/>
<value name="GL_LIGHTING"/>
@@ -862,6 +860,8 @@
<value name="GL_RESCALE_NORMAL"/>
<range base="GL_CLIP_PLANE" from="0" to="5"/>
+ <value name="GL_CLIP_PLANE0+6"/>
+ <value name="GL_CLIP_PLANE0+7"/>
<value name="GL_FOG"/>
<value name="GL_LIGHTING"/>
@@ -1260,10 +1260,6 @@
<param name="plane" type="GLenum"/>
<vector name="equation" type="GLtype *" size="4"/>
</proto>
-
- <desc name="plane">
- <range base="GL_CLIP_PLANE" from="0" to="5"/>
- </desc>
</template>
<template name="GetError" direction="get">
@@ -1517,6 +1513,8 @@
<value name="GL_RESCALE_NORMAL"/>
<range base="GL_CLIP_PLANE" from="0" to="5"/>
+ <value name="GL_CLIP_PLANE0+6"/>
+ <value name="GL_CLIP_PLANE0+7"/>
<value name="GL_FOG"/>
<value name="GL_LIGHTING"/>
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 2532c47de..fc52e8c15 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1852,17 +1852,15 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
sh = shProg[i]->_LinkedShaders[i];
switch (sh->Type) {
case GL_VERTEX_SHADER:
- _mesa_append_uniforms_to_file(sh, &shProg[i]->VertexProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
case GL_GEOMETRY_SHADER_ARB:
- _mesa_append_uniforms_to_file(sh,
- &shProg[i]->GeometryProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
case GL_FRAGMENT_SHADER:
- _mesa_append_uniforms_to_file(sh,
- &shProg[i]->FragmentProgram->Base);
+ _mesa_append_uniforms_to_file(sh, sh->Program);
break;
}
}
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 787556451..4e017ae38 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -901,6 +901,7 @@ struct dd_function_table {
*/
void (*EndCallList)( struct gl_context *ctx );
+ /**@}*/
/**
* \name GL_ARB_sync interfaces
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 7cc172168..e6451c98b 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -315,7 +315,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
const GLboolean vertexShader =
(ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus &&
- ctx->Shader.CurrentVertexProgram->VertexProgram);
+ ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]);
const GLboolean vertexProgram = ctx->VertexProgram._Enabled;
GLbitfield fp_inputs = 0x0;
@@ -371,7 +371,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
}
else {
/* calculate from vp->outputs */
- struct gl_vertex_program *vprog;
+ struct gl_program *vprog;
GLbitfield64 vp_outputs;
/* Choose GLSL vertex shader over ARB vertex program. Need this
@@ -379,11 +379,11 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
* validation (see additional comments in state.c).
*/
if (vertexShader)
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
else
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
- vp_outputs = vprog->Base.OutputsWritten;
+ vp_outputs = vprog->OutputsWritten;
/* These get generated in the setup routine regardless of the
* vertex program:
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 02b20284b..6307f8e4d 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -2075,13 +2075,13 @@ _mesa_format_to_type_and_comps(gl_format format,
return;
case MESA_FORMAT_Z24_S8:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1; /* XXX OK? */
+ *datatype = GL_UNSIGNED_INT_24_8_MESA;
+ *comps = 2;
return;
case MESA_FORMAT_S8_Z24:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1; /* XXX OK? */
+ *datatype = GL_UNSIGNED_INT_8_24_REV_MESA;
+ *comps = 2;
return;
case MESA_FORMAT_Z16:
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index a869133a1..160a4f218 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -512,6 +512,7 @@ static const struct value_desc values[] = {
#if FEATURE_GL || FEATURE_ES1
/* Enums in OpenGL and GLES1 */
{ 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT, NO_EXTRA },
+ { GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA },
{ GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA },
{ GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].Enabled), NO_EXTRA },
{ GL_LIGHT2, CONTEXT_BOOL(Light.Light[2].Enabled), NO_EXTRA },
@@ -680,8 +681,6 @@ static const struct value_desc values[] = {
#if FEATURE_GL || FEATURE_ES2
{ 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES2_BIT, NO_EXTRA },
- /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's GLSL: */
- { GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA },
{ GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */
CONTEXT_INT(Const.MaxTextureCoordUnits),
extra_ARB_fragment_program_NV_fragment_program },
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index 8f0971959..345a1c53e 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -527,6 +527,19 @@ _mesa_bitcount(unsigned int n)
}
return bits;
}
+
+/**
+ * Return number of bits set in given 64-bit uint.
+ */
+unsigned int
+_mesa_bitcount_64(uint64_t n)
+{
+ unsigned int bits;
+ for (bits = 0; n > 0; n = n >> 1) {
+ bits += (n & 1);
+ }
+ return bits;
+}
#endif
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 5fb5581ef..20fa148fe 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -578,9 +578,12 @@ _mesa_init_sqrt_table(void);
#if ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4)
#define _mesa_bitcount(i) __builtin_popcount(i)
+#define _mesa_bitcount_64(i) __builtin_popcountll(i)
#else
extern unsigned int
_mesa_bitcount(unsigned int n);
+extern unsigned int
+_mesa_bitcount_64(uint64_t n);
#endif
#else
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index f04a98b03..46d71bb22 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -43,7 +43,13 @@
static GLint
bytes_per_pixel(GLenum datatype, GLuint comps)
{
- GLint b = _mesa_sizeof_packed_type(datatype);
+ GLint b;
+
+ if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA ||
+ datatype == GL_UNSIGNED_INT_24_8_MESA)
+ return 4;
+
+ b = _mesa_sizeof_packed_type(datatype);
assert(b >= 0);
if (_mesa_type_is_packed(datatype))
@@ -717,6 +723,36 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
}
}
+ else if (datatype == GL_UNSIGNED_INT_24_8_MESA && comps == 2) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
+ GLuint *dst = (GLuint *) dstRow;
+ /* note: averaging stencil values seems weird, but what else? */
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ GLuint z = (((rowA[j] >> 8) + (rowA[k] >> 8) +
+ (rowB[j] >> 8) + (rowB[k] >> 8)) / 4) << 8;
+ GLuint s = ((rowA[j] & 0xff) + (rowA[k] & 0xff) +
+ (rowB[j] & 0xff) + (rowB[k] & 0xff)) / 4;
+ dst[i] = z | s;
+ }
+ }
+ else if (datatype == GL_UNSIGNED_INT_8_24_REV_MESA && comps == 2) {
+ GLuint i, j, k;
+ const GLuint *rowA = (const GLuint *) srcRowA;
+ const GLuint *rowB = (const GLuint *) srcRowB;
+ GLuint *dst = (GLuint *) dstRow;
+ for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+ i++, j += colStride, k += colStride) {
+ GLuint z = ((rowA[j] & 0xffffff) + (rowA[k] & 0xffffff) +
+ (rowB[j] & 0xffffff) + (rowB[k] & 0xffffff)) / 4;
+ GLuint s = (((rowA[j] >> 24) + (rowA[k] >> 24) +
+ (rowB[j] >> 24) + (rowB[k] >> 24)) / 4) << 24;
+ dst[i] = z | s;
+ }
+ }
+
else {
_mesa_problem(NULL, "bad format in do_row()");
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index c97c0bf80..749324d76 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1231,8 +1231,8 @@ typedef enum
/**
- * Texture image state. Describes the dimensions of a texture image,
- * the texel format and pointers to Texel Fetch functions.
+ * Texture image state. Drivers will typically create a subclass of this
+ * with extra fields for memory buffers, etc.
*/
struct gl_texture_image
{
@@ -2171,9 +2171,6 @@ struct gl_shader_program
} Vert;
/* post-link info: */
- struct gl_vertex_program *VertexProgram; /**< Linked vertex program */
- struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
- struct gl_geometry_program *GeometryProgram; /**< Linked geometry prog */
struct gl_uniform_list *Uniforms;
struct gl_program_parameter_list *Varying;
GLboolean LinkStatus; /**< GL_LINK_STATUS */
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 62e352f3f..092e541c5 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -467,6 +467,69 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
}
}
+/*
+ * integer packing , no transfer operations only packs
+ * to dst of GL_UNSIGNED_INT or GL_INT
+ */
+void
+_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr)
+{
+ int i;
+
+ switch(dstType) {
+ case GL_UNSIGNED_INT: {
+ GLuint *dst = (GLuint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = (GLuint) rgba[i][RCOMP];
+ dst[i*4+1] = (GLuint) rgba[i][GCOMP];
+ dst[i*4+2] = (GLuint) rgba[i][BCOMP];
+ dst[i*4+3] = (GLuint) rgba[i][ACOMP];
+ }
+ break;
+ }
+ }
+ break;
+ case GL_INT: {
+ GLint *dst = (GLint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = (GLint) rgba[i][RCOMP];
+ dst[i*4+1] = (GLint) rgba[i][GCOMP];
+ dst[i*4+2] = (GLint) rgba[i][BCOMP];
+ dst[i*4+3] = (GLint) rgba[i][ACOMP];
+ }
+ break;
+ }
+ }
+ break;
+ default:
+ assert(0);
+ return;
+ }
+}
/**
diff --git a/mesalib/src/mesa/main/pack.h b/mesalib/src/mesa/main/pack.h
index 7c76baae4..7a0089c2f 100644
--- a/mesalib/src/mesa/main/pack.h
+++ b/mesalib/src/mesa/main/pack.h
@@ -144,4 +144,9 @@ _mesa_unpack_image(GLuint dimensions,
const struct gl_pixelstore_attrib *unpack);
+void
+_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr);
+
#endif
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 9e0ed9c69..c3aabe43f 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -808,12 +808,15 @@ print_shader_info(const struct gl_shader_program *shProg)
shProg->Shaders[i]->Name,
shProg->Shaders[i]->SourceChecksum);
}
- if (shProg->VertexProgram)
- printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
- if (shProg->FragmentProgram)
- printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
- if (shProg->GeometryProgram)
- printf(" geom prog %u\n", shProg->GeometryProgram->Base.Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX])
+ printf(" vert prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT])
+ printf(" frag prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->Id);
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY])
+ printf(" geom prog %u\n",
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id);
}
@@ -963,9 +966,7 @@ static GLboolean
validate_shader_program(const struct gl_shader_program *shProg,
char *errMsg)
{
- const struct gl_vertex_program *vp = shProg->VertexProgram;
- const struct gl_geometry_program *gp = shProg->GeometryProgram;
- const struct gl_fragment_program *fp = shProg->FragmentProgram;
+ unsigned i;
if (!shProg->LinkStatus) {
return GL_FALSE;
@@ -991,14 +992,11 @@ validate_shader_program(const struct gl_shader_program *shProg,
* Check: any two active samplers in the current program object are of
* different types, but refer to the same texture image unit,
*/
- if (vp && !validate_samplers(&vp->Base, errMsg)) {
- return GL_FALSE;
- }
- if (gp && !validate_samplers(&gp->Base, errMsg)) {
- return GL_FALSE;
- }
- if (fp && !validate_samplers(&fp->Base, errMsg)) {
- return GL_FALSE;
+ for (i = 0; i < Elements(shProg->_LinkedShaders); i++) {
+ if (shProg->_LinkedShaders[i]
+ && !validate_samplers(shProg->_LinkedShaders[i]->Program, errMsg)) {
+ return GL_FALSE;
+ }
}
return GL_TRUE;
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 1eba75697..ccf7efddb 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -275,10 +275,6 @@ void
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
- _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
-
if (shProg->Uniforms) {
_mesa_free_uniform_list(shProg->Uniforms);
shProg->Uniforms = NULL;
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index fc25515a0..bbe90a32e 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -246,10 +246,12 @@ update_program(struct gl_context *ctx)
* come up, or matter.
*/
- if (fsProg && fsProg->LinkStatus && fsProg->FragmentProgram) {
+ if (fsProg && fsProg->LinkStatus
+ && fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* Use GLSL fragment shader */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
- fsProg->FragmentProgram);
+ (struct gl_fragment_program *)
+ fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
@@ -268,10 +270,12 @@ update_program(struct gl_context *ctx)
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
}
- if (gsProg && gsProg->LinkStatus && gsProg->GeometryProgram) {
+ if (gsProg && gsProg->LinkStatus
+ && gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* Use GLSL geometry shader */
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current,
- gsProg->GeometryProgram);
+ (struct gl_geometry_program *)
+ gsProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program);
} else {
/* No geometry program */
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL);
@@ -281,10 +285,12 @@ update_program(struct gl_context *ctx)
* _mesa_get_fixed_func_vertex_program() needs to know active
* fragprog inputs.
*/
- if (vsProg && vsProg->LinkStatus && vsProg->VertexProgram) {
+ if (vsProg && vsProg->LinkStatus
+ && vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* Use GLSL vertex shader */
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
- vsProg->VertexProgram);
+ (struct gl_vertex_program *)
+ vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
}
else if (ctx->VertexProgram._Enabled) {
/* Use user-defined vertex program */
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index b6d8ae016..41630a47c 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/src/mesa/main/texcompress_fxt1.c
@@ -76,6 +76,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
if (srcFormat != GL_RGB ||
srcType != GL_UNSIGNED_BYTE ||
ctx->_ImageTransferState ||
+ srcPacking->RowLength != srcWidth ||
srcPacking->SwapBytes) {
/* convert image to RGB/GLubyte */
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
@@ -91,7 +92,9 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
srcFormat = GL_RGB;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
+
srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
srcType) / sizeof(GLubyte);
}
@@ -146,7 +149,9 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
srcFormat = GL_RGBA;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
+
srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
srcType) / sizeof(GLubyte);
}
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index b180c80f0..904aa457e 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -178,6 +178,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
if (srcFormat != GL_RGB ||
srcType != GL_UNSIGNED_BYTE ||
ctx->_ImageTransferState ||
+ srcPacking->RowLength != srcWidth ||
srcPacking->SwapBytes) {
/* convert image to RGB/GLubyte */
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
@@ -192,7 +193,8 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
srcFormat = GL_RGB;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -236,6 +238,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
if (srcFormat != GL_RGBA ||
srcType != GL_UNSIGNED_BYTE ||
ctx->_ImageTransferState ||
+ srcPacking->RowLength != srcWidth ||
srcPacking->SwapBytes) {
/* convert image to RGBA/GLubyte */
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
@@ -250,7 +253,8 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
srcFormat = GL_RGBA;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -293,6 +297,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
if (srcFormat != GL_RGBA ||
srcType != GL_UNSIGNED_BYTE ||
ctx->_ImageTransferState ||
+ srcPacking->RowLength != srcWidth ||
srcPacking->SwapBytes) {
/* convert image to RGBA/GLubyte */
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
@@ -306,7 +311,8 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
pixels = tempImage;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
@@ -349,6 +355,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
if (srcFormat != GL_RGBA ||
srcType != GL_UNSIGNED_BYTE ||
ctx->_ImageTransferState ||
+ srcPacking->RowLength != srcWidth ||
srcPacking->SwapBytes) {
/* convert image to RGBA/GLubyte */
tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
@@ -362,7 +369,8 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
pixels = tempImage;
}
else {
- pixels = (const GLubyte *) srcAddr;
+ pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
+ srcFormat, srcType, 0, 0);
}
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index ccc3c49f5..7f262d6d8 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -591,86 +591,144 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
if (ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
- case GL_RGBA32UI_EXT:
- case GL_RGB32UI_EXT:
- case GL_ALPHA32UI_EXT:
- case GL_INTENSITY32UI_EXT:
- case GL_LUMINANCE32UI_EXT:
- case GL_LUMINANCE_ALPHA32UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
- break;
- case GL_RGBA16UI_EXT:
- case GL_RGB16UI_EXT:
+ case GL_ALPHA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
case GL_ALPHA16UI_EXT:
- case GL_INTENSITY16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_ALPHA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_ALPHA8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ case GL_ALPHA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_ALPHA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+ case GL_LUMINANCE8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
case GL_LUMINANCE16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_LUMINANCE32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_LUMINANCE8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ case GL_LUMINANCE16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_LUMINANCE32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+ case GL_LUMINANCE_ALPHA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
case GL_LUMINANCE_ALPHA16UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
- break;
- case GL_RGBA8UI_EXT:
- case GL_RGB8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
- break;
- case GL_ALPHA8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8);
- break;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_LUMINANCE_ALPHA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_LUMINANCE_ALPHA8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ case GL_LUMINANCE_ALPHA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_LUMINANCE_ALPHA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
case GL_INTENSITY8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8);
- break;
- case GL_LUMINANCE8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8);
- break;
- case GL_LUMINANCE_ALPHA8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8);
- break;
- case GL_RGBA32I_EXT:
- case GL_RGB32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
- break;
- case GL_ALPHA32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32);
- break;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
+ case GL_INTENSITY16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_INTENSITY32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_INTENSITY8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ case GL_INTENSITY16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
case GL_INTENSITY32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32);
- break;
- case GL_LUMINANCE32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32);
- break;
- case GL_LUMINANCE_ALPHA32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32);
- break;
- case GL_RGBA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+ case GL_RGB8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
+ case GL_RGB16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_RGB32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_RGB8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
case GL_RGB16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
- break;
- case GL_ALPHA16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16);
- break;
- case GL_INTENSITY16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT16);
- break;
- case GL_LUMINANCE16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16);
- break;
- case GL_LUMINANCE_ALPHA16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16);
- break;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_RGB32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+ case GL_RGBA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
+ case GL_RGBA16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_RGBA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
case GL_RGBA8I_EXT:
- case GL_RGB8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
- break;
- case GL_ALPHA8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8);
- break;
- case GL_INTENSITY8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT8);
- break;
- case GL_LUMINANCE8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8);
- break;
- case GL_LUMINANCE_ALPHA8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8);
- break;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ case GL_RGBA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_RGBA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
}
}
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index e02f16240..9f14d8a0d 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -489,26 +489,26 @@ static void
update_texture_state( struct gl_context *ctx )
{
GLuint unit;
- struct gl_fragment_program *fprog = NULL;
- struct gl_vertex_program *vprog = NULL;
+ struct gl_program *fprog = NULL;
+ struct gl_program *vprog = NULL;
GLbitfield enabledFragUnits = 0x0;
if (ctx->Shader.CurrentVertexProgram &&
ctx->Shader.CurrentVertexProgram->LinkStatus) {
- vprog = ctx->Shader.CurrentVertexProgram->VertexProgram;
+ vprog = ctx->Shader.CurrentVertexProgram->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
} else if (ctx->VertexProgram._Enabled) {
/* XXX enable this if/when non-shader vertex programs get
* texture fetches:
- vprog = ctx->VertexProgram.Current;
+ vprog = &ctx->VertexProgram.Current->Base;
*/
}
if (ctx->Shader.CurrentFragmentProgram &&
ctx->Shader.CurrentFragmentProgram->LinkStatus) {
- fprog = ctx->Shader.CurrentFragmentProgram->FragmentProgram;
+ fprog = ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else if (ctx->FragmentProgram._Enabled) {
- fprog = ctx->FragmentProgram.Current;
+ fprog = &ctx->FragmentProgram.Current->Base;
}
/* FINISHME: Geometry shader texture accesses should also be considered
@@ -540,11 +540,11 @@ update_texture_state( struct gl_context *ctx )
* settle on the one with highest priority (see below).
*/
if (vprog) {
- enabledVertTargets |= vprog->Base.TexturesUsed[unit];
+ enabledVertTargets |= vprog->TexturesUsed[unit];
}
if (fprog) {
- enabledFragTargets |= fprog->Base.TexturesUsed[unit];
+ enabledFragTargets |= fprog->TexturesUsed[unit];
}
else {
/* fixed-function fragment program */
@@ -611,7 +611,7 @@ update_texture_state( struct gl_context *ctx )
if (fprog) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits
- = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
+ = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
}
else {
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 2323819aa..7252c099a 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -180,17 +180,17 @@ find_uniform_parameter_pos(struct gl_shader_program *shProg, GLint index,
pos = shProg->Uniforms->Uniforms[index].VertPos;
if (pos >= 0) {
- prog = &shProg->VertexProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].FragPos;
if (pos >= 0) {
- prog = &shProg->FragmentProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
}
else {
pos = shProg->Uniforms->Uniforms[index].GeomPos;
if (pos >= 0) {
- prog = &shProg->GeometryProgram->Base;
+ prog = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program;
}
}
}
@@ -911,29 +911,32 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
/* A uniform var may be used by both a vertex shader and a fragment
* shader. We may need to update one or both shader's uniform here:
*/
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset, type, count, elems, values);
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset, type, count, elems, values);
}
}
- if (shProg->GeometryProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* convert uniform location to program parameter index */
GLint index = uniform->GeomPos;
if (index >= 0) {
- set_program_uniform(ctx, &shProg->GeometryProgram->Base,
+ set_program_uniform(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
index, offset, type, count, elems, values);
}
}
@@ -1056,31 +1059,34 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
uniform = &shProg->Uniforms->Uniforms[location];
- if (shProg->VertexProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
/* convert uniform location to program parameter index */
GLint index = uniform->VertPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program,
index, offset,
count, rows, cols, transpose, values);
}
}
- if (shProg->FragmentProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* convert uniform location to program parameter index */
GLint index = uniform->FragPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
index, offset,
count, rows, cols, transpose, values);
}
}
- if (shProg->GeometryProgram) {
+ if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) {
/* convert uniform location to program parameter index */
GLint index = uniform->GeomPos;
if (index >= 0) {
- set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base,
+ set_program_uniform_matrix(ctx,
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program,
index, offset,
count, rows, cols, transpose, values);
}
@@ -1437,6 +1443,12 @@ _mesa_GetnUniformdvARB(GLhandleARB program, GLint location,
GLsizei bufSize, GLdouble *params)
{
GET_CURRENT_CONTEXT(ctx);
+
+ (void) program;
+ (void) location;
+ (void) bufSize;
+ (void) params;
+
/*
get_uniform(ctx, program, location, bufSize, GL_DOUBLE, params);
*/
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 2e1b8fba3..5be44bc51 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3288,31 +3288,20 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- bool ok = true;
+ static const GLenum targets[] = {
+ GL_VERTEX_PROGRAM_ARB,
+ GL_FRAGMENT_PROGRAM_ARB,
+ GL_GEOMETRY_PROGRAM_NV
+ };
- switch (prog->_LinkedShaders[i]->Type) {
- case GL_VERTEX_SHADER:
+ if (i == MESA_SHADER_VERTEX) {
((struct gl_vertex_program *)linked_prog)->UsesClipDistance
= prog->Vert.UsesClipDistance;
- _mesa_reference_vertprog(ctx, &prog->VertexProgram,
- (struct gl_vertex_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
- linked_prog);
- break;
- case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
- linked_prog);
- break;
- case GL_GEOMETRY_SHADER:
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
- (struct gl_geometry_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
- linked_prog);
- break;
- }
- if (!ok) {
+ }
+
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
+ if (!ctx->Driver.ProgramStringNotify(ctx, targets[i], linked_prog)) {
return GL_FALSE;
}
}
@@ -3427,10 +3416,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
- _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL);
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL);
-
if (prog->LinkStatus) {
link_shaders(ctx, prog);
}
diff --git a/mesalib/src/mesa/program/prog_uniform.c b/mesalib/src/mesa/program/prog_uniform.c
index 28acb8871..d0b25e5c5 100644
--- a/mesalib/src/mesa/program/prog_uniform.c
+++ b/mesalib/src/mesa/program/prog_uniform.c
@@ -56,80 +56,6 @@ _mesa_free_uniform_list(struct gl_uniform_list *list)
}
-struct gl_uniform *
-_mesa_append_uniform(struct gl_uniform_list *list,
- const char *name, GLenum target, GLuint progPos)
-{
- const GLuint oldNum = list->NumUniforms;
- struct gl_uniform *uniform;
- GLint index;
-
- assert(target == GL_VERTEX_PROGRAM_ARB ||
- target == GL_FRAGMENT_PROGRAM_ARB ||
- target == MESA_GEOMETRY_PROGRAM);
-
- index = _mesa_lookup_uniform(list, name);
- if (index < 0) {
- /* not found - append to list */
-
- if (oldNum + 1 > list->Size) {
- /* Need to grow the list array (alloc some extra) */
- list->Size += 4;
-
- /* realloc arrays */
- list->Uniforms = (struct gl_uniform *)
- _mesa_realloc(list->Uniforms,
- oldNum * sizeof(struct gl_uniform),
- list->Size * sizeof(struct gl_uniform));
- }
-
- if (!list->Uniforms) {
- /* out of memory */
- list->NumUniforms = 0;
- list->Size = 0;
- return GL_FALSE;
- }
-
- uniform = list->Uniforms + oldNum;
-
- uniform->Name = _mesa_strdup(name);
- uniform->VertPos = -1;
- uniform->FragPos = -1;
- uniform->GeomPos = -1;
- uniform->Initialized = GL_FALSE;
-
- list->NumUniforms++;
- }
- else {
- /* found */
- uniform = list->Uniforms + index;
- }
-
- /* update position for the vertex or fragment program */
- if (target == GL_VERTEX_PROGRAM_ARB) {
- if (uniform->VertPos != -1) {
- /* this uniform is already in the list - that shouldn't happen */
- return GL_FALSE;
- }
- uniform->VertPos = progPos;
- } else if (target == GL_FRAGMENT_PROGRAM_ARB) {
- if (uniform->FragPos != -1) {
- /* this uniform is already in the list - that shouldn't happen */
- return GL_FALSE;
- }
- uniform->FragPos = progPos;
- } else {
- if (uniform->GeomPos != -1) {
- /* this uniform is already in the list - that shouldn't happen */
- return GL_FALSE;
- }
- uniform->GeomPos = progPos;
- }
-
- return uniform;
-}
-
-
/**
* Return the location/index of the named uniform in the uniform list,
* or -1 if not found.
diff --git a/mesalib/src/mesa/program/prog_uniform.h b/mesalib/src/mesa/program/prog_uniform.h
index 67f78006e..83cd30780 100644
--- a/mesalib/src/mesa/program/prog_uniform.h
+++ b/mesalib/src/mesa/program/prog_uniform.h
@@ -72,10 +72,6 @@ _mesa_new_uniform_list(void);
extern void
_mesa_free_uniform_list(struct gl_uniform_list *list);
-extern struct gl_uniform *
-_mesa_append_uniform(struct gl_uniform_list *list,
- const char *name, GLenum target, GLuint progPos);
-
extern GLint
_mesa_lookup_uniform(const struct gl_uniform_list *list, const char *name);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index e2b29fe30..7fa1672fd 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -387,6 +387,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
GLsizei i, j;
GLint yStep, dfStride;
GLfloat *df;
+ GLuint *dui;
+ GLint *di;
struct st_renderbuffer *strb;
struct gl_pixelstore_attrib clippedPacking = *pack;
struct pipe_transfer *trans;
@@ -454,10 +456,13 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
}
else {
/* write tile(row) into temp row buffer */
- df = (GLfloat *) temp;
+ df = (GLfloat *)temp;
dfStride = 0;
}
+ dui = (GLuint *)df;
+ di = (GLint *)df;
+
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
/* convert GL Y to Gallium Y */
y = strb->Base.Height - y - height;
@@ -611,7 +616,38 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
dst += dstStride;
}
}
- else {
+ else if (util_format_is_pure_sint(pformat)) {
+ for (i = 0; i < height; i++) {
+ if (type == GL_UNSIGNED_INT)
+ pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+ pformat, dui);
+ else
+ pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+ pformat, di);
+ y += yStep;
+ if (!dfStride) {
+ _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+ format, type, dst);
+ dst += dstStride;
+ }
+ }
+ } else if (util_format_is_pure_uint(pformat)) {
+ for (i = 0; i < height; i++) {
+ if (type == GL_UNSIGNED_INT)
+ pipe_get_tile_ui_format(pipe, trans, 0, y, width, 1,
+ pformat, dui);
+ else
+ pipe_get_tile_i_format(pipe, trans, 0, y, width, 1,
+ pformat, di);
+ y += yStep;
+ df += dfStride;
+ if (!dfStride) {
+ _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4])temp,
+ format, type, dst);
+ dst += dstStride;
+ }
+ }
+ } else {
/* RGBA format */
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 6eb8a506b..6e8ab94f4 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -291,20 +291,112 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
return PIPE_FORMAT_R16G16B16A16_UNORM;
/* signed int formats */
+ case MESA_FORMAT_ALPHA_UINT8:
+ return PIPE_FORMAT_A8_UINT;
+ case MESA_FORMAT_ALPHA_UINT16:
+ return PIPE_FORMAT_A16_UINT;
+ case MESA_FORMAT_ALPHA_UINT32:
+ return PIPE_FORMAT_A32_UINT;
+
+ case MESA_FORMAT_ALPHA_INT8:
+ return PIPE_FORMAT_A8_SINT;
+ case MESA_FORMAT_ALPHA_INT16:
+ return PIPE_FORMAT_A16_SINT;
+ case MESA_FORMAT_ALPHA_INT32:
+ return PIPE_FORMAT_A32_SINT;
+
+ case MESA_FORMAT_INTENSITY_UINT8:
+ return PIPE_FORMAT_I8_UINT;
+ case MESA_FORMAT_INTENSITY_UINT16:
+ return PIPE_FORMAT_I16_UINT;
+ case MESA_FORMAT_INTENSITY_UINT32:
+ return PIPE_FORMAT_I32_UINT;
+
+ case MESA_FORMAT_INTENSITY_INT8:
+ return PIPE_FORMAT_I8_SINT;
+ case MESA_FORMAT_INTENSITY_INT16:
+ return PIPE_FORMAT_I16_SINT;
+ case MESA_FORMAT_INTENSITY_INT32:
+ return PIPE_FORMAT_I32_SINT;
+
+ case MESA_FORMAT_LUMINANCE_UINT8:
+ return PIPE_FORMAT_L8_UINT;
+ case MESA_FORMAT_LUMINANCE_UINT16:
+ return PIPE_FORMAT_L16_UINT;
+ case MESA_FORMAT_LUMINANCE_UINT32:
+ return PIPE_FORMAT_L32_UINT;
+
+ case MESA_FORMAT_LUMINANCE_INT8:
+ return PIPE_FORMAT_L8_SINT;
+ case MESA_FORMAT_LUMINANCE_INT16:
+ return PIPE_FORMAT_L16_SINT;
+ case MESA_FORMAT_LUMINANCE_INT32:
+ return PIPE_FORMAT_L32_SINT;
+
+ case MESA_FORMAT_LUMINANCE_ALPHA_UINT8:
+ return PIPE_FORMAT_L8A8_UINT;
+ case MESA_FORMAT_LUMINANCE_ALPHA_UINT16:
+ return PIPE_FORMAT_L16A16_UINT;
+ case MESA_FORMAT_LUMINANCE_ALPHA_UINT32:
+ return PIPE_FORMAT_L32A32_UINT;
+
+ case MESA_FORMAT_LUMINANCE_ALPHA_INT8:
+ return PIPE_FORMAT_L8A8_SINT;
+ case MESA_FORMAT_LUMINANCE_ALPHA_INT16:
+ return PIPE_FORMAT_L16A16_SINT;
+ case MESA_FORMAT_LUMINANCE_ALPHA_INT32:
+ return PIPE_FORMAT_L32A32_SINT;
+
+ case MESA_FORMAT_R_INT8:
+ return PIPE_FORMAT_R8_SINT;
+ case MESA_FORMAT_RG_INT8:
+ return PIPE_FORMAT_R8G8_SINT;
+ case MESA_FORMAT_RGB_INT8:
+ return PIPE_FORMAT_R8G8B8_SINT;
case MESA_FORMAT_RGBA_INT8:
- return PIPE_FORMAT_R8G8B8A8_SSCALED;
+ return PIPE_FORMAT_R8G8B8A8_SINT;
+ case MESA_FORMAT_R_INT16:
+ return PIPE_FORMAT_R16_SINT;
+ case MESA_FORMAT_RG_INT16:
+ return PIPE_FORMAT_R16G16_SINT;
+ case MESA_FORMAT_RGB_INT16:
+ return PIPE_FORMAT_R16G16B16_SINT;
case MESA_FORMAT_RGBA_INT16:
- return PIPE_FORMAT_R16G16B16A16_SSCALED;
+ return PIPE_FORMAT_R16G16B16A16_SINT;
+ case MESA_FORMAT_R_INT32:
+ return PIPE_FORMAT_R32_SINT;
+ case MESA_FORMAT_RG_INT32:
+ return PIPE_FORMAT_R32G32_SINT;
+ case MESA_FORMAT_RGB_INT32:
+ return PIPE_FORMAT_R32G32B32_SINT;
case MESA_FORMAT_RGBA_INT32:
- return PIPE_FORMAT_R32G32B32A32_SSCALED;
+ return PIPE_FORMAT_R32G32B32A32_SINT;
/* unsigned int formats */
+ case MESA_FORMAT_R_UINT8:
+ return PIPE_FORMAT_R8_UINT;
+ case MESA_FORMAT_RG_UINT8:
+ return PIPE_FORMAT_R8G8_UINT;
+ case MESA_FORMAT_RGB_UINT8:
+ return PIPE_FORMAT_R8G8B8_UINT;
case MESA_FORMAT_RGBA_UINT8:
- return PIPE_FORMAT_R8G8B8A8_USCALED;
+ return PIPE_FORMAT_R8G8B8A8_UINT;
+ case MESA_FORMAT_R_UINT16:
+ return PIPE_FORMAT_R16_UINT;
+ case MESA_FORMAT_RG_UINT16:
+ return PIPE_FORMAT_R16G16_UINT;
+ case MESA_FORMAT_RGB_UINT16:
+ return PIPE_FORMAT_R16G16B16_UINT;
case MESA_FORMAT_RGBA_UINT16:
- return PIPE_FORMAT_R16G16B16A16_USCALED;
+ return PIPE_FORMAT_R16G16B16A16_UINT;
+ case MESA_FORMAT_R_UINT32:
+ return PIPE_FORMAT_R32_UINT;
+ case MESA_FORMAT_RG_UINT32:
+ return PIPE_FORMAT_R32G32_UINT;
+ case MESA_FORMAT_RGB_UINT32:
+ return PIPE_FORMAT_R32G32B32_UINT;
case MESA_FORMAT_RGBA_UINT32:
- return PIPE_FORMAT_R32G32B32A32_USCALED;
+ return PIPE_FORMAT_R32G32B32A32_UINT;
case MESA_FORMAT_RED_RGTC1:
return PIPE_FORMAT_RGTC1_UNORM;
@@ -519,20 +611,111 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_R16G16_UNORM:
return MESA_FORMAT_RG1616;
- /* signed int formats */
- case PIPE_FORMAT_R8G8B8A8_SSCALED:
+ case PIPE_FORMAT_A8_UINT:
+ return MESA_FORMAT_ALPHA_UINT8;
+ case PIPE_FORMAT_A16_UINT:
+ return MESA_FORMAT_ALPHA_UINT16;
+ case PIPE_FORMAT_A32_UINT:
+ return MESA_FORMAT_ALPHA_UINT32;
+ case PIPE_FORMAT_A8_SINT:
+ return MESA_FORMAT_ALPHA_INT8;
+ case PIPE_FORMAT_A16_SINT:
+ return MESA_FORMAT_ALPHA_INT16;
+ case PIPE_FORMAT_A32_SINT:
+ return MESA_FORMAT_ALPHA_INT32;
+
+ case PIPE_FORMAT_I8_UINT:
+ return MESA_FORMAT_INTENSITY_UINT8;
+ case PIPE_FORMAT_I16_UINT:
+ return MESA_FORMAT_INTENSITY_UINT16;
+ case PIPE_FORMAT_I32_UINT:
+ return MESA_FORMAT_INTENSITY_UINT32;
+ case PIPE_FORMAT_I8_SINT:
+ return MESA_FORMAT_INTENSITY_INT8;
+ case PIPE_FORMAT_I16_SINT:
+ return MESA_FORMAT_INTENSITY_INT16;
+ case PIPE_FORMAT_I32_SINT:
+ return MESA_FORMAT_INTENSITY_INT32;
+
+ case PIPE_FORMAT_L8_UINT:
+ return MESA_FORMAT_LUMINANCE_UINT8;
+ case PIPE_FORMAT_L16_UINT:
+ return MESA_FORMAT_LUMINANCE_UINT16;
+ case PIPE_FORMAT_L32_UINT:
+ return MESA_FORMAT_LUMINANCE_UINT32;
+ case PIPE_FORMAT_L8_SINT:
+ return MESA_FORMAT_LUMINANCE_INT8;
+ case PIPE_FORMAT_L16_SINT:
+ return MESA_FORMAT_LUMINANCE_INT16;
+ case PIPE_FORMAT_L32_SINT:
+ return MESA_FORMAT_LUMINANCE_INT32;
+
+ case PIPE_FORMAT_L8A8_UINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_UINT8;
+ case PIPE_FORMAT_L16A16_UINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_UINT16;
+ case PIPE_FORMAT_L32A32_UINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_UINT32;
+ case PIPE_FORMAT_L8A8_SINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_INT8;
+ case PIPE_FORMAT_L16A16_SINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_INT16;
+ case PIPE_FORMAT_L32A32_SINT:
+ return MESA_FORMAT_LUMINANCE_ALPHA_INT32;
+
+ case PIPE_FORMAT_R8_SINT:
+ return MESA_FORMAT_R_INT8;
+ case PIPE_FORMAT_R8G8_SINT:
+ return MESA_FORMAT_RG_INT8;
+ case PIPE_FORMAT_R8G8B8_SINT:
+ return MESA_FORMAT_RGB_INT8;
+ case PIPE_FORMAT_R8G8B8A8_SINT:
return MESA_FORMAT_RGBA_INT8;
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
+
+ case PIPE_FORMAT_R16_SINT:
+ return MESA_FORMAT_R_INT16;
+ case PIPE_FORMAT_R16G16_SINT:
+ return MESA_FORMAT_RG_INT16;
+ case PIPE_FORMAT_R16G16B16_SINT:
+ return MESA_FORMAT_RGB_INT16;
+ case PIPE_FORMAT_R16G16B16A16_SINT:
return MESA_FORMAT_RGBA_INT16;
- case PIPE_FORMAT_R32G32B32A32_SSCALED:
+
+ case PIPE_FORMAT_R32_SINT:
+ return MESA_FORMAT_R_INT32;
+ case PIPE_FORMAT_R32G32_SINT:
+ return MESA_FORMAT_RG_INT32;
+ case PIPE_FORMAT_R32G32B32_SINT:
+ return MESA_FORMAT_RGB_INT32;
+ case PIPE_FORMAT_R32G32B32A32_SINT:
return MESA_FORMAT_RGBA_INT32;
/* unsigned int formats */
- case PIPE_FORMAT_R8G8B8A8_USCALED:
+ case PIPE_FORMAT_R8_UINT:
+ return MESA_FORMAT_R_UINT8;
+ case PIPE_FORMAT_R8G8_UINT:
+ return MESA_FORMAT_RG_UINT8;
+ case PIPE_FORMAT_R8G8B8_UINT:
+ return MESA_FORMAT_RGB_UINT8;
+ case PIPE_FORMAT_R8G8B8A8_UINT:
return MESA_FORMAT_RGBA_UINT8;
- case PIPE_FORMAT_R16G16B16A16_USCALED:
+
+ case PIPE_FORMAT_R16_UINT:
+ return MESA_FORMAT_R_UINT16;
+ case PIPE_FORMAT_R16G16_UINT:
+ return MESA_FORMAT_RG_UINT16;
+ case PIPE_FORMAT_R16G16B16_UINT:
+ return MESA_FORMAT_RGB_UINT16;
+ case PIPE_FORMAT_R16G16B16A16_UINT:
return MESA_FORMAT_RGBA_UINT16;
- case PIPE_FORMAT_R32G32B32A32_USCALED:
+
+ case PIPE_FORMAT_R32_UINT:
+ return MESA_FORMAT_R_UINT32;
+ case PIPE_FORMAT_R32G32_UINT:
+ return MESA_FORMAT_RG_UINT32;
+ case PIPE_FORMAT_R32G32B32_UINT:
+ return MESA_FORMAT_RGB_UINT32;
+ case PIPE_FORMAT_R32G32B32A32_UINT:
return MESA_FORMAT_RGBA_UINT32;
case PIPE_FORMAT_RGTC1_UNORM:
@@ -996,79 +1179,215 @@ static const struct format_mapping format_map[] = {
},
/* signed/unsigned integer formats.
- * XXX Mesa only has formats for RGBA signed/unsigned integer formats.
- * If/when new formats are added this code should be updated.
*/
{
{ GL_RED_INTEGER_EXT,
GL_GREEN_INTEGER_EXT,
GL_BLUE_INTEGER_EXT,
- GL_ALPHA_INTEGER_EXT,
- GL_RGB_INTEGER_EXT,
GL_RGBA_INTEGER_EXT,
- GL_BGR_INTEGER_EXT,
GL_BGRA_INTEGER_EXT,
- GL_LUMINANCE_INTEGER_EXT,
- GL_LUMINANCE_ALPHA_INTEGER_EXT,
- GL_RGBA8I_EXT,
- GL_RGB8I_EXT,
- GL_ALPHA8I_EXT,
- GL_INTENSITY8I_EXT,
- GL_LUMINANCE8I_EXT,
+ GL_RGBA8I_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8A8_SINT, 0 }
+ },
+ {
+ { GL_RGB_INTEGER_EXT,
+ GL_BGR_INTEGER_EXT,
+ GL_RGB8I_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8_SINT,
+ PIPE_FORMAT_R8G8B8A8_SINT, 0 }
+ },
+ {
+ { GL_ALPHA_INTEGER_EXT,
+ GL_ALPHA8I_EXT, 0 },
+ { PIPE_FORMAT_A8_SINT, 0 }
+ },
+ {
+ { GL_ALPHA16I_EXT, 0 },
+ { PIPE_FORMAT_A16_SINT, 0 }
+ },
+ {
+ { GL_ALPHA32I_EXT, 0 },
+ { PIPE_FORMAT_A32_SINT, 0 }
+ },
+ {
+ { GL_ALPHA8UI_EXT, 0 },
+ { PIPE_FORMAT_A8_UINT, 0 }
+ },
+ {
+ { GL_ALPHA16UI_EXT, 0 },
+ { PIPE_FORMAT_A16_UINT, 0 }
+ },
+ {
+ { GL_ALPHA32UI_EXT, 0 },
+ { PIPE_FORMAT_A32_UINT, 0 }
+ },
+ {
+ { GL_INTENSITY8I_EXT, 0 },
+ { PIPE_FORMAT_I8_SINT, 0 }
+ },
+ {
+ { GL_INTENSITY16I_EXT, 0 },
+ { PIPE_FORMAT_I16_SINT, 0 }
+ },
+ {
+ { GL_INTENSITY32I_EXT, 0 },
+ { PIPE_FORMAT_I32_SINT, 0 }
+ },
+ {
+ { GL_INTENSITY8UI_EXT, 0 },
+ { PIPE_FORMAT_I8_UINT, 0 }
+ },
+ {
+ { GL_INTENSITY16UI_EXT, 0 },
+ { PIPE_FORMAT_I16_UINT, 0 }
+ },
+ {
+ { GL_INTENSITY32UI_EXT, 0 },
+ { PIPE_FORMAT_I32_UINT, 0 }
+ },
+ {
+ { GL_LUMINANCE8I_EXT, 0 },
+ { PIPE_FORMAT_L8_SINT, 0 }
+ },
+ {
+ { GL_LUMINANCE16I_EXT, 0 },
+ { PIPE_FORMAT_L16_SINT, 0 }
+ },
+ {
+ { GL_LUMINANCE32I_EXT, 0 },
+ { PIPE_FORMAT_L32_SINT, 0 }
+ },
+ {
+ { GL_LUMINANCE_INTEGER_EXT,
+ GL_LUMINANCE8UI_EXT, 0 },
+ { PIPE_FORMAT_L8_UINT, 0 }
+ },
+ {
+ { GL_LUMINANCE16UI_EXT, 0 },
+ { PIPE_FORMAT_L16_UINT, 0 }
+ },
+ {
+ { GL_LUMINANCE32UI_EXT, 0 },
+ { PIPE_FORMAT_L32_UINT, 0 }
+ },
+ {
+ { GL_LUMINANCE_ALPHA_INTEGER_EXT,
GL_LUMINANCE_ALPHA8I_EXT, 0 },
- { PIPE_FORMAT_R8G8B8A8_SSCALED, 0 }
+ { PIPE_FORMAT_L8A8_SINT, 0 }
},
{
- {
- GL_RGBA16I_EXT,
- GL_RGB16I_EXT,
- GL_ALPHA16I_EXT,
- GL_INTENSITY16I_EXT,
- GL_LUMINANCE16I_EXT,
- GL_LUMINANCE_ALPHA16I_EXT, 0 },
- { PIPE_FORMAT_R16G16B16A16_SSCALED, 0 },
+ { GL_LUMINANCE_ALPHA16I_EXT, 0 },
+ { PIPE_FORMAT_L16A16_SINT, 0 }
},
{
- {
- GL_RGBA32I_EXT,
- GL_RGB32I_EXT,
- GL_ALPHA32I_EXT,
- GL_INTENSITY32I_EXT,
- GL_LUMINANCE32I_EXT,
- GL_LUMINANCE_ALPHA32I_EXT, 0 },
- { PIPE_FORMAT_R32G32B32A32_SSCALED, 0 }
+ { GL_LUMINANCE_ALPHA32I_EXT, 0 },
+ { PIPE_FORMAT_L32A32_SINT, 0 }
},
{
- {
- GL_RGBA8UI_EXT,
- GL_RGB8UI_EXT,
- GL_ALPHA8UI_EXT,
- GL_INTENSITY8UI_EXT,
- GL_LUMINANCE8UI_EXT,
- GL_LUMINANCE_ALPHA8UI_EXT, 0 },
- { PIPE_FORMAT_R8G8B8A8_USCALED, 0 }
+ { GL_LUMINANCE_ALPHA8UI_EXT, 0 },
+ { PIPE_FORMAT_L8A8_UINT, 0 }
},
{
- {
- GL_RGBA16UI_EXT,
- GL_RGB16UI_EXT,
- GL_ALPHA16UI_EXT,
- GL_INTENSITY16UI_EXT,
- GL_LUMINANCE16UI_EXT,
- GL_LUMINANCE_ALPHA16UI_EXT, 0 },
- { PIPE_FORMAT_R16G16B16A16_USCALED, 0 }
+ { GL_LUMINANCE_ALPHA16UI_EXT, 0 },
+ { PIPE_FORMAT_L16A16_UINT, 0 }
},
{
- {
- GL_RGBA32UI_EXT,
- GL_RGB32UI_EXT,
- GL_ALPHA32UI_EXT,
- GL_INTENSITY32UI_EXT,
- GL_LUMINANCE32UI_EXT,
- GL_LUMINANCE_ALPHA32UI_EXT, 0 },
- { PIPE_FORMAT_R32G32B32A32_USCALED, 0 }
+ { GL_LUMINANCE_ALPHA32UI_EXT, 0 },
+ { PIPE_FORMAT_L32A32_UINT, 0 }
+ },
+ {
+ { GL_RGB16I_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16_SINT,
+ PIPE_FORMAT_R16G16B16A16_SINT, 0 },
+ },
+ {
+ { GL_RGBA16I_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16A16_SINT, 0 },
+ },
+ {
+ { GL_RGB32I_EXT, 0 },
+ { PIPE_FORMAT_R32G32B32_SINT,
+ PIPE_FORMAT_R32G32B32A32_SINT, 0 },
+ },
+ {
+ { GL_RGBA32I_EXT, 0 },
+ { PIPE_FORMAT_R32G32B32A32_SINT, 0 }
+ },
+ {
+ { GL_RGBA8UI_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8A8_UINT, 0 }
+ },
+ {
+ { GL_RGB8UI_EXT, 0 },
+ { PIPE_FORMAT_R8G8B8_UINT,
+ PIPE_FORMAT_R8G8B8A8_UINT, 0 }
+ },
+ {
+ { GL_RGB16UI_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16_UINT,
+ PIPE_FORMAT_R16G16B16A16_UINT, 0 }
+ },
+ {
+ { GL_RGBA16UI_EXT, 0 },
+ { PIPE_FORMAT_R16G16B16A16_UINT, 0 }
+ },
+ {
+ { GL_RGB32UI_EXT, 0},
+ { PIPE_FORMAT_R32G32B32_UINT,
+ PIPE_FORMAT_R32G32B32A32_UINT, 0 }
+ },
+ {
+ { GL_RGBA32UI_EXT, 0},
+ { PIPE_FORMAT_R32G32B32A32_UINT, 0 }
+ },
+ {
+ { GL_R8I, 0},
+ { PIPE_FORMAT_R8_SINT, 0},
+ },
+ {
+ { GL_R16I, 0},
+ { PIPE_FORMAT_R16_SINT, 0},
+ },
+ {
+ { GL_R32I, 0},
+ { PIPE_FORMAT_R32_SINT, 0},
+ },
+ {
+ { GL_R8UI, 0},
+ { PIPE_FORMAT_R8_UINT, 0},
+ },
+ {
+ { GL_R16UI, 0},
+ { PIPE_FORMAT_R16_UINT, 0},
+ },
+ {
+ { GL_R32UI, 0},
+ { PIPE_FORMAT_R32_UINT, 0},
+ },
+ {
+ { GL_RG8I, 0},
+ { PIPE_FORMAT_R8G8_SINT, 0},
+ },
+ {
+ { GL_RG16I, 0},
+ { PIPE_FORMAT_R16G16_SINT, 0},
+ },
+ {
+ { GL_RG32I, 0},
+ { PIPE_FORMAT_R32G32_SINT, 0},
+ },
+ {
+ { GL_RG8UI, 0},
+ { PIPE_FORMAT_R8G8_UINT, 0},
+ },
+ {
+ { GL_RG16UI, 0},
+ { PIPE_FORMAT_R16G16_UINT, 0},
+ },
+ {
+ { GL_RG32UI, 0},
+ { PIPE_FORMAT_R32G32_UINT, 0},
},
-
/* signed normalized formats */
{
{ GL_RED_SNORM, GL_R8_SNORM, 0 },
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index d8ef8a3ce..fe65ae539 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5180,39 +5180,17 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- bool ok = true;
-
- switch (prog->_LinkedShaders[i]->Type) {
- case GL_VERTEX_SHADER:
- _mesa_reference_vertprog(ctx, &prog->VertexProgram,
- (struct gl_vertex_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
- linked_prog);
- if (!ok) {
- _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL);
- }
- break;
- case GL_FRAGMENT_SHADER:
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram,
- (struct gl_fragment_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
- linked_prog);
- if (!ok) {
- _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL);
- }
- break;
- case GL_GEOMETRY_SHADER:
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram,
- (struct gl_geometry_program *)linked_prog);
- ok = ctx->Driver.ProgramStringNotify(ctx, GL_GEOMETRY_PROGRAM_NV,
- linked_prog);
- if (!ok) {
- _mesa_reference_geomprog(ctx, &prog->GeometryProgram, NULL);
- }
- break;
- }
- if (!ok) {
- _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, NULL);
+ static const GLenum targets[] = {
+ GL_VERTEX_PROGRAM_ARB,
+ GL_FRAGMENT_PROGRAM_ARB,
+ GL_GEOMETRY_PROGRAM_NV
+ };
+
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ linked_prog);
+ if (!ctx->Driver.ProgramStringNotify(ctx, targets[i], linked_prog)) {
+ _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
+ NULL);
_mesa_reference_program(ctx, &linked_prog, NULL);
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index a4f47edfc..acd3b56b9 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -1153,12 +1153,9 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData)
destroy_program_variants(st, shProg->Shaders[i]->Program);
}
- destroy_program_variants(st, (struct gl_program *)
- shProg->VertexProgram);
- destroy_program_variants(st, (struct gl_program *)
- shProg->FragmentProgram);
- destroy_program_variants(st, (struct gl_program *)
- shProg->GeometryProgram);
+ for (i = 0; i < Elements(shProg->_LinkedShaders); i++) {
+ destroy_program_variants(st, shProg->_LinkedShaders[i]->Program);
+ }
}
break;
case GL_VERTEX_SHADER:
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 12ad688b0..ec8451eb8 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -112,18 +112,12 @@ typedef void (*validate_texture_image_func)(struct gl_context *ctx,
struct swrast_texture_image;
-typedef void (*FetchTexelFuncC)(const struct swrast_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLchan *texelOut);
-
/**
- * As above, but returns floats.
- * Used for depth component images and for upcoming signed/float
- * texture images.
+ * Fetch a texel from texture image at given position.
*/
-typedef void (*FetchTexelFuncF)(const struct swrast_texture_image *texImage,
- GLint col, GLint row, GLint img,
- GLfloat *texelOut);
+typedef void (*FetchTexelFunc)(const struct swrast_texture_image *texImage,
+ GLint col, GLint row, GLint img,
+ GLfloat *texelOut);
typedef void (*StoreTexelFunc)(struct swrast_texture_image *texImage,
@@ -150,8 +144,7 @@ struct swrast_texture_image
GLint TexelSize; /**< bytes per texel block */
#endif
- FetchTexelFuncC FetchTexelc;
- FetchTexelFuncF FetchTexelf;
+ FetchTexelFunc FetchTexel;
StoreTexelFunc Store;
#if 0
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 7573abda6..a854c3efd 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -121,9 +121,9 @@ static void store_null_texel(struct swrast_texture_image *texImage,
*/
static struct {
gl_format Name;
- FetchTexelFuncF Fetch1D;
- FetchTexelFuncF Fetch2D;
- FetchTexelFuncF Fetch3D;
+ FetchTexelFunc Fetch1D;
+ FetchTexelFunc Fetch2D;
+ FetchTexelFunc Fetch3D;
StoreTexelFunc StoreTexel;
}
texfetch_funcs[MESA_FORMAT_COUNT] =
@@ -1250,7 +1250,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
};
-FetchTexelFuncF
+FetchTexelFunc
_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
{
#ifdef DEBUG
@@ -1287,63 +1287,7 @@ _mesa_get_texel_store_func(gl_format format)
/**
- * Adaptor for fetching a GLchan texel from a float-valued texture.
- */
-static void
-fetch_texel_float_to_chan(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texelOut)
-{
- GLfloat temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->Base.TexFormat);
-
- ASSERT(texImage->FetchTexelf);
- texImage->FetchTexelf(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- }
- else {
- /* four channels */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
- }
-}
-
-
-#if 0
-/**
- * Adaptor for fetching a float texel from a GLchan-valued texture.
- */
-static void
-fetch_texel_chan_to_float(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texelOut)
-{
- GLchan temp[4];
- GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
-
- ASSERT(texImage->FetchTexelc);
- texImage->FetchTexelc(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- }
- else {
- /* four channels */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- texelOut[1] = CHAN_TO_FLOAT(temp[1]);
- texelOut[2] = CHAN_TO_FLOAT(temp[2]);
- texelOut[3] = CHAN_TO_FLOAT(temp[3]);
- }
-}
-#endif
-
-
-/**
- * Initialize the texture image's FetchTexelc and FetchTexelf methods.
+ * Initialize the texture image's FetchTexel methods.
*/
static void
set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
@@ -1357,12 +1301,8 @@ set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
format = _mesa_get_srgb_format_linear(format);
}
- texImage->FetchTexelf = _mesa_get_texel_fetch_func(format, dims);
-
- texImage->FetchTexelc = fetch_texel_float_to_chan;
-
- ASSERT(texImage->FetchTexelc);
- ASSERT(texImage->FetchTexelf);
+ texImage->FetchTexel = _mesa_get_texel_fetch_func(format, dims);
+ ASSERT(texImage->FetchTexel);
}
void
diff --git a/mesalib/src/mesa/swrast/s_texfetch.h b/mesalib/src/mesa/swrast/s_texfetch.h
index 19b196a5a..c98aa5c5a 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.h
+++ b/mesalib/src/mesa/swrast/s_texfetch.h
@@ -32,7 +32,7 @@
extern StoreTexelFunc
_mesa_get_texel_store_func(gl_format format);
-extern FetchTexelFuncF
+extern FetchTexelFunc
_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
void
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index ca9133b21..f8b0fa1aa 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -815,7 +815,7 @@ sample_1d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- swImg->FetchTexelf(swImg, i, 0, 0, rgba);
+ swImg->FetchTexel(swImg, i, 0, 0, rgba);
}
}
@@ -852,13 +852,13 @@ sample_1d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t0);
}
else {
- swImg->FetchTexelf(swImg, i0, 0, 0, t0);
+ swImg->FetchTexel(swImg, i0, 0, 0, t0);
}
if (useBorderColor & I1BIT) {
get_border_color(tObj, img, t1);
}
else {
- swImg->FetchTexelf(swImg, i1, 0, 0, t1);
+ swImg->FetchTexel(swImg, i1, 0, 0, t1);
}
lerp_rgba(rgba, a, t0, t1);
@@ -1082,7 +1082,7 @@ sample_2d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- swImg->FetchTexelf(swImg, i, j, 0, rgba);
+ swImg->FetchTexel(swImg, i, j, 0, rgba);
}
}
@@ -1127,25 +1127,25 @@ sample_2d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t00);
}
else {
- swImg->FetchTexelf(swImg, i0, j0, 0, t00);
+ swImg->FetchTexel(swImg, i0, j0, 0, t00);
}
if (useBorderColor & (I1BIT | J0BIT)) {
get_border_color(tObj, img, t10);
}
else {
- swImg->FetchTexelf(swImg, i1, j0, 0, t10);
+ swImg->FetchTexel(swImg, i1, j0, 0, t10);
}
if (useBorderColor & (I0BIT | J1BIT)) {
get_border_color(tObj, img, t01);
}
else {
- swImg->FetchTexelf(swImg, i0, j1, 0, t01);
+ swImg->FetchTexel(swImg, i0, j1, 0, t01);
}
if (useBorderColor & (I1BIT | J1BIT)) {
get_border_color(tObj, img, t11);
}
else {
- swImg->FetchTexelf(swImg, i1, j1, 0, t11);
+ swImg->FetchTexel(swImg, i1, j1, 0, t11);
}
lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
@@ -1180,10 +1180,10 @@ sample_2d_linear_repeat(struct gl_context *ctx,
linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi);
linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
- swImg->FetchTexelf(swImg, i0, j0, 0, t00);
- swImg->FetchTexelf(swImg, i1, j0, 0, t10);
- swImg->FetchTexelf(swImg, i0, j1, 0, t01);
- swImg->FetchTexelf(swImg, i1, j1, 0, t11);
+ swImg->FetchTexel(swImg, i0, j0, 0, t00);
+ swImg->FetchTexel(swImg, i1, j0, 0, t10);
+ swImg->FetchTexel(swImg, i0, j1, 0, t01);
+ swImg->FetchTexel(swImg, i1, j1, 0, t11);
lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
}
@@ -1369,6 +1369,7 @@ opt_sample_rgb_2d(struct gl_context *ctx,
ASSERT(img->Border==0);
ASSERT(img->TexFormat == MESA_FORMAT_RGB888);
ASSERT(swImg->_IsPowerOfTwo);
+ (void) swImg;
for (k=0; k<n; k++) {
GLint i = IFLOOR(texcoords[k][0] * width) & colMask;
@@ -1412,6 +1413,7 @@ opt_sample_rgba_2d(struct gl_context *ctx,
ASSERT(img->Border==0);
ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888);
ASSERT(swImg->_IsPowerOfTwo);
+ (void) swImg;
for (i = 0; i < n; i++) {
const GLint col = IFLOOR(texcoords[i][0] * width) & colMask;
@@ -1966,7 +1968,7 @@ sample_3d_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- swImg->FetchTexelf(swImg, i, j, k, rgba);
+ swImg->FetchTexel(swImg, i, j, k, rgba);
}
}
@@ -2018,50 +2020,50 @@ sample_3d_linear(struct gl_context *ctx,
get_border_color(tObj, img, t000);
}
else {
- swImg->FetchTexelf(swImg, i0, j0, k0, t000);
+ swImg->FetchTexel(swImg, i0, j0, k0, t000);
}
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
get_border_color(tObj, img, t100);
}
else {
- swImg->FetchTexelf(swImg, i1, j0, k0, t100);
+ swImg->FetchTexel(swImg, i1, j0, k0, t100);
}
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t010);
}
else {
- swImg->FetchTexelf(swImg, i0, j1, k0, t010);
+ swImg->FetchTexel(swImg, i0, j1, k0, t010);
}
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
get_border_color(tObj, img, t110);
}
else {
- swImg->FetchTexelf(swImg, i1, j1, k0, t110);
+ swImg->FetchTexel(swImg, i1, j1, k0, t110);
}
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t001);
}
else {
- swImg->FetchTexelf(swImg, i0, j0, k1, t001);
+ swImg->FetchTexel(swImg, i0, j0, k1, t001);
}
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
get_border_color(tObj, img, t101);
}
else {
- swImg->FetchTexelf(swImg, i1, j0, k1, t101);
+ swImg->FetchTexel(swImg, i1, j0, k1, t101);
}
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t011);
}
else {
- swImg->FetchTexelf(swImg, i0, j1, k1, t011);
+ swImg->FetchTexel(swImg, i0, j1, k1, t011);
}
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
get_border_color(tObj, img, t111);
}
else {
- swImg->FetchTexelf(swImg, i1, j1, k1, t111);
+ swImg->FetchTexel(swImg, i1, j1, k1, t111);
}
/* trilinear interpolation of samples */
@@ -2582,7 +2584,7 @@ sample_nearest_rect(struct gl_context *ctx,
if (col < 0 || col >= width || row < 0 || row >= height)
get_border_color(tObj, img, rgba[i]);
else
- swImg->FetchTexelf(swImg, col, row, 0, rgba[i]);
+ swImg->FetchTexel(swImg, col, row, 0, rgba[i]);
}
}
@@ -2630,22 +2632,22 @@ sample_linear_rect(struct gl_context *ctx,
if (useBorderColor & (I0BIT | J0BIT))
get_border_color(tObj, img, t00);
else
- swImg->FetchTexelf(swImg, i0, j0, 0, t00);
+ swImg->FetchTexel(swImg, i0, j0, 0, t00);
if (useBorderColor & (I1BIT | J0BIT))
get_border_color(tObj, img, t10);
else
- swImg->FetchTexelf(swImg, i1, j0, 0, t10);
+ swImg->FetchTexel(swImg, i1, j0, 0, t10);
if (useBorderColor & (I0BIT | J1BIT))
get_border_color(tObj, img, t01);
else
- swImg->FetchTexelf(swImg, i0, j1, 0, t01);
+ swImg->FetchTexel(swImg, i0, j1, 0, t01);
if (useBorderColor & (I1BIT | J1BIT))
get_border_color(tObj, img, t11);
else
- swImg->FetchTexelf(swImg, i1, j1, 0, t11);
+ swImg->FetchTexel(swImg, i1, j1, 0, t11);
lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
}
@@ -2723,7 +2725,7 @@ sample_2d_array_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- swImg->FetchTexelf(swImg, i, j, array, rgba);
+ swImg->FetchTexel(swImg, i, j, array, rgba);
}
}
@@ -2775,25 +2777,25 @@ sample_2d_array_linear(struct gl_context *ctx,
get_border_color(tObj, img, t00);
}
else {
- swImg->FetchTexelf(swImg, i0, j0, array, t00);
+ swImg->FetchTexel(swImg, i0, j0, array, t00);
}
if (useBorderColor & (I1BIT | J0BIT)) {
get_border_color(tObj, img, t10);
}
else {
- swImg->FetchTexelf(swImg, i1, j0, array, t10);
+ swImg->FetchTexel(swImg, i1, j0, array, t10);
}
if (useBorderColor & (I0BIT | J1BIT)) {
get_border_color(tObj, img, t01);
}
else {
- swImg->FetchTexelf(swImg, i0, j1, array, t01);
+ swImg->FetchTexel(swImg, i0, j1, array, t01);
}
if (useBorderColor & (I1BIT | J1BIT)) {
get_border_color(tObj, img, t11);
}
else {
- swImg->FetchTexelf(swImg, i1, j1, array, t11);
+ swImg->FetchTexel(swImg, i1, j1, array, t11);
}
/* trilinear interpolation of samples */
@@ -3032,7 +3034,7 @@ sample_1d_array_nearest(struct gl_context *ctx,
get_border_color(tObj, img, rgba);
}
else {
- swImg->FetchTexelf(swImg, i, array, 0, rgba);
+ swImg->FetchTexel(swImg, i, array, 0, rgba);
}
}
@@ -3076,13 +3078,13 @@ sample_1d_array_linear(struct gl_context *ctx,
get_border_color(tObj, img, t0);
}
else {
- swImg->FetchTexelf(swImg, i0, array, 0, t0);
+ swImg->FetchTexel(swImg, i0, array, 0, t0);
}
if (useBorderColor & (I1BIT | K0BIT)) {
get_border_color(tObj, img, t1);
}
else {
- swImg->FetchTexelf(swImg, i1, array, 0, t1);
+ swImg->FetchTexel(swImg, i1, array, 0, t1);
}
/* bilinear interpolation of samples */
@@ -3446,7 +3448,7 @@ sample_depth_texture( struct gl_context *ctx,
if (col >= 0 && row >= 0 && col < width && row < height &&
slice >= 0 && slice < depth) {
- swImg->FetchTexelf(swImg, col, row, slice, &depthSample);
+ swImg->FetchTexel(swImg, col, row, slice, &depthSample);
}
else {
depthSample = tObj->Sampler.BorderColor.f[0];
@@ -3515,13 +3517,13 @@ sample_depth_texture( struct gl_context *ctx,
depth00 = tObj->Sampler.BorderColor.f[0];
}
else {
- swImg->FetchTexelf(swImg, i0, j0, slice, &depth00);
+ swImg->FetchTexel(swImg, i0, j0, slice, &depth00);
}
if (useBorderTexel & (I1BIT | J0BIT)) {
depth10 = tObj->Sampler.BorderColor.f[0];
}
else {
- swImg->FetchTexelf(swImg, i1, j0, slice, &depth10);
+ swImg->FetchTexel(swImg, i1, j0, slice, &depth10);
}
if (tObj->Target != GL_TEXTURE_1D_ARRAY_EXT) {
@@ -3529,13 +3531,13 @@ sample_depth_texture( struct gl_context *ctx,
depth01 = tObj->Sampler.BorderColor.f[0];
}
else {
- swImg->FetchTexelf(swImg, i0, j1, slice, &depth01);
+ swImg->FetchTexel(swImg, i0, j1, slice, &depth01);
}
if (useBorderTexel & (I1BIT | J1BIT)) {
depth11 = tObj->Sampler.BorderColor.f[0];
}
else {
- swImg->FetchTexelf(swImg, i1, j1, slice, &depth11);
+ swImg->FetchTexel(swImg, i1, j1, slice, &depth11);
}
}
else {
diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c
index 643952875..47e458e1c 100644
--- a/mesalib/src/mesa/swrast/s_texrender.c
+++ b/mesalib/src/mesa/swrast/s_texrender.c
@@ -23,7 +23,7 @@ struct texture_renderbuffer
struct gl_renderbuffer Base; /**< Base class object */
struct swrast_texture_image *TexImage;
StoreTexelFunc Store;
- FetchTexelFuncF Fetchf;
+ FetchTexelFunc Fetch;
GLint Yoffset; /**< Layer for 1D array textures. */
GLint Zoffset; /**< Layer for 2D array textures, or slice
* for 3D textures
@@ -52,7 +52,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
GLchan *rgbaOut = (GLchan *) values;
for (i = 0; i < count; i++) {
GLfloat rgba[4];
- trb->Fetchf(trb->TexImage, x + i, y, z, rgba);
+ trb->Fetch(trb->TexImage, x + i, y, z, rgba);
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
}
}
@@ -60,7 +60,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetch(trb->TexImage, x + i, y, z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
}
@@ -71,7 +71,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
*/
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetch(trb->TexImage, x + i, y, z, &flt);
#if 0
/* this should work, but doesn't (overflow due to low precision) */
zValues[i] = (GLuint) (flt * scale);
@@ -85,7 +85,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetch(trb->TexImage, x + i, y, z, &flt);
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
}
}
@@ -93,7 +93,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetch(trb->TexImage, x + i, y, z, &flt);
zValues[i] = (GLuint) (flt * 0xffffff);
}
}
@@ -116,7 +116,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
GLchan *rgbaOut = (GLchan *) values;
for (i = 0; i < count; i++) {
GLfloat rgba[4];
- trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, rgba);
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
}
@@ -125,7 +125,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
@@ -134,7 +134,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
#if 0
zValues[i] = (GLuint) (flt * 0xffffffff);
@@ -147,7 +147,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
}
@@ -156,7 +156,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetch(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = (GLuint) (flt * 0xffffff);
}
@@ -544,11 +544,11 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
trb->Store = store_nop;
}
- if (!trb->TexImage->FetchTexelf) {
+ if (!trb->TexImage->FetchTexel) {
_mesa_update_fetch_functions(trb->TexImage->Base.TexObject);
}
- trb->Fetchf = trb->TexImage->FetchTexelf;
- assert(trb->Fetchf);
+ trb->Fetch = trb->TexImage->FetchTexel;
+ assert(trb->Fetch);
if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
trb->Yoffset = att->Zoffset;
@@ -592,17 +592,17 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
break;
/* SRGB formats pre EXT_framebuffer_sRGB don't do sRGB translations on FBO readback */
case MESA_FORMAT_SRGB8:
- trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGB888, _mesa_get_texture_dimensions(att->Texture->Target));
+ trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_RGB888, _mesa_get_texture_dimensions(att->Texture->Target));
trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
case MESA_FORMAT_SRGBA8:
- trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGBA8888, _mesa_get_texture_dimensions(att->Texture->Target));
+ trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_RGBA8888, _mesa_get_texture_dimensions(att->Texture->Target));
trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
case MESA_FORMAT_SARGB8:
- trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_ARGB8888, _mesa_get_texture_dimensions(att->Texture->Target));
+ trb->Fetch = _mesa_get_texel_fetch_func(MESA_FORMAT_ARGB8888, _mesa_get_texture_dimensions(att->Texture->Target));
trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
break;
diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c
index cc5e85634..367dfd5bb 100644
--- a/mesalib/src/mesa/tnl/t_vb_program.c
+++ b/mesalib/src/mesa/tnl/t_vb_program.c
@@ -336,11 +336,17 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
for (i = 0; i < VERT_RESULT_MAX; i++) {
if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) {
outputs[numOutputs++] = i;
+ }
+ }
- if (!store->results[i].data) {
- _mesa_vector4f_alloc( &store->results[i], 0, VB->Size, 32 );
- store->results[i].size = 4;
- }
+ /* Allocate result vectors. We delay this until now to avoid allocating
+ * memory that would never be used if we don't run the software tnl pipeline.
+ */
+ if (!store->results[0].storage) {
+ for (i = 0; i < VERT_RESULT_MAX; i++) {
+ assert(!store->results[i].storage);
+ _mesa_vector4f_alloc( &store->results[i], 0, VB->Size, 32 );
+ store->results[i].size = 4;
}
}