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
621c0e3d
Commit
621c0e3d
authored
Mar 06, 2017
by
John Kessenich
Committed by
GitHub
Mar 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #755 from steve-lunarg/sb-orderfix
HLSL: Fix ordering defect if global SB decl after fn param
parents
33f85b6e
40efe5ce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
102 deletions
+98
-102
hlsl.structbuffer.fn.frag.out
Test/baseResults/hlsl.structbuffer.fn.frag.out
+92
-92
hlsl.structbuffer.fn.frag
Test/hlsl.structbuffer.fn.frag
+5
-4
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+0
-6
No files found.
Test/baseResults/hlsl.structbuffer.fn.frag.out
View file @
621c0e3d
...
...
@@ -2,59 +2,59 @@ hlsl.structbuffer.fn.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:
9
Function Definition: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:
9
Function Parameters:
0:
9
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
9
'bufferOffset' (in uint)
0:
5
Function Definition: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:
5
Function Parameters:
0:
5
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
5
'bufferOffset' (in uint)
0:? Sequence
0:
10
Branch: Return with expression
0:
10
indirect index (layout(row_major std430 ) buffer 4-component vector of uint)
0:
10
@data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint)
0:
10
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
10
Constant:
0:
10
0 (const uint)
0:
10
'bufferOffset' (in uint)
0:1
4
Function Definition: set(block--vu4[0]1;u1;vu4; (temp void)
0:1
4
Function Parameters:
0:1
4
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
4
'bufferOffset' (in uint)
0:1
4
'data' (in 4-component vector of uint)
0:
6
Branch: Return with expression
0:
6
indirect index (layout(row_major std430 ) buffer 4-component vector of uint)
0:
6
@data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint)
0:
6
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
6
Constant:
0:
6
0 (const uint)
0:
6
'bufferOffset' (in uint)
0:1
0
Function Definition: set(block--vu4[0]1;u1;vu4; (temp void)
0:1
0
Function Parameters:
0:1
0
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
0
'bufferOffset' (in uint)
0:1
0
'data' (in 4-component vector of uint)
0:? Sequence
0:1
5
move second child to first child (temp 4-component vector of uint)
0:1
5 indirect index (layout(row_major std430 )
buffer 4-component vector of uint)
0:1
5 @data: direct index for structure (layout(row_major std430 )
buffer implicitly-sized array of 4-component vector of uint)
0:1
5
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
5
Constant:
0:1
5
0 (const uint)
0:1
5
'bufferOffset' (in uint)
0:1
5
'data' (in 4-component vector of uint)
0:
19
Function Definition: @main(u1; (temp 4-component vector of float)
0:
19
Function Parameters:
0:
19
'pos' (in uint)
0:1
1
move second child to first child (temp 4-component vector of uint)
0:1
1 indirect index (
buffer 4-component vector of uint)
0:1
1 @data: direct index for structure (
buffer implicitly-sized array of 4-component vector of uint)
0:1
1
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
1
Constant:
0:1
1
0 (const uint)
0:1
1
'bufferOffset' (in uint)
0:1
1
'data' (in 4-component vector of uint)
0:
20
Function Definition: @main(u1; (temp 4-component vector of float)
0:
20
Function Parameters:
0:
20
'pos' (in uint)
0:? Sequence
0:2
0
Function Call: set(block--vu4[0]1;u1;vu4; (temp void)
0:2
0
'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
0
Constant:
0:2
0
2 (const uint)
0:2
0
Function Call: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:2
0
'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
0
Constant:
0:2
0
3 (const uint)
0:2
2
Branch: Return with expression
0:2
2
Constant:
0:2
2
0.000000
0:2
2
0.000000
0:2
2
0.000000
0:2
2
0.000000
0:
19
Function Definition: main( (temp void)
0:
19
Function Parameters:
0:2
1
Function Call: set(block--vu4[0]1;u1;vu4; (temp void)
0:2
1
'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
1
Constant:
0:2
1
2 (const uint)
0:2
1
Function Call: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:2
1
'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
1
Constant:
0:2
1
3 (const uint)
0:2
3
Branch: Return with expression
0:2
3
Constant:
0:2
3
0.000000
0:2
3
0.000000
0:2
3
0.000000
0:2
3
0.000000
0:
20
Function Definition: main( (temp void)
0:
20
Function Parameters:
0:? Sequence
0:
19
move second child to first child (temp uint)
0:
20
move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:
19
move second child to first child (temp 4-component vector of float)
0:
20
move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:
19
Function Call: @main(u1; (temp 4-component vector of float)
0:
20
Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
...
...
@@ -70,59 +70,59 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:
9
Function Definition: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:
9
Function Parameters:
0:
9
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
9
'bufferOffset' (in uint)
0:
5
Function Definition: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:
5
Function Parameters:
0:
5
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
5
'bufferOffset' (in uint)
0:? Sequence
0:
10
Branch: Return with expression
0:
10
indirect index (layout(row_major std430 ) buffer 4-component vector of uint)
0:
10
@data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint)
0:
10
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
10
Constant:
0:
10
0 (const uint)
0:
10
'bufferOffset' (in uint)
0:1
4
Function Definition: set(block--vu4[0]1;u1;vu4; (temp void)
0:1
4
Function Parameters:
0:1
4
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
4
'bufferOffset' (in uint)
0:1
4
'data' (in 4-component vector of uint)
0:
6
Branch: Return with expression
0:
6
indirect index (layout(row_major std430 ) buffer 4-component vector of uint)
0:
6
@data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint)
0:
6
'sb' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:
6
Constant:
0:
6
0 (const uint)
0:
6
'bufferOffset' (in uint)
0:1
0
Function Definition: set(block--vu4[0]1;u1;vu4; (temp void)
0:1
0
Function Parameters:
0:1
0
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
0
'bufferOffset' (in uint)
0:1
0
'data' (in 4-component vector of uint)
0:? Sequence
0:1
5
move second child to first child (temp 4-component vector of uint)
0:1
5 indirect index (layout(row_major std430 )
buffer 4-component vector of uint)
0:1
5 @data: direct index for structure (layout(row_major std430 )
buffer implicitly-sized array of 4-component vector of uint)
0:1
5
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
5
Constant:
0:1
5
0 (const uint)
0:1
5
'bufferOffset' (in uint)
0:1
5
'data' (in 4-component vector of uint)
0:
19
Function Definition: @main(u1; (temp 4-component vector of float)
0:
19
Function Parameters:
0:
19
'pos' (in uint)
0:1
1
move second child to first child (temp 4-component vector of uint)
0:1
1 indirect index (
buffer 4-component vector of uint)
0:1
1 @data: direct index for structure (
buffer implicitly-sized array of 4-component vector of uint)
0:1
1
'sb' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:1
1
Constant:
0:1
1
0 (const uint)
0:1
1
'bufferOffset' (in uint)
0:1
1
'data' (in 4-component vector of uint)
0:
20
Function Definition: @main(u1; (temp 4-component vector of float)
0:
20
Function Parameters:
0:
20
'pos' (in uint)
0:? Sequence
0:2
0
Function Call: set(block--vu4[0]1;u1;vu4; (temp void)
0:2
0
'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
0
Constant:
0:2
0
2 (const uint)
0:2
0
Function Call: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:2
0
'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
0
Constant:
0:2
0
3 (const uint)
0:2
2
Branch: Return with expression
0:2
2
Constant:
0:2
2
0.000000
0:2
2
0.000000
0:2
2
0.000000
0:2
2
0.000000
0:
19
Function Definition: main( (temp void)
0:
19
Function Parameters:
0:2
1
Function Call: set(block--vu4[0]1;u1;vu4; (temp void)
0:2
1
'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
1
Constant:
0:2
1
2 (const uint)
0:2
1
Function Call: get(block--vu4[0]1;u1; (temp 4-component vector of uint)
0:2
1
'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
0:2
1
Constant:
0:2
1
3 (const uint)
0:2
3
Branch: Return with expression
0:2
3
Constant:
0:2
3
0.000000
0:2
3
0.000000
0:2
3
0.000000
0:2
3
0.000000
0:
20
Function Definition: main( (temp void)
0:
20
Function Parameters:
0:? Sequence
0:
19
move second child to first child (temp uint)
0:
20
move second child to first child (temp uint)
0:? 'pos' (temp uint)
0:? 'pos' (layout(location=0 ) in uint)
0:
19
move second child to first child (temp 4-component vector of float)
0:
20
move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:
19
Function Call: @main(u1; (temp 4-component vector of float)
0:
20
Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'sbuf' (layout(binding=10 row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of 4-component vector of uint @data})
...
...
Test/hlsl.structbuffer.fn.frag
View file @
621c0e3d
StructuredBuffer
<
uint4
>
sbuf
:
register
(
t10
);
RWStructuredBuffer
<
uint4
>
sbuf2
;
// Not shared, because of type difference.
StructuredBuffer
<
uint3
>
sbuf3
:
register
(
t12
);
uint4
get
(
in
StructuredBuffer
<
uint4
>
sb
,
uint
bufferOffset
)
{
...
...
@@ -15,6 +11,11 @@ void set(in RWStructuredBuffer<uint4> sb, uint bufferOffset, uint4 data)
sb
[
bufferOffset
]
=
data
;
}
RWStructuredBuffer
<
uint4
>
sbuf2
;
// Not shared, because of type difference.
StructuredBuffer
<
uint3
>
sbuf3
:
register
(
t12
);
float4
main
(
uint
pos
:
FOO
)
:
SV_Target0
{
set
(
sbuf2
,
2
,
get
(
sbuf
,
3
));
...
...
hlsl/hlslGrammar.cpp
View file @
621c0e3d
...
...
@@ -1874,6 +1874,7 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
TArraySizes
unsizedArray
;
unsizedArray
.
addInnerSize
(
UnsizedArraySize
);
templateType
->
newArraySizes
(
unsizedArray
);
templateType
->
getQualifier
().
storage
=
storage
;
// field name is canonical for all structbuffers
templateType
->
setFieldName
(
"@data"
);
...
...
hlsl/hlslParseHelper.cpp
View file @
621c0e3d
...
...
@@ -5223,10 +5223,6 @@ void HlslParseContext::shareStructBufferType(TType& type)
return
compareQualifiers
(
lhs
,
rhs
)
&&
lhs
==
rhs
;
};
// TString typeName;
// type.appendMangledName(typeName);
// type.setTypeName(typeName);
// This is an exhaustive O(N) search, but real world shaders have
// only a small number of these.
for
(
int
idx
=
0
;
idx
<
int
(
structBufferTypes
.
size
());
++
idx
)
{
...
...
@@ -5241,8 +5237,6 @@ void HlslParseContext::shareStructBufferType(TType& type)
TType
*
typeCopy
=
new
TType
;
typeCopy
->
shallowCopy
(
type
);
structBufferTypes
.
push_back
(
typeCopy
);
// structBuffTypes.push_back(type.getWritableStruct());
}
void
HlslParseContext
::
paramFix
(
TType
&
type
)
...
...
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