radv/aco: allow ACO for GS
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 14 Oct 2019 16:45:09 +0000 (17:45 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 24 Jan 2020 13:35:07 +0000 (13:35 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2421>

src/amd/vulkan/radv_pipeline.c

index 588a249..71ffa1b 100644 (file)
@@ -2715,9 +2715,10 @@ void radv_stop_feedback(VkPipelineCreationFeedbackEXT *feedback, bool cache_hit)
 }
 
 static
-bool radv_aco_supported_stage(gl_shader_stage stage, bool has_gs, bool has_ts)
+bool radv_aco_supported_stage(gl_shader_stage stage, bool has_ts)
 {
-       return (stage == MESA_SHADER_VERTEX && !has_gs && !has_ts) ||
+       return (stage == MESA_SHADER_VERTEX && !has_ts) ||
+              (stage == MESA_SHADER_GEOMETRY && !has_ts) ||
               stage == MESA_SHADER_FRAGMENT ||
               stage == MESA_SHADER_COMPUTE;
 }
@@ -2782,7 +2783,6 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                modules[MESA_SHADER_FRAGMENT] = &fs_m;
        }
 
-       bool has_gs = modules[MESA_SHADER_GEOMETRY];
        bool has_ts = modules[MESA_SHADER_TESS_CTRL] || modules[MESA_SHADER_TESS_EVAL];
        bool use_aco = device->physical_device->use_aco;
 
@@ -2794,7 +2794,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
                radv_start_feedback(stage_feedbacks[i]);
 
-               bool aco = use_aco && radv_aco_supported_stage(i, has_gs, has_ts);
+               bool aco = use_aco && radv_aco_supported_stage(i, has_ts);
                nir[i] = radv_shader_compile_to_nir(device, modules[i],
                                                    stage ? stage->pName : "main", i,
                                                    stage ? stage->pSpecializationInfo : NULL,
@@ -2826,7 +2826,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                                           nir_lower_non_uniform_texture_access |
                                           nir_lower_non_uniform_image_access);
 
-                       bool aco = use_aco && radv_aco_supported_stage(i, has_gs, has_ts);
+                       bool aco = use_aco && radv_aco_supported_stage(i, has_ts);
                        if (!aco)
                                NIR_PASS_V(nir[i], nir_lower_bool_to_int32);
                }
@@ -2903,7 +2903,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                if (!pipeline->shaders[MESA_SHADER_FRAGMENT]) {
                        radv_start_feedback(stage_feedbacks[MESA_SHADER_FRAGMENT]);
 
-                       bool aco = use_aco && radv_aco_supported_stage(MESA_SHADER_FRAGMENT, has_gs, has_ts);
+                       bool aco = use_aco && radv_aco_supported_stage(MESA_SHADER_FRAGMENT, has_ts);
                        pipeline->shaders[MESA_SHADER_FRAGMENT] =
                               radv_shader_variant_compile(device, modules[MESA_SHADER_FRAGMENT], &nir[MESA_SHADER_FRAGMENT], 1,
                                                          pipeline->layout, keys + MESA_SHADER_FRAGMENT,
@@ -2942,10 +2942,11 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
                        radv_start_feedback(stage_feedbacks[MESA_SHADER_GEOMETRY]);
 
+                       bool aco = use_aco && radv_aco_supported_stage(MESA_SHADER_GEOMETRY, has_ts);
                        pipeline->shaders[MESA_SHADER_GEOMETRY] = radv_shader_variant_compile(device, modules[MESA_SHADER_GEOMETRY], combined_nir, 2,
                                                                                             pipeline->layout,
                                                                                             &keys[pre_stage], &infos[MESA_SHADER_GEOMETRY], keep_executable_info,
-                                                                                            false, &binaries[MESA_SHADER_GEOMETRY]);
+                                                                                            aco, &binaries[MESA_SHADER_GEOMETRY]);
 
                        radv_stop_feedback(stage_feedbacks[MESA_SHADER_GEOMETRY], false);
                }
@@ -2964,7 +2965,7 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
 
                        radv_start_feedback(stage_feedbacks[i]);
 
-                       bool aco = use_aco && radv_aco_supported_stage(i, has_gs, has_ts);
+                       bool aco = use_aco && radv_aco_supported_stage(i, has_ts);
                        pipeline->shaders[i] = radv_shader_variant_compile(device, modules[i], &nir[i], 1,
                                                                          pipeline->layout,
                                                                          keys + i, infos + i,keep_executable_info,