Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printing of 'unknown stage' during crossStageCheck #3764

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Test/baseResults/iomap.crossStage.2.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ Linked geometry stage:

Linked fragment stage:

WARNING: Linking unknown stage and fragment stages: Matched shader interfaces are using different instance names.
unknown stage stage: Block: crossStageBlock2 Instance: blockName1: ""
WARNING: Linking fragment stage: Matched shader interfaces are using different instance names.
vertex stage: Block: crossStageBlock2 Instance: blockName1: ""
fragment stage: Block: crossStageBlock2 Instance: blockName2: ""

Shader version: 460
Expand Down
4 changes: 2 additions & 2 deletions Test/baseResults/iomap.crossStage.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ Linked vertex stage:

Linked fragment stage:

WARNING: Linking unknown stage and fragment stages: Matched shader interfaces are using different instance names.
unknown stage stage: Block: crossStageBlock2 Instance: blockName1: ""
WARNING: Linking fragment stage: Matched shader interfaces are using different instance names.
vertex stage: Block: crossStageBlock2 Instance: blockName1: ""
fragment stage: Block: crossStageBlock2 Instance: blockName2: ""

Shader version: 460
Expand Down
4 changes: 2 additions & 2 deletions Test/baseResults/iomap.crossStage.vk.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ Linked geometry stage:

Linked fragment stage:

WARNING: Linking unknown stage and fragment stages: Matched shader interfaces are using different instance names.
unknown stage stage: Block: crossStageBlock2 Instance: blockName1: ""
WARNING: Linking fragment stage: Matched shader interfaces are using different instance names.
vertex stage: Block: crossStageBlock2 Instance: blockName1: ""
fragment stage: Block: crossStageBlock2 Instance: blockName2: ""

Shader version: 460
Expand Down
45 changes: 45 additions & 0 deletions Test/baseResults/iomap.mismatchedBufferTypes.vert.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
iomap.mismatchedBufferTypes.vert
Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:? Linker Objects
0:? 'blockname' (layout( column_major std140) uniform block{layout( column_major std140) uniform float a, layout( column_major std140) uniform float b})
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

iomap.mismatchedBufferTypes.frag
Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:? Linker Objects
0:? 'blockname' (layout( column_major std140) uniform block{layout( column_major std140) uniform float a})


Linked vertex stage:


Linked fragment stage:

ERROR: Linking fragment stage: vertex block member has no corresponding member in fragment block:
vertex stage: Block: crossStageBlock, Member: b
fragment stage: Block: crossStageBlock, Member: n/a

Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:? Linker Objects
0:? 'blockname' (layout( column_major std140) uniform block{layout( column_major std140) uniform float a, layout( column_major std140) uniform float b})
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:? Linker Objects
0:? 'blockname' (layout( column_major std140) uniform block{layout( column_major std140) uniform float a})

Validation failed
SPIR-V is not generated for failed compile or link
1 change: 1 addition & 0 deletions Test/baseResults/validation_fails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Test/baseResults/hlsl.struct.split.assign.frag.out
Test/baseResults/hlsl.texture.struct.frag.out
Test/baseResults/hlsl.tristream-append.geom.out
Test/baseResults/iomap.crossStage.vk.2.vert.out
Test/baseResults/iomap.mismatchedBufferTypes.vert.out
Test/baseResults/link.vk.differentPC.0.0.frag.out
Test/baseResults/link.vk.differentPC.1.0.frag.out
Test/baseResults/link.vk.pcNamingInvalid.0.0.vert.out
Expand Down
4 changes: 2 additions & 2 deletions Test/baseResults/vk.relaxed.errorcheck.vert.out
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Linked vertex stage:

Linked fragment stage:

ERROR: Linking unknown stage stage: Types must match:
a: " uniform highp 2-component vector of float" versus " uniform highp 4-component vector of float"
ERROR: Linking fragment stage: Types must match:
a: " uniform highp 2-component vector of float" in stage vertex versus " uniform highp 4-component vector of float" in stage fragment

Shader version: 460
0:? Sequence
Expand Down
10 changes: 10 additions & 0 deletions Test/iomap.mismatchedBufferTypes.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 460

// GLSL spec: Hence, the types, initializers, and any location specifiers of all statically used uniform
// variables with the same name must match across all shaders that are linked into a single program
uniform crossStageBlock {
float a;
// 2nd member from vert absent in frag
} blockname;

void main() {}
10 changes: 10 additions & 0 deletions Test/iomap.mismatchedBufferTypes.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 460

// GLSL spec: Hence, the types, initializers, and any location specifiers of all statically used uniform
// variables with the same name must match across all shaders that are linked into a single program
uniform crossStageBlock {
float a;
float b; // not present in frag
} blockname;

void main() {}
3 changes: 2 additions & 1 deletion glslang/HLSL/hlslParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ TIntermTyped* HlslParseContext::flattenAccess(long long uniqueId, int member, TS

// If this is not the final flattening, accumulate the position and return
// an object of the partially dereferenced type.
subsetSymbol = new TIntermSymbol(uniqueId, "flattenShadow", dereferencedType);
subsetSymbol = new TIntermSymbol(uniqueId, "flattenShadow", getLanguage(), dereferencedType);
subsetSymbol->setFlattenSubset(newSubset);
}

Expand Down Expand Up @@ -5806,6 +5806,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
internalAggregate->getWritableType().getQualifier().makeTemporary();
TIntermSymbol* internalSymbolNode = new TIntermSymbol(internalAggregate->getUniqueId(),
internalAggregate->getName(),
getLanguage(),
internalAggregate->getType());
internalSymbolNode->setLoc(arg->getLoc());
// This makes the deepest level, the member-wise copy
Expand Down
6 changes: 4 additions & 2 deletions glslang/Include/intermediate.h
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,8 @@ class TIntermSymbol : public TIntermTyped {
// if symbol is initialized as symbol(sym), the memory comes from the pool allocator of sym. If sym comes from
// per process threadPoolAllocator, then it causes increased memory usage per compile
// it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(long long i, const TString& n, const TType& t)
: TIntermTyped(t), id(i), flattenSubset(-1), constSubtree(nullptr) { name = n; }
TIntermSymbol(long long i, const TString& n, EShLanguage s, const TType& t)
: TIntermTyped(t), id(i), flattenSubset(-1), stage(s), constSubtree(nullptr) { name = n; }
virtual long long getId() const { return id; }
virtual void changeId(long long i) { id = i; }
virtual const TString& getName() const { return name; }
Expand All @@ -1376,11 +1376,13 @@ class TIntermSymbol : public TIntermTyped {
// This is meant for cases where a node has already been constructed, and
// later on, it becomes necessary to switch to a different symbol.
virtual void switchId(long long newId) { id = newId; }
EShLanguage getStage() const { return stage; }

protected:
long long id; // the unique id of the symbol this node represents
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
TString name; // the name of the symbol this node represents
EShLanguage stage;
TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value
TIntermTyped* constSubtree;
};
Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/Intermediate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace glslang {
TIntermSymbol* TIntermediate::addSymbol(long long id, const TString& name, const TType& type, const TConstUnionArray& constArray,
TIntermTyped* constSubtree, const TSourceLoc& loc)
{
TIntermSymbol* node = new TIntermSymbol(id, name, type);
TIntermSymbol* node = new TIntermSymbol(id, name, getStage(), type);
node->setLoc(loc);
node->setConstArray(constArray);
node->setConstSubtree(constSubtree);
Expand Down
Loading