Add a test for enhanced layouts.
This commit is contained in:
Родитель
5a89606f26
Коммит
4d11220aa8
|
@ -0,0 +1,14 @@
|
|||
#version 450
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#version 450
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
};
|
||||
|
||||
layout(std140, binding = 0) uniform UBO
|
||||
{
|
||||
layout(offset = 4) int a;
|
||||
layout(offset = 8) int b;
|
||||
layout(offset = 16) Foo foo;
|
||||
layout(offset = 48) int c[8];
|
||||
} ubo;
|
||||
|
||||
layout(std140, binding = 1) buffer SSBO1
|
||||
{
|
||||
layout(offset = 4) int a;
|
||||
layout(offset = 8) int b;
|
||||
layout(offset = 16) Foo foo;
|
||||
layout(offset = 48) int c[8];
|
||||
} ssbo1;
|
||||
|
||||
layout(std430, binding = 2) buffer SSBO2
|
||||
{
|
||||
layout(offset = 4) int a;
|
||||
layout(offset = 8) int b;
|
||||
layout(offset = 16) Foo foo;
|
||||
layout(offset = 48) int c[8];
|
||||
} ssbo2;
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
|
|
@ -1114,6 +1114,7 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var)
|
|||
attr.push_back("std140");
|
||||
else if (ssbo_is_packing_standard(type, BufferPackingStd140EnhancedLayout))
|
||||
{
|
||||
attr.push_back("std140");
|
||||
// Fallback time. We might be able to use the ARB_enhanced_layouts to deal with this difference,
|
||||
// however, we can only use layout(offset) on the block itself, not any substructs, so the substructs better be the appropriate layout.
|
||||
// Enhanced layouts seem to always work in Vulkan GLSL, so no need for extensions there.
|
||||
|
|
Загрузка…
Ссылка в новой задаче