summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2015-06-22 13:59:25 +1000
committerDave Airlie <[email protected]>2015-06-23 15:54:07 +1000
commit1a71fbe28ca0525b618f6fb9d7354f3a6589af2f (patch)
tree9b1ba492c69abd08667fde724ca9d77846ada0b9 /src/gallium/auxiliary/draw
parent40d225803ecfa805b4dea4ee0ebd04df00ca8827 (diff)
draw/gallivm: add invocation ID support for llvmpipe.
This extends the draw code to add support for invocations. Reviewed-by: Roland Scheidegger <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h3
3 files changed, 8 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 755e52793a8..a1564f93292 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -391,7 +391,8 @@ llvm_gs_run(struct draw_geometry_shader *shader,
(struct vertex_header*)input,
input_primitives,
shader->draw->instance_id,
- shader->llvm_prim_ids);
+ shader->llvm_prim_ids,
+ shader->invocation_id);
return ret;
}
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 9629a8a3e42..90a31bc6ac0 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -2069,7 +2069,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
struct gallivm_state *gallivm = variant->gallivm;
LLVMContextRef context = gallivm->context;
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
- LLVMTypeRef arg_types[6];
+ LLVMTypeRef arg_types[7];
LLVMTypeRef func_type;
LLVMValueRef variant_func;
LLVMValueRef context_ptr;
@@ -2105,6 +2105,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
arg_types[4] = int32_type; /* instance_id */
arg_types[5] = LLVMPointerType(
LLVMVectorType(int32_type, vector_length), 0); /* prim_id_ptr */
+ arg_types[6] = int32_type;
func_type = LLVMFunctionType(int32_type, arg_types, Elements(arg_types), 0);
@@ -2125,6 +2126,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
num_prims = LLVMGetParam(variant_func, 3);
system_values.instance_id = LLVMGetParam(variant_func, 4);
prim_id_ptr = LLVMGetParam(variant_func, 5);
+ system_values.invocation_id = LLVMGetParam(variant_func, 6);
lp_build_name(context_ptr, "context");
lp_build_name(input_array, "input");
@@ -2132,6 +2134,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm,
lp_build_name(num_prims, "num_prims");
lp_build_name(system_values.instance_id, "instance_id");
lp_build_name(prim_id_ptr, "prim_id_ptr");
+ lp_build_name(system_values.invocation_id, "invocation_id");
variant->context_ptr = context_ptr;
variant->io_ptr = io_ptr;
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index 9565fc68af9..d48ed721593 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -298,7 +298,8 @@ typedef int
struct vertex_header *output,
unsigned num_prims,
unsigned instance_id,
- int *prim_ids);
+ int *prim_ids,
+ unsigned invocation_id);
struct draw_llvm_variant_key
{