layers: Added check and test for scalar block layout
Added code to use scalar block layout validation in spirv-val when
VK_EXT_scalar_block_layout is enabled.
Added positive test for this, mirroring the relaxed block layout
extension test.
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index cb0ea8a..e8e35af 100755
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2570,6 +2570,11 @@
device_data->enabled_features.float16_int8 = *float16_int8_features;
}
+ const auto *scalar_block_layout_features = lvl_find_in_chain<VkPhysicalDeviceScalarBlockLayoutFeaturesEXT>(pCreateInfo->pNext);
+ if (scalar_block_layout_features) {
+ device_data->enabled_features.scalar_block_layout_features = *scalar_block_layout_features;
+ }
+
// Store physical device properties and physical device mem limits into device layer_data structs
instance_data->dispatch_table.GetPhysicalDeviceMemoryProperties(gpu, &device_data->phys_dev_mem_props);
instance_data->dispatch_table.GetPhysicalDeviceProperties(gpu, &device_data->phys_dev_props);
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index c6a48ce..357247e 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -1144,6 +1144,7 @@
VkPhysicalDeviceInlineUniformBlockFeaturesEXT inline_uniform_block;
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback_features;
VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8;
+ VkPhysicalDeviceScalarBlockLayoutFeaturesEXT scalar_block_layout_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 b6e78dc..ef6cbe1 100644
--- a/layers/shader_validation.cpp
+++ b/layers/shader_validation.cpp
@@ -1434,6 +1434,8 @@
: IsEnabled([=](const DeviceFeatures &features) { return features.transform_feedback_features.*ptr; }) {}
FeaturePointer(VkBool32 VkPhysicalDeviceFloat16Int8FeaturesKHR::*ptr)
: IsEnabled([=](const DeviceFeatures &features) { return features.float16_int8.*ptr; }) {}
+ FeaturePointer(VkBool32 VkPhysicalDeviceScalarBlockLayoutFeaturesEXT::*ptr)
+ : IsEnabled([=](const DeviceFeatures &features) { return features.scalar_block_layout_features.*ptr; }) {}
};
struct CapabilityInfo {
@@ -2295,6 +2297,10 @@
if (GetDeviceExtensions(dev_data)->vk_khr_relaxed_block_layout) {
spvValidatorOptionsSetRelaxBlockLayout(options, true);
}
+ if (GetDeviceExtensions(dev_data)->vk_ext_scalar_block_layout &&
+ GetEnabledFeatures(dev_data)->scalar_block_layout_features.scalarBlockLayout == VK_TRUE) {
+ spvValidatorOptionsSetScalarBlockLayout(options, true);
+ }
spv_valid = spvValidateWithOptions(ctx, options, &binary, &diag);
if (spv_valid != SPV_SUCCESS) {
if (!have_glsl_shader || (pCreateInfo->pCode[0] == spv::MagicNumber)) {