mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
HLSL: Non-functional: Make test valid HLSL, and related comments/cleanup.
This commit is contained in:
parent
e2ff404f6b
commit
054378d988
@ -20,12 +20,12 @@ gl_FragCoord origin is upper left
|
||||
0:31 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:31 v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
|
||||
0:31 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:31 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
|
||||
0:31 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:31 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
|
||||
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
|
||||
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:30 Function Definition: PixelShaderFunction( ( temp void)
|
||||
@ -33,7 +33,7 @@ gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:30 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'input' ( temp 4-component vector of float)
|
||||
0:? 'input' (layout( location=0) in 4-component vector of float)
|
||||
0:? 'input' ( in 4-component vector of float FragCoord)
|
||||
0:30 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:30 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
||||
@ -41,10 +41,10 @@ gl_FragCoord origin is upper left
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
|
||||
0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
|
||||
0:? 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
|
||||
0:? 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:? 'input' (layout( location=0) in 4-component vector of float)
|
||||
0:? 'input' ( in 4-component vector of float FragCoord)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
@ -71,12 +71,12 @@ gl_FragCoord origin is upper left
|
||||
0:31 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:31 v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
|
||||
0:31 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:31 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
|
||||
0:31 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:31 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
|
||||
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
|
||||
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
|
||||
0:31 Constant:
|
||||
0:31 0 (const uint)
|
||||
0:30 Function Definition: PixelShaderFunction( ( temp void)
|
||||
@ -84,7 +84,7 @@ gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:30 move second child to first child ( temp 4-component vector of float)
|
||||
0:? 'input' ( temp 4-component vector of float)
|
||||
0:? 'input' (layout( location=0) in 4-component vector of float)
|
||||
0:? 'input' ( in 4-component vector of float FragCoord)
|
||||
0:30 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:30 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
|
||||
@ -92,10 +92,10 @@ gl_FragCoord origin is upper left
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
|
||||
0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
|
||||
0:? 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
|
||||
0:? 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
|
||||
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:? 'input' (layout( location=0) in 4-component vector of float)
|
||||
0:? 'input' ( in 4-component vector of float FragCoord)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
@ -110,11 +110,11 @@ gl_FragCoord origin is upper left
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 11 "@PixelShaderFunction(vf4;"
|
||||
Name 10 "input"
|
||||
Name 14 ""
|
||||
MemberName 14 0 "v1"
|
||||
Name 14 "buf1"
|
||||
MemberName 14(buf1) 0 "v1"
|
||||
Name 16 ""
|
||||
Name 23 ""
|
||||
MemberName 23 0 "v2"
|
||||
Name 23 "buf2"
|
||||
MemberName 23(buf2) 0 "v2"
|
||||
Name 25 ""
|
||||
Name 29 "cbufName"
|
||||
MemberName 29(cbufName) 0 "v3"
|
||||
@ -138,18 +138,17 @@ gl_FragCoord origin is upper left
|
||||
Name 46 "input"
|
||||
Name 49 "@entryPointOutput"
|
||||
Name 50 "param"
|
||||
MemberDecorate 14 0 Offset 0
|
||||
Decorate 14 Block
|
||||
MemberDecorate 14(buf1) 0 Offset 0
|
||||
Decorate 14(buf1) Block
|
||||
Decorate 16 DescriptorSet 0
|
||||
MemberDecorate 23 0 NonWritable
|
||||
MemberDecorate 23 0 Offset 0
|
||||
Decorate 23 BufferBlock
|
||||
MemberDecorate 23(buf2) 0 NonWritable
|
||||
MemberDecorate 23(buf2) 0 Offset 0
|
||||
Decorate 23(buf2) BufferBlock
|
||||
Decorate 25 DescriptorSet 0
|
||||
MemberDecorate 29(cbufName) 0 Offset 0
|
||||
MemberDecorate 29(cbufName) 1 Offset 20
|
||||
Decorate 29(cbufName) Block
|
||||
Decorate 31 DescriptorSet 10
|
||||
Decorate 31 Binding 2
|
||||
Decorate 31 DescriptorSet 0
|
||||
MemberDecorate 36(tbufName) 0 NonWritable
|
||||
MemberDecorate 36(tbufName) 0 Offset 16
|
||||
MemberDecorate 36(tbufName) 1 NonWritable
|
||||
@ -165,27 +164,27 @@ gl_FragCoord origin is upper left
|
||||
MemberDecorate 36(tbufName) 6 NonWritable
|
||||
MemberDecorate 36(tbufName) 6 Offset 76
|
||||
MemberDecorate 36(tbufName) 7 NonWritable
|
||||
MemberDecorate 36(tbufName) 7 Offset 80
|
||||
MemberDecorate 36(tbufName) 7 Offset 128
|
||||
MemberDecorate 36(tbufName) 8 RowMajor
|
||||
MemberDecorate 36(tbufName) 8 NonWritable
|
||||
MemberDecorate 36(tbufName) 8 Offset 96
|
||||
MemberDecorate 36(tbufName) 8 Offset 112
|
||||
MemberDecorate 36(tbufName) 8 MatrixStride 16
|
||||
MemberDecorate 36(tbufName) 9 ColMajor
|
||||
MemberDecorate 36(tbufName) 9 NonWritable
|
||||
MemberDecorate 36(tbufName) 9 Offset 160
|
||||
MemberDecorate 36(tbufName) 9 Offset 176
|
||||
MemberDecorate 36(tbufName) 9 MatrixStride 16
|
||||
MemberDecorate 36(tbufName) 10 RowMajor
|
||||
MemberDecorate 36(tbufName) 10 NonWritable
|
||||
MemberDecorate 36(tbufName) 10 Offset 208
|
||||
MemberDecorate 36(tbufName) 10 Offset 240
|
||||
MemberDecorate 36(tbufName) 10 MatrixStride 16
|
||||
MemberDecorate 36(tbufName) 11 RowMajor
|
||||
MemberDecorate 36(tbufName) 11 NonWritable
|
||||
MemberDecorate 36(tbufName) 11 Offset 272
|
||||
MemberDecorate 36(tbufName) 11 Offset 304
|
||||
MemberDecorate 36(tbufName) 11 MatrixStride 16
|
||||
Decorate 36(tbufName) BufferBlock
|
||||
Decorate 38 DescriptorSet 0
|
||||
Decorate 38 Binding 8
|
||||
Decorate 46(input) Location 0
|
||||
Decorate 46(input) BuiltIn FragCoord
|
||||
Decorate 49(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
@ -193,14 +192,14 @@ gl_FragCoord origin is upper left
|
||||
7: TypeVector 6(float) 4
|
||||
8: TypePointer Function 7(fvec4)
|
||||
9: TypeFunction 7(fvec4) 8(ptr)
|
||||
14: TypeStruct 7(fvec4)
|
||||
15: TypePointer Uniform 14(struct)
|
||||
14(buf1): TypeStruct 7(fvec4)
|
||||
15: TypePointer Uniform 14(buf1)
|
||||
16: 15(ptr) Variable Uniform
|
||||
17: TypeInt 32 1
|
||||
18: 17(int) Constant 0
|
||||
19: TypePointer Uniform 7(fvec4)
|
||||
23: TypeStruct 7(fvec4)
|
||||
24: TypePointer Uniform 23(struct)
|
||||
23(buf2): TypeStruct 7(fvec4)
|
||||
24: TypePointer Uniform 23(buf2)
|
||||
25: 24(ptr) Variable Uniform
|
||||
29(cbufName): TypeStruct 7(fvec4) 17(int)
|
||||
30: TypePointer Uniform 29(cbufName)
|
||||
|
@ -1,17 +1,17 @@
|
||||
cbuffer {
|
||||
cbuffer buf1 {
|
||||
float4 v1;
|
||||
};
|
||||
|
||||
tbuffer {
|
||||
tbuffer buf2 {
|
||||
float4 v2;
|
||||
};
|
||||
|
||||
cbuffer cbufName : register(b2, space10) {
|
||||
float4 v3;
|
||||
int i3 : packoffset(c1.y);
|
||||
cbuffer cbufName {
|
||||
float4 v3 : packoffset(c0);
|
||||
int i3 : packoffset(c1.y);
|
||||
} // no semicolon is okay
|
||||
|
||||
tbuffer tbufName : register(b8) {
|
||||
tbuffer tbufName : register(t8) {
|
||||
float4 v4 : packoffset(c1);
|
||||
int i4 : packoffset(c3);
|
||||
float f1 : packoffset(c3.w);
|
||||
@ -19,14 +19,14 @@ tbuffer tbufName : register(b8) {
|
||||
float f4 : packoffset(c4.y);
|
||||
float f5 : packoffset(c4.z);
|
||||
float f6 : packoffset(c);
|
||||
float f7;
|
||||
float3x4 m1;
|
||||
row_major float3x4 m2;
|
||||
column_major float3x4 m3;
|
||||
float3x4 m4;
|
||||
float f7 : packoffset(c8);
|
||||
float3x4 m1 : packoffset(c7);
|
||||
row_major float3x4 m2 : packoffset(c11);
|
||||
column_major float3x4 m3 : packoffset(c15);
|
||||
float3x4 m4 : packoffset(c19);
|
||||
} // no semicolon is okay
|
||||
|
||||
float4 PixelShaderFunction(float4 input) : COLOR0
|
||||
float4 PixelShaderFunction(float4 input : SV_POSITION) : SV_TARGET0
|
||||
{
|
||||
return input + v1 + v2 + v3 + v4;
|
||||
}
|
||||
|
@ -725,7 +725,9 @@ void TReflection::buildCounterIndices()
|
||||
// Returns false if the input is too malformed to do this.
|
||||
bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
|
||||
{
|
||||
if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive())
|
||||
if (intermediate.getTreeRoot() == nullptr ||
|
||||
intermediate.getNumEntryPoints() != 1 ||
|
||||
intermediate.isRecursive())
|
||||
return false;
|
||||
|
||||
buildAttributeReflection(stage, intermediate);
|
||||
|
@ -296,7 +296,8 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
|
||||
|
||||
// declaration
|
||||
// : sampler_declaration_dx9 post_decls SEMICOLON
|
||||
// | fully_specified_type declarator_list SEMICOLON(optional for cbuffer/tbuffer)
|
||||
// | fully_specified_type // for cbuffer/tbuffer
|
||||
// | fully_specified_type declarator_list SEMICOLON // for non cbuffer/tbuffer
|
||||
// | fully_specified_type identifier function_parameters post_decls compound_statement // function definition
|
||||
// | fully_specified_type identifier sampler_state post_decls compound_statement // sampler definition
|
||||
// | typedef declaration
|
||||
@ -374,7 +375,9 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
|
||||
if (! acceptFullySpecifiedType(declaredType, nodeList))
|
||||
return false;
|
||||
|
||||
// identifier
|
||||
// declarator_list
|
||||
// : declarator
|
||||
// : identifier
|
||||
HlslToken idToken;
|
||||
TIntermAggregate* initializers = nullptr;
|
||||
while (acceptIdentifier(idToken)) {
|
||||
@ -483,11 +486,10 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
|
||||
}
|
||||
}
|
||||
|
||||
if (acceptTokenClass(EHTokComma)) {
|
||||
// COMMA
|
||||
if (acceptTokenClass(EHTokComma))
|
||||
declarator_list = true;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
// The top-level initializer node is a sequence.
|
||||
if (initializers != nullptr)
|
||||
@ -1901,18 +1903,19 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
|
||||
TStorageQualifier storageQualifier = EvqTemporary;
|
||||
bool readonly = false;
|
||||
|
||||
// CBUFFER
|
||||
if (acceptTokenClass(EHTokCBuffer)) {
|
||||
// CBUFFER
|
||||
storageQualifier = EvqUniform;
|
||||
// TBUFFER
|
||||
} else if (acceptTokenClass(EHTokTBuffer)) {
|
||||
// TBUFFER
|
||||
storageQualifier = EvqBuffer;
|
||||
readonly = true;
|
||||
}
|
||||
// CLASS
|
||||
// STRUCT
|
||||
else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct))
|
||||
} else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct)) {
|
||||
// Neither CLASS nor STRUCT
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now known to be one of CBUFFER, TBUFFER, CLASS, or STRUCT
|
||||
|
||||
// IDENTIFIER
|
||||
TString structName = "";
|
||||
|
Loading…
Reference in New Issue
Block a user