Commit 47736cf0 by John Kessenich

Implement streams for built-in blocks.

Also, don't make SPIR-V with streams on types.
parent fbe33812
......@@ -3251,10 +3251,6 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// Decorate the structure
builder.addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix));
builder.addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer()));
if (type.getQualifier().hasStream() && glslangIntermediate->isMultiStream()) {
builder.addCapability(spv::CapabilityGeometryStreams);
builder.addDecoration(spvType, spv::DecorationStream, type.getQualifier().layoutStream);
}
}
// Turn the expression forming the array size into an id.
......
......@@ -42,14 +42,12 @@ error: Capability GeometryStreams is not allowed by Vulkan 1.0 specification (or
MemberName 68(toFragment) 0 "color"
Name 70 "toF"
Decorate 8(fromVertex) Block
Decorate 8(fromVertex) Stream 3
Decorate 10 Stream 3
Decorate 13(fromVertex) Block
MemberDecorate 27(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 27(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 27(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 27(gl_PerVertex) Block
Decorate 27(gl_PerVertex) Stream 0
Decorate 29 Stream 0
MemberDecorate 30(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 30(gl_PerVertex) 1 BuiltIn PointSize
......@@ -61,7 +59,6 @@ error: Capability GeometryStreams is not allowed by Vulkan 1.0 specification (or
Decorate 51(gl_Layer) Stream 0
Decorate 51(gl_Layer) BuiltIn Layer
Decorate 68(toFragment) Block
Decorate 68(toFragment) Stream 3
Decorate 70(toF) Stream 3
2: TypeVoid
3: TypeFunction 2
......
......@@ -40,7 +40,6 @@ error: Capability GeometryStreams is not allowed by Vulkan 1.0 specification (or
Decorate 9(gl_PerVertex) Block
MemberDecorate 21(gl_PerVertex) 0 BuiltIn PointSize
Decorate 21(gl_PerVertex) Block
Decorate 21(gl_PerVertex) Stream 0
Decorate 23 Stream 0
Decorate 28(gl_ViewportIndex) Stream 0
Decorate 28(gl_ViewportIndex) BuiltIn ViewportIndex
......
......@@ -4003,6 +4003,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;
fixBlockXfbOffsets(currentBlockQualifier, newTypeList);
}
......@@ -4064,6 +4066,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;
......@@ -4075,8 +4080,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;
}
......@@ -4101,6 +4106,11 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
}
}
if (true) { // ?? should "if (some new functionality is enabled) { ..."
// ...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) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment