diff options
author | Iago Toral Quiroga <[email protected]> | 2019-10-29 08:32:44 +0100 |
---|---|---|
committer | Iago Toral <[email protected]> | 2019-10-31 08:46:35 +0000 |
commit | e7e501efceca73b92727e9d295eda63d21e76afe (patch) | |
tree | 90e4c392cc3124820d0ec639bba3c53e9e583bac /src/broadcom | |
parent | d688e4166ca9c49a980a78ce91846fd7072df8fd (diff) |
v3d: rename vertex shader key (num)_fs_inputs fields
Until now this made sense because we always paired vertex shaders
with fragment shaders, but as soon as we implement geometry and
tessellation shaders that will no longer be the case, so rename
this to (num_)used_outputs.
v2: Use 'used_outputs' instead of ns_outputs, which is more explicit (Eric).
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/broadcom')
-rw-r--r-- | src/broadcom/common/v3d_limits.h | 1 | ||||
-rw-r--r-- | src/broadcom/compiler/v3d_compiler.h | 4 | ||||
-rw-r--r-- | src/broadcom/compiler/v3d_nir_lower_io.c | 10 | ||||
-rw-r--r-- | src/broadcom/compiler/vir.c | 6 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/broadcom/common/v3d_limits.h b/src/broadcom/common/v3d_limits.h index 77684762203..d65edddab74 100644 --- a/src/broadcom/common/v3d_limits.h +++ b/src/broadcom/common/v3d_limits.h @@ -31,6 +31,7 @@ #define V3D_MAX_FS_INPUTS 64 #define V3D_MAX_VS_INPUTS 64 +#define V3D_MAX_ANY_STAGE_INPUTS MAX2(V3D_MAX_VS_INPUTS, V3D_MAX_FS_INPUTS) /* Not specifically a hardware limit, just coordination between compiler and * driver. diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index fbb4b64a365..e2a4665ed42 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -374,8 +374,8 @@ struct v3d_fs_key { struct v3d_vs_key { struct v3d_key base; - struct v3d_varying_slot fs_inputs[V3D_MAX_FS_INPUTS]; - uint8_t num_fs_inputs; + struct v3d_varying_slot used_outputs[V3D_MAX_ANY_STAGE_INPUTS]; + uint8_t num_used_outputs; bool is_coord; bool per_vertex_point_size; diff --git a/src/broadcom/compiler/v3d_nir_lower_io.c b/src/broadcom/compiler/v3d_nir_lower_io.c index 2a68efb7b6b..ee9b29d0f2d 100644 --- a/src/broadcom/compiler/v3d_nir_lower_io.c +++ b/src/broadcom/compiler/v3d_nir_lower_io.c @@ -45,7 +45,7 @@ struct v3d_nir_lower_io_state { int psiz_vpm_offset; int varyings_vpm_offset; - BITSET_WORD varyings_stored[BITSET_WORDS(V3D_MAX_FS_INPUTS)]; + BITSET_WORD varyings_stored[BITSET_WORDS(V3D_MAX_ANY_STAGE_INPUTS)]; nir_ssa_def *pos[4]; }; @@ -91,8 +91,8 @@ v3d_varying_slot_vpm_offset(struct v3d_compile *c, nir_variable *var, int chan) { int component = var->data.location_frac + chan; - for (int i = 0; i < c->vs_key->num_fs_inputs; i++) { - struct v3d_varying_slot slot = c->vs_key->fs_inputs[i]; + for (int i = 0; i < c->vs_key->num_used_outputs; i++) { + struct v3d_varying_slot slot = c->vs_key->used_outputs[i]; if (v3d_slot_get_slot(slot) == var->data.location && v3d_slot_get_component(slot) == component) { @@ -255,7 +255,7 @@ v3d_nir_setup_vpm_layout(struct v3d_compile *c, state->varyings_vpm_offset = vpm_offset; - c->vpm_output_size = vpm_offset + c->vs_key->num_fs_inputs; + c->vpm_output_size = vpm_offset + c->vs_key->num_used_outputs; } static void @@ -306,7 +306,7 @@ v3d_nir_emit_ff_vpm_outputs(struct v3d_compile *c, nir_builder *b, * This should be undefined behavior, but glsl-routing seems to rely * on it. */ - for (int i = 0; i < c->vs_key->num_fs_inputs; i++) { + for (int i = 0; i < c->vs_key->num_used_outputs; i++) { if (!BITSET_TEST(state->varyings_stored, i)) { v3d_nir_store_output(b, state->varyings_vpm_offset + i, nir_imm_int(b, 0)); diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index da4234042ea..12009002f9b 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -749,9 +749,9 @@ v3d_nir_lower_vs_early(struct v3d_compile *c) NIR_PASS_V(c->s, nir_lower_io_to_scalar_early, nir_var_shader_in | nir_var_shader_out); uint64_t used_outputs[4] = {0}; - for (int i = 0; i < c->vs_key->num_fs_inputs; i++) { - int slot = v3d_slot_get_slot(c->vs_key->fs_inputs[i]); - int comp = v3d_slot_get_component(c->vs_key->fs_inputs[i]); + for (int i = 0; i < c->vs_key->num_used_outputs; i++) { + int slot = v3d_slot_get_slot(c->vs_key->used_outputs[i]); + int comp = v3d_slot_get_component(c->vs_key->used_outputs[i]); used_outputs[comp] |= 1ull << slot; } NIR_PASS_V(c->s, nir_remove_unused_io_vars, |