[Mesa-dev] [PATCH 23/31] radv/ac: handle case of swizzle with single components in get_alu_src.

Dave Airlie airlied at gmail.com
Fri Jan 20 03:03:19 UTC 2017


From: Dave Airlie <airlied at redhat.com>

This gets hit with some geom shaders.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/common/ac_nir_to_llvm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 92e2b44..97e352b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -844,7 +844,10 @@ static LLVMValueRef get_alu_src(struct nir_to_llvm_context *ctx,
 		    LLVMConstInt(ctx->i32, src.swizzle[2], false),
 		    LLVMConstInt(ctx->i32, src.swizzle[3], false)};
 
-		if (src_components > 1 && num_components == 1) {
+		if (src_components == 1 && num_components == 1) {
+			value = LLVMBuildExtractElement(ctx->builder, value,
+			                                masks[0], "");
+		} else if (src_components > 1 && num_components == 1) {
 			value = LLVMBuildExtractElement(ctx->builder, value,
 			                                masks[0], "");
 		} else if (src_components == 1 && num_components > 1) {
-- 
2.9.3



More information about the mesa-dev mailing list