Module: Mesa
Branch: master
Commit: 2f7bb93146743497a6b9fa703b0135c22af6fe31
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f7bb93146743497a6b9fa703b0135c22af6fe31

Author: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Date:   Fri Apr  6 14:06:24 2018 +0200

radv: add radv_get_num_physical_sgprs() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_shader.c | 15 ++++-----------
 src/amd/vulkan/radv_shader.h |  6 ++++++
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index f46beab8c1..59ad2f3819 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -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) {
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index ae30d6125b..f5c0645b5f 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -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

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to