layers: Add shader_subgroup_ballot ext shader caps
authorMark Lobodzinski <mark@lunarg.com>
Tue, 28 Mar 2017 19:34:55 +0000 (13:34 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Wed, 29 Mar 2017 16:58:32 +0000 (10:58 -0600)
Recognize and validate shader capabilities added in the new
VK_KHR_shader_subgroup_ballot extension.

Change-Id: I79f02f50600dcbd85f7b91aeefe56bb426f53b6b

layers/core_validation.cpp
layers/core_validation_types.h

index 374103bf9d18c8ee2b217dc1eea3d3f69f197e76..c4cba305430b0aa5a6efe8ddf606b9857f0fbf4b 100644 (file)
@@ -2547,6 +2547,11 @@ static bool validate_shader_capabilities(layer_data *dev_data, shader_module con
                                               VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME);
                     break;
 
+                case spv::CapabilitySubgroupBallotKHR:
+                    pass &= require_extension(report_data, dev_data->device_extensions.khr_subgroup_ballot_enabled,
+                                              VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME);
+                    break;
+
                 default:
                     // Spirv-validator should catch these errors
                     break;
@@ -3861,6 +3866,7 @@ static void checkDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo,
     dev_data->device_extensions.nv_geometry_shader_passthrough_enabled = false;
     dev_data->device_extensions.nv_sample_mask_override_coverage_enabled = false;
     dev_data->device_extensions.nv_viewport_array2_enabled = false;
+    dev_data->device_extensions.khr_subgroup_ballot_enabled = false;
 
 
     for (i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
@@ -3891,6 +3897,9 @@ static void checkDeviceRegisterExtensions(const VkDeviceCreateInfo *pCreateInfo,
         if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME) == 0) {
             dev_data->device_extensions.nv_viewport_array2_enabled = true;
         }
+        if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME) == 0) {
+            dev_data->device_extensions.khr_subgroup_ballot_enabled = true;
+        }
     }
 }
 
index 1ab611cc6d984b834bbac8aeca291a953f697a9c..5dd0dbf6c9ae0960b07687bdc85122324e008c3b 100644 (file)
@@ -794,6 +794,7 @@ struct devExts {
     bool nv_geometry_shader_passthrough_enabled;
     bool nv_sample_mask_override_coverage_enabled;
     bool nv_viewport_array2_enabled;
+    bool khr_subgroup_ballot_enabled;
     std::unordered_map<VkSwapchainKHR, std::unique_ptr<SWAPCHAIN_NODE>> swapchainMap;
     std::unordered_map<VkImage, VkSwapchainKHR> imageToSwapchainMap;
 };