diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/APIspec.xml | 14 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/dd.h | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ff_fragment_shader.cpp | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.c | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mipmap.c | 38 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/main/pack.c | 63 | ||||
-rw-r--r-- | mesalib/src/mesa/main/pack.h | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 32 | ||||
-rw-r--r-- | mesalib/src/mesa/main/shaderobj.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/main/state.c | 18 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_fxt1.c | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_s3tc.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texformat.c | 204 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texstate.c | 18 | ||||
-rw-r--r-- | mesalib/src/mesa/main/uniforms.c | 42 |
20 files changed, 356 insertions, 160 deletions
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); */ |