Update VK_CBuffer_Zoo test to account for glslang regression

* glslang now requires and uses scalar block layout for hlsl cbuffer packing
This commit is contained in:
baldurk
2025-04-18 13:28:19 +01:00
parent f837af3066
commit a8a0e9628d
2 changed files with 30 additions and 5 deletions
+21 -2
View File
@@ -332,7 +332,8 @@ layout(set = 0, binding = 0) cbuffer consts
float4 dummy1;
float o[4]; // should cover 4 float4s = 48, <..>, 52, <..>, 56, <..>, 60
float p; // can't be packed in with above array = 64, <65, 66, 67>
float p; // with glslang regression to scalar packing, is packed after = 61
float3 glslang_regression;
float4 dummy2;
float4 gldummy;
@@ -393,7 +394,8 @@ layout(set = 0, binding = 0) cbuffer consts
// row1: {197, 201}
// <198, 202>
// <199, 203>
float z; // doesn't overlap in final row = 204, <205, 206, 207>
float z; // with glslang regression to scalar packing, is packed after = 202
float3 glslang_regression2;
// SPIR-V can't represent single-dimension matrices properly at the moment
/*
@@ -572,6 +574,10 @@ float4 main() : SV_Target0
devExts.push_back(VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME);
optDevExts.push_back(VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME);
// new glslang has a regression that requires scalar block layout for hlsl and does not support
// generating non-scalar layout hlsl packing
devExts.push_back(VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME);
VulkanGraphicsTest::Prepare(argc, argv);
static VkPhysicalDeviceInlineUniformBlockFeaturesEXT inlineFeats = {
@@ -584,6 +590,19 @@ float4 main() : SV_Target0
inlineFeats.pNext = (void *)devInfoNext;
devInfoNext = &inlineFeats;
}
static VkPhysicalDeviceScalarBlockLayoutFeaturesEXT scalarFeatures = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT,
};
getPhysFeatures2(&scalarFeatures);
if(!scalarFeatures.scalarBlockLayout)
Avail = "Scalar block layout feature 'scalarBlockLayout' not available";
scalarFeatures.pNext = (void *)devInfoNext;
devInfoNext = &scalarFeatures;
}
int main()
+9 -3
View File
@@ -529,8 +529,11 @@ class VK_CBuffer_Zoo(rdtest.TestCase):
3: lambda x: x.rows(1).cols(1).value([60.0]),
})
# float p; with std140 vulkan packing
var_check.check('p').rows(1).cols(1).value([64.0])
# float p; with forced scalar vulkan packing due to glslang regression
var_check.check('p').rows(1).cols(1).value([61.0])
# float3 glslang_regression;
var_check.check('glslang_regression')
# float4 dummy2;
var_check.check('dummy2')
@@ -608,7 +611,10 @@ class VK_CBuffer_Zoo(rdtest.TestCase):
197.0, 201.0])
# float z;
var_check.check('z').rows(1).cols(1).value([204.0])
var_check.check('z').rows(1).cols(1).value([202.0])
# float3 glslang_regression2;
var_check.check('glslang_regression2')
# Temporarily until SPIR-V support for degenerate HLSL matrices is determined
var_check.check('dummy9')