Mesa (master): radeon/llvm: Export prepare_cube_coords helper to driver.

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Dec 6 19:35:56 UTC 2012


Module: Mesa
Branch: master
Commit: aac21547292cf0540e14679fc9bef260eb5092a3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aac21547292cf0540e14679fc9bef260eb5092a3

Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Dec  3 12:45:41 2012 +0100

radeon/llvm: Export prepare_cube_coords helper to driver.

To be used by radeonsi.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

---

 src/gallium/drivers/radeon/radeon_llvm.h           |    3 +++
 .../drivers/radeon/radeon_setup_tgsi_llvm.c        |   18 ++++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h
index 61975c4..61f3772 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -152,6 +152,9 @@ static inline LLVMValueRef bitcast(
 }
 
 
+void radeon_llvm_emit_prepare_cube_coords(struct lp_build_tgsi_context * bld_base,
+                                          LLVMValueRef *arg, unsigned target);
+
 void radeon_llvm_context_init(struct radeon_llvm_context * ctx);
 
 void radeon_llvm_dispose(struct radeon_llvm_context * ctx);
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 9cb0e9a..db25c89 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -514,11 +514,12 @@ static void kil_emit(
 }
 
 
-static void emit_prepare_cube_coords(
+void radeon_llvm_emit_prepare_cube_coords(
 		struct lp_build_tgsi_context * bld_base,
-		struct lp_build_emit_data * emit_data)
+		LLVMValueRef *arg,
+                unsigned target)
 {
-	boolean shadowcube = (emit_data->inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE);
+	boolean shadowcube = (target == TGSI_TEXTURE_SHADOWCUBE);
 	struct gallivm_state * gallivm = bld_base->base.gallivm;
 	LLVMBuilderRef builder = gallivm->builder;
 	LLVMTypeRef type = bld_base->base.elem_type;
@@ -528,7 +529,7 @@ static void emit_prepare_cube_coords(
 
 	LLVMValueRef v = build_intrinsic(builder, "llvm.AMDGPU.cube",
 			LLVMVectorType(type, 4),
-			&emit_data->args[0],1, LLVMReadNoneAttribute);
+			arg, 1, LLVMReadNoneAttribute);
 
 	/* save src.w for shadow cube */
 	cnt = shadowcube ? 3 : 4;
@@ -559,8 +560,7 @@ static void emit_prepare_cube_coords(
 	coords[1] = coords[0];
 	coords[0] = coords[3];
 
-	emit_data->args[0] = lp_build_gather_values(bld_base->base.gallivm,
-						coords, 4);
+	*arg = lp_build_gather_values(bld_base->base.gallivm, coords, 4);
 }
 
 static void txd_fetch_args(
@@ -609,7 +609,8 @@ static void txp_fetch_args(
 	if ((inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
 	     inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE) &&
 	    inst->Instruction.Opcode != TGSI_OPCODE_TXQ) {
-		emit_prepare_cube_coords(bld_base, emit_data);
+		radeon_llvm_emit_prepare_cube_coords(bld_base, &emit_data->args[0],
+                                                     inst->Texture.Texture);
 	}
 }
 
@@ -641,7 +642,8 @@ static void tex_fetch_args(
 	if ((inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
 	     inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE) &&
 	    inst->Instruction.Opcode != TGSI_OPCODE_TXQ) {
-		emit_prepare_cube_coords(bld_base, emit_data);
+		radeon_llvm_emit_prepare_cube_coords(bld_base, &emit_data->args[0],
+                                                     inst->Texture.Texture);
 	}
 }
 




More information about the mesa-commit mailing list