summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2014-05-06 18:12:40 +0200
committerMarek Olšák <marek.olsak@amd.com>2014-06-02 12:58:22 +0200
commit5b06fc376df8ac4e63603d1768cd0dccc9e4b491 (patch)
treed92f803572ba65f97a7b7e7226d43d77b99168b1 /src/gallium
parent501fee2511a0a84303319a5e3deacf4959da5b08 (diff)
radeonsi: implement SAMPLEID fragment shader input
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 5f4f1bf0f4a..d021caaa6c4 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -529,6 +529,18 @@ static void declare_input_fs(
}
}
+static LLVMValueRef get_sample_id(struct radeon_llvm_context *radeon_bld)
+{
+ struct gallivm_state *gallivm = &radeon_bld->gallivm;
+ LLVMValueRef value = LLVMGetParam(radeon_bld->main_fn,
+ SI_PARAM_ANCILLARY);
+ value = LLVMBuildLShr(gallivm->builder, value,
+ lp_build_const_int32(gallivm, 8), "");
+ value = LLVMBuildAnd(gallivm->builder, value,
+ lp_build_const_int32(gallivm, 0xf), "");
+ return value;
+}
+
static LLVMValueRef load_const(LLVMBuilderRef builder, LLVMValueRef resource,
LLVMValueRef offset, LLVMTypeRef return_type)
{
@@ -558,6 +570,10 @@ static void declare_system_value(
si_shader_ctx->param_vertex_id);
break;
+ case TGSI_SEMANTIC_SAMPLEID:
+ value = get_sample_id(radeon_bld);
+ break;
+
default:
assert(!"unknown system value");
return;
@@ -2186,7 +2202,7 @@ static void create_function(struct si_shader_context *si_shader_ctx)
params[SI_PARAM_POS_Z_FLOAT] = f32;
params[SI_PARAM_POS_W_FLOAT] = f32;
params[SI_PARAM_FRONT_FACE] = f32;
- params[SI_PARAM_ANCILLARY] = f32;
+ params[SI_PARAM_ANCILLARY] = i32;
params[SI_PARAM_SAMPLE_COVERAGE] = f32;
params[SI_PARAM_POS_FIXED_PT] = f32;
num_params = SI_PARAM_POS_FIXED_PT+1;