Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
2fcdd64e
Commit
2fcdd64e
authored
Jun 19, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Remove support for named tbuffer/cbuffer. Fixes #939.
parent
054378d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
251 additions
and
253 deletions
+251
-253
hlsl.buffer.frag.out
Test/baseResults/hlsl.buffer.frag.out
+206
-181
hlsl.reflection.vert.out
Test/baseResults/hlsl.reflection.vert.out
+12
-20
hlsl.buffer.frag
Test/hlsl.buffer.frag
+10
-5
hlsl.reflection.vert
Test/hlsl.reflection.vert
+9
-36
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+14
-11
No files found.
Test/baseResults/hlsl.buffer.frag.out
View file @
2fcdd64e
...
@@ -2,41 +2,49 @@ hlsl.buffer.frag
...
@@ -2,41 +2,49 @@ hlsl.buffer.frag
Shader version: 500
Shader version: 500
gl_FragCoord origin is upper left
gl_FragCoord origin is upper left
0:? Sequence
0:? Sequence
0:30 Function Definition:
@PixelShaderFunction(vf4; ( temp 4-component vector of
float)
0:30 Function Definition:
foo( ( temp
float)
0:30 Function Parameters:
0:30 Function Parameters:
0:30 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:31 Branch: Return with expression
0:31 Branch: Return with expression
0:31 add ( temp 4-component vector of float)
0:31 Constant:
0:31 add ( temp 4-component vector of float)
0:31 1.000000
0:31 add ( temp 4-component vector of float)
0:35 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:31 add ( temp 4-component vector of float)
0:35 Function Parameters:
0:31 'input' ( in 4-component vector of float)
0:35 'input' ( in 4-component vector of float)
0:31 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
0:? Sequence
0:31 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:36 Branch: Return with expression
0:31 Constant:
0:36 vector-scale ( temp 4-component vector of float)
0:31 0 (const uint)
0:36 add ( temp 4-component vector of float)
0:31 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
0:36 add ( temp 4-component vector of float)
0:31 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:36 add ( temp 4-component vector of float)
0:31 Constant:
0:36 add ( temp 4-component vector of float)
0:31 0 (const uint)
0:36 'input' ( in 4-component vector of float)
0:31 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
0:36 v1: direct index for structure (layout( row_major std140) 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:36 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:31 Constant:
0:36 Constant:
0:31 0 (const uint)
0:36 0 (const uint)
0:31 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:36 v2: direct index for structure (layout( row_major std430) 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 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:36 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:31 Constant:
0:36 Constant:
0:31 0 (const uint)
0:36 0 (const uint)
0:30 Function Definition: PixelShaderFunction( ( temp void)
0:36 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
0:30 Function Parameters:
0:36 '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:36 Constant:
0:36 0 (const uint)
0:36 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:36 '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:36 Constant:
0:36 0 (const uint)
0:36 Function Call: foo( ( temp float)
0:35 Function Definition: PixelShaderFunction( ( temp void)
0:35 Function Parameters:
0:? Sequence
0:? Sequence
0:3
0
move second child to first child ( temp 4-component vector of float)
0:3
5
move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( in 4-component vector of float FragCoord)
0:? 'input' ( in 4-component vector of float FragCoord)
0:3
0
move second child to first child ( temp 4-component vector of float)
0:3
5
move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:3
0
Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:3
5
Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
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@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
...
@@ -53,41 +61,49 @@ Linked fragment stage:
...
@@ -53,41 +61,49 @@ Linked fragment stage:
Shader version: 500
Shader version: 500
gl_FragCoord origin is upper left
gl_FragCoord origin is upper left
0:? Sequence
0:? Sequence
0:30 Function Definition:
@PixelShaderFunction(vf4; ( temp 4-component vector of
float)
0:30 Function Definition:
foo( ( temp
float)
0:30 Function Parameters:
0:30 Function Parameters:
0:30 'input' ( in 4-component vector of float)
0:? Sequence
0:? Sequence
0:31 Branch: Return with expression
0:31 Branch: Return with expression
0:31 add ( temp 4-component vector of float)
0:31 Constant:
0:31 add ( temp 4-component vector of float)
0:31 1.000000
0:31 add ( temp 4-component vector of float)
0:35 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:31 add ( temp 4-component vector of float)
0:35 Function Parameters:
0:31 'input' ( in 4-component vector of float)
0:35 'input' ( in 4-component vector of float)
0:31 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
0:31 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:31 Constant:
0:31 0 (const uint)
0:31 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
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 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 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)
0:30 Function Parameters:
0:? Sequence
0:? Sequence
0:30 move second child to first child ( temp 4-component vector of float)
0:36 Branch: Return with expression
0:36 vector-scale ( temp 4-component vector of float)
0:36 add ( temp 4-component vector of float)
0:36 add ( temp 4-component vector of float)
0:36 add ( temp 4-component vector of float)
0:36 add ( temp 4-component vector of float)
0:36 'input' ( in 4-component vector of float)
0:36 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
0:36 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:36 Constant:
0:36 0 (const uint)
0:36 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
0:36 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:36 Constant:
0:36 0 (const uint)
0:36 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
0:36 '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:36 Constant:
0:36 0 (const uint)
0:36 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:36 '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:36 Constant:
0:36 0 (const uint)
0:36 Function Call: foo( ( temp float)
0:35 Function Definition: PixelShaderFunction( ( temp void)
0:35 Function Parameters:
0:? Sequence
0:35 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( in 4-component vector of float FragCoord)
0:? 'input' ( in 4-component vector of float FragCoord)
0:3
0
move second child to first child ( temp 4-component vector of float)
0:3
5
move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:3
0
Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:3
5
Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
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@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
...
@@ -99,146 +115,155 @@ gl_FragCoord origin is upper left
...
@@ -99,146 +115,155 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by
53
// Id's are bound by
61
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction"
46 49
EntryPoint Fragment 4 "PixelShaderFunction"
54 57
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Source HLSL 500
Name 4 "PixelShaderFunction"
Name 4 "PixelShaderFunction"
Name 11 "@PixelShaderFunction(vf4;"
Name 8 "foo("
Name 10 "input"
Name 14 "@PixelShaderFunction(vf4;"
Name 14 "buf1"
Name 13 "input"
MemberName 14(buf1) 0 "v1"
Name 20 "buf1"
Name 16 ""
MemberName 20(buf1) 0 "v1"
Name 23 "buf2"
Name 22 ""
MemberName 23(buf2) 0 "v2"
Name 29 "buf2"
Name 25 ""
MemberName 29(buf2) 0 "v2"
Name 29 "cbufName"
MemberName 29(cbufName) 0 "v3"
MemberName 29(cbufName) 1 "i3"
Name 31 ""
Name 31 ""
Name 3
6 "t
bufName"
Name 3
5 "c
bufName"
MemberName 3
6(tbufName) 0 "v4
"
MemberName 3
5(cbufName) 0 "v3
"
MemberName 3
6(tbufName) 1 "i4
"
MemberName 3
5(cbufName) 1 "i3
"
MemberName 36(tbufName) 2 "f1
"
Name 37 "
"
MemberName 36(tbufName) 3 "f3
"
Name 42 "tbufName
"
MemberName
36(tbufName) 4 "f
4"
MemberName
42(tbufName) 0 "v
4"
MemberName
36(tbufName) 5 "f5
"
MemberName
42(tbufName) 1 "i4
"
MemberName
36(tbufName) 6 "f6
"
MemberName
42(tbufName) 2 "f1
"
MemberName
36(tbufName) 7 "f7
"
MemberName
42(tbufName) 3 "f3
"
MemberName
36(tbufName) 8 "m1
"
MemberName
42(tbufName) 4 "f4
"
MemberName
36(tbufName) 9 "m2
"
MemberName
42(tbufName) 5 "f5
"
MemberName
36(tbufName) 10 "m3
"
MemberName
42(tbufName) 6 "f6
"
MemberName
36(tbufName) 11 "m4
"
MemberName
42(tbufName) 7 "f7
"
Name 38 "
"
MemberName 42(tbufName) 8 "m1
"
Name 44 "input
"
MemberName 42(tbufName) 9 "m2
"
Name 46 "input
"
MemberName 42(tbufName) 10 "m3
"
Name 49 "@entryPointOutput
"
MemberName 42(tbufName) 11 "m4
"
Name
50 "param
"
Name
44 "
"
MemberDecorate 14(buf1) 0 Offset 0
Name 52 "input"
Decorate 14(buf1) Block
Name 54 "input"
Decorate 16 DescriptorSet 0
Name 57 "@entryPointOutput"
MemberDecorate 23(buf2) 0 NonWritable
Name 58 "param"
MemberDecorate 2
3(buf2
) 0 Offset 0
MemberDecorate 2
0(buf1
) 0 Offset 0
Decorate 2
3(buf2) Buffer
Block
Decorate 2
0(buf1)
Block
Decorate 2
5
DescriptorSet 0
Decorate 2
2
DescriptorSet 0
MemberDecorate 29(
cbufName) 0 Offset 0
MemberDecorate 29(
buf2) 0 NonWritable
MemberDecorate 29(
cbufName) 1 Offset 2
0
MemberDecorate 29(
buf2) 0 Offset
0
Decorate 29(
cbufName)
Block
Decorate 29(
buf2) Buffer
Block
Decorate 31 DescriptorSet 0
Decorate 31 DescriptorSet 0
MemberDecorate 36(tbufName) 0 NonWritable
MemberDecorate 35(cbufName) 0 Offset 0
MemberDecorate 36(tbufName) 0 Offset 16
MemberDecorate 35(cbufName) 1 Offset 20
MemberDecorate 36(tbufName) 1 NonWritable
Decorate 35(cbufName) Block
MemberDecorate 36(tbufName) 1 Offset 48
Decorate 37 DescriptorSet 0
MemberDecorate 36(tbufName) 2 NonWritable
MemberDecorate 42(tbufName) 0 NonWritable
MemberDecorate 36(tbufName) 2 Offset 60
MemberDecorate 42(tbufName) 0 Offset 16
MemberDecorate 36(tbufName) 3 NonWritable
MemberDecorate 42(tbufName) 1 NonWritable
MemberDecorate 36(tbufName) 3 Offset 64
MemberDecorate 42(tbufName) 1 Offset 48
MemberDecorate 36(tbufName) 4 NonWritable
MemberDecorate 42(tbufName) 2 NonWritable
MemberDecorate 36(tbufName) 4 Offset 68
MemberDecorate 42(tbufName) 2 Offset 60
MemberDecorate 36(tbufName) 5 NonWritable
MemberDecorate 42(tbufName) 3 NonWritable
MemberDecorate 36(tbufName) 5 Offset 72
MemberDecorate 42(tbufName) 3 Offset 64
MemberDecorate 36(tbufName) 6 NonWritable
MemberDecorate 42(tbufName) 4 NonWritable
MemberDecorate 36(tbufName) 6 Offset 76
MemberDecorate 42(tbufName) 4 Offset 68
MemberDecorate 36(tbufName) 7 NonWritable
MemberDecorate 42(tbufName) 5 NonWritable
MemberDecorate 36(tbufName) 7 Offset 128
MemberDecorate 42(tbufName) 5 Offset 72
MemberDecorate 36(tbufName) 8 RowMajor
MemberDecorate 42(tbufName) 6 NonWritable
MemberDecorate 36(tbufName) 8 NonWritable
MemberDecorate 42(tbufName) 6 Offset 76
MemberDecorate 36(tbufName) 8 Offset 112
MemberDecorate 42(tbufName) 7 NonWritable
MemberDecorate 36(tbufName) 8 MatrixStride 16
MemberDecorate 42(tbufName) 7 Offset 128
MemberDecorate 36(tbufName) 9 ColMajor
MemberDecorate 42(tbufName) 8 RowMajor
MemberDecorate 36(tbufName) 9 NonWritable
MemberDecorate 42(tbufName) 8 NonWritable
MemberDecorate 36(tbufName) 9 Offset 176
MemberDecorate 42(tbufName) 8 Offset 112
MemberDecorate 36(tbufName) 9 MatrixStride 16
MemberDecorate 42(tbufName) 8 MatrixStride 16
MemberDecorate 36(tbufName) 10 RowMajor
MemberDecorate 42(tbufName) 9 ColMajor
MemberDecorate 36(tbufName) 10 NonWritable
MemberDecorate 42(tbufName) 9 NonWritable
MemberDecorate 36(tbufName) 10 Offset 240
MemberDecorate 42(tbufName) 9 Offset 176
MemberDecorate 36(tbufName) 10 MatrixStride 16
MemberDecorate 42(tbufName) 9 MatrixStride 16
MemberDecorate 36(tbufName) 11 RowMajor
MemberDecorate 42(tbufName) 10 RowMajor
MemberDecorate 36(tbufName) 11 NonWritable
MemberDecorate 42(tbufName) 10 NonWritable
MemberDecorate 36(tbufName) 11 Offset 304
MemberDecorate 42(tbufName) 10 Offset 240
MemberDecorate 36(tbufName) 11 MatrixStride 16
MemberDecorate 42(tbufName) 10 MatrixStride 16
Decorate 36(tbufName) BufferBlock
MemberDecorate 42(tbufName) 11 RowMajor
Decorate 38 DescriptorSet 0
MemberDecorate 42(tbufName) 11 NonWritable
Decorate 38 Binding 8
MemberDecorate 42(tbufName) 11 Offset 304
Decorate 46(input) BuiltIn FragCoord
MemberDecorate 42(tbufName) 11 MatrixStride 16
Decorate 49(@entryPointOutput) Location 0
Decorate 42(tbufName) BufferBlock
Decorate 44 DescriptorSet 0
Decorate 44 Binding 8
Decorate 54(input) BuiltIn FragCoord
Decorate 57(@entryPointOutput) Location 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeFloat 32
6: TypeFloat 32
7: TypeVector 6(float) 4
7: TypeFunction 6(float)
8: TypePointer Function 7(fvec4)
10: TypeVector 6(float) 4
9: TypeFunction 7(fvec4) 8(ptr)
11: TypePointer Function 10(fvec4)
14(buf1): TypeStruct 7(fvec4)
12: TypeFunction 10(fvec4) 11(ptr)
15: TypePointer Uniform 14(buf1)
16: 6(float) Constant 1065353216
16: 15(ptr) Variable Uniform
20(buf1): TypeStruct 10(fvec4)
17: TypeInt 32 1
21: TypePointer Uniform 20(buf1)
18: 17(int) Constant 0
22: 21(ptr) Variable Uniform
19: TypePointer Uniform 7(fvec4)
23: TypeInt 32 1
23(buf2): TypeStruct 7(fvec4)
24: 23(int) Constant 0
24: TypePointer Uniform 23(buf2)
25: TypePointer Uniform 10(fvec4)
25: 24(ptr) Variable Uniform
29(buf2): TypeStruct 10(fvec4)
29(cbufName): TypeStruct 7(fvec4) 17(int)
30: TypePointer Uniform 29(buf2)
30: TypePointer Uniform 29(cbufName)
31: 30(ptr) Variable Uniform
31: 30(ptr) Variable Uniform
35: TypeMatrix 7(fvec4) 3
35(cbufName): TypeStruct 10(fvec4) 23(int)
36(tbufName): TypeStruct 7(fvec4) 17(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 35 35 35 35
36: TypePointer Uniform 35(cbufName)
37: TypePointer Uniform 36(tbufName)
37: 36(ptr) Variable Uniform
38: 37(ptr) Variable Uniform
41: TypeMatrix 10(fvec4) 3
45: TypePointer Input 7(fvec4)
42(tbufName): TypeStruct 10(fvec4) 23(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 41 41 41 41
46(input): 45(ptr) Variable Input
43: TypePointer Uniform 42(tbufName)
48: TypePointer Output 7(fvec4)
44: 43(ptr) Variable Uniform
49(@entryPointOutput): 48(ptr) Variable Output
53: TypePointer Input 10(fvec4)
54(input): 53(ptr) Variable Input
56: TypePointer Output 10(fvec4)
57(@entryPointOutput): 56(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
4(PixelShaderFunction): 2 Function None 3
5: Label
5: Label
44(input): 8
(ptr) Variable Function
52(input): 11
(ptr) Variable Function
5
0(param): 8
(ptr) Variable Function
5
8(param): 11
(ptr) Variable Function
47: 7(fvec4) Load 46
(input)
55: 10(fvec4) Load 54
(input)
Store
44(input) 47
Store
52(input) 55
5
1: 7(fvec4) Load 44
(input)
5
9: 10(fvec4) Load 52
(input)
Store 5
0(param) 51
Store 5
8(param) 59
52: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 50
(param)
60: 10(fvec4) FunctionCall 14(@PixelShaderFunction(vf4;) 58
(param)
Store
49(@entryPointOutput) 52
Store
57(@entryPointOutput) 60
Return
Return
FunctionEnd
FunctionEnd
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
8(foo(): 6(float) Function None 7
10(input): 8(ptr) FunctionParameter
9: Label
12: Label
ReturnValue 16
13: 7(fvec4) Load 10(input)
FunctionEnd
20: 19(ptr) AccessChain 16 18
14(@PixelShaderFunction(vf4;): 10(fvec4) Function None 12
21: 7(fvec4) Load 20
13(input): 11(ptr) FunctionParameter
22: 7(fvec4) FAdd 13 21
15: Label
26: 19(ptr) AccessChain 25 18
19: 10(fvec4) Load 13(input)
27: 7(fvec4) Load 26
26: 25(ptr) AccessChain 22 24
28: 7(fvec4) FAdd 22 27
27: 10(fvec4) Load 26
32: 19(ptr) AccessChain 31 18
28: 10(fvec4) FAdd 19 27
33: 7(fvec4) Load 32
32: 25(ptr) AccessChain 31 24
34: 7(fvec4) FAdd 28 33
33: 10(fvec4) Load 32
39: 19(ptr) AccessChain 38 18
34: 10(fvec4) FAdd 28 33
40: 7(fvec4) Load 39
38: 25(ptr) AccessChain 37 24
41: 7(fvec4) FAdd 34 40
39: 10(fvec4) Load 38
ReturnValue 41
40: 10(fvec4) FAdd 34 39
45: 25(ptr) AccessChain 44 24
46: 10(fvec4) Load 45
47: 10(fvec4) FAdd 40 46
48: 6(float) FunctionCall 8(foo()
49: 10(fvec4) VectorTimesScalar 47 48
ReturnValue 49
FunctionEnd
FunctionEnd
Test/baseResults/hlsl.reflection.vert.out
View file @
2fcdd64e
...
@@ -2,26 +2,19 @@ hlsl.reflection.vert
...
@@ -2,26 +2,19 @@ hlsl.reflection.vert
Uniform reflection:
Uniform reflection:
anonMember3: offset 80, type 8b52, size 1, index 0, binding -1
anonMember3: offset 80, type 8b52, size 1, index 0, binding -1
s.a: offset 0, type 1404, size 1, index 1, binding -1
s.a: offset 0, type 1404, size 1, index 1, binding -1
ablock.scalar: offset 12, type 1404, size 1, index 2, binding -1
m23: offset 16, type 8b67, size 1, index 0, binding -1
m23: offset 16, type 8b67, size 1, index 0, binding -1
scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1
scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1
c_m23: offset 16, type 8b67, size 1, index
3
, binding -1
c_m23: offset 16, type 8b67, size 1, index
2
, binding -1
c_scalarAfterm23: offset 48, type 1404, size 1, index
3
, binding -1
c_scalarAfterm23: offset 48, type 1404, size 1, index
2
, binding -1
scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1
scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1
floatArray: offset 112, type 1406, size 5, index 0, binding -1
floatArray: offset 112, type 1406, size 5, index 0, binding -1
scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1
scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1
ablock.memfloat2: offset 48, type 8b50, size 1, index 2, binding -1
m22: offset 208, type 8b5a, size 9, index 0, binding -1
ablock.memf1: offset 56, type 1406, size 1, index 2, binding -1
ablock.memf2: offset 60, type 8b56, size 1, index 2, binding -1
ablock.memf3: offset 64, type 1404, size 1, index 2, binding -1
ablock.memfloat2a: offset 72, type 8b50, size 1, index 2, binding -1
ablock.m22: offset 80, type 8b5a, size 7, index 2, binding -1
dm22: offset 32, type 8b5a, size 4, index 1, binding -1
dm22: offset 32, type 8b5a, size 4, index 1, binding -1
m22: offset 208, type 8b5a, size 3, index 0, binding -1
foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1
nest.foo.n1.a: offset 0, type 1406, size 1, index 4, binding -1
foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1
nest.foo.n2.b: offset 16, type 1406, size 1, index 4, binding -1
foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1
nest.foo.n2.c: offset 20, type 1406, size 1, index 4, binding -1
foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1
nest.foo.n2.d: offset 24, type 1406, size 1, index 4, binding -1
deepA.d2.d1[2].va: offset 376, type 8b50, size 2, index 1, binding -1
deepA.d2.d1[2].va: offset 376, type 8b50, size 2, index 1, binding -1
deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1
deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1
deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1
deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1
...
@@ -61,19 +54,18 @@ deepD[1].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1
...
@@ -61,19 +54,18 @@ deepD[1].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1
deepD[1].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1
deepD[1].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1
deepD[1].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1
deepD[1].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1
deepD[1].v3: offset 2480, type 8b54, size 1, index 1, binding -1
deepD[1].v3: offset 2480, type 8b54, size 1, index 1, binding -1
arrBl.foo: offset 0, type 1406, size 1, index 5
, binding -1
foo1: offset 0, type 1406, size 1, index 4
, binding -1
arrBl2.foo: offset 0, type 1406, size 1, index 6
, binding -1
foo2: offset 0, type 1406, size 1, index 5
, binding -1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
uf1: offset 16, type 1406, size 1, index 1, binding -1
uf1: offset 16, type 1406, size 1, index 1, binding -1
Uniform block reflection:
Uniform block reflection:
nameless: offset -1, type ffffffff, size 496, index -1, binding -1
nameless: offset -1, type ffffffff, size 496, index -1, binding -1
$Global: offset -1, type ffffffff, size 3088, index -1, binding -1
$Global: offset -1, type ffffffff, size 3088, index -1, binding -1
ablock: offset -1, type ffffffff, size 304, index -1, binding -1
c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1
c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1
nest: offset -1, type ffffffff, size 32, index -1, binding -1
nest
ed
: offset -1, type ffffffff, size 32, index -1, binding -1
a
rrB
l: offset -1, type ffffffff, size 4, index -1, binding -1
a
b
l: offset -1, type ffffffff, size 4, index -1, binding -1
a
rrB
l2: offset -1, type ffffffff, size 4, index -1, binding -1
a
b
l2: offset -1, type ffffffff, size 4, index -1, binding -1
Vertex attribute reflection:
Vertex attribute reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
...
...
Test/hlsl.buffer.frag
View file @
2fcdd64e
cbuffer
buf1
{
cbuffer
buf1
{
float4
v1
;
float4
v1
;
};
};
// extraneous ;
tbuffer
buf2
{
tbuffer
buf2
{
float4
v2
;
float4
v2
;
};
};
// extraneous ;
cbuffer
cbufName
{
cbuffer
cbufName
{
float4
v3
:
packoffset
(
c0
);
float4
v3
:
packoffset
(
c0
);
int
i3
:
packoffset
(
c1
.
y
);
int
i3
:
packoffset
(
c1
.
y
);
}
// no semicolon is okay
}
tbuffer
tbufName
:
register
(
t8
)
{
tbuffer
tbufName
:
register
(
t8
)
{
float4
v4
:
packoffset
(
c1
);
float4
v4
:
packoffset
(
c1
);
...
@@ -24,9 +24,14 @@ tbuffer tbufName : register(t8) {
...
@@ -24,9 +24,14 @@ tbuffer tbufName : register(t8) {
row_major
float3x4
m2
:
packoffset
(
c11
);
row_major
float3x4
m2
:
packoffset
(
c11
);
column_major
float3x4
m3
:
packoffset
(
c15
);
column_major
float3x4
m3
:
packoffset
(
c15
);
float3x4
m4
:
packoffset
(
c19
);
float3x4
m4
:
packoffset
(
c19
);
}
// no semicolon is okay
}
float
foo
()
// float looks like identifier, but can't be part of tbuffer
{
return
1
.
0
;
}
float4
PixelShaderFunction
(
float4
input
:
SV_POSITION
)
:
SV_TARGET0
float4
PixelShaderFunction
(
float4
input
:
SV_POSITION
)
:
SV_TARGET0
{
{
return
input
+
v1
+
v2
+
v3
+
v4
;
return
(
input
+
v1
+
v2
+
v3
+
v4
)
*
foo
()
;
}
}
Test/hlsl.reflection.vert
View file @
2fcdd64e
...
@@ -19,27 +19,10 @@ cbuffer c_nameless {
...
@@ -19,27 +19,10 @@ cbuffer c_nameless {
float4
c_anonMember3
;
float4
c_anonMember3
;
};
};
cbuffer
named
{
float3
deadMember1
;
int
scalar
;
float4
member2
;
float4
member3
;
float2
memfloat2
;
float
memf1
;
bool
memf2
;
int
memf3
;
float2
memfloat2a
;
float2x2
m22
[
7
];
}
ablock
;
cbuffer
namelessdead
{
cbuffer
namelessdead
{
int
a
;
int
a
;
};
};
cbuffer
namedDead
{
int
b
;
}
bblock
;
struct
N1
{
struct
N1
{
float
a
;
float
a
;
};
};
...
@@ -57,7 +40,7 @@ struct N3 {
...
@@ -57,7 +40,7 @@ struct N3 {
cbuffer
nested
{
cbuffer
nested
{
N3
foo
;
N3
foo
;
}
nest
;
}
struct
TS
{
struct
TS
{
int
a
;
int
a
;
...
@@ -89,16 +72,12 @@ struct deep3 {
...
@@ -89,16 +72,12 @@ struct deep3 {
int3
v3
;
int3
v3
;
};
};
uniform
deep3
deepA
[
2
],
deepB
[
2
],
deepC
[
3
],
deepD
[
2
];
uniform
deep3
deepA
[
2
],
deepB
[
2
],
deepC
[
3
],
deepD
[
2
];
const
bool
control
=
true
;
const
bool
control
=
true
;
void
deadFunction
()
void
deadFunction
()
{
{
float3
v3
=
ablock
.
deadMember1
;
float4
v
=
anonDeadMember2
;
float4
v
=
anonDeadMember2
;
float
f
=
ufDead4
;
float
f
=
ufDead4
;
}
}
...
@@ -110,12 +89,12 @@ void liveFunction2()
...
@@ -110,12 +89,12 @@ void liveFunction2()
}
}
tbuffer
abl
{
tbuffer
abl
{
float
foo
;
float
foo
1
;
}
arrBl
;
}
tbuffer
abl2
{
tbuffer
abl2
{
float
foo
;
float
foo
2
;
}
arrBl2
;
}
void
flizv
(
in
float
attributeFloat
,
in
float2
attributeFloat2
,
in
float3
attributeFloat3
,
in
float4
attributeFloat4
,
in
float4x4
attributeMat4
)
void
flizv
(
in
float
attributeFloat
,
in
float2
attributeFloat2
,
in
float3
attributeFloat3
,
in
float4
attributeFloat4
,
in
float4x4
attributeMat4
)
{
{
...
@@ -130,22 +109,16 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
...
@@ -130,22 +109,16 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
liveFunction2
();
liveFunction2
();
f
=
anonMember3
.
z
;
f
=
anonMember3
.
z
;
f
=
s
.
a
;
f
=
s
.
a
;
f
=
ablock
.
scalar
;
f
=
m23
[
1
].
y
+
scalarAfterm23
;
f
=
m23
[
1
].
y
+
scalarAfterm23
;
f
=
c_m23
[
1
].
y
+
c_scalarAfterm23
;
f
=
c_m23
[
1
].
y
+
c_scalarAfterm23
;
f
+=
scalarBeforeArray
;
f
+=
scalarBeforeArray
;
f
+=
floatArray
[
2
];
f
+=
floatArray
[
2
];
f
+=
floatArray
[
4
];
f
+=
floatArray
[
4
];
f
+=
scalarAfterArray
;
f
+=
scalarAfterArray
;
f
+=
ablock
.
memfloat2
.
x
;
f
+=
m22
[
i
][
1
][
0
];
f
+=
ablock
.
memf1
;
f
+=
float
(
ablock
.
memf2
);
f
+=
ablock
.
memf3
;
f
+=
ablock
.
memfloat2a
.
y
;
f
+=
ablock
.
m22
[
i
][
1
][
0
];
f
+=
dm22
[
3
][
0
][
1
];
f
+=
dm22
[
3
][
0
][
1
];
f
+=
m22
[
2
][
1
].
y
;
f
+=
m22
[
2
][
1
].
y
;
f
+=
nest
.
foo
.
n1
.
a
+
nest
.
foo
.
n2
.
b
+
nest
.
foo
.
n2
.
c
+
nest
.
foo
.
n2
.
d
;
f
+=
foo
.
n1
.
a
+
foo
.
n2
.
b
+
foo
.
n2
.
c
+
foo
.
n2
.
d
;
f
+=
deepA
[
i
].
d2
.
d1
[
2
].
va
[
1
].
x
;
f
+=
deepA
[
i
].
d2
.
d1
[
2
].
va
[
1
].
x
;
f
+=
deepB
[
1
].
d2
.
d1
[
i
].
va
[
1
].
x
;
f
+=
deepB
[
1
].
d2
.
d1
[
i
].
va
[
1
].
x
;
f
+=
deepB
[
i
].
d2
.
d1
[
i
].
va
[
1
].
x
;
f
+=
deepB
[
i
].
d2
.
d1
[
i
].
va
[
1
].
x
;
...
@@ -154,8 +127,8 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
...
@@ -154,8 +127,8 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
}
else
}
else
f
=
ufDead3
;
f
=
ufDead3
;
f
+=
arrBl
.
foo
+
arrBl
.
foo
;
f
+=
foo1
+
foo2
;
f
+=
arrBl2
.
foo
;
f
+=
foo2
;
f
+=
attributeFloat
;
f
+=
attributeFloat
;
f
+=
attributeFloat2
.
x
;
f
+=
attributeFloat2
.
x
;
...
...
hlsl/hlslGrammar.cpp
View file @
2fcdd64e
...
@@ -371,10 +371,16 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
...
@@ -371,10 +371,16 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
// if (acceptSamplerDeclarationDX9(declaredType))
// if (acceptSamplerDeclarationDX9(declaredType))
// return true;
// return true;
bool
forbidDeclarators
=
(
peekTokenClass
(
EHTokCBuffer
)
||
peekTokenClass
(
EHTokTBuffer
));
// fully_specified_type
// fully_specified_type
if
(
!
acceptFullySpecifiedType
(
declaredType
,
nodeList
))
if
(
!
acceptFullySpecifiedType
(
declaredType
,
nodeList
))
return
false
;
return
false
;
// cbuffer and tbuffer end with the closing '}'.
// No semicolon is included.
if
(
forbidDeclarators
)
return
true
;
// declarator_list
// declarator_list
// : declarator
// : declarator
// : identifier
// : identifier
...
@@ -489,7 +495,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
...
@@ -489,7 +495,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
// COMMA
// COMMA
if
(
acceptTokenClass
(
EHTokComma
))
if
(
acceptTokenClass
(
EHTokComma
))
declarator_list
=
true
;
declarator_list
=
true
;
}
}
// The top-level initializer node is a sequence.
// The top-level initializer node is a sequence.
if
(
initializers
!=
nullptr
)
if
(
initializers
!=
nullptr
)
...
@@ -501,18 +507,15 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
...
@@ -501,18 +507,15 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
else
else
nodeList
=
initializers
;
nodeList
=
initializers
;
// SEMICOLON
(optional for cbuffer/tbuffer)
// SEMICOLON
if
(
!
acceptTokenClass
(
EHTokSemicolon
))
{
if
(
!
acceptTokenClass
(
EHTokSemicolon
))
{
// This may have been a false detection of what appeared to be a declaration, but
// was actually an assignment such as "float = 4", where "float" is an identifier.
// We put the token back to let further parsing happen for cases where that may
// happen. This errors on the side of caution, and mostly triggers the error.
if
(
peek
()
==
EHTokAssign
||
peek
()
==
EHTokLeftBracket
||
peek
()
==
EHTokDot
||
peek
()
==
EHTokComma
)
{
if
(
peek
()
==
EHTokAssign
||
peek
()
==
EHTokLeftBracket
||
peek
()
==
EHTokDot
||
peek
()
==
EHTokComma
)
{
// This may have been a false detection of what appeared to be a declaration, but
// was actually an assignment such as "float = 4", where "float" is an identifier.
// We put the token back to let further parsing happen for cases where that may
// happen. This errors on the side of caution, and mostly triggers the error.
recedeToken
();
recedeToken
();
return
false
;
return
false
;
}
else
if
(
declaredType
.
getBasicType
()
==
EbtBlock
)
{
// cbuffer, et. al. (but not struct) don't have an ending semicolon
return
true
;
}
else
{
}
else
{
expected
(
";"
);
expected
(
";"
);
return
false
;
return
false
;
...
@@ -1904,10 +1907,10 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
...
@@ -1904,10 +1907,10 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
bool
readonly
=
false
;
bool
readonly
=
false
;
if
(
acceptTokenClass
(
EHTokCBuffer
))
{
if
(
acceptTokenClass
(
EHTokCBuffer
))
{
// CBUFFER
// CBUFFER
storageQualifier
=
EvqUniform
;
storageQualifier
=
EvqUniform
;
}
else
if
(
acceptTokenClass
(
EHTokTBuffer
))
{
}
else
if
(
acceptTokenClass
(
EHTokTBuffer
))
{
// TBUFFER
// TBUFFER
storageQualifier
=
EvqBuffer
;
storageQualifier
=
EvqBuffer
;
readonly
=
true
;
readonly
=
true
;
}
else
if
(
!
acceptTokenClass
(
EHTokClass
)
&&
!
acceptTokenClass
(
EHTokStruct
))
{
}
else
if
(
!
acceptTokenClass
(
EHTokClass
)
&&
!
acceptTokenClass
(
EHTokStruct
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment