diff options
author | Kenneth Graunke <[email protected]> | 2015-03-09 01:58:56 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-03-12 08:29:48 -0700 |
commit | a5c4e7fcf52c048c02e4ee14413a574b4ff3695e (patch) | |
tree | 2ecd6eee746a37e2739c5bec58f0ddca4ffd4604 /src | |
parent | 34628a838aa96643be02cd23eb55af50025dd422 (diff) |
i965/fs: Refactor fs_visitor::nir_setup_inputs().
No functional change. In preparation for supporting vertex shaders,
this adds a switch statement on shader stage (since vertex attributes
and fragment shader varyings will need different handling). It also
renames "varying" to "input", to be more general.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 7b83a35a940..9a767455106 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -199,18 +199,27 @@ fs_visitor::nir_setup_inputs(nir_shader *shader) struct hash_entry *entry; hash_table_foreach(shader->inputs, entry) { nir_variable *var = (nir_variable *) entry->data; - fs_reg varying = offset(nir_inputs, var->data.driver_location); + fs_reg input = offset(nir_inputs, var->data.driver_location); fs_reg reg; - if (var->data.location == VARYING_SLOT_POS) { - reg = *emit_fragcoord_interpolation(var->data.pixel_center_integer, - var->data.origin_upper_left); - emit_percomp(MOV(varying, reg), 0xF); - } else { - emit_general_interpolation(varying, var->name, var->type, - (glsl_interp_qualifier) var->data.interpolation, - var->data.location, var->data.centroid, - var->data.sample); + switch (stage) { + case MESA_SHADER_VERTEX: + case MESA_SHADER_GEOMETRY: + case MESA_SHADER_COMPUTE: + unreachable("fs_visitor not used for these stages yet."); + break; + case MESA_SHADER_FRAGMENT: + if (var->data.location == VARYING_SLOT_POS) { + reg = *emit_fragcoord_interpolation(var->data.pixel_center_integer, + var->data.origin_upper_left); + emit_percomp(MOV(input, reg), 0xF); + } else { + emit_general_interpolation(input, var->name, var->type, + (glsl_interp_qualifier) var->data.interpolation, + var->data.location, var->data.centroid, + var->data.sample); + } + break; } } } |