diff options
author | Jason Ekstrand <[email protected]> | 2018-08-31 07:35:17 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-09-06 16:07:50 -0500 |
commit | 44ec31cd75f679b32afb03c3c9c46762e57ce506 (patch) | |
tree | c9ff90ef7289fb26513724d0663fcdb91193f34a /src/compiler | |
parent | 0909a57b631f2b200a7422907df6302a72930252 (diff) |
nir: Drop the vs_inputs_dual_locations option
It was very inconsistently handled; the only things that made use of it
were glsl_to_nir, glspirv, and nir_gather_info. In particular,
nir_lower_io completely ignored it so anyone using nir_lower_io on
64-bit vertex attributes was going to be in for a shock. Also, as of
the previous commit, it's set by every driver that supports 64-bit
vertex attributes. There's no longer any reason to have it be an option
so let's just delete it.
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 7 | ||||
-rw-r--r-- | src/compiler/nir/nir.c | 32 | ||||
-rw-r--r-- | src/compiler/nir/nir.h | 9 | ||||
-rw-r--r-- | src/compiler/nir/nir_gather_info.c | 20 |
4 files changed, 21 insertions, 47 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index d22f4a58dd4..dc6ffa3599d 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -149,11 +149,8 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, * two locations. For instance, if we have in the IR code a dvec3 attr0 in * location 0 and vec4 attr1 in location 1, in NIR attr0 will use * locations/slots 0 and 1, and attr1 will use location/slot 2 */ - if (shader->info.stage == MESA_SHADER_VERTEX) { - sh->Program->DualSlotInputs = nir_get_dual_slot_attributes(shader); - if (options->vs_inputs_dual_locations) - nir_remap_dual_slot_attributes(shader, sh->Program->DualSlotInputs); - } + if (shader->info.stage == MESA_SHADER_VERTEX) + nir_remap_dual_slot_attributes(shader, &sh->Program->DualSlotInputs); shader->info.name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name); if (shader_prog->Label) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 0d8a554bd20..a6240c11f2d 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1854,34 +1854,32 @@ nir_system_value_from_intrinsic(nir_intrinsic_op intrin) } } -uint64_t -nir_get_dual_slot_attributes(nir_shader *shader) +/* OpenGL utility method that remaps the location attributes if they are + * doubles. Not needed for vulkan due the differences on the input location + * count for doubles on vulkan vs OpenGL + * + * The bitfield returned in dual_slot is one bit for each double input slot in + * the original OpenGL single-slot input numbering. The mapping from old + * locations to new locations is as follows: + * + * new_loc = loc + _mesa_bitcount(dual_slot & BITFIELD64_MASK(loc)) + */ +void +nir_remap_dual_slot_attributes(nir_shader *shader, uint64_t *dual_slot) { assert(shader->info.stage == MESA_SHADER_VERTEX); - uint64_t dual_slot = 0; + *dual_slot = 0; nir_foreach_variable(var, &shader->inputs) { if (glsl_type_is_dual_slot(glsl_without_array(var->type))) { unsigned slots = glsl_count_attribute_slots(var->type, true); - dual_slot |= BITFIELD64_MASK(slots) << var->data.location; + *dual_slot |= BITFIELD64_MASK(slots) << var->data.location; } } - return dual_slot; -} - -/* OpenGL utility method that remaps the location attributes if they are - * doubles. Not needed for vulkan due the differences on the input location - * count for doubles on vulkan vs OpenGL - */ -void -nir_remap_dual_slot_attributes(nir_shader *shader, uint64_t dual_slot) -{ - assert(shader->info.stage == MESA_SHADER_VERTEX); - nir_foreach_variable(var, &shader->inputs) { var->data.location += - _mesa_bitcount_64(dual_slot & BITFIELD64_MASK(var->data.location)); + _mesa_bitcount_64(*dual_slot & BITFIELD64_MASK(var->data.location)); } } diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index b9393702097..bf4bd916d27 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2119,12 +2119,6 @@ typedef struct nir_shader_compiler_options { */ bool use_interpolated_input_intrinsics; - /** - * Do vertex shader double inputs use two locations? The Vulkan spec - * requires two locations to be used, OpenGL allows a single location. - */ - bool vs_inputs_dual_locations; - unsigned max_unroll_iterations; } nir_shader_compiler_options; @@ -3039,9 +3033,8 @@ bool nir_opt_conditional_discard(nir_shader *shader); void nir_sweep(nir_shader *shader); -uint64_t nir_get_dual_slot_attributes(nir_shader *shader); void nir_remap_dual_slot_attributes(nir_shader *shader, - uint64_t dual_slot); + uint64_t *dual_slot_inputs); uint64_t nir_get_single_slot_attribs_mask(uint64_t attribs, uint64_t dual_slot); nir_intrinsic_op nir_intrinsic_from_system_value(gl_system_value val); diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index de18c9bd78e..30f0bc721d4 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -88,21 +88,15 @@ static void mark_whole_variable(nir_shader *shader, nir_variable *var, bool is_output_read) { const struct glsl_type *type = var->type; - bool is_vertex_input = false; if (nir_is_per_vertex_io(var, shader->info.stage)) { assert(glsl_type_is_array(type)); type = glsl_get_array_element(type); } - if (!shader->options->vs_inputs_dual_locations && - shader->info.stage == MESA_SHADER_VERTEX && - var->data.mode == nir_var_shader_in) - is_vertex_input = true; - const unsigned slots = var->data.compact ? DIV_ROUND_UP(glsl_get_length(type), 4) - : glsl_count_attribute_slots(type, is_vertex_input); + : glsl_count_attribute_slots(type, false); set_io_mask(shader, var, 0, slots, is_output_read); } @@ -165,13 +159,7 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var, return false; } - bool is_vertex_input = false; - if (!shader->options->vs_inputs_dual_locations && - shader->info.stage == MESA_SHADER_VERTEX && - var->data.mode == nir_var_shader_in) - is_vertex_input = true; - - unsigned offset = get_io_offset(deref, is_vertex_input); + unsigned offset = get_io_offset(deref, false); if (offset == -1) return false; @@ -187,10 +175,8 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var, } /* double element width for double types that takes two slots */ - if (!is_vertex_input && - glsl_type_is_dual_slot(glsl_without_array(type))) { + if (glsl_type_is_dual_slot(glsl_without_array(type))) elem_width *= 2; - } if (offset >= num_elems * elem_width * mat_cols) { /* Constant index outside the bounds of the matrix/array. This could |