From c790c2c7598dea2d5a5b0bfbe47732956e1e89a6 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Tue, 19 Jun 2012 20:51:21 +0200 Subject: llvmpipe: Add vertex id support. Signed-off-by: Olivier Galibert Reviewed-by: Brian Paul --- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 13 +++++++++++-- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 11 ++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src/gallium/auxiliary/gallivm') 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 @@ -145,6 +145,15 @@ struct lp_tgsi_info const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS]; }; +/** + * Reference to system values. + */ +struct lp_bld_tgsi_system_values { + LLVMValueRef instance_id; + LLVMValueRef vertex_id; +}; + + /** * Sampler code generation interface. * @@ -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); -- cgit v1.2.3