On 18.04.2017 07:19, Dave Airlie wrote:
On 18 April 2017 at 15:07, Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> wrote:
On Tue, Apr 18, 2017 at 5:57 AM, Dave Airlie <airl...@gmail.com> wrote:
From: Dave Airlie <airl...@redhat.com>

In practice this will probably just drop draw id in a few places.

Signed-off-by: Dave Airlie <airl...@redhat.com>
---
 src/amd/common/ac_nir_to_llvm.c  | 42 +++++++++++++++++++++++++++-----------
 src/amd/common/ac_shader_info.c  | 26 ++++++++++++++++++++++++
 src/amd/common/ac_shader_info.h  |  5 +++++
 src/amd/vulkan/radv_cmd_buffer.c | 44 +++++++++++++++++++++++++++++++---------
 4 files changed, 95 insertions(+), 22 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index dbb3b67..7161caf 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -614,10 +614,15 @@ static void create_function(struct nir_to_llvm_context 
*ctx)
                break;
        case MESA_SHADER_VERTEX:
                if (!ctx->is_gs_copy_shader) {
-                       arg_types[arg_idx++] = const_array(ctx->v16i8, 16); /* 
vertex buffers */
-                       arg_types[arg_idx++] = ctx->i32; // base vertex
-                       arg_types[arg_idx++] = ctx->i32; // start instance
-                       arg_types[arg_idx++] = ctx->i32; // draw index
+                       if (ctx->shader_info->info.vs.has_vertex_buffers)
+                               arg_types[arg_idx++] = const_array(ctx->v16i8, 
16); /* vertex buffers */
+                       if 
(ctx->shader_info->info.vs.needs_base_vertex_start_instance ||
+                           ctx->shader_info->info.vs.needs_draw_id) {
+                               arg_types[arg_idx++] = ctx->i32; // base vertex
+                               arg_types[arg_idx++] = ctx->i32; // start 
instance

I'm not sure we can avoid having the CP write these two to some user
SGPRs for indirect draws? If so, we cannot skip them.

Yeah I did wonder this, it's a pity but you are probably right, I'll
rework this patch
to always allocate those two.

You *may* be able to instruct the CP to write those values somewhere into the void, i.e. to a non-existing register. It's not something that's documented anywhere as a thing that one could or should do, but I once did some experiments where this at least didn't hang the GPU, so...

Cheers,
Nicolai
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to