diff options
author | Kenneth Graunke <[email protected]> | 2017-01-07 13:58:42 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-01-07 15:15:08 -0800 |
commit | 957ec00243ec8ccc0a94f68106d079b54685fe5a (patch) | |
tree | c9663602e6c1449819a140755911e4f8c276a4ca /src | |
parent | 42699e12711668a142b7acf11c168cf4301c1295 (diff) |
Revert recent GLSL slot counting fiasco.
I apparently broke mark_whole_variable in ir_set_program_inouts.
It was passing a type that wasn't var->type, so the wrapper didn't
work out. It's all broken, revert it and start over.
Fixes all kinds of things on other drivers.
Revert "glsl: Make is_fixed_function_array actually check for varyings."
This reverts commit 42699e12711668a142b7acf11c168cf4301c1295.
Revert "glsl: Mark whole variable used for ClipDistance and TessLevel*."
This reverts commit 5c580e64cc206ab160e1767c42e4d6c81f67da4d.
Revert "glsl: Override the # of varying slots for ClipDistance and TessLevel*."
This reverts commit 8b5749f65ac434961308ccb579fb8a816e4f29d5.
Revert "glsl: Create and use a new ir_variable::count_attribute_slots() wrapper."
This reverts commit 6aa5cb34d03765b7be8611aa516bc201bd337f73.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/ir.cpp | 25 | ||||
-rw-r--r-- | src/compiler/glsl/ir.h | 2 | ||||
-rw-r--r-- | src/compiler/glsl/ir_set_program_inouts.cpp | 39 | ||||
-rw-r--r-- | src/compiler/glsl/link_varyings.cpp | 4 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 6 |
5 files changed, 14 insertions, 62 deletions
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp index 69f1f1a7e5d..8e4b382ebd3 100644 --- a/src/compiler/glsl/ir.cpp +++ b/src/compiler/glsl/ir.cpp @@ -1618,31 +1618,6 @@ ir_variable::get_extension_warning() const ? NULL : warn_extension_table[this->data.warn_extension_index]; } -unsigned -ir_variable::count_attribute_slots(bool is_vertex_stage) const -{ - /* GLSL contains several built-in arrays that control fixed-function - * hardware, and are somewhat special. Clip distances and tessellation - * factors are exposed as float[] arrays, but typically are packed - * tightly. We want to expose these as taking a single varying slot - * and let drivers handle laying them out appropriately. - * - * Skip this override if the arrays were lowered to vectors. - */ - if (type->without_array()->is_scalar() && - (data.mode == ir_var_shader_in || data.mode == ir_var_shader_out) && - (data.location == VARYING_SLOT_CLIP_DIST0 || - data.location == VARYING_SLOT_CULL_DIST0 || - data.location == VARYING_SLOT_TESS_LEVEL_OUTER || - data.location == VARYING_SLOT_TESS_LEVEL_INNER)) { - return type->length / 4; - } - - /* For normal variables, simply consult the type. */ - bool is_vs_input = is_vertex_stage && this->data.mode == ir_var_shader_in; - return this->type->count_attribute_slots(is_vs_input); -} - ir_function_signature::ir_function_signature(const glsl_type *return_type, builtin_available_predicate b) : ir_instruction(ir_type_function_signature), diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 1cd6a60c081..a11dccd2e9b 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -553,8 +553,6 @@ public: return this->u.max_ifc_array_access; } - unsigned count_attribute_slots(bool is_vertex_stage) const; - inline unsigned get_num_state_slots() const { assert(!this->is_interface_instance() diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp index 354b533bdcd..90b06b9f417 100644 --- a/src/compiler/glsl/ir_set_program_inouts.cpp +++ b/src/compiler/glsl/ir_set_program_inouts.cpp @@ -149,7 +149,7 @@ void ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var) { const glsl_type *type = var->type; - + bool is_vertex_input = false; if (this->shader_stage == MESA_SHADER_GEOMETRY && var->data.mode == ir_var_shader_in && type->is_array()) { type = type->fields.array; @@ -173,8 +173,11 @@ ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var) type = type->fields.array; } - mark(this->prog, var, 0, - var->count_attribute_slots(this->shader_stage == MESA_SHADER_VERTEX), + if (this->shader_stage == MESA_SHADER_VERTEX && + var->data.mode == ir_var_shader_in) + is_vertex_input = true; + + mark(this->prog, var, 0, type->count_attribute_slots(is_vertex_input), this->shader_stage); } @@ -330,27 +333,6 @@ is_multiple_vertices(gl_shader_stage stage, ir_variable *var) return false; } -/** - * Return true if \p var is a GLSL built-in array that controls fixed-function - * aspects of the pipeline. These have to be used as a whole. - */ -static bool -is_fixed_function_array(ir_variable *var) -{ - if (var->data.mode != ir_var_shader_in && - var->data.mode != ir_var_shader_out) - return false; - - switch (var->data.location) { - case VARYING_SLOT_TESS_LEVEL_OUTER: - case VARYING_SLOT_TESS_LEVEL_INNER: - case VARYING_SLOT_CLIP_DIST0: - return true; - default: - return false; - } -} - ir_visitor_status ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) { @@ -383,12 +365,9 @@ ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) } else if (ir_dereference_variable * const deref_var = ir->array->as_dereference_variable()) { /* ir => foo[i], where foo is a variable. */ - if (is_multiple_vertices(this->shader_stage, deref_var->var) || - is_fixed_function_array(deref_var->var)) { - /* In the first case, foo is a geometry or tessellation shader input, - * so i is the vertex, and we're accessing the entire input. In the - * second case, foo is a GLSL built-in array that controls - * fixed-function hardware, which is consumed as a whole. + if (is_multiple_vertices(this->shader_stage, deref_var->var)) { + /* foo is a geometry or tessellation shader input, so i is + * the vertex, and we're accessing the entire input. */ mark_whole_variable(deref_var->var); /* We've now taken care of foo, but i might contain a subexpression diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index c7ff6d041fb..e1a29b03549 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -2301,7 +2301,7 @@ check_against_output_limit(struct gl_context *ctx, var->data.mode == ir_var_shader_out && var_counts_against_varying_limit(producer->Stage, var)) { /* outputs for fragment shader can't be doubles */ - output_vectors += var->count_attribute_slots(false); + output_vectors += var->type->count_attribute_slots(false); } } @@ -2345,7 +2345,7 @@ check_against_input_limit(struct gl_context *ctx, var->data.mode == ir_var_shader_in && var_counts_against_varying_limit(consumer->Stage, var)) { /* vertex inputs aren't varying counted */ - input_vectors += var->count_attribute_slots(false); + input_vectors += var->type->count_attribute_slots(false); } } diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index ef2b01e17d7..d4a484fdea0 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2670,7 +2670,7 @@ assign_attribute_or_color_locations(void *mem_ctx, return false; } - const unsigned slots = var->count_attribute_slots(target_index == MESA_SHADER_VERTEX); + const unsigned slots = var->type->count_attribute_slots(target_index == MESA_SHADER_VERTEX); /* If the variable is not a built-in and has a location statically * assigned in the shader (presumably via a layout qualifier), make sure @@ -2782,7 +2782,7 @@ assign_attribute_or_color_locations(void *mem_ctx, */ for (unsigned i = 0; i < assigned_attr; i++) { unsigned assigned_slots = - assigned[i]->count_attribute_slots(false); + assigned[i]->type->count_attribute_slots(false); unsigned assig_attr = assigned[i]->data.location - generic_base; unsigned assigned_use_mask = (1 << assigned_slots) - 1; @@ -3233,7 +3233,7 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog) ir_variable *var = node->as_variable(); if (var && var->data.mode == ir_var_shader_out) /* since there are no double fs outputs - pass false */ - fragment_outputs += var->count_attribute_slots(false); + fragment_outputs += var->type->count_attribute_slots(false); } } } |