radv: add radv_get_num_physical_sgprs() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 6 Apr 2018 12:06:24 +0000 (14:06 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 9 Apr 2018 12:28:13 +0000 (14:28 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index f46beab8c183a08b47f6ae7ae056de6cf323442b..59ad2f3819b9b89e06434cc38937498d7fdc5bd4 100644 (file)
@@ -597,15 +597,6 @@ radv_get_shader_name(struct radv_shader_variant *var, gl_shader_stage stage)
        };
 }
 
-static uint32_t
-get_total_sgprs(struct radv_device *device)
-{
-       if (device->physical_device->rad_info.chip_class >= VI)
-               return 800;
-       else
-               return 512;
-}
-
 static void
 generate_shader_stats(struct radv_device *device,
                      struct radv_shader_variant *variant,
@@ -637,7 +628,9 @@ generate_shader_stats(struct radv_device *device,
        }
 
        if (conf->num_sgprs)
-               max_simd_waves = MIN2(max_simd_waves, get_total_sgprs(device) / conf->num_sgprs);
+               max_simd_waves =
+                       MIN2(max_simd_waves,
+                            radv_get_num_physical_sgprs(device->physical_device) / conf->num_sgprs);
 
        if (conf->num_vgprs)
                max_simd_waves = MIN2(max_simd_waves, 256 / conf->num_vgprs);
@@ -720,7 +713,7 @@ radv_GetShaderInfoAMD(VkDevice _device,
                        VkShaderStatisticsInfoAMD statistics = {};
                        statistics.shaderStageMask = shaderStage;
                        statistics.numPhysicalVgprs = 256;
-                       statistics.numPhysicalSgprs = get_total_sgprs(device);
+                       statistics.numPhysicalSgprs = radv_get_num_physical_sgprs(device->physical_device);
                        statistics.numAvailableSgprs = statistics.numPhysicalSgprs;
 
                        if (stage == MESA_SHADER_COMPUTE) {
index ae30d6125b148f190a0bd8f78e1ee06cfde4c49b..f5c0645b5f13e88642f29ea12010f66db5e69fe2 100644 (file)
@@ -362,4 +362,10 @@ static inline unsigned shader_io_get_unique_index(gl_varying_slot slot)
        unreachable("illegal slot in get unique index\n");
 }
 
+static inline uint32_t
+radv_get_num_physical_sgprs(struct radv_physical_device *physical_device)
+{
+       return physical_device->rad_info.chip_class >= VI ? 800 : 512;
+}
+
 #endif