summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorOlivier Galibert <[email protected]>2012-06-19 20:51:21 +0200
committerBrian Paul <[email protected]>2012-06-19 14:40:44 -0600
commitc790c2c7598dea2d5a5b0bfbe47732956e1e89a6 (patch)
tree76c69bbe525b74b870551c0863c10787583973de /src/gallium/auxiliary/gallivm
parent46931ecf480e1d231bb6c2236d91b5390f2465ac (diff)
llvmpipe: Add vertex id support.
Signed-off-by: Olivier Galibert <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h13
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c11
2 files changed, 19 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index c4e690c43c6..4423bc5dedd 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -146,6 +146,15 @@ struct lp_tgsi_info
};
/**
+ * Reference to system values.
+ */
+struct lp_bld_tgsi_system_values {
+ LLVMValueRef instance_id;
+ LLVMValueRef vertex_id;
+};
+
+
+/**
* Sampler code generation interface.
*
* Although texture sampling is a requirement for TGSI translation, it is
@@ -205,7 +214,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef consts_ptr,
- LLVMValueRef instance_id,
+ const struct lp_bld_tgsi_system_values *system_values,
const LLVMValueRef *pos,
const LLVMValueRef (*inputs)[4],
LLVMValueRef (*outputs)[4],
@@ -381,7 +390,7 @@ struct lp_build_tgsi_soa_context
*/
LLVMValueRef inputs_array;
- LLVMValueRef instance_id;
+ struct lp_bld_tgsi_system_values system_values;
/** bitmask indicating which register files are accessed indirectly */
unsigned indirect_files;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 26be9021fdf..d9faaf20273 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -795,7 +795,12 @@ emit_fetch_system_value(
switch (info->system_value_semantic_name[reg->Register.Index]) {
case TGSI_SEMANTIC_INSTANCEID:
- res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->instance_id);
+ res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.instance_id);
+ atype = TGSI_TYPE_UNSIGNED;
+ break;
+
+ case TGSI_SEMANTIC_VERTEXID:
+ res = bld->system_values.vertex_id;
atype = TGSI_TYPE_UNSIGNED;
break;
@@ -1995,7 +2000,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef consts_ptr,
- LLVMValueRef instance_id,
+ const struct lp_bld_tgsi_system_values *system_values,
const LLVMValueRef *pos,
const LLVMValueRef (*inputs)[TGSI_NUM_CHANNELS],
LLVMValueRef (*outputs)[TGSI_NUM_CHANNELS],
@@ -2070,7 +2075,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
lp_exec_mask_init(&bld.exec_mask, &bld.bld_base.base);
- bld.instance_id = instance_id;
+ bld.system_values = *system_values;
lp_build_tgsi_llvm(&bld.bld_base, tokens);