spirv/radv: add AMD_gcn_shader capability, remove current extensions
authorAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 8 Mar 2018 11:43:00 +0000 (12:43 +0100)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 15 Mar 2018 11:08:25 +0000 (12:08 +0100)
So now, during spirv_to_nir, it uses the capability instead of the
extension. Note that we are really doing here is treating
SPV_AMD_gcn_shader as other supported extensions. SPV_AMD_gcn_shader
is not the first SPV extension supported. For example, the capability
draw_parameters infers if the extension SPV_KHR_shader_draw_parameters
is supported or not.

This could be seen as counter-intuitive, and that it would be easier
to define which extensions are supported, and based our checks on
that, but we need to take into account that some capabilities are
optional from core, and others came from new extensions.

Also this commit would make the implementation of ARB_spirv_extensions
easier.

v2: AMD_gcn_shader capability renamed to gcn_shader (Daniel Schürmann)

Reviewed-by: Daniel Schürmann <daniel.schuermann@campus.tu-berlin.de>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_shader.c
src/compiler/shader_info.h
src/compiler/spirv/nir_spirv.h
src/compiler/spirv/spirv_to_nir.c

index 3eddc089d40baf20629f72e3eac81703e48a0427..2fc7060d6c2e811ff645bee324871366b10cefa4 100644 (file)
@@ -214,9 +214,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                                .multiview = true,
                                .subgroup_basic = true,
                                .variable_pointers = true,
-                       },
-                       .exts = {
-                               .AMD_gcn_shader = true,
+                               .gcn_shader = true,
                        },
                };
                entry_point = spirv_to_nir(spirv, module->size / 4,
index b1e200070f77267bfe5ac0d4fa89e8c96b427521..0eeb2ca58eab5c0e8d3ccc1aa7b2ec63bd63240d 100644 (file)
@@ -51,11 +51,7 @@ struct spirv_supported_capabilities {
    bool subgroup_quad;
    bool subgroup_shuffle;
    bool subgroup_vote;
-};
-
-/* The supported extensions which add extended instructions */
-struct spirv_supported_extensions {
-   bool AMD_gcn_shader;
+   bool gcn_shader;
 };
 
 typedef struct shader_info {
index 2b0bdaec013743adade58095e6ee4fa5326a6486..a2c40e57d1890a128fe313629c7871458e7c1d8e 100644 (file)
@@ -59,7 +59,6 @@ struct spirv_to_nir_options {
    bool lower_workgroup_access_to_offsets;
 
    struct spirv_supported_capabilities caps;
-   struct spirv_supported_extensions exts;
 
    struct {
       void (*func)(void *private_data,
index df01f4ff4a3d9e1f6d21553390c41064a71d2259..f06dca90efd5f066bca5d64f61754aebaf1c032b 100644 (file)
@@ -376,7 +376,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
       if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
          val->ext_handler = vtn_handle_glsl450_instruction;
       } else if ((strcmp((const char *)&w[2], "SPV_AMD_gcn_shader") == 0)
-                && (b->options && b->options->exts.AMD_gcn_shader)) {
+                && (b->options && b->options->caps.gcn_shader)) {
          val->ext_handler = vtn_handle_amd_gcn_shader_instruction;
       } else {
          vtn_fail("Unsupported extension");