summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-03-04 13:57:40 +1000
committerMarge Bot <eric+marge@anholt.net>2021-03-12 05:05:51 +0000
commita2bee6df5fd23b80dfadb21953584601935d1167 (patch)
tree0fddb75e80338d96a600d599ed7f2142bca838ca
parenta417843a3c48b951b84b9b9b4bda893b1976d5b2 (diff)
draw/vs: pass the view index to the vertex shader
Reviewed-by: Roland Scheidegger <sroland@vmware.com> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9399>
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 19b0d4c5f6b..ca7d04b197f 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1891,7 +1891,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
struct gallivm_state *gallivm = variant->gallivm;
LLVMContextRef context = gallivm->context;
LLVMTypeRef int32_type = LLVMInt32TypeInContext(context);
- LLVMTypeRef arg_types[12];
+ LLVMTypeRef arg_types[13];
unsigned num_arg_types = ARRAY_SIZE(arg_types);
LLVMTypeRef func_type;
LLVMValueRef context_ptr;
@@ -1958,6 +1958,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
arg_types[i++] = int32_type; /* start_instance */
arg_types[i++] = LLVMPointerType(int32_type, 0); /* fetch_elts */
arg_types[i++] = int32_type; /* draw_id */
+ arg_types[i++] = int32_type; /* view_id */
func_type = LLVMFunctionType(LLVMInt8TypeInContext(context),
arg_types, num_arg_types, 0);
@@ -1995,6 +1996,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
system_values.base_instance = LLVMGetParam(variant_func, 9);
fetch_elts = LLVMGetParam(variant_func, 10);
system_values.draw_id = LLVMGetParam(variant_func, 11);
+ system_values.view_index = LLVMGetParam(variant_func, 12);
lp_build_name(context_ptr, "context");
lp_build_name(io_ptr, "io");
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index c75179cb957..f2d3ef83b06 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -437,7 +437,7 @@ typedef boolean
unsigned vertex_id_offset,
unsigned start_instance,
const unsigned *fetch_elts,
- unsigned draw_id);
+ unsigned draw_id, unsigned view_id);
typedef int
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index c4b79ea0e24..cca0bcc627c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -631,7 +631,8 @@ llvm_pipeline_generic(struct draw_pt_middle_end *middle,
draw->instance_id,
vid_base,
draw->start_instance,
- elts, draw->pt.user.drawid);
+ elts, draw->pt.user.drawid,
+ draw->pt.user.viewid);
/* Finished with fetch and vs:
*/