GLSL/SPV: XFB: No streams on types, but support them on built-in blocks.
From internal Khronos discussions, work, and testing.
This commit is contained in:
parent
ba9f596eee
commit
236eb0d325
4 changed files with 12 additions and 10 deletions
14
glslang/MachineIndependent/ParseHelper.cpp
Normal file → Executable file
14
glslang/MachineIndependent/ParseHelper.cpp
Normal file → Executable file
|
|
@ -4059,6 +4059,8 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) {
|
||||
if (!currentBlockQualifier.hasXfbBuffer())
|
||||
currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer;
|
||||
if (!currentBlockQualifier.hasStream())
|
||||
currentBlockQualifier.layoutStream = globalOutputDefaults.layoutStream;
|
||||
fixXfbOffsets(currentBlockQualifier, newTypeList);
|
||||
}
|
||||
|
||||
|
|
@ -4141,6 +4143,9 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
if (newType.getQualifier().hasXfbBuffer() &&
|
||||
newType.getQualifier().layoutXfbBuffer != currentBlockQualifier.layoutXfbBuffer)
|
||||
error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", "");
|
||||
if (newType.getQualifier().hasStream() &&
|
||||
newType.getQualifier().layoutStream != currentBlockQualifier.layoutStream)
|
||||
error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_stream", "");
|
||||
oldType.getQualifier().centroid = newType.getQualifier().centroid;
|
||||
oldType.getQualifier().sample = newType.getQualifier().sample;
|
||||
oldType.getQualifier().invariant = newType.getQualifier().invariant;
|
||||
|
|
@ -4152,8 +4157,8 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
oldType.getQualifier().layoutXfbBuffer = newType.getQualifier().layoutXfbBuffer;
|
||||
oldType.getQualifier().layoutXfbStride = newType.getQualifier().layoutXfbStride;
|
||||
if (oldType.getQualifier().layoutXfbOffset != TQualifier::layoutXfbBufferEnd) {
|
||||
// if any member as an xfb_offset, then the block's xfb_buffer inherents current xfb_buffer,
|
||||
// and for xfb processing, the member needs it as well, along with xfb_stride
|
||||
// If any member has an xfb_offset, then the block's xfb_buffer inherents current xfb_buffer,
|
||||
// and for xfb processing, the member needs it as well, along with xfb_stride.
|
||||
type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer;
|
||||
oldType.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer;
|
||||
}
|
||||
|
|
@ -4178,6 +4183,11 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
|||
}
|
||||
}
|
||||
|
||||
if (spvVersion.vulkan > 0) {
|
||||
// ...then streams apply to built-in blocks, instead of them being only on stream 0
|
||||
type.getQualifier().layoutStream = currentBlockQualifier.layoutStream;
|
||||
}
|
||||
|
||||
if (numOriginalMembersFound < newTypeList.size())
|
||||
error(loc, "block redeclaration has extra members", blockName.c_str(), "");
|
||||
if (type.isArray() != (arraySizes != nullptr) ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue