diff options
author | marha <marha@users.sourceforge.net> | 2011-10-19 12:11:26 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-10-19 12:11:26 +0200 |
commit | 1e90ede4237374dfbb2c8c506a906233bcfd3c5d (patch) | |
tree | 13b59b0ab2715fd0bb9eea788c73b08f3b07c01e /mesalib/src/mesa/state_tracker | |
parent | baf98f9bb36f956245d83ecd04f90625d6d68d2b (diff) | |
parent | 9f986778bd4393c5a9108426969d45aa7f10f334 (diff) | |
download | vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.gz vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.bz2 vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/include/os.h
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 40 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_eglimage.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_fbo.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_readpixels.c | 14 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_format.c | 34 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 128 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_program.c | 3 |
8 files changed, 62 insertions, 175 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 74e87f0e4..89e0a73f1 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -871,7 +871,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, if (format == GL_DEPTH_STENCIL) { GLenum ztype = - pt->resource->format == PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED ? + pt->resource->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT ? GL_FLOAT : GL_UNSIGNED_INT; _mesa_unpack_depth_span(ctx, spanWidth, ztype, zValues, @@ -896,14 +896,14 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, /* now pack the stencil (and Z) values in the dest format */ switch (pt->resource->format) { - case PIPE_FORMAT_S8_USCALED: + case PIPE_FORMAT_S8_UINT: { ubyte *dest = stmap + spanY * pt->stride + spanX; assert(usage == PIPE_TRANSFER_WRITE); memcpy(dest, sValues, spanWidth); } break; - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: if (format == GL_DEPTH_STENCIL) { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; @@ -921,7 +921,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } } break; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: if (format == GL_DEPTH_STENCIL) { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLint k; @@ -939,7 +939,7 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } } break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: if (format == GL_DEPTH_STENCIL) { uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4); GLfloat *destf = (GLfloat*)dest; @@ -1112,20 +1112,20 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, enum pipe_format stencil_format = PIPE_FORMAT_NONE; switch (pt->format) { - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - case PIPE_FORMAT_X24S8_USCALED: - stencil_format = PIPE_FORMAT_X24S8_USCALED; + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_X24S8_UINT: + stencil_format = PIPE_FORMAT_X24S8_UINT; break; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - case PIPE_FORMAT_S8X24_USCALED: - stencil_format = PIPE_FORMAT_S8X24_USCALED; + case PIPE_FORMAT_S8_UINT_Z24_UNORM: + case PIPE_FORMAT_S8X24_UINT: + stencil_format = PIPE_FORMAT_S8X24_UINT; break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED: - case PIPE_FORMAT_X32_S8X24_USCALED: - stencil_format = PIPE_FORMAT_X32_S8X24_USCALED; + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + case PIPE_FORMAT_X32_S8X24_UINT: + stencil_format = PIPE_FORMAT_X32_S8X24_UINT; break; - case PIPE_FORMAT_S8_USCALED: - stencil_format = PIPE_FORMAT_S8_USCALED; + case PIPE_FORMAT_S8_UINT: + stencil_format = PIPE_FORMAT_S8_UINT; break; default: assert(0); @@ -1241,7 +1241,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, src = buffer + i * width; switch (ptDraw->resource->format) { - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: { uint *dst4 = (uint *) dst; int j; @@ -1252,7 +1252,7 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, } } break; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: { uint *dst4 = (uint *) dst; int j; @@ -1263,11 +1263,11 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, } } break; - case PIPE_FORMAT_S8_USCALED: + case PIPE_FORMAT_S8_UINT: assert(usage == PIPE_TRANSFER_WRITE); memcpy(dst, src, width); break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: { uint *dst4 = (uint *) dst; int j; diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c index 531296fb3..37c20ebe3 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c @@ -53,7 +53,7 @@ st_pipe_format_to_base_format(enum pipe_format format) base_format = GL_DEPTH_STENCIL; } else { - if (format == PIPE_FORMAT_S8_USCALED) + if (format == PIPE_FORMAT_S8_UINT) base_format = GL_STENCIL_INDEX; else base_format = GL_DEPTH_COMPONENT; diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 4d321587f..6da65d7b9 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -259,13 +259,13 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) case PIPE_FORMAT_Z32_UNORM: strb->Base.InternalFormat = GL_DEPTH_COMPONENT32; break; - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_X8Z24_UNORM: strb->Base.InternalFormat = GL_DEPTH24_STENCIL8_EXT; break; - case PIPE_FORMAT_S8_USCALED: + case PIPE_FORMAT_S8_UINT: strb->Base.InternalFormat = GL_STENCIL_INDEX8_EXT; break; case PIPE_FORMAT_R16G16B16A16_SNORM: diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c index 7fa1672fd..bd73f3bf0 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c @@ -109,13 +109,13 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, /* get stencil (and Z) values */ switch (pt->resource->format) { - case PIPE_FORMAT_S8_USCALED: + case PIPE_FORMAT_S8_UINT: { const ubyte *src = stmap + srcY * pt->stride; memcpy(sValues, src, width); } break; - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: if (format == GL_DEPTH_STENCIL) { const uint *src = (uint *) (stmap + srcY * pt->stride); const GLfloat scale = 1.0f / (0xffffff); @@ -133,7 +133,7 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } } break; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: if (format == GL_DEPTH_STENCIL) { const uint *src = (uint *) (stmap + srcY * pt->stride); const GLfloat scale = 1.0f / (0xffffff); @@ -151,7 +151,7 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } } break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: if (format == GL_DEPTH_STENCIL) { const uint *src = (uint *) (stmap + srcY * pt->stride); const GLfloat *srcf = (const GLfloat*)src; @@ -502,7 +502,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width, format, type); - if (pformat == PIPE_FORMAT_Z24_UNORM_S8_USCALED || + if (pformat == PIPE_FORMAT_Z24_UNORM_S8_UINT || pformat == PIPE_FORMAT_Z24X8_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { @@ -534,7 +534,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h } } } - else if (pformat == PIPE_FORMAT_S8_USCALED_Z24_UNORM || + else if (pformat == PIPE_FORMAT_S8_UINT_Z24_UNORM || pformat == PIPE_FORMAT_X8Z24_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { @@ -601,7 +601,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h dst += dstStride; } } - else if (pformat == PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED) { + else if (pformat == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) { assert(format == GL_DEPTH_COMPONENT); for (i = 0; i < height; i++) { GLfloat zfloat[MAX_WIDTH]; /* Z32 */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 6707fcae1..a1f029089 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -368,18 +368,18 @@ void st_init_extensions(struct st_context *st) /* GL_EXT_packed_depth_stencil requires both the ability to render to * a depth/stencil buffer and texture from depth/stencil source. */ - if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, + if (screen->is_format_supported(screen, PIPE_FORMAT_S8_UINT_Z24_UNORM, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL) && - screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, + screen->is_format_supported(screen, PIPE_FORMAT_S8_UINT_Z24_UNORM, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; } - else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, + else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL) && - screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, + screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW)) { ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; @@ -650,7 +650,7 @@ void st_init_extensions(struct st_context *st) PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW) && - screen->is_format_supported(screen, PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, + screen->is_format_supported(screen, PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW)) { diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index 6e8ab94f4..196433d5e 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -89,13 +89,13 @@ st_format_datatype(enum pipe_format format) format == PIPE_FORMAT_R9G9B9E5_FLOAT) { return GL_FLOAT; } - else if (format == PIPE_FORMAT_Z24_UNORM_S8_USCALED || - format == PIPE_FORMAT_S8_USCALED_Z24_UNORM || + else if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT || + format == PIPE_FORMAT_S8_UINT_Z24_UNORM || format == PIPE_FORMAT_Z24X8_UNORM || format == PIPE_FORMAT_X8Z24_UNORM) { return GL_UNSIGNED_INT_24_8; } - else if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED) { + else if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) { return GL_FLOAT_32_UNSIGNED_INT_24_8_REV; } else { @@ -199,19 +199,19 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) case MESA_FORMAT_Z32: return PIPE_FORMAT_Z32_UNORM; case MESA_FORMAT_Z24_S8: - return PIPE_FORMAT_S8_USCALED_Z24_UNORM; + return PIPE_FORMAT_S8_UINT_Z24_UNORM; case MESA_FORMAT_S8_Z24: - return PIPE_FORMAT_Z24_UNORM_S8_USCALED; + return PIPE_FORMAT_Z24_UNORM_S8_UINT; case MESA_FORMAT_Z24_X8: return PIPE_FORMAT_X8Z24_UNORM; case MESA_FORMAT_X8_Z24: return PIPE_FORMAT_Z24X8_UNORM; case MESA_FORMAT_S8: - return PIPE_FORMAT_S8_USCALED; + return PIPE_FORMAT_S8_UINT; case MESA_FORMAT_Z32_FLOAT: return PIPE_FORMAT_Z32_FLOAT; case MESA_FORMAT_Z32_FLOAT_X24S8: - return PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED; + return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_UYVY; #if FEATURE_texture_s3tc @@ -508,7 +508,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_I8; case PIPE_FORMAT_I16_UNORM: return MESA_FORMAT_I16; - case PIPE_FORMAT_S8_USCALED: + case PIPE_FORMAT_S8_UINT: return MESA_FORMAT_S8; case PIPE_FORMAT_R16G16B16A16_UNORM: @@ -518,17 +518,17 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_Z16; case PIPE_FORMAT_Z32_UNORM: return MESA_FORMAT_Z32; - case PIPE_FORMAT_S8_USCALED_Z24_UNORM: + case PIPE_FORMAT_S8_UINT_Z24_UNORM: return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_X8Z24_UNORM: return MESA_FORMAT_Z24_X8; case PIPE_FORMAT_Z24X8_UNORM: return MESA_FORMAT_X8_Z24; - case PIPE_FORMAT_Z24_UNORM_S8_USCALED: + case PIPE_FORMAT_Z24_UNORM_S8_UINT: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_Z32_FLOAT: return MESA_FORMAT_Z32_FLOAT; - case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED: + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: return MESA_FORMAT_Z32_FLOAT_X24S8; case PIPE_FORMAT_UYVY: @@ -818,8 +818,8 @@ struct format_mapping PIPE_FORMAT_Z24X8_UNORM, \ PIPE_FORMAT_X8Z24_UNORM, \ PIPE_FORMAT_Z16_UNORM, \ - PIPE_FORMAT_Z24_UNORM_S8_USCALED, \ - PIPE_FORMAT_S8_USCALED_Z24_UNORM, \ + PIPE_FORMAT_Z24_UNORM_S8_UINT, \ + PIPE_FORMAT_S8_UINT_Z24_UNORM, \ 0 /** @@ -988,19 +988,19 @@ static const struct format_mapping format_map[] = { { GL_STENCIL_INDEX, GL_STENCIL_INDEX1_EXT, GL_STENCIL_INDEX4_EXT, GL_STENCIL_INDEX8_EXT, GL_STENCIL_INDEX16_EXT, 0 }, { - PIPE_FORMAT_S8_USCALED, PIPE_FORMAT_Z24_UNORM_S8_USCALED, - PIPE_FORMAT_S8_USCALED_Z24_UNORM, 0 + PIPE_FORMAT_S8_UINT, PIPE_FORMAT_Z24_UNORM_S8_UINT, + PIPE_FORMAT_S8_UINT_Z24_UNORM, 0 } }, /* Depth / Stencil formats */ { { GL_DEPTH_STENCIL_EXT, GL_DEPTH24_STENCIL8_EXT, 0 }, - { PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_FORMAT_S8_USCALED_Z24_UNORM, 0 } + { PIPE_FORMAT_Z24_UNORM_S8_UINT, PIPE_FORMAT_S8_UINT_Z24_UNORM, 0 } }, { { GL_DEPTH32F_STENCIL8, 0 }, - { PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED, 0 } + { PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, 0 } }, /* sRGB formats */ 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 fe65ae539..18e8a1db4 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -42,12 +42,13 @@ #include "ir_optimization.h" #include "ast.h" -extern "C" { #include "main/mtypes.h" -#include "main/shaderapi.h" #include "main/shaderobj.h" -#include "main/uniforms.h" #include "program/hash_table.h" + +extern "C" { +#include "main/shaderapi.h" +#include "main/uniforms.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -2913,122 +2914,6 @@ check_resources(const struct gl_context *ctx, } - -struct uniform_sort { - struct gl_uniform *u; - int pos; -}; - -/* The shader_program->Uniforms list is almost sorted in increasing - * uniform->{Frag,Vert}Pos locations, but not quite when there are - * uniforms shared between targets. We need to add parameters in - * increasing order for the targets. - */ -static int -sort_uniforms(const void *a, const void *b) -{ - struct uniform_sort *u1 = (struct uniform_sort *)a; - struct uniform_sort *u2 = (struct uniform_sort *)b; - - return u1->pos - u2->pos; -} - -/* Add the uniforms to the parameters. The linker chose locations - * in our parameters lists (which weren't created yet), which the - * uniforms code will use to poke values into our parameters list - * when uniforms are updated. - */ -static void -add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, - struct gl_shader *shader, - struct gl_program *prog) -{ - unsigned int i; - unsigned int next_sampler = 0, num_uniforms = 0; - struct uniform_sort *sorted_uniforms; - - sorted_uniforms = ralloc_array(NULL, struct uniform_sort, - shader_program->Uniforms->NumUniforms); - - for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { - struct gl_uniform *uniform = shader_program->Uniforms->Uniforms + i; - int parameter_index = -1; - - switch (shader->Type) { - case GL_VERTEX_SHADER: - parameter_index = uniform->VertPos; - break; - case GL_FRAGMENT_SHADER: - parameter_index = uniform->FragPos; - break; - case GL_GEOMETRY_SHADER: - parameter_index = uniform->GeomPos; - break; - } - - /* Only add uniforms used in our target. */ - if (parameter_index != -1) { - sorted_uniforms[num_uniforms].pos = parameter_index; - sorted_uniforms[num_uniforms].u = uniform; - num_uniforms++; - } - } - - qsort(sorted_uniforms, num_uniforms, sizeof(struct uniform_sort), - sort_uniforms); - - for (i = 0; i < num_uniforms; i++) { - struct gl_uniform *uniform = sorted_uniforms[i].u; - int parameter_index = sorted_uniforms[i].pos; - const glsl_type *type = uniform->Type; - unsigned int size; - - if (type->is_vector() || - type->is_scalar()) { - size = type->vector_elements; - } else { - size = type_size(type) * 4; - } - - gl_register_file file; - if (type->is_sampler() || - (type->is_array() && type->fields.array->is_sampler())) { - file = PROGRAM_SAMPLER; - } else { - file = PROGRAM_UNIFORM; - } - - GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, - uniform->Name); - - if (index < 0) { - index = _mesa_add_parameter(prog->Parameters, file, - uniform->Name, size, type->gl_type, - NULL, NULL, 0x0); - - /* Sampler uniform values are stored in prog->SamplerUnits, - * and the entry in that array is selected by this index we - * store in ParameterValues[]. - */ - if (file == PROGRAM_SAMPLER) { - for (unsigned int j = 0; j < size / 4; j++) - prog->Parameters->ParameterValues[index + j][0].f = next_sampler++; - } - - /* The location chosen in the Parameters list here (returned - * from _mesa_add_uniform) has to match what the linker chose. - */ - if (index != parameter_index) { - fail_link(shader_program, "Allocation of uniform `%s' to target " - "failed (%d vs %d)\n", - uniform->Name, index, parameter_index); - } - } - } - - ralloc_free(sorted_uniforms); -} - static void set_uniform_initializer(struct gl_context *ctx, void *mem_ctx, struct gl_shader_program *shader_program, @@ -3772,7 +3657,7 @@ glsl_to_tgsi_visitor::eliminate_dead_code_advanced(void) if (!inst->dead_mask || !inst->dst.writemask) continue; - else if (inst->dead_mask == inst->dst.writemask) { + else if ((inst->dst.writemask & ~inst->dead_mask) == 0) { iter.remove(); delete inst; removed++; @@ -4964,7 +4849,8 @@ get_mesa_program(struct gl_context *ctx, v->glsl_version = ctx->Const.GLSLVersion; v->native_integers = ctx->Const.NativeIntegers; - add_uniforms_to_parameters_list(shader_program, shader, prog); + _mesa_generate_parameters_list_for_uniforms(shader_program, shader, + prog->Parameters); /* Emit intermediate IR for main(). */ visit_exec_list(shader->ir, v); diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index acd3b56b9..c419c4066 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -1154,7 +1154,8 @@ destroy_shader_program_variants_cb(GLuint key, void *data, void *userData) } for (i = 0; i < Elements(shProg->_LinkedShaders); i++) { - destroy_program_variants(st, shProg->_LinkedShaders[i]->Program); + if (shProg->_LinkedShaders[i]) + destroy_program_variants(st, shProg->_LinkedShaders[i]->Program); } } break; |