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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
72 deletions
+45
-72
hlsl.buffer.frag.out
Test/baseResults/hlsl.buffer.frag.out
+0
-0
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
This diff is collapsed.
Click to expand it.
Test/baseResults/hlsl.reflection.vert.out
View file @
2fcdd64e
...
...
@@ -2,26 +2,19 @@ hlsl.reflection.vert
Uniform reflection:
anonMember3: offset 80, type 8b52, size 1, index 0, 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
scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1
c_m23: offset 16, type 8b67, size 1, index
3
, binding -1
c_scalarAfterm23: offset 48, type 1404, 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
2
, binding -1
scalarBeforeArray: offset 96, type 1404, size 1, 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
ablock.memfloat2: offset 48, type 8b50, size 1, index 2, 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
m22: offset 208, type 8b5a, size 9, index 0, binding -1
dm22: offset 32, type 8b5a, size 4, index 1, binding -1
m22: offset 208, type 8b5a, size 3, index 0, binding -1
nest.foo.n1.a: offset 0, type 1406, size 1, index 4, binding -1
nest.foo.n2.b: offset 16, type 1406, size 1, index 4, binding -1
nest.foo.n2.c: offset 20, type 1406, size 1, index 4, binding -1
nest.foo.n2.d: offset 24, type 1406, size 1, index 4, binding -1
foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1
foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1
foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1
foo.n2.d: offset 24, type 1406, size 1, index 3, 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[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
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].v3: offset 2480, type 8b54, size 1, index 1, binding -1
arrBl.foo: offset 0, type 1406, size 1, index 5
, binding -1
arrBl2.foo: offset 0, type 1406, size 1, index 6
, binding -1
foo1: offset 0, type 1406, size 1, index 4
, binding -1
foo2: offset 0, type 1406, size 1, index 5
, binding -1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
uf1: offset 16, type 1406, size 1, index 1, binding -1
Uniform block reflection:
nameless: offset -1, type ffffffff, size 496, 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
nest: offset -1, type ffffffff, size 32, index -1, binding -1
a
rrB
l: offset -1, type ffffffff, size 4, index -1, binding -1
a
rrB
l2: offset -1, type ffffffff, size 4, index -1, binding -1
nest
ed
: offset -1, type ffffffff, size 32, index -1, binding -1
a
b
l: 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:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1
...
...
Test/hlsl.buffer.frag
View file @
2fcdd64e
cbuffer
buf1
{
float4
v1
;
};
};
// extraneous ;
tbuffer
buf2
{
float4
v2
;
};
};
// extraneous ;
cbuffer
cbufName
{
float4
v3
:
packoffset
(
c0
);
int
i3
:
packoffset
(
c1
.
y
);
}
// no semicolon is okay
}
tbuffer
tbufName
:
register
(
t8
)
{
float4
v4
:
packoffset
(
c1
);
...
...
@@ -24,9 +24,14 @@ tbuffer tbufName : register(t8) {
row_major
float3x4
m2
:
packoffset
(
c11
);
column_major
float3x4
m3
:
packoffset
(
c15
);
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
{
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 {
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
{
int
a
;
};
cbuffer
namedDead
{
int
b
;
}
bblock
;
struct
N1
{
float
a
;
};
...
...
@@ -57,7 +40,7 @@ struct N3 {
cbuffer
nested
{
N3
foo
;
}
nest
;
}
struct
TS
{
int
a
;
...
...
@@ -89,16 +72,12 @@ struct deep3 {
int3
v3
;
};
uniform
deep3
deepA
[
2
],
deepB
[
2
],
deepC
[
3
],
deepD
[
2
];
const
bool
control
=
true
;
void
deadFunction
()
{
float3
v3
=
ablock
.
deadMember1
;
float4
v
=
anonDeadMember2
;
float
f
=
ufDead4
;
}
...
...
@@ -110,12 +89,12 @@ void liveFunction2()
}
tbuffer
abl
{
float
foo
;
}
arrBl
;
float
foo
1
;
}
tbuffer
abl2
{
float
foo
;
}
arrBl2
;
float
foo
2
;
}
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
liveFunction2
();
f
=
anonMember3
.
z
;
f
=
s
.
a
;
f
=
ablock
.
scalar
;
f
=
m23
[
1
].
y
+
scalarAfterm23
;
f
=
c_m23
[
1
].
y
+
c_scalarAfterm23
;
f
+=
scalarBeforeArray
;
f
+=
floatArray
[
2
];
f
+=
floatArray
[
4
];
f
+=
scalarAfterArray
;
f
+=
ablock
.
memfloat2
.
x
;
f
+=
ablock
.
memf1
;
f
+=
float
(
ablock
.
memf2
);
f
+=
ablock
.
memf3
;
f
+=
ablock
.
memfloat2a
.
y
;
f
+=
ablock
.
m22
[
i
][
1
][
0
];
f
+=
m22
[
i
][
1
][
0
];
f
+=
dm22
[
3
][
0
][
1
];
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
+=
deepB
[
1
].
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
}
else
f
=
ufDead3
;
f
+=
arrBl
.
foo
+
arrBl
.
foo
;
f
+=
arrBl2
.
foo
;
f
+=
foo1
+
foo2
;
f
+=
foo2
;
f
+=
attributeFloat
;
f
+=
attributeFloat2
.
x
;
...
...
hlsl/hlslGrammar.cpp
View file @
2fcdd64e
...
...
@@ -371,10 +371,16 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
// if (acceptSamplerDeclarationDX9(declaredType))
// return true;
bool
forbidDeclarators
=
(
peekTokenClass
(
EHTokCBuffer
)
||
peekTokenClass
(
EHTokTBuffer
));
// fully_specified_type
if
(
!
acceptFullySpecifiedType
(
declaredType
,
nodeList
))
return
false
;
// cbuffer and tbuffer end with the closing '}'.
// No semicolon is included.
if
(
forbidDeclarators
)
return
true
;
// declarator_list
// : declarator
// : identifier
...
...
@@ -489,7 +495,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
// COMMA
if
(
acceptTokenClass
(
EHTokComma
))
declarator_list
=
true
;
}
}
// The top-level initializer node is a sequence.
if
(
initializers
!=
nullptr
)
...
...
@@ -501,18 +507,15 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
else
nodeList
=
initializers
;
// SEMICOLON
(optional for cbuffer/tbuffer)
// SEMICOLON
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
)
{
// 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
();
return
false
;
}
else
if
(
declaredType
.
getBasicType
()
==
EbtBlock
)
{
// cbuffer, et. al. (but not struct) don't have an ending semicolon
return
true
;
}
else
{
expected
(
";"
);
return
false
;
...
...
@@ -1904,10 +1907,10 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
bool
readonly
=
false
;
if
(
acceptTokenClass
(
EHTokCBuffer
))
{
// CBUFFER
// CBUFFER
storageQualifier
=
EvqUniform
;
}
else
if
(
acceptTokenClass
(
EHTokTBuffer
))
{
// TBUFFER
// TBUFFER
storageQualifier
=
EvqBuffer
;
readonly
=
true
;
}
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