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
53864846
Commit
53864846
authored
Dec 30, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Support empty {} initializers for arrays and scalars.
parent
807a0d9e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
hlsl.partialInit.frag.out
Test/baseResults/hlsl.partialInit.frag.out
+0
-0
hlsl.partialInit.frag
Test/hlsl.partialInit.frag
+4
-0
revision.h
glslang/Include/revision.h
+2
-2
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+8
-1
No files found.
Test/baseResults/hlsl.partialInit.frag.out
View file @
53864846
This diff is collapsed.
Click to expand it.
Test/hlsl.partialInit.frag
View file @
53864846
...
@@ -25,5 +25,9 @@ outs PixelShaderFunction(float4 input) : COLOR0
...
@@ -25,5 +25,9 @@ outs PixelShaderFunction(float4 input) : COLOR0
o4
.
c
=
o1
.
c
;
o4
.
c
=
o1
.
c
;
Nest
nest
=
(
Nest
)
0
;
Nest
nest
=
(
Nest
)
0
;
float2
gf2a
[
4
]
=
{
};
int
cgi
=
{
};
o4
.
b
=
gf2a
[
2
].
y
*
cgi
;
return
o4
;
return
o4
;
}
}
glslang/Include/revision.h
View file @
53864846
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.172
1
"
#define GLSLANG_REVISION "Overload400-PrecQual.172
5
"
#define GLSLANG_DATE "
21
-Dec-2016"
#define GLSLANG_DATE "
30
-Dec-2016"
hlsl/hlslParseHelper.cpp
View file @
53864846
...
@@ -4960,14 +4960,18 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
...
@@ -4960,14 +4960,18 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
// edit array sizes to fill in unsized dimensions
// edit array sizes to fill in unsized dimensions
if
(
type
.
isImplicitlySizedArray
())
if
(
type
.
isImplicitlySizedArray
())
arrayType
.
changeOuterArraySize
((
int
)
initList
->
getSequence
().
size
());
arrayType
.
changeOuterArraySize
((
int
)
initList
->
getSequence
().
size
());
// set unsized array dimensions that can be derived from the initializer's first element
if
(
arrayType
.
isArrayOfArrays
()
&&
initList
->
getSequence
().
size
()
>
0
)
{
TIntermTyped
*
firstInit
=
initList
->
getSequence
()[
0
]
->
getAsTyped
();
TIntermTyped
*
firstInit
=
initList
->
getSequence
()[
0
]
->
getAsTyped
();
if
(
arrayType
.
isArrayOfArrays
()
&&
firstInit
->
getType
().
isArray
()
&&
if
(
firstInit
->
getType
().
isArray
()
&&
arrayType
.
getArraySizes
().
getNumDims
()
==
firstInit
->
getType
().
getArraySizes
()
->
getNumDims
()
+
1
)
{
arrayType
.
getArraySizes
().
getNumDims
()
==
firstInit
->
getType
().
getArraySizes
()
->
getNumDims
()
+
1
)
{
for
(
int
d
=
1
;
d
<
arrayType
.
getArraySizes
().
getNumDims
();
++
d
)
{
for
(
int
d
=
1
;
d
<
arrayType
.
getArraySizes
().
getNumDims
();
++
d
)
{
if
(
arrayType
.
getArraySizes
().
getDimSize
(
d
)
==
UnsizedArraySize
)
if
(
arrayType
.
getArraySizes
().
getDimSize
(
d
)
==
UnsizedArraySize
)
arrayType
.
getArraySizes
().
setDimSize
(
d
,
firstInit
->
getType
().
getArraySizes
()
->
getDimSize
(
d
-
1
));
arrayType
.
getArraySizes
().
setDimSize
(
d
,
firstInit
->
getType
().
getArraySizes
()
->
getDimSize
(
d
-
1
));
}
}
}
}
}
// lengthen list to be long enough
// lengthen list to be long enough
lengthenList
(
loc
,
initList
->
getSequence
(),
arrayType
.
getOuterArraySize
());
lengthenList
(
loc
,
initList
->
getSequence
(),
arrayType
.
getOuterArraySize
());
...
@@ -5024,6 +5028,9 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
...
@@ -5024,6 +5028,9 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
return
nullptr
;
return
nullptr
;
}
}
}
else
if
(
type
.
isScalar
())
{
}
else
if
(
type
.
isScalar
())
{
// lengthen list to be long enough
lengthenList
(
loc
,
initList
->
getSequence
(),
1
);
if
((
int
)
initList
->
getSequence
().
size
()
!=
1
)
{
if
((
int
)
initList
->
getSequence
().
size
()
!=
1
)
{
error
(
loc
,
"scalar expected one element:"
,
"initializer list"
,
type
.
getCompleteString
().
c_str
());
error
(
loc
,
"scalar expected one element:"
,
"initializer list"
,
type
.
getCompleteString
().
c_str
());
return
nullptr
;
return
nullptr
;
...
...
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