From a2bee6df5fd23b80dfadb21953584601935d1167 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 4 Mar 2021 13:57:40 +1000 Subject: draw/vs: pass the view index to the vertex shader Reviewed-by: Roland Scheidegger Acked-By: Mike Blumenkrantz Part-of: --- src/gallium/auxiliary/draw/draw_llvm.c | 4 +++- src/gallium/auxiliary/draw/draw_llvm.h | 2 +- src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 3 ++- 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: */ -- cgit v1.2.3