From 25efd787cfd842c0b0b900f35399e44a2e01ea39 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 30 Aug 2018 15:02:25 -0500 Subject: compiler: Move double_inputs to gl_program::DualSlotInputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we had two field in shader_info: double_inputs_read and double_inputs. Presumably, the one was for all double inputs that are read and the other is all that exist. However, because nir_gather_info regenerates these two values, there is a possibility, if a variable gets deleted, that the value of double_inputs could change over time. This is a problem because double_inputs is used to remap the input locations to a two-slot-per-dvec3/4 scheme for i965. If that mapping were to change between glsl_to_nir and back-end state setup, we would fall over when trying to map the NIR outputs back onto the GL location space. This commit changes the way slot re-mapping works. Instead of the double_inputs field in shader_info, it adds a DualSlotInputs bitfield to gl_program. By having it in gl_program, we more easily guarantee that NIR passes won't touch it after it's been set. It also makes more sense to put it in a GL data structure since it's really a mapping from GL slots to back-end and/or NIR slots and not really a NIR shader thing. Tested-by: Alejandro Piñeiro (ARB_gl_spirv tests) Reviewed-by: Alejandro Piñeiro Reviewed-by: Timothy Arceri --- src/compiler/nir/nir.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/compiler/nir/nir.h') diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 169fa1fa20d..b9393702097 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3039,8 +3039,10 @@ bool nir_opt_conditional_discard(nir_shader *shader); void nir_sweep(nir_shader *shader); -void nir_remap_attributes(nir_shader *shader, - const nir_shader_compiler_options *options); +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 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); gl_system_value nir_system_value_from_intrinsic(nir_intrinsic_op intrin); -- cgit v1.2.3