When NIR was first created, we were a bit lazy about numbers of components. The rule was that a source couldn't consume more components than the thing it was reading from. However, this leads to a lot of confusion because you now have a thing sourcing from a vec4 but only reading two of the components.
The solution to this is to disallow that case and require that the number of components always match. The one exception is ALU instructions because they're designed to naturally swizzle things around like mad. We already require this restriction for phi instructions. This series adds it for intrinsics, texture instructions, and deref indirects. Cc: Kenneth Graunke <kenn...@whitecape.org> Cc: Connor Abbott <cwabbo...@gmaial.com> Jason Ekstrand (8): nir/intrinsics: Make load_barycentric_input take a 2-component coor nir/copy_prop: Respect the source's number of components nir/spirv: Restrict the number of channels in texture coordinates nir/lower_tex: Use tex_instr_dest_size for txs destinations anv/apply_dynamic_offsets: Only use one channel for computed offsets i965/fs: Use num_components from the SSA def in image intrinsics nir: Make image_size a variable-width intrinsic nir/validate: Validate that bit sizes and components always match src/compiler/glsl/glsl_to_nir.cpp | 7 +- src/compiler/nir/nir_intrinsics.h | 6 +- src/compiler/nir/nir_lower_tex.c | 3 +- src/compiler/nir/nir_opt_copy_propagate.c | 129 +++++++++++++++++------ src/compiler/nir/nir_validate.c | 101 +++++++++++------- src/compiler/spirv/spirv_to_nir.c | 21 ++-- src/intel/vulkan/anv_nir_apply_dynamic_offsets.c | 3 +- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 3 +- 8 files changed, 185 insertions(+), 88 deletions(-) -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev