summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-05-18 22:17:51 +0200
committerVincent Lejeune <vljn@ovi.com>2013-05-20 20:23:09 +0200
commit32c9cbb38fc03d028500b1904ff4d66a07e9471e (patch)
tree91df91c0fba757215df36351c8011d431ba24ad8
parent9c2943601e088c6fb3e871f8d706ded8f68493bc (diff)
r600g/llvm: Fix cubearray textureSize
-rw-r--r--src/gallium/drivers/r600/r600_llvm.c15
-rw-r--r--src/gallium/drivers/r600/r600_shader.c1
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 26d40a24f77..3d2c492773c 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -22,6 +22,7 @@
#define CONSTANT_BUFFER_0_ADDR_SPACE 8
#define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER)
+#define CONSTANT_TXQ_BUFFER (CONSTANT_BUFFER_0_ADDR_SPACE + R600_TXQ_CONST_BUFFER)
static LLVMValueRef llvm_load_const_buffer(
struct lp_build_tgsi_context * bld_base,
@@ -471,6 +472,20 @@ static void llvm_emit_tex(
emit_data->output[0] = build_intrinsic(gallivm->builder,
action->intr_name,
emit_data->dst_type, args, c, LLVMReadNoneAttribute);
+
+ if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_TXQ &&
+ ((emit_data->inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY ||
+ emit_data->inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE_ARRAY)))
+ if (emit_data->inst->Dst[0].Register.WriteMask & 4) {
+ LLVMValueRef offset = lp_build_const_int32(bld_base->base.gallivm, 0);
+ LLVMValueRef ZLayer = LLVMBuildExtractElement(gallivm->builder,
+ llvm_load_const_buffer(bld_base, offset, CONSTANT_TXQ_BUFFER),
+ lp_build_const_int32(gallivm, 0), "");
+
+ emit_data->output[0] = LLVMBuildInsertElement(gallivm->builder, emit_data->output[0], ZLayer, lp_build_const_int32(gallivm, 2), "");
+ struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
+ ctx->has_txq_cube_array_z_comp = true;
+ }
}
static void emit_cndlt(
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 4d74db08650..81ed3cec4b7 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1169,6 +1169,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
radeon_llvm_ctx.clip_vertex = ctx.cv_output;
radeon_llvm_ctx.alpha_to_one = key.alpha_to_one;
mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
+ ctx.shader->has_txq_cube_array_z_comp = radeon_llvm_ctx.has_txq_cube_array_z_comp;
if (r600_llvm_compile(mod, rscreen->family, ctx.bc, &use_kill, dump)) {
radeon_llvm_dispose(&radeon_llvm_ctx);
diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h
index 1d4bd456670..14a8c347006 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -66,6 +66,7 @@ struct radeon_llvm_context {
unsigned color_buffer_count;
unsigned fs_color_all;
unsigned alpha_to_one;
+ unsigned has_txq_cube_array_z_comp;
/*=== Front end configuration ===*/