From c58dff753c2e2d8c05d5a998548f25a9080e02a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 9 May 2018 20:43:16 +0200 Subject: [PATCH] radv: enable AMD_shader_ballot with RADV_PERFTEST_SHADER_BALLOT ('shader_ballot') Reviewed-by: Connor Abbott --- src/amd/vulkan/radv_debug.h | 1 + src/amd/vulkan/radv_device.c | 3 +++ src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_private.h | 3 +++ src/amd/vulkan/radv_shader.c | 2 +- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 652a3b677d2..aef0139c1b0 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -61,6 +61,7 @@ enum { RADV_PERFTEST_OUT_OF_ORDER = 0x8, RADV_PERFTEST_DCC_MSAA = 0x10, RADV_PERFTEST_BO_LIST = 0x20, + RADV_PERFTEST_SHADER_BALLOT = 0x40, }; bool diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 3b69e457496..487b75491d1 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -371,6 +371,8 @@ radv_physical_device_init(struct radv_physical_device *device, (device->rad_info.chip_class >= GFX8 && device->rad_info.me_fw_feature >= 41); + device->use_shader_ballot = device->instance->perftest_flags & RADV_PERFTEST_SHADER_BALLOT; + radv_physical_device_init_mem_types(device); radv_fill_device_extension_table(device, &device->supported_extensions); @@ -479,6 +481,7 @@ static const struct debug_control radv_perftest_options[] = { {"localbos", RADV_PERFTEST_LOCAL_BOS}, {"dccmsaa", RADV_PERFTEST_DCC_MSAA}, {"bolist", RADV_PERFTEST_BO_LIST}, + {"shader_ballot", RADV_PERFTEST_SHADER_BALLOT}, {NULL, 0} }; diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 8f4fcad1983..0a3c0759cca 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -134,6 +134,7 @@ EXTENSIONS = [ Extension('VK_AMD_gpu_shader_half_float', 1, 'device->rad_info.chip_class >= GFX8 && HAVE_LLVM >= 0x0800'), Extension('VK_AMD_gpu_shader_int16', 1, 'device->rad_info.chip_class >= GFX8'), Extension('VK_AMD_rasterization_order', 1, 'device->has_out_of_order_rast'), + Extension('VK_AMD_shader_ballot', 1, 'device->use_shader_ballot'), Extension('VK_AMD_shader_core_properties', 1, True), Extension('VK_AMD_shader_info', 1, True), Extension('VK_AMD_shader_trinary_minmax', 1, True), diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 8f2e80b3017..d6f396f0056 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -316,6 +316,9 @@ struct radv_physical_device { /* Whether LOAD_CONTEXT_REG packets are supported. */ bool has_load_ctx_reg_pkt; + /* Whether to enable the AMD_shader_ballot extension */ + bool use_shader_ballot; + /* This is the drivers on-disk cache used as a fallback as opposed to * the pipeline cache defined by apps. */ diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index 3e1098de79f..c3bbf3fdda7 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -246,7 +246,7 @@ radv_shader_compile_to_nir(struct radv_device *device, .lower_ubo_ssbo_access_to_offsets = true, .caps = { .amd_gcn_shader = true, - .amd_shader_ballot = false, + .amd_shader_ballot = device->instance->perftest_flags & RADV_PERFTEST_SHADER_BALLOT, .amd_trinary_minmax = true, .derivative_group = true, .descriptor_array_dynamic_indexing = true, -- 2.30.2