Hi,
I am using this uniform buffer in the shader:
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
#extension GL_EXT_shader_16bit_storage : enable
#extension GL_EXT_scalar_block_layout : enable
precision highp float;
layout(set=1, binding = 0, std430) uniform Cfg
{
int width;
int height;
int imageAlign;
int reserved0;
float blend_kernal[9*64];
} cfg;
and I get the following runtime error:
Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282 | vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
Structure id 14 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 4 contains an array with stride 4 not satisfying alignment to 16
%Cfg = OpTypeStruct %int %int %int %int %_arr_float_uint_576
The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (Vulkan® 1.4.325 - A Specification (with all registered extensions))
I activated in the code the following extenssions:
const char* deviceExtensions[] = {
//VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME
VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME,
VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME,
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME
};
I dont understand why I get this error. On Internet says that std430 is used for uniform buffers with floats aligned at 4 bytes.
Any help appreciated!
Thanks,
Andrei