[Mesa-dev] [PATCH 14/15] radv: enable VK_AMD_shader_ballot

Connor Abbott connora at valvesoftware.com
Tue Aug 8 01:32:40 UTC 2017


From: Connor Abbott <cwabbott0 at gmail.com>

---
 src/amd/vulkan/radv_device.c   | 15 +++++++++++++++
 src/amd/vulkan/radv_pipeline.c |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 21f2437..2255ff8 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -188,6 +188,12 @@ static const VkExtensionProperties ext_sema_device_extensions[] = {
 	},
 };
 
+static const VkExtensionProperties amd_shader_ballot_extension = {
+	.extensionName = VK_AMD_SHADER_BALLOT_EXTENSION_NAME,
+	.specVersion = 1,
+};
+
+
 static VkResult
 radv_extensions_register(struct radv_instance *instance,
 			struct radv_extensions *extensions,
@@ -346,6 +352,15 @@ radv_physical_device_init(struct radv_physical_device *device,
 			goto fail;
 	}
 
+	if (device->rad_info.chip_class >= VI && HAVE_LLVM >= 0x600) {
+		result = radv_extensions_register(instance,
+						  &device->extensions,
+						  &amd_shader_ballot_extension,
+						  1);
+		if (result != VK_SUCCESS)
+			goto fail;
+	}
+
 	fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
 	device->name = get_chip_name(device->rad_info.family);
 
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 4aecb81..1b9a2b9 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -237,6 +237,10 @@ radv_shader_compile_to_nir(struct radv_device *device,
 			.variable_pointers = true,
 			.shader_ballot = true,
 			.shader_group_vote = true,
+#if HAVE_LLVM >= 0x600
+			.amd_shader_ballot = true,
+			.groups = true,
+#endif
 		};
 		entry_point = spirv_to_nir(spirv, module->size / 4,
 					   spec_entries, num_spec_entries,
-- 
2.9.4



More information about the mesa-dev mailing list