mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
Support align/offset for all versions GLSL/ESSL targeting SPIR-V.
This commit is contained in:
parent
e4e8f7b7a3
commit
7225a1cb1e
@ -54,7 +54,7 @@ spv.140.frag
|
||||
MemberDecorate 87(bn) 3 Offset 576
|
||||
MemberDecorate 87(bn) 3 MatrixStride 16
|
||||
MemberDecorate 87(bn) 4 RowMajor
|
||||
MemberDecorate 87(bn) 4 Offset 640
|
||||
MemberDecorate 87(bn) 4 Offset 1024
|
||||
MemberDecorate 87(bn) 4 MatrixStride 16
|
||||
Decorate 87(bn) Block
|
||||
Decorate 89 DescriptorSet 0
|
||||
|
@ -61,7 +61,7 @@ Warning, version 310 is not yet complete; most version-specific features are pre
|
||||
MemberDecorate 45(T3) 2 ColMajor
|
||||
MemberDecorate 45(T3) 2 Offset 128
|
||||
MemberDecorate 45(T3) 2 MatrixStride 16
|
||||
MemberDecorate 45(T3) 3 Offset 160
|
||||
MemberDecorate 45(T3) 3 Offset 2048
|
||||
Decorate 45(T3) Block
|
||||
Decorate 47 DescriptorSet 0
|
||||
MemberDecorate 78(T2) 0 Offset 0
|
||||
|
@ -14,7 +14,7 @@ layout(std140) uniform bn {
|
||||
layout(column_major) mat4 matca[4];
|
||||
layout(row_major) mat4 matr;
|
||||
layout(column_major) mat4 matc;
|
||||
mat4 matrdef;
|
||||
layout(align=512, offset=1024) mat4 matrdef;
|
||||
};
|
||||
|
||||
uniform sampler2DRect sampR;
|
||||
|
@ -25,7 +25,7 @@ layout(column_major) uniform T3 { // shared and column_major
|
||||
mat4 M3; // column_major
|
||||
layout(row_major) mat4 M4; // row major
|
||||
mat2x3 N2; // column_major
|
||||
uvec3 uv3a[4];
|
||||
layout(align=16, offset=2048) uvec3 uv3a[4];
|
||||
};
|
||||
|
||||
in uint uiuin;
|
||||
|
@ -2,5 +2,5 @@
|
||||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1825"
|
||||
#define GLSLANG_DATE "10-Feb-2017"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1828"
|
||||
#define GLSLANG_DATE "13-Feb-2017"
|
||||
|
@ -4008,16 +4008,20 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
||||
// - uniform offsets
|
||||
// - atomic_uint offsets
|
||||
const char* feature = "offset";
|
||||
if (spvVersion.spv == 0) {
|
||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
|
||||
const char* exts[2] = { E_GL_ARB_enhanced_layouts, E_GL_ARB_shader_atomic_counters };
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
|
||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||
}
|
||||
publicType.qualifier.layoutOffset = value;
|
||||
return;
|
||||
} else if (id == "align") {
|
||||
const char* feature = "uniform buffer-member align";
|
||||
if (spvVersion.spv == 0) {
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature);
|
||||
}
|
||||
// "The specified alignment must be a power of 2, or a compile-time error results."
|
||||
if (! IsPow2(value))
|
||||
error(loc, "must be a power of 2", "align", "");
|
||||
@ -5546,9 +5550,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
||||
if (memberType.isArray())
|
||||
arrayUnsizedCheck(memberLoc, currentBlockQualifier, &memberType.getArraySizes(), false, member == typeList.size() - 1);
|
||||
if (memberQualifier.hasOffset()) {
|
||||
if (spvVersion.spv == 0) {
|
||||
requireProfile(memberLoc, ~EEsProfile, "offset on block member");
|
||||
profileRequires(memberLoc, ~EEsProfile, 440, E_GL_ARB_enhanced_layouts, "offset on block member");
|
||||
}
|
||||
}
|
||||
|
||||
if (memberType.containsOpaque())
|
||||
error(memberLoc, "member of block cannot be or contain a sampler, image, or atomic_uint type", typeList[member].type->getFieldName().c_str(), "");
|
||||
|
Loading…
Reference in New Issue
Block a user