diff options
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r-- | mesalib/src/mesa/drivers/dri/Makefile.am | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/drirc | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/arrayobj.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_pack.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 19 | ||||
-rw-r--r-- | mesalib/src/mesa/main/pack.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texparam.c | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_context.h | 22 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec.c | 15 |
13 files changed, 102 insertions, 59 deletions
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index 70039f9ad..2009da921 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -85,7 +85,6 @@ install-data-hook: ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la + $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.* endif diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc index ebc04cd9b..4b9841bd2 100644 --- a/mesalib/src/mesa/drivers/dri/common/drirc +++ b/mesalib/src/mesa/drivers/dri/common/drirc @@ -11,17 +11,21 @@ Application bugs worked around in this file: is still 1.10. * Unigine Heaven 3.0 with ARB_texture_multisample uses a "ivec4 * vec4" - expression, which fails to compile with GLSL 1.10. + expression, which is illegal in GLSL 1.10. Adding "#version 130" fixes this. * Unigine Heaven 3.0 with ARB_shader_bit_encoding uses the uint keyword, which - fails to compile with GLSL 1.10. + is illegal in GLSL 1.10. Adding "#version 130" fixes this. * Unigine Heaven 3.0 with ARB_shader_bit_encoding uses a "uint & int" - expression, which fails (and should fail) to compile with any GLSL version. + expression, which is illegal in any GLSL version. Disabling ARB_shader_bit_encoding fixes this. +* If ARB_sample_shading is supported, Unigine Heaven 4.0 and Valley 1.0 uses + an #extension directive in the middle of its shaders, which is illegal + in GLSL. + TODO: document the other workarounds. --> @@ -45,6 +49,7 @@ TODO: document the other workarounds. <option name="disable_blend_func_extended" value="true" /> <option name="force_glsl_version" value="130" /> <option name="disable_shader_bit_encoding" value="true" /> + <option name="allow_glsl_extension_directive_midshader" value="true" /> </application> <application name="Unigine Heaven (64-bit)" executable="heaven_x64"> @@ -52,6 +57,15 @@ TODO: document the other workarounds. <option name="disable_blend_func_extended" value="true" /> <option name="force_glsl_version" value="130" /> <option name="disable_shader_bit_encoding" value="true" /> + <option name="allow_glsl_extension_directive_midshader" value="true" /> + </application> + + <application name="Unigine Valley (32-bit)" executable="valley_x86"> + <option name="allow_glsl_extension_directive_midshader" value="true" /> + </application> + + <application name="Unigine Valley (64-bit)" executable="valley_x64"> + <option name="allow_glsl_extension_directive_midshader" value="true" /> </application> <application name="Unigine OilRush (32-bit)" executable="OilRush_x86"> diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index fc9e10461..b73a6620c 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -105,6 +105,11 @@ DRI_CONF_OPT_BEGIN_V(force_glsl_version, int, def, "0:999") \ DRI_CONF_DESC(en,gettext("Force a default GLSL version for shaders that lack an explicit #version line")) \ DRI_CONF_OPT_END +#define DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(def) \ +DRI_CONF_OPT_BEGIN_B(allow_glsl_extension_directive_midshader, def) \ + DRI_CONF_DESC(en,gettext("Allow GLSL #extension directives in the middle of shaders")) \ +DRI_CONF_OPT_END + /** diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index efb993012..1ea319a74 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -427,6 +427,21 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) } } + if (ctx->Array.DrawMethod == DRAW_ARRAYS) { + /* The _DrawArrays pointer is pointing at the VAO being unbound and + * that VAO may be in the process of being deleted. If it's not going + * to be deleted, this will have no effect, because the pointer needs + * to be updated by the VBO module anyway. + * + * Before the VBO module can update the pointer, we have to set it + * to NULL for drivers not to set up arrays which are not bound, + * or to prevent a crash if the VAO being unbound is going to be + * deleted. + */ + ctx->Array._DrawArrays = NULL; + ctx->Array.DrawMethod = DRAW_NONE; + } + ctx->NewState |= _NEW_ARRAY; _mesa_reference_vao(ctx, &ctx->Array.VAO, newObj); diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 6b28592a6..c97c05297 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -888,7 +888,7 @@ pack_float_R_UNORM8(const GLfloat src[4], void *dst) static void pack_ubyte_R8G8_UNORM(const GLubyte src[4], void *dst) { - GLubyte *d = ((GLubyte *) dst); + GLushort *d = ((GLushort *) dst); *d = PACK_COLOR_88(src[GCOMP], src[RCOMP]); } diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index a7126fd55..91d9172f9 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1640,6 +1640,17 @@ struct gl_vertex_array_object }; +/** Used to signal when transitioning from one kind of drawing method + * to another. + */ +typedef enum { + DRAW_NONE, /**< Initial value only */ + DRAW_BEGIN_END, + DRAW_DISPLAY_LIST, + DRAW_ARRAYS +} gl_draw_method; + + /** * Vertex array state */ @@ -1679,6 +1690,9 @@ struct gl_array_attrib * The array pointer is set up only by the VBO module. */ const struct gl_client_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */ + + /** One of the DRAW_xxx flags, not consumed by drivers */ + gl_draw_method DrawMethod; }; @@ -3349,6 +3363,11 @@ struct gl_constants GLuint ForceGLSLVersion; /** + * Allow GLSL #extension directives in the middle of shaders. + */ + GLboolean AllowGLSLExtensionDirectiveMidShader; + + /** * Does the driver support real 32-bit integers? (Otherwise, integers are * simulated via floats.) */ diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 5ebaaf6e5..649a74cce 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -3183,10 +3183,10 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], PROCESS(aSrc, ACOMP, 1.0F, 255, GLubyte, UBYTE_TO_FLOAT); break; case GL_BYTE: - PROCESS(rSrc, RCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOATZ); - PROCESS(gSrc, GCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOATZ); - PROCESS(bSrc, BCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOATZ); - PROCESS(aSrc, ACOMP, 1.0F, 127, GLbyte, BYTE_TO_FLOATZ); + PROCESS(rSrc, RCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT_TEX); + PROCESS(gSrc, GCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT_TEX); + PROCESS(bSrc, BCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT_TEX); + PROCESS(aSrc, ACOMP, 1.0F, 127, GLbyte, BYTE_TO_FLOAT_TEX); break; case GL_UNSIGNED_SHORT: PROCESS(rSrc, RCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT); @@ -3195,10 +3195,10 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], PROCESS(aSrc, ACOMP, 1.0F, 0xffff, GLushort, USHORT_TO_FLOAT); break; case GL_SHORT: - PROCESS(rSrc, RCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOATZ); - PROCESS(gSrc, GCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOATZ); - PROCESS(bSrc, BCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOATZ); - PROCESS(aSrc, ACOMP, 1.0F, 32767, GLshort, SHORT_TO_FLOATZ); + PROCESS(rSrc, RCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT_TEX); + PROCESS(gSrc, GCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT_TEX); + PROCESS(bSrc, BCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT_TEX); + PROCESS(aSrc, ACOMP, 1.0F, 32767, GLshort, SHORT_TO_FLOAT_TEX); break; case GL_UNSIGNED_INT: PROCESS(rSrc, RCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT); diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index dc17ea584..30dd0b9b3 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -1051,6 +1051,7 @@ get_tex_level_parameter_image(struct gl_context *ctx, GLenum pname, GLint *params) { const struct gl_texture_image *img = NULL; + struct gl_texture_image dummy_image; mesa_format texFormat; img = _mesa_select_tex_image(ctx, texObj, target, level); @@ -1062,12 +1063,12 @@ get_tex_level_parameter_image(struct gl_context *ctx, * instead of 1. TEXTURE_COMPONENTS is deprecated; always * use TEXTURE_INTERNAL_FORMAT." */ + memset(&dummy_image, 0, sizeof(dummy_image)); + dummy_image.TexFormat = MESA_FORMAT_NONE; + dummy_image.InternalFormat = GL_RGBA; + dummy_image._BaseFormat = GL_NONE; - if (pname == GL_TEXTURE_INTERNAL_FORMAT) - *params = GL_RGBA; - else - *params = 0; - return; + img = &dummy_image; } texFormat = img->TexFormat; @@ -1107,6 +1108,8 @@ get_tex_level_parameter_image(struct gl_context *ctx, } break; case GL_TEXTURE_BORDER: + if (ctx->API != API_OPENGL_COMPAT) + goto invalid_pname; *params = img->Border; break; case GL_TEXTURE_RED_SIZE: @@ -1120,6 +1123,8 @@ get_tex_level_parameter_image(struct gl_context *ctx, break; case GL_TEXTURE_INTENSITY_SIZE: case GL_TEXTURE_LUMINANCE_SIZE: + if (ctx->API != API_OPENGL_COMPAT) + goto invalid_pname; if (_mesa_base_format_has_channel(img->_BaseFormat, pname)) { *params = _mesa_get_format_bits(texFormat, pname); if (*params == 0) { @@ -1166,12 +1171,15 @@ get_tex_level_parameter_image(struct gl_context *ctx, break; /* GL_ARB_texture_float */ + case GL_TEXTURE_LUMINANCE_TYPE_ARB: + case GL_TEXTURE_INTENSITY_TYPE_ARB: + if (ctx->API != API_OPENGL_COMPAT) + goto invalid_pname; + /* FALLTHROUGH */ case GL_TEXTURE_RED_TYPE_ARB: case GL_TEXTURE_GREEN_TYPE_ARB: case GL_TEXTURE_BLUE_TYPE_ARB: case GL_TEXTURE_ALPHA_TYPE_ARB: - case GL_TEXTURE_LUMINANCE_TYPE_ARB: - case GL_TEXTURE_INTENSITY_TYPE_ARB: case GL_TEXTURE_DEPTH_TYPE_ARB: if (!ctx->Extensions.ARB_texture_float) goto invalid_pname; diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 1109051e9..2a82e9d9d 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -1456,6 +1456,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_binop_carry: case ir_binop_borrow: case ir_binop_imul_high: + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: assert(!"not supported"); break; @@ -2814,10 +2817,7 @@ get_mesa_program(struct gl_context *ctx, prog->NumTemporaries = v.next_temp; - int num_instructions = 0; - foreach_in_list(ir_instruction, node, &v.instructions) { - num_instructions++; - } + unsigned num_instructions = v.instructions.length(); mesa_instructions = (struct prog_instruction *)calloc(num_instructions, diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 4207cb64a..aa59fbfa9 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -772,6 +772,9 @@ void st_init_extensions(struct st_context *st) if (st->options.disable_glsl_line_continuations) ctx->Const.DisableGLSLLineContinuations = 1; + if (st->options.allow_glsl_extension_directive_midshader) + ctx->Const.AllowGLSLExtensionDirectiveMidShader = GL_TRUE; + ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); 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 f47cd7d53..5c51e63d9 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2049,6 +2049,9 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) case ir_binop_ldexp: case ir_binop_carry: case ir_binop_borrow: + case ir_unop_interpolate_at_centroid: + case ir_binop_interpolate_at_offset: + case ir_binop_interpolate_at_sample: /* This operation is not supported, or should have already been handled. */ assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"); @@ -2820,7 +2823,13 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) } break; case ir_txb: - opcode = is_cube_array ? TGSI_OPCODE_TXB2 : TGSI_OPCODE_TXB; + if (is_cube_array || + sampler_type == glsl_type::samplerCubeShadow_type) { + opcode = TGSI_OPCODE_TXB2; + } + else { + opcode = TGSI_OPCODE_TXB; + } ir->lod_info.bias->accept(this); lod_info = this->result; if (ir->offset) { diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h index 1680e23dc..e22451305 100644 --- a/mesalib/src/mesa/vbo/vbo_context.h +++ b/mesalib/src/mesa/vbo/vbo_context.h @@ -57,18 +57,6 @@ #include "vbo_save.h" -/** Used to signal when transitioning from one kind of drawing method - * to another. - */ -enum draw_method -{ - DRAW_NONE, /**< Initial value only */ - DRAW_BEGIN_END, - DRAW_DISPLAY_LIST, - DRAW_ARRAYS -}; - - struct vbo_context { struct gl_client_array currval[VBO_ATTRIB_MAX]; @@ -83,8 +71,6 @@ struct vbo_context { * is responsible for initiating any fallback actions required: */ vbo_draw_func draw_prims; - - enum draw_method last_draw_method; }; @@ -122,11 +108,11 @@ get_program_mode( struct gl_context *ctx ) * that arrays may be changing. */ static inline void -vbo_draw_method(struct vbo_context *vbo, enum draw_method method) +vbo_draw_method(struct vbo_context *vbo, gl_draw_method method) { - if (vbo->last_draw_method != method) { - struct gl_context *ctx = vbo->exec.ctx; + struct gl_context *ctx = vbo->exec.ctx; + if (ctx->Array.DrawMethod != method) { switch (method) { case DRAW_ARRAYS: ctx->Array._DrawArrays = vbo->exec.array.inputs; @@ -142,7 +128,7 @@ vbo_draw_method(struct vbo_context *vbo, enum draw_method method) } ctx->NewDriverState |= ctx->DriverFlags.NewArray; - vbo->last_draw_method = method; + ctx->Array.DrawMethod = method; } } diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c index bd2b1b1a9..eb9035043 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.c +++ b/mesalib/src/mesa/vbo/vbo_exec.c @@ -82,21 +82,6 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ) if (!exec->validating && new_state & (_NEW_PROGRAM|_NEW_ARRAY)) { exec->array.recalculate_inputs = GL_TRUE; - - /* If we ended up here because a VAO was deleted, the _DrawArrays - * pointer which pointed to the VAO might be invalid now, so set it - * to NULL. This prevents crashes in driver functions like Clear - * where driver state validation might occur, but the vbo module is - * still in an invalid state. - * - * Drivers should skip vertex array state validation if _DrawArrays - * is NULL. It also has no effect on performance, because attrib - * bindings will be recalculated anyway. - */ - if (vbo->last_draw_method == DRAW_ARRAYS) { - ctx->Array._DrawArrays = NULL; - vbo->last_draw_method = DRAW_NONE; - } } if (new_state & _NEW_EVAL) |