radv: Add export_prim_id to the shader variant info.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 1 Jul 2019 22:41:47 +0000 (00:41 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 4 Jul 2019 10:52:26 +0000 (10:52 +0000)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index 1f86d3a..a7e949a 100644 (file)
@@ -3973,6 +3973,7 @@ ac_fill_shader_info(struct radv_shader_variant_info *shader_info, struct nir_sha
                 shader_info->tes.ccw = nir->info.tess.ccw;
                 shader_info->tes.point_mode = nir->info.tess.point_mode;
                 shader_info->tes.as_es = options->key.tes.as_es;
+                shader_info->tes.export_prim_id = options->key.tes.export_prim_id;
                 break;
         case MESA_SHADER_TESS_CTRL:
                 shader_info->tcs.tcs_vertices_out = nir->info.tess.tcs_vertices_out;
@@ -3980,6 +3981,7 @@ ac_fill_shader_info(struct radv_shader_variant_info *shader_info, struct nir_sha
         case MESA_SHADER_VERTEX:
                 shader_info->vs.as_es = options->key.vs.as_es;
                 shader_info->vs.as_ls = options->key.vs.as_ls;
+                shader_info->vs.export_prim_id = options->key.vs.export_prim_id;
                 break;
         default:
                 break;
index 3d71ab7..073ed39 100644 (file)
@@ -501,7 +501,7 @@ radv_fill_shader_variant(struct radv_device *device,
                        assert(device->physical_device->rad_info.chip_class <= GFX8);
                        vgpr_comp_cnt = info->uses_prim_id ? 3 : 2;
                } else {
-                       bool enable_prim_id = options->key.tes.export_prim_id || info->uses_prim_id;
+                       bool enable_prim_id = variant->info.tes.export_prim_id || info->uses_prim_id;
                        vgpr_comp_cnt = enable_prim_id ? 3 : 2;
                }
                variant->config.rsrc2 |= S_00B12C_OC_LDS_EN(1);
@@ -534,7 +534,7 @@ radv_fill_shader_variant(struct radv_device *device,
                         * If PrimID is disabled. InstanceID / StepRate1 is loaded instead.
                         * StepRate0 is set to 1. so that VGPR3 doesn't have to be loaded.
                         */
-                       if (options->key.vs.export_prim_id) {
+                       if (variant->info.vs.export_prim_id) {
                                vgpr_comp_cnt = 2;
                        } else if (info->vs.needs_instance_id) {
                                vgpr_comp_cnt = 1;
index f6f345e..66cd005 100644 (file)
@@ -268,6 +268,7 @@ struct radv_shader_variant_info {
                        struct radv_es_output_info es_info;
                        bool as_es;
                        bool as_ls;
+                       bool export_prim_id;
                } vs;
                struct {
                        unsigned num_interp;
@@ -302,6 +303,7 @@ struct radv_shader_variant_info {
                        enum gl_tess_spacing spacing;
                        bool ccw;
                        bool point_mode;
+                       bool export_prim_id;
                } tes;
        };
 };