radv/gfx10: determine the number of vertices per primitive for TES
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 5 Sep 2019 10:19:22 +0000 (12:19 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 6 Sep 2019 15:36:49 +0000 (17:36 +0200)
This doesn't fix anything known but it's correct now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c

index 0c13860fe281000cda00f7ccdb43905f884b093b..1b77bd70eec227b1c6ba2d1641820b1bf4281c33 100644 (file)
@@ -3125,7 +3125,6 @@ static void
 handle_ngg_outputs_post(struct radv_shader_context *ctx)
 {
        LLVMBuilderRef builder = ctx->ac.builder;
-       unsigned num_vertices = 3;
        LLVMValueRef tmp;
 
        assert((ctx->stage == MESA_SHADER_VERTEX ||
@@ -3143,6 +3142,22 @@ handle_ngg_outputs_post(struct radv_shader_context *ctx)
                ac_unpack_param(&ctx->ac, ctx->gs_vtx_offset[2], 0, 16),
        };
 
+       /* Determine the number of vertices per primitive. */
+       unsigned num_vertices;
+
+       if (ctx->stage == MESA_SHADER_VERTEX) {
+               num_vertices = 3; /* TODO: optimize for points & lines */
+       } else {
+               assert(ctx->stage == MESA_SHADER_TESS_EVAL);
+
+               if (ctx->shader->info.tess.point_mode)
+                       num_vertices = 1;
+               else if (ctx->shader->info.tess.primitive_mode == GL_ISOLINES)
+                       num_vertices = 2;
+               else
+                       num_vertices = 3;
+       }
+
        /* TODO: streamout */
 
        /* Copy Primitive IDs from GS threads to the LDS address corresponding