diff options
author | Bas Nieuwenhuizen <[email protected]> | 2019-06-01 18:46:21 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2019-08-12 23:00:24 +0200 |
commit | 290ca0c4dd1506f83b59a0f529546180340a4ce5 (patch) | |
tree | e0d6276806dd277aa7642131711a333624d5cc6e /src | |
parent | 026773397b1e64e95ad04e271a2de70453672424 (diff) |
radv: Add utility function to calculate max waves.
Not AC because a lot of it is data extraction out of radv structs.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_shader.c | 26 | ||||
-rw-r--r-- | src/amd/vulkan/radv_shader.h | 6 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index c74bfa2e281..0f0703d66d1 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1279,23 +1279,21 @@ radv_get_shader_name(struct radv_shader_variant_info *info, }; } -static void -generate_shader_stats(struct radv_device *device, - struct radv_shader_variant *variant, - gl_shader_stage stage, - struct _mesa_string_buffer *buf) + +unsigned +radv_get_max_waves(struct radv_device *device, + struct radv_shader_variant *variant, + gl_shader_stage stage) { enum chip_class chip_class = device->physical_device->rad_info.chip_class; unsigned lds_increment = chip_class >= GFX7 ? 512 : 256; uint8_t wave_size = variant->info.info.wave_size; - struct ac_shader_config *conf; + struct ac_shader_config *conf = &variant->config; unsigned max_simd_waves; unsigned lds_per_wave = 0; max_simd_waves = ac_get_max_simd_waves(device->physical_device->rad_info.family); - conf = &variant->config; - if (stage == MESA_SHADER_FRAGMENT) { lds_per_wave = conf->lds_size * lds_increment + align(variant->info.fs.num_interp * 48, @@ -1323,6 +1321,18 @@ generate_shader_stats(struct radv_device *device, if (lds_per_wave) max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave); + return max_simd_waves; +} + +static void +generate_shader_stats(struct radv_device *device, + struct radv_shader_variant *variant, + gl_shader_stage stage, + struct _mesa_string_buffer *buf) +{ + struct ac_shader_config *conf = &variant->config; + unsigned max_simd_waves = radv_get_max_waves(device, variant, stage); + if (stage == MESA_SHADER_FRAGMENT) { _mesa_string_buffer_printf(buf, "*** SHADER CONFIG ***\n" "SPI_PS_INPUT_ADDR = 0x%04x\n" diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 9adf2a6a279..f93b1ec0fe2 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -413,6 +413,12 @@ void radv_shader_variant_destroy(struct radv_device *device, struct radv_shader_variant *variant); + +unsigned +radv_get_max_waves(struct radv_device *device, + struct radv_shader_variant *variant, + gl_shader_stage stage); + const char * radv_get_shader_name(struct radv_shader_variant_info *info, gl_shader_stage stage); |