Mesa (master): mesa: Move sanity check of BindVertexBuffer for OpenGL ES 3.1
Module: Mesa Branch: master Commit: 2bcacc69b9935f073e271527771b4fb42081dcb6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2bcacc69b9935f073e271527771b4fb42081dcb6 Author: Marta Lofstedt Date: Fri Jan 8 14:55:55 2016 +0100 mesa: Move sanity check of BindVertexBuffer for OpenGL ES 3.1 Sanity check of BindVertexBuffer for OpenGL ES in _mesa_handle_bind_buffer_gen breaks OpenGL ES 2 conformance. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93426 Signed-off-by: Marta Lofstedt Reviewed-by: Tapani Pälli --- src/mesa/main/bufferobj.c | 2 +- src/mesa/main/varray.c| 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 26f873b..8ede1f0 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -953,7 +953,7 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx, { struct gl_buffer_object *buf = *buf_handle; - if (!buf && (ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx))) { + if (!buf && (ctx->API == API_OPENGL_CORE)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller); return false; } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index c71e16a..c2bf295 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1744,6 +1744,10 @@ vertex_array_vertex_buffer(struct gl_context *ctx, } else if (buffer != 0) { vbo = _mesa_lookup_bufferobj(ctx, buffer); + if (!vbo && _mesa_is_gles31(ctx)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", func); + return; + } /* From the GL_ARB_vertex_attrib_array spec: * * "[Core profile only:] ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util/u_pstipple.c: copy immediates during transformation
Module: Mesa Branch: master Commit: e6281a285012d76cf60fb8639838c369cf4d438f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6281a285012d76cf60fb8639838c369cf4d438f Author: Nicolai Hähnle Date: Fri Jan 15 16:56:15 2016 -0500 util/u_pstipple.c: copy immediates during transformation Apparently, nobody has combined stippling with a fragment shader containing immediates in almost five years... Fixes a bug in Kodi with radeonsi reported by Christian König. Cc: "11.0 11.1" Tested-by: Christian König Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_pstipple.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index 08dec13..3428172 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -230,6 +230,7 @@ pstip_transform_immed(struct tgsi_transform_context *ctx, struct pstip_transform_context *pctx = (struct pstip_transform_context *) ctx; pctx->numImmed++; + ctx->emit_immediate(ctx, immed); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/va: fix motion adaptive deinterlacing
Module: Mesa Branch: master Commit: f3b067af8656b1d3e0fda3e50bf80dbda5f4c1f8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f3b067af8656b1d3e0fda3e50bf80dbda5f4c1f8 Author: Christian König Date: Mon Jan 18 20:56:06 2016 +0100 st/va: fix motion adaptive deinterlacing Signed-off-by: Christian König --- src/gallium/state_trackers/va/postproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/va/postproc.c b/src/gallium/state_trackers/va/postproc.c index f541f7c..d06f016 100644 --- a/src/gallium/state_trackers/va/postproc.c +++ b/src/gallium/state_trackers/va/postproc.c @@ -273,7 +273,7 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex case VAProcDeinterlacingMotionAdaptive: src = vlVaApplyDeint(drv, context, param, src, -deint->flags & VA_DEINTERLACING_BOTTOM_FIELD); +!!(deint->flags & VA_DEINTERLACING_BOTTOM_FIELD)); break; default: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Inform compiler of variable range to silence warning.
Module: Mesa Branch: master Commit: e734fb0326e61470d4341cc7bda52a25c96e1a72 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e734fb0326e61470d4341cc7bda52a25c96e1a72 Author: Matt Turner Date: Fri Jan 15 13:38:46 2016 -0800 i965: Inform compiler of variable range to silence warning. Extends commit 6531ccb70 to silence the warning in release builds as well. Reviewed-by: Ilia Mirkin --- src/mesa/drivers/dri/i965/brw_vue_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vue_map.c b/src/mesa/drivers/dri/i965/brw_vue_map.c index fea2436..b66c209 100644 --- a/src/mesa/drivers/dri/i965/brw_vue_map.c +++ b/src/mesa/drivers/dri/i965/brw_vue_map.c @@ -248,6 +248,8 @@ brw_compute_tess_vue_map(struct brw_vue_map *vue_map, static const char * varying_name(brw_varying_slot slot) { + assume(slot < BRW_VARYING_SLOT_COUNT); + if (slot < VARYING_SLOT_MAX) return gl_varying_slot_name(slot); @@ -257,7 +259,6 @@ varying_name(brw_varying_slot slot) [BRW_VARYING_SLOT_PNTC - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_PNTC", }; - assert(slot < BRW_VARYING_SLOT_COUNT); return brw_names[slot - VARYING_SLOT_MAX]; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/vec4: Spaces around operators.
Module: Mesa Branch: master Commit: 866a6bf9f70625517d6d2c17be9523b9f035f1db URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=866a6bf9f70625517d6d2c17be9523b9f035f1db Author: Matt Turner Date: Tue Jan 19 12:12:38 2016 -0800 i965/vec4: Spaces around operators. --- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 4ee2ed4..1b87e30 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -1069,7 +1069,7 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) case nir_op_umul_high: { struct brw_reg acc = retype(brw_acc_reg(8), dst.type); - if (devinfo->gen >=8) + if (devinfo->gen >= 8) emit(MUL(acc, op[0], retype(op[1], BRW_REGISTER_TYPE_UW))); else emit(MUL(acc, op[0], op[1])); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: Restore Mesa-style to shader_enums.c/h.
Module: Mesa Branch: master Commit: a439788c59ae8e09854cebc7d8e4edd0eee6d391 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a439788c59ae8e09854cebc7d8e4edd0eee6d391 Author: Matt Turner Date: Fri Jan 15 13:31:34 2016 -0800 glsl: Restore Mesa-style to shader_enums.c/h. --- src/glsl/nir/shader_enums.c | 24 src/glsl/nir/shader_enums.h | 16 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/glsl/nir/shader_enums.c b/src/glsl/nir/shader_enums.c index 10f546a..16b20db 100644 --- a/src/glsl/nir/shader_enums.c +++ b/src/glsl/nir/shader_enums.c @@ -33,7 +33,8 @@ #define ENUM(x) [x] = #x #define NAME(val) val) < ARRAY_SIZE(names)) && names[(val)]) ? names[(val)] : "UNKNOWN") -const char * gl_shader_stage_name(gl_shader_stage stage) +const char * +gl_shader_stage_name(gl_shader_stage stage) { static const char *names[] = { ENUM(MESA_SHADER_VERTEX), @@ -51,7 +52,8 @@ const char * gl_shader_stage_name(gl_shader_stage stage) * Translate a gl_shader_stage to a short shader stage name for debug * printouts and error messages. */ -const char * _mesa_shader_stage_to_string(unsigned stage) +const char * +_mesa_shader_stage_to_string(unsigned stage) { switch (stage) { case MESA_SHADER_VERTEX: return "vertex"; @@ -69,7 +71,8 @@ const char * _mesa_shader_stage_to_string(unsigned stage) * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS) * for debug printouts and error messages. */ -const char * _mesa_shader_stage_to_abbrev(unsigned stage) +const char * +_mesa_shader_stage_to_abbrev(unsigned stage) { switch (stage) { case MESA_SHADER_VERTEX: return "VS"; @@ -83,7 +86,8 @@ const char * _mesa_shader_stage_to_abbrev(unsigned stage) unreachable("Unknown shader stage."); } -const char * gl_vert_attrib_name(gl_vert_attrib attrib) +const char * +gl_vert_attrib_name(gl_vert_attrib attrib) { static const char *names[] = { ENUM(VERT_ATTRIB_POS), @@ -124,7 +128,8 @@ const char * gl_vert_attrib_name(gl_vert_attrib attrib) return NAME(attrib); } -const char * gl_varying_slot_name(gl_varying_slot slot) +const char * +gl_varying_slot_name(gl_varying_slot slot) { static const char *names[] = { ENUM(VARYING_SLOT_POS), @@ -190,7 +195,8 @@ const char * gl_varying_slot_name(gl_varying_slot slot) return NAME(slot); } -const char * gl_system_value_name(gl_system_value sysval) +const char * +gl_system_value_name(gl_system_value sysval) { static const char *names[] = { ENUM(SYSTEM_VALUE_VERTEX_ID), @@ -216,7 +222,8 @@ const char * gl_system_value_name(gl_system_value sysval) return NAME(sysval); } -const char * glsl_interp_qualifier_name(enum glsl_interp_qualifier qual) +const char * +glsl_interp_qualifier_name(enum glsl_interp_qualifier qual) { static const char *names[] = { ENUM(INTERP_QUALIFIER_NONE), @@ -228,7 +235,8 @@ const char * glsl_interp_qualifier_name(enum glsl_interp_qualifier qual) return NAME(qual); } -const char * gl_frag_result_name(gl_frag_result result) +const char * +gl_frag_result_name(gl_frag_result result) { static const char *names[] = { ENUM(FRAG_RESULT_DEPTH), diff --git a/src/glsl/nir/shader_enums.h b/src/glsl/nir/shader_enums.h index c747464..efc0b0d 100644 --- a/src/glsl/nir/shader_enums.h +++ b/src/glsl/nir/shader_enums.h @@ -47,19 +47,19 @@ typedef enum MESA_SHADER_COMPUTE = 5, } gl_shader_stage; -const char * gl_shader_stage_name(gl_shader_stage stage); +const char *gl_shader_stage_name(gl_shader_stage stage); /** * Translate a gl_shader_stage to a short shader stage name for debug * printouts and error messages. */ -const char * _mesa_shader_stage_to_string(unsigned stage); +const char *_mesa_shader_stage_to_string(unsigned stage); /** * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS) * for debug printouts and error messages. */ -const char * _mesa_shader_stage_to_abbrev(unsigned stage); +const char *_mesa_shader_stage_to_abbrev(unsigned stage); #define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1) @@ -109,7 +109,7 @@ typedef enum VERT_ATTRIB_MAX = 33 } gl_vert_attrib; -const char * gl_vert_attrib_name(gl_vert_attrib attrib); +const char *gl_vert_attrib_name(gl_vert_attrib attrib); /** * Symbolic constats to help iterating over @@ -254,7 +254,7 @@ typedef enum #define VARYING_SLOT_PATCH0(VARYING_SLOT_MAX) #define VARYING_SLOT_TESS_MAX (VARYING_SLOT_PATCH0 + MAX_VARYING) -const char * gl_varying_slot_name(gl_varying_slot slot); +const char *gl_varying_slot_name(gl_varying_slot slot); /** * Bitflags for varying slots. @@ -465,7 +465,7 @@ typedef enum SYSTEM_VALUE_MAX /**< Number of values */ } gl_system_value; -const char * gl_system_value_name(gl_system_value sysval); +const char *gl_system_value_name(gl_system_value sysval); /** * The possible interpolation qualifiers tha
Mesa (master): glsl: allow duplicate layout-qualifier-names
Module: Mesa Branch: master Commit: c8b8c578d145f90794611602eb66fc7d3f1df033 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8b8c578d145f90794611602eb66fc7d3f1df033 Author: Timothy Arceri Date: Fri Jan 15 11:01:25 2016 +1100 glsl: allow duplicate layout-qualifier-names This is added by ARB_enhanced_layouts although it doesn't fit into any of the six main changes so we enable this independently. From the ARB_enhanced_layouts spec: "More than one layout qualifier may appear in a single declaration. Additionally, the same layout-qualifier-name can occur multiple times within a layout qualifier or across multiple layout qualifiers in the same declaration" Reviewed-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/ast_type.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 1f675b2..4e75016 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -157,7 +157,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, allowed_duplicates_mask.flags.i |= stream_layout_mask.flags.i; - if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) { + if (!state->has_enhanced_layouts() && + (this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) { _mesa_glsl_error(loc, state, "duplicate layout qualifiers used"); return false; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: update parser to allow duplicate default layout qualifiers
Module: Mesa Branch: master Commit: 564009986ff1485c467664542a9042e6ce4dcdfe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=564009986ff1485c467664542a9042e6ce4dcdfe Author: Timothy Arceri Date: Mon Jan 18 17:06:57 2016 +1100 glsl: update parser to allow duplicate default layout qualifiers In order to only create a single node for each default declaration we add a new boolean parameter to the in/out merge function to only create one once we reach the rightmost layout qualifier. From the ARB_shading_language_420pack spec: "More than one layout qualifier may appear in a single declaration. If the same layout-qualifier-name occurs in multiple layout qualifiers for the same declaration, the last one overrides the former ones." Acked-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/ast.h | 4 +-- src/glsl/ast_type.cpp | 18 -- src/glsl/glsl_parser.yy | 66 - 3 files changed, 73 insertions(+), 15 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index f8ab0b7..4651669 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -704,12 +704,12 @@ struct ast_type_qualifier { bool merge_out_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, const ast_type_qualifier &q, - ast_node* &node); + ast_node* &node, bool create_node); bool merge_in_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, const ast_type_qualifier &q, - ast_node* &node); + ast_node* &node, bool create_node); ast_subroutine_list *subroutine_list; }; diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index e59d1b2..32cb0a0 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -291,7 +291,7 @@ bool ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, const ast_type_qualifier &q, -ast_node* &node) +ast_node* &node, bool create_node) { void *mem_ctx = state; const bool r = this->merge_qualifier(loc, state, q); @@ -314,7 +314,9 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc, /* Allow future assigments of global out's stream id value */ this->flags.q.explicit_stream = 0; } else if (state->stage == MESA_SHADER_TESS_CTRL) { - node = new(mem_ctx) ast_tcs_output_layout(*loc); + if (create_node) { + node = new(mem_ctx) ast_tcs_output_layout(*loc); + } } else { _mesa_glsl_error(loc, state, "out layout qualifiers only valid in " "tessellation control or geometry shaders"); @@ -327,7 +329,7 @@ bool ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, const ast_type_qualifier &q, - ast_node* &node) + ast_node* &node, bool create_node) { void *mem_ctx = state; bool create_gs_ast = false; @@ -467,10 +469,12 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc, this->point_mode = q.point_mode; } - if (create_gs_ast) { - node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type); - } else if (create_cs_ast) { - node = new(mem_ctx) ast_cs_input_layout(*loc, q.local_size); + if (create_node) { + if (create_gs_ast) { + node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type); + } else if (create_cs_ast) { + node = new(mem_ctx) ast_cs_input_layout(*loc, q.local_size); + } } return true; diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 925cb82..6099aeb 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -2742,7 +2742,20 @@ member_declaration: ; layout_uniform_defaults: - layout_qualifier UNIFORM ';' + layout_qualifier layout_uniform_defaults + { + $$ = NULL; + if (!state->has_420pack_or_es31()) { + _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers"); + YYERROR; + } else { + if (!state->default_uniform_qualifier-> +merge_qualifier(& @1, state, $1)) { +YYERROR; + } + } + } + | layout_qualifier UNIFORM ';' { if (!state->default_uniform_qualifier->merge_qualifier(& @1, state, $1)) { YYERROR; @@ -2752,7 +2765,20 @@ layout_uniform_defaults: ; layout_buffer_defaults: - layout_qualifier BUFFER ';' + layout_qualifier layout_buffer_defaults + { + $$ = NULL; + if (!state->has_420pack_or_es31()) { + _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers"); +
Mesa (master): glsl: split layout_defaults into specific types
Module: Mesa Branch: master Commit: fd612e4547175d1350eac2d8374d01390de58acb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd612e4547175d1350eac2d8374d01390de58acb Author: Timothy Arceri Date: Mon Jan 18 16:09:06 2016 +1100 glsl: split layout_defaults into specific types This will allow merging of duplicate layout qualifiers as allowed by ARB_shading_language_420pack Reviewed-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/glsl_parser.yy | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 51796a6..462ca45 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -299,6 +299,10 @@ static bool match_layout_qualifier(const char *s1, const char *s2, %type for_init_statement %type for_rest_statement %type layout_defaults +%type layout_uniform_defaults +%type layout_buffer_defaults +%type layout_in_defaults +%type layout_out_defaults %right THEN ELSE %% @@ -2737,7 +2741,7 @@ member_declaration: } ; -layout_defaults: +layout_uniform_defaults: layout_qualifier UNIFORM ';' { if (!state->default_uniform_qualifier->merge_qualifier(& @1, state, $1)) { @@ -2745,8 +2749,10 @@ layout_defaults: } $$ = NULL; } + ; - | layout_qualifier BUFFER ';' +layout_buffer_defaults: + layout_qualifier BUFFER ';' { if (!state->default_shader_storage_qualifier->merge_qualifier(& @1, state, $1)) { YYERROR; @@ -2764,16 +2770,20 @@ layout_defaults: $$ = NULL; } + ; - | layout_qualifier IN_TOK ';' +layout_in_defaults: + layout_qualifier IN_TOK ';' { $$ = NULL; if (!state->in_qualifier->merge_in_qualifier(& @1, state, $1, $$)) { YYERROR; } } + ; - | layout_qualifier OUT_TOK ';' +layout_out_defaults: + layout_qualifier OUT_TOK ';' { $$ = NULL; if (state->stage == MESA_SHADER_GEOMETRY) { @@ -2804,3 +2814,11 @@ layout_defaults: "tessellation control or geometry shaders"); } } + ; + +layout_defaults: + layout_uniform_defaults + | layout_buffer_defaults + | layout_in_defaults + | layout_out_defaults + ; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: allow multiple layout qualifiers for a single declaration
Module: Mesa Branch: master Commit: 6a660a5f5dad02a6594ea905c511ba3cae6862a5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a660a5f5dad02a6594ea905c511ba3cae6862a5 Author: Timothy Arceri Date: Fri Jan 15 12:43:10 2016 +1100 glsl: allow multiple layout qualifiers for a single declaration From the ARB_shading_language_420pack spec: "More than one layout qualifier may appear in a single declaration. If the same layout-qualifier-name occurs in multiple layout qualifiers for the same declaration, the last one overrides the former ones." The parser was already failing correctly when the extension is not available but testing for duplicates within a single layout qualifier was still causing this to fail when available as both cases share the same function for merging. Here we add a parameter to differentiate between the two uses and apply it to the duplicate test. Acked-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/ast.h | 3 ++- src/glsl/ast_type.cpp | 12 +--- src/glsl/glsl_parser.yy | 32 +--- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 4651669..03df6c0 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -699,7 +699,8 @@ struct ast_type_qualifier { bool merge_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, - const ast_type_qualifier &q); +const ast_type_qualifier &q, +bool is_single_layout_merge); bool merge_out_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 32cb0a0..cf494d9 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -114,10 +114,16 @@ ast_type_qualifier::interpolation_string() const return NULL; } +/** + * This function merges both duplicate identifies within a single layout and + * multiple layout qualifiers on a single variable declaration. The + * is_single_layout_merge param is used differentiate between the two. + */ bool ast_type_qualifier::merge_qualifier(YYLTYPE *loc, _mesa_glsl_parse_state *state, - const ast_type_qualifier &q) +const ast_type_qualifier &q, +bool is_single_layout_merge) { ast_type_qualifier ubo_mat_mask; ubo_mat_mask.flags.i = 0; @@ -157,7 +163,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, allowed_duplicates_mask.flags.i |= stream_layout_mask.flags.i; - if (!state->has_enhanced_layouts() && + if (is_single_layout_merge && !state->has_enhanced_layouts() && (this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) { _mesa_glsl_error(loc, state, "duplicate layout qualifiers used"); @@ -294,7 +300,7 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc, ast_node* &node, bool create_node) { void *mem_ctx = state; - const bool r = this->merge_qualifier(loc, state, q); + const bool r = this->merge_qualifier(loc, state, q, false); if (state->stage == MESA_SHADER_GEOMETRY) { if (q.flags.q.prim_type) { diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 6099aeb..1019875 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -957,7 +957,7 @@ parameter_qualifier: "or precise"); $$ = $1; - $$.merge_qualifier(&@1, state, $2); + $$.merge_qualifier(&@1, state, $2, false); } | precision_qualifier parameter_qualifier { @@ -974,7 +974,7 @@ parameter_qualifier: | memory_qualifier parameter_qualifier { $$ = $1; - $$.merge_qualifier(&@1, state, $2); + $$.merge_qualifier(&@1, state, $2, false); } parameter_direction_qualifier: @@ -1153,7 +1153,7 @@ layout_qualifier_id_list: | layout_qualifier_id_list ',' layout_qualifier_id { $$ = $1; - if (!$$.merge_qualifier(& @3, state, $3)) { + if (!$$.merge_qualifier(& @3, state, $3, true)) { YYERROR; } } @@ -1762,7 +1762,7 @@ type_qualifier: } $$ = $1; - $$.merge_qualifier(&@1, state, $2); + $$.merge_qualifier(&@1, state, $2, false); } | layout_qualifier type_qualifier { @@ -1779,12 +1779,12 @@ type_qualifier: _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers"); $$ = $1; - $$.merge_qualifier(&@1, state, $2); + $$.merge_qualifier(&@1, state, $2, false); } | subroutine_qualifier type_qualifier { $$ = $1; - $$.merge_qualifier(&@1, state, $2); + $$.merge_qualifier(&@1, state, $2, false); } | auxiliary_storage_qualifier type_qualifier { @@ -1800,7 +1800,7 @@ type_qualifier:
Mesa (master): glsl: move default layout qualifier rules out of the parser
Module: Mesa Branch: master Commit: a0a93470e3413d5a5890d988462bb898362bd68f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0a93470e3413d5a5890d988462bb898362bd68f Author: Timothy Arceri Date: Mon Jan 18 19:13:03 2016 +1100 glsl: move default layout qualifier rules out of the parser Acked-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/ast_type.cpp | 22 +- src/glsl/glsl_parser.yy | 29 ++--- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 4e75016..e59d1b2 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -296,8 +296,28 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc, void *mem_ctx = state; const bool r = this->merge_qualifier(loc, state, q); - if (state->stage == MESA_SHADER_TESS_CTRL) { + if (state->stage == MESA_SHADER_GEOMETRY) { + if (q.flags.q.prim_type) { + /* Make sure this is a valid output primitive type. */ + switch (q.prim_type) { + case GL_POINTS: + case GL_LINE_STRIP: + case GL_TRIANGLE_STRIP: +break; + default: +_mesa_glsl_error(loc, state, "invalid geometry shader output " + "primitive type"); +break; + } + } + + /* Allow future assigments of global out's stream id value */ + this->flags.q.explicit_stream = 0; + } else if (state->stage == MESA_SHADER_TESS_CTRL) { node = new(mem_ctx) ast_tcs_output_layout(*loc); + } else { + _mesa_glsl_error(loc, state, "out layout qualifiers only valid in " + "tessellation control or geometry shaders"); } return r; diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 462ca45..925cb82 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -2786,33 +2786,8 @@ layout_out_defaults: layout_qualifier OUT_TOK ';' { $$ = NULL; - if (state->stage == MESA_SHADER_GEOMETRY) { - if ($1.flags.q.prim_type) { -/* Make sure this is a valid output primitive type. */ -switch ($1.prim_type) { -case GL_POINTS: -case GL_LINE_STRIP: -case GL_TRIANGLE_STRIP: - break; -default: - _mesa_glsl_error(&@1, state, "invalid geometry shader output " -"primitive type"); - break; -} - } - if (!state->out_qualifier->merge_qualifier(& @1, state, $1)) -YYERROR; - - /* Allow future assigments of global out's stream id value */ - state->out_qualifier->flags.q.explicit_stream = 0; - } else if (state->stage == MESA_SHADER_TESS_CTRL) { - if (!state->out_qualifier->merge_out_qualifier(& @1, state, $1, $$)) -YYERROR; - } else { - _mesa_glsl_error(& @1, state, - "out layout qualifiers only valid in " - "tessellation control or geometry shaders"); - } + if (!state->out_qualifier->merge_out_qualifier(& @1, state, $1, $$)) + YYERROR; } ; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: remove link validation that should be done elsewhere
Module: Mesa Branch: master Commit: 11fc7ad62ef9aa4c9df71e4e001582f8017e7a81 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=11fc7ad62ef9aa4c9df71e4e001582f8017e7a81 Author: Timothy Arceri Date: Wed Jan 6 12:40:12 2016 +1100 mesa: remove link validation that should be done elsewhere Even if re-linking fails rendering shouldn't fail as the previous succesfully linked program will still be available. It also shouldn't be possible to have an unlinked program as part of the current rendering state. This fixes a subtest in: ES31-CTS.sepshaderobjs.StateInteraction This change should improve performance on CPU limited benchmarks as noted in commit d6c6b186cf308f. >From Section 7.3 (Program Objects) of the OpenGL 4.5 spec: "If a program object that is active for any shader stage is re-linked unsuccessfully, the link status will be set to FALSE, but any existing executables and associated state will remain part of the current rendering state until a subsequent call to UseProgram, UseProgramStages, or BindProgramPipeline removes them from use. If such a program is attached to any program pipeline object, the existing executables and associated state will remain part of the program pipeline object until a subsequent call to UseProgramStages removes them from use. An unsuccessfully linked program may not be made part of the current rendering state by UseProgram or added to program pipeline objects by UseProgramStages until it is successfully re-linked." "void UseProgram(uint program); ... An INVALID_OPERATION error is generated if program has not been linked, or was last linked unsuccessfully. The current rendering state is not modified." V2: apply the rule to both core and compat. Cc: Tapani Pälli Cc: Brian Paul Reviewed-by: Ian Romanick --- src/mesa/main/context.c | 63 +++-- 1 file changed, 3 insertions(+), 60 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index be983d4..f3fd01f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1930,31 +1930,6 @@ _mesa_check_blend_func_error(struct gl_context *ctx) return GL_TRUE; } -static bool -shader_linked_or_absent(struct gl_context *ctx, -const struct gl_shader_program *shProg, -bool *shader_present, const char *where) -{ - if (shProg) { - *shader_present = true; - - if (!shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(shader not linked)", where); - return false; - } -#if 0 /* not normally enabled */ - { - char errMsg[100]; - if (!_mesa_validate_shader_program(ctx, shProg, errMsg)) { -_mesa_warning(ctx, "Shader program %u is invalid: %s", - shProg->Name, errMsg); - } - } -#endif - } - - return true; -} /** * Prior to drawing anything with glBegin, glDrawArrays, etc. this function @@ -1967,54 +1942,22 @@ shader_linked_or_absent(struct gl_context *ctx, GLboolean _mesa_valid_to_render(struct gl_context *ctx, const char *where) { - unsigned i; - /* This depends on having up to date derived state (shaders) */ if (ctx->NewState) _mesa_update_state(ctx); - if (ctx->API == API_OPENGL_CORE || ctx->API == API_OPENGLES2) { - bool from_glsl_shader[MESA_SHADER_COMPUTE] = { false }; - - for (i = 0; i < MESA_SHADER_COMPUTE; i++) { - if (!shader_linked_or_absent(ctx, ctx->_Shader->CurrentProgram[i], - &from_glsl_shader[i], where)) -return GL_FALSE; - } - - /* In OpenGL Core Profile and OpenGL ES 2.0 / 3.0, there are no assembly - * shaders. Don't check state related to those. - */ - } else { - bool has_vertex_shader = false; - bool has_fragment_shader = false; - - /* In OpenGL Compatibility Profile, there is only vertex shader and - * fragment shader. We take this path also for API_OPENGLES because - * optimizing that path would make the other (more common) paths - * slightly slower. - */ - if (!shader_linked_or_absent(ctx, - ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX], - &has_vertex_shader, where)) - return GL_FALSE; - - if (!shader_linked_or_absent(ctx, - ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT], - &has_fragment_shader, where)) - return GL_FALSE; - + if (ctx->API == API_OPENGL_COMPAT) { /* Any shader stages that are not supplied by the GLSL shader and have * assembly shaders enabled must now be validated. */ - if (!has_vertex_shader + if (!ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX] && ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
Mesa (master): glsl: Don't abbreviate tessellation shader stage names.
Module: Mesa Branch: master Commit: 4fc018576b577ed9ab3b713ba21727479a0e8b23 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fc018576b577ed9ab3b713ba21727479a0e8b23 Author: Kenneth Graunke Date: Thu Dec 31 16:28:08 2015 -0800 glsl: Don't abbreviate tessellation shader stage names. I have a patch that writes shaders as .shader_test files, and it uses this function to create the headers (i.e. [vertex shader]). [tess ctrl shader] isn't a valid shader_runner header - it's spelled out as [tessellation control shader]. There's no real reason to abbreviate it, so spell it out. v2: Rebase on Rob's patches to move the code. Signed-off-by: Kenneth Graunke Reviewed-by: Iago Toral Quiroga --- src/glsl/nir/shader_enums.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glsl/nir/shader_enums.c b/src/glsl/nir/shader_enums.c index 16b20db..942d152 100644 --- a/src/glsl/nir/shader_enums.c +++ b/src/glsl/nir/shader_enums.c @@ -60,8 +60,8 @@ _mesa_shader_stage_to_string(unsigned stage) case MESA_SHADER_FRAGMENT: return "fragment"; case MESA_SHADER_GEOMETRY: return "geometry"; case MESA_SHADER_COMPUTE: return "compute"; - case MESA_SHADER_TESS_CTRL: return "tess ctrl"; - case MESA_SHADER_TESS_EVAL: return "tess eval"; + case MESA_SHADER_TESS_CTRL: return "tessellation control"; + case MESA_SHADER_TESS_EVAL: return "tessellation evaluation"; } unreachable("Unknown shader stage."); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Implement compute sampler state atom.
Module: Mesa Branch: master Commit: f8ac314cc2353f439e6a917db4e3aeaf47e2093e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8ac314cc2353f439e6a917db4e3aeaf47e2093e Author: Francisco Jerez Date: Sat Jan 16 15:11:03 2016 -0800 i965: Implement compute sampler state atom. Fixes a number of GLES31 CTS failures and hangs on various hardware: ES31-CTS.texture_gather.plain-gather-depth-2d ES31-CTS.texture_gather.plain-gather-depth-2darray ES31-CTS.texture_gather.plain-gather-depth-cube ES31-CTS.texture_gather.offset-gather-depth-2d ES31-CTS.texture_gather.offset-gather-depth-2darray ES31-CTS.layout_binding.sampler2D_layout_binding_texture_ComputeShader ES31-CTS.layout_binding.sampler2DArray_layout_binding_texture_ComputeShader ES31-CTS.explicit_uniform_location.uniform-loc-types-samplers ES31-CTS.compute_shader.resources-texture Some of them were actually passing by luck on some generations even though we weren't uploading sampler state tables explicitly for the compute stage, most likely because they relied on the cached sampler state left from previous rendering to be close enough. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92589 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93312 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93325 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93407 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93725 Reported-by: Marta Lofstedt Reviewed-by: Marta Lofstedt Reviewed-by: Jordan Justen --- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/i965/brw_sampler_state.c | 20 src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index b80db00..2a29dfe 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1264,7 +1264,7 @@ struct brw_context int num_atoms[BRW_NUM_PIPELINES]; const struct brw_tracked_state render_atoms[76]; - const struct brw_tracked_state compute_atoms[10]; + const struct brw_tracked_state compute_atoms[11]; /* If (INTEL_DEBUG & DEBUG_BATCH) */ struct { diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index 24798a5..c20a028 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -693,3 +693,23 @@ const struct brw_tracked_state brw_tes_samplers = { }, .emit = brw_upload_tes_samplers, }; + +static void +brw_upload_cs_samplers(struct brw_context *brw) +{ + /* BRW_NEW_COMPUTE_PROGRAM */ + struct gl_program *cs = (struct gl_program *) brw->compute_program; + if (!cs) + return; + + brw_upload_sampler_state_table(brw, cs, &brw->cs.base); +} + +const struct brw_tracked_state brw_cs_samplers = { + .dirty = { + .mesa = _NEW_TEXTURE, + .brw = BRW_NEW_BATCH | + BRW_NEW_COMPUTE_PROGRAM, + }, + .emit = brw_upload_cs_samplers, +}; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 7d61b7c..f44ccd6 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -75,6 +75,7 @@ extern const struct brw_tracked_state brw_vs_samplers; extern const struct brw_tracked_state brw_tcs_samplers; extern const struct brw_tracked_state brw_tes_samplers; extern const struct brw_tracked_state brw_gs_samplers; +extern const struct brw_tracked_state brw_cs_samplers; extern const struct brw_tracked_state brw_vs_ubo_surfaces; extern const struct brw_tracked_state brw_vs_abo_surfaces; extern const struct brw_tracked_state brw_vs_image_surfaces; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 876e130..ee75ca8 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -282,6 +282,7 @@ static const struct brw_tracked_state *gen7_compute_atoms[] = &brw_cs_abo_surfaces, &brw_texture_surfaces, &brw_cs_work_groups_surface, + &brw_cs_samplers, &brw_cs_state, }; @@ -396,6 +397,7 @@ static const struct brw_tracked_state *gen8_compute_atoms[] = &brw_cs_abo_surfaces, &brw_texture_surfaces, &brw_cs_work_groups_surface, + &brw_cs_samplers, &brw_cs_state, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965: Trigger CS state reemission when new sampler state is uploaded.
Module: Mesa Branch: master Commit: 9e4c8acd7814186673c4945c7045124ebbcd125f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9e4c8acd7814186673c4945c7045124ebbcd125f Author: Francisco Jerez Date: Sat Jan 16 15:05:51 2016 -0800 i965: Trigger CS state reemission when new sampler state is uploaded. This reuses the NEW_SAMPLER_STATE_TABLE state bit (currently only used on pre-Gen7 hardware) to signal that the sampler state tables have changed in order to make sure that the GPGPU interface descriptor is updated. Reviewed-by: Marta Lofstedt Reviewed-by: Jordan Justen --- src/mesa/drivers/dri/i965/brw_sampler_state.c | 2 +- src/mesa/drivers/dri/i965/gen7_cs_state.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index d181468..24798a5 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -582,7 +582,7 @@ brw_upload_sampler_state_table(struct brw_context *brw, batch_offset_for_sampler_state += size_in_bytes; } - if (brw->gen >= 7) { + if (brw->gen >= 7 && stage_state->stage != MESA_SHADER_COMPUTE) { /* Emit a 3DSTATE_SAMPLER_STATE_POINTERS_XS packet. */ gen7_emit_sampler_state_pointers_xs(brw, stage_state); } else { diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c index a025bb9..6d6988c 100644 --- a/src/mesa/drivers/dri/i965/gen7_cs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c @@ -196,6 +196,7 @@ const struct brw_tracked_state brw_cs_state = { .brw = BRW_NEW_BATCH | BRW_NEW_CS_PROG_DATA | BRW_NEW_PUSH_CONSTANT_ALLOCATION | + BRW_NEW_SAMPLER_STATE_TABLE | BRW_NEW_SURFACES, }, .emit = brw_upload_cs_state ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): llvmpipe: turn depth clears into full depth/ stencil clears for d24x8 formats
Module: Mesa Branch: master Commit: b21973acaa67fb7945a12fc266e20281d7eb5375 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b21973acaa67fb7945a12fc266e20281d7eb5375 Author: Roland Scheidegger Date: Mon Jan 18 04:29:22 2016 +0100 llvmpipe: turn depth clears into full depth/stencil clears for d24x8 formats If we have a d24x8 format, there is no stencil. Therefore, we can always clear these bits too, which means this will be some kind of memset rather than read-modify-write. This is good for some 7% increase or so in gears with huge window size - seems to have a bigger effect if things aren't in caches. Of course, any real app won't spend nearly as much time comparatively in clearing depth buffer in the first place, so the speedup will be much lower. Reviewed-by: Jose Fonseca --- src/gallium/drivers/llvmpipe/lp_setup.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index e8c3e7c..34d3c81 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -476,27 +476,30 @@ lp_setup_try_clear_zs(struct lp_setup_context *setup, uint64_t zsvalue = 0; uint32_t zmask32; uint8_t smask8; + enum pipe_format format = setup->fb.zsbuf->format; LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state); zmask32 = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0; smask8 = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0; - zsvalue = util_pack64_z_stencil(setup->fb.zsbuf->format, - depth, - stencil); + zsvalue = util_pack64_z_stencil(format, depth, stencil); - /* -* XXX: should make a full mask here for things like D24X8, -* otherwise we'll do a read-modify-write clear later which -* should be unnecessary. -*/ - zsmask = util_pack64_mask_z_stencil(setup->fb.zsbuf->format, - zmask32, - smask8); + zsmask = util_pack64_mask_z_stencil(format, zmask32, smask8); zsvalue &= zsmask; + if (format == PIPE_FORMAT_Z24X8_UNORM || + format == PIPE_FORMAT_X8Z24_UNORM) { + /* + * Make full mask if there's "X" bits so we can do full + * clear (without rmw). + */ + uint32_t zsmask_full = 0; + zsmask_full = util_pack_mask_z_stencil(format, ~0, ~0); + zsmask |= ~zsmask_full; + } + if (setup->state == SETUP_ACTIVE) { struct lp_scene *scene = setup->scene; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: add missing explicit_image_format flag to has_layout( )
Module: Mesa Branch: master Commit: 0a6a05c8eaeda570891fdece2d86e8e0b0e4d56f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a6a05c8eaeda570891fdece2d86e8e0b0e4d56f Author: Timothy Arceri Date: Wed Jan 20 10:49:54 2016 +1100 glsl: add missing explicit_image_format flag to has_layout() Fixes piglit regression after fixes to duplicate layout rules. Previously catching multiple layouts was relying on the code meant to catch duplicates within a single layout(...), this change triggers the rules for multiple layouts. Cc: Mark Janes Reviewed-by: Francisco Jerez --- src/glsl/ast_type.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index cf494d9..e0e3311 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -74,6 +74,7 @@ ast_type_qualifier::has_layout() const || this->flags.q.row_major || this->flags.q.packed || this->flags.q.explicit_location + || this->flags.q.explicit_image_format || this->flags.q.explicit_index || this->flags.q.explicit_binding || this->flags.q.explicit_offset ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glsl: move uniform calculation to link_uniforms
Module: Mesa Branch: master Commit: 4475d8f9169195baefa893b9b147fe20414cda7c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4475d8f9169195baefa893b9b147fe20414cda7c Author: Tapani Pälli Date: Fri Jan 15 13:11:20 2016 +0200 glsl: move uniform calculation to link_uniforms Patch moves uniform calculation to happen during link_uniforms, this is possible with help of UniformRemapTable that has all the reserved locations. Location assignment for implicit locations is changed so that we utilize also the 'holes' that explicit uniform location assignment might have left in UniformRemapTable, this makes it possible to fit more uniforms as previously we were lazy here and wasting space. Fixes following CTS tests: ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array v2: code cleanups, increment NumUniformRemapTable correctly, fix find_empty_block to work properly and add some more comments. Signed-off-by: Tapani Pälli Reviewed-by: Marta Lofstedt --- src/glsl/link_uniforms.cpp | 87 -- src/glsl/linker.cpp| 19 -- src/glsl/linker.h | 3 +- 3 files changed, 85 insertions(+), 24 deletions(-) diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 33b2d4c..76ee70d 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -1057,9 +1057,40 @@ assign_hidden_uniform_slot_id(const char *name, unsigned hidden_id, uniform_size->map->put(hidden_uniform_start + hidden_id, name); } +/** + * Search UniformRemapTable for empty block big enough to hold given uniform. + * TODO Optimize this algorithm later if it turns out to be a major bottleneck. + */ +static int +find_empty_block(struct gl_shader_program *prog, + struct gl_uniform_storage *uniform) +{ + const unsigned entries = MAX2(1, uniform->array_elements); + for (unsigned i = 0, j; i < prog->NumUniformRemapTable; i++) { + /* We found empty space in UniformRemapTable. */ + if (prog->UniformRemapTable[i] == NULL) { + for (j = i; j < entries && j < prog->NumUniformRemapTable; j++) { +if (prog->UniformRemapTable[j] != NULL) { + /* Entries do not fit in this space, continue searching +* after this location. +*/ + i = j + 1; + break; +} + } + /* Entries fit, we can return this location. */ + if (i != j + 1) { +return i; + } + } + } + return -1; +} + void link_assign_uniform_locations(struct gl_shader_program *prog, - unsigned int boolean_true) + unsigned int boolean_true, + unsigned int max_locations) { ralloc_free(prog->UniformStorage); prog->UniformStorage = NULL; @@ -1150,6 +1181,20 @@ link_assign_uniform_locations(struct gl_shader_program *prog, parcel_out_uniform_storage parcel(prog->UniformHash, uniforms, data); + unsigned total_entries = 0; + + /* Calculate amount of 'holes' left after explicit locations were +* reserved from UniformRemapTable. +*/ + unsigned empty_locs = 0; + for (unsigned i = 0; i < prog->NumUniformRemapTable; i++) + if (prog->UniformRemapTable[i] == NULL) + empty_locs++; + + /* Add all the reserved explicit locations - empty locations in remap table. */ + if (prog->NumUniformRemapTable) + total_entries = (prog->NumUniformRemapTable - 1) - empty_locs; + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { if (prog->_LinkedShaders[i] == NULL) continue; @@ -1213,21 +1258,43 @@ link_assign_uniform_locations(struct gl_shader_program *prog, /* how many new entries for this uniform? */ const unsigned entries = MAX2(1, uniforms[i].array_elements); - /* resize remap table to fit new entries */ - prog->UniformRemapTable = - reralloc(prog, - prog->UniformRemapTable, - gl_uniform_storage *, - prog->NumUniformRemapTable + entries); + /* Find UniformRemapTable for empty blocks where we can fit this uniform. */ + int chosen_location = -1; + + if (empty_locs) + chosen_location = find_empty_block(prog, &uniforms[i]); + + if (chosen_location != -1) { + empty_locs -= entries; + } else { + chosen_location = prog->NumUniformRemapTable; + + /* Add new entries to the total amount of entries. */ + total_entries += entries; + + /* resize remap table to fit new entries */ + prog->UniformRemapTable = +reralloc(prog, + prog->UniformRemapTable, + gl_uniform_storage *, + prog->NumUniformRemapTable + entries); + prog->NumUniformRemapTable += entries; + }