From 69189417ae16772a59074f766c49826577b6888b Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 15 Jul 2019 15:48:31 +0200 Subject: [PATCH] zink/spirv: support vec1 coordinates Acked-by: Jordan Justen --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index c3d84ec8643..51d1424109d 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -1165,12 +1165,17 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex) if (proj) { SpvId constituents[coord_components + 1]; - SpvId float_type = spirv_builder_type_float(&ctx->builder, 32); - for (uint32_t i = 0; i < coord_components; ++i) - constituents[i] = spirv_builder_emit_composite_extract(&ctx->builder, - float_type, - coord, - &i, 1); + if (coord_components == 1) + constituents[0] = coord; + else { + assert(coord_components > 1); + SpvId float_type = spirv_builder_type_float(&ctx->builder, 32); + for (uint32_t i = 0; i < coord_components; ++i) + constituents[i] = spirv_builder_emit_composite_extract(&ctx->builder, + float_type, + coord, + &i, 1); + } constituents[coord_components++] = proj; -- 2.30.2