layers: Validate VK_NV_fragment_shader_barycentric
Adds a shader capability check to make sure that the
VK_NV_fragment_shader_barycentric feature is enabled when ever
an instruction requiring the FragmentBarycentricNV capability is used.
More info about extension:
- https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/
vkspec.html#VK_NV_fragment_shader_barycentric
- http://htmlpreview.github.io/?https://github.com/KhronosGroup/
SPIRV-Registry/blob/master/extensions/NV/
SPV_NV_fragment_shader_barycentric.html
Change-Id: I46380781c2fc451c61f561d9f199b831b6757f0b
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 1612134..f0e742f 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2533,6 +2533,12 @@
core_checks->enabled_features.compute_shader_derivatives_features = *compute_shader_derivatives_features;
}
+ const auto *fragment_shader_barycentric_features =
+ lvl_find_in_chain<VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV>(pCreateInfo->pNext);
+ if (fragment_shader_barycentric_features) {
+ core_checks->enabled_features.fragment_shader_barycentric_features = *fragment_shader_barycentric_features;
+ }
+
// Store physical device properties and physical device mem limits into CoreChecks structs
DispatchGetPhysicalDeviceMemoryProperties(gpu, &core_checks->phys_dev_mem_props);
DispatchGetPhysicalDeviceProperties(gpu, &core_checks->phys_dev_props);
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index 4435803..24e59f2 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -1543,6 +1543,7 @@
VkPhysicalDeviceFloatControlsPropertiesKHR float_controls;
VkPhysicalDeviceHostQueryResetFeaturesEXT host_query_reset_features;
VkPhysicalDeviceComputeShaderDerivativesFeaturesNV compute_shader_derivatives_features;
+ VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV fragment_shader_barycentric_features;
};
enum RenderPassCreateVersion { RENDER_PASS_VERSION_1 = 0, RENDER_PASS_VERSION_2 = 1 };
diff --git a/layers/shader_validation.cpp b/layers/shader_validation.cpp
index d7866d3..776fe80 100644
--- a/layers/shader_validation.cpp
+++ b/layers/shader_validation.cpp
@@ -1545,6 +1545,8 @@
: IsEnabled([=](const DeviceFeatures &features) { return features.float_controls.*ptr; }) {}
FeaturePointer(VkBool32 VkPhysicalDeviceComputeShaderDerivativesFeaturesNV::*ptr)
: IsEnabled([=](const DeviceFeatures &features) { return features.compute_shader_derivatives_features.*ptr; }) {}
+ FeaturePointer(VkBool32 VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV::*ptr)
+ : IsEnabled([=](const DeviceFeatures &features) { return features.fragment_shader_barycentric_features.*ptr; }) {}
};
struct CapabilityInfo {
@@ -1621,6 +1623,7 @@
{spv::CapabilityComputeDerivativeGroupQuadsNV, {"VkPhysicalDeviceComputeShaderDerivativesFeaturesNV::computeDerivativeGroupQuads", &VkPhysicalDeviceComputeShaderDerivativesFeaturesNV::computeDerivativeGroupQuads, &DeviceExtensions::vk_nv_compute_shader_derivatives}},
{spv::CapabilityComputeDerivativeGroupLinearNV, {"VkPhysicalDeviceComputeShaderDerivativesFeaturesNV::computeDerivativeGroupLinear", &VkPhysicalDeviceComputeShaderDerivativesFeaturesNV::computeDerivativeGroupLinear, &DeviceExtensions::vk_nv_compute_shader_derivatives}},
+ {spv::CapabilityFragmentBarycentricNV , {"VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV::fragmentShaderBarycentric", &VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV::fragmentShaderBarycentric, &DeviceExtensions::vk_nv_fragment_shader_barycentric}},
{spv::CapabilityStorageBuffer8BitAccess , {"VkPhysicalDevice8BitStorageFeaturesKHR::storageBuffer8BitAccess", &VkPhysicalDevice8BitStorageFeaturesKHR::storageBuffer8BitAccess, &DeviceExtensions::vk_khr_8bit_storage}},
{spv::CapabilityUniformAndStorageBuffer8BitAccess , {"VkPhysicalDevice8BitStorageFeaturesKHR::uniformAndStorageBuffer8BitAccess", &VkPhysicalDevice8BitStorageFeaturesKHR::uniformAndStorageBuffer8BitAccess, &DeviceExtensions::vk_khr_8bit_storage}},