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
230168d5
Commit
230168d5
authored
Jun 08, 2021
by
Greg Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for float spec const vector initialization
Fixes #2025
parent
cb2c7fd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
vulkan.ast.vert.out
Test/baseResults/vulkan.ast.vert.out
+9
-9
vulkan.ast.vert
Test/vulkan.ast.vert
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+12
-0
No files found.
Test/baseResults/vulkan.ast.vert.out
View file @
230168d5
...
@@ -102,18 +102,18 @@ Shader version: 450
...
@@ -102,18 +102,18 @@ Shader version: 450
0:38 2 (const int)
0:38 2 (const int)
0:38 'sci2' ( specialization-constant const highp int)
0:38 'sci2' ( specialization-constant const highp int)
0:38 2 (const int)
0:38 2 (const int)
0:40 Construct vec2 (
temp
2-component vector of float)
0:40 Construct vec2 (
specialization-constant const
2-component vector of float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 1.000000
0:40 1.000000
0:40 'scf1' ( specialization-constant const highp float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 1.000000
0:40 1.000000
0:41 Construct vec2 ( temp 2-element array of 2-component vector of float)
0:41 Construct vec2 ( temp 2-element array of 2-component vector of float)
0:41 Construct vec2 (
temp
2-component vector of float)
0:41 Construct vec2 (
specialization-constant const
2-component vector of float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 Construct vec2 (
temp
2-component vector of float)
0:41 Construct vec2 (
specialization-constant const
2-component vector of float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
...
@@ -233,18 +233,18 @@ Shader version: 450
...
@@ -233,18 +233,18 @@ Shader version: 450
0:38 2 (const int)
0:38 2 (const int)
0:38 'sci2' ( specialization-constant const highp int)
0:38 'sci2' ( specialization-constant const highp int)
0:38 2 (const int)
0:38 2 (const int)
0:40 Construct vec2 (
temp
2-component vector of float)
0:40 Construct vec2 (
specialization-constant const
2-component vector of float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 1.000000
0:40 1.000000
0:40 'scf1' ( specialization-constant const highp float)
0:40 'scf1' ( specialization-constant const highp float)
0:40 1.000000
0:40 1.000000
0:41 Construct vec2 ( temp 2-element array of 2-component vector of float)
0:41 Construct vec2 ( temp 2-element array of 2-component vector of float)
0:41 Construct vec2 (
temp
2-component vector of float)
0:41 Construct vec2 (
specialization-constant const
2-component vector of float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 Construct vec2 (
temp
2-component vector of float)
0:41 Construct vec2 (
specialization-constant const
2-component vector of float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
0:41 1.000000
0:41 1.000000
0:41 'scf1' ( specialization-constant const highp float)
0:41 'scf1' ( specialization-constant const highp float)
...
@@ -303,6 +303,9 @@ Shader version: 450
...
@@ -303,6 +303,9 @@ Shader version: 450
41: 14(int) Constant 2
41: 14(int) Constant 2
42: TypeArray 37(ivec2) 41
42: TypeArray 37(ivec2) 41
44: TypeVector 6(float) 2
44: TypeVector 6(float) 2
45: 44(fvec2) SpecConstantComposite 7(scf1) 7(scf1)
46: 44(fvec2) SpecConstantComposite 7(scf1) 7(scf1)
47: 44(fvec2) SpecConstantComposite 7(scf1) 7(scf1)
48: TypeArray 44(fvec2) 41
48: TypeArray 44(fvec2) 41
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
...
@@ -317,9 +320,6 @@ Shader version: 450
...
@@ -317,9 +320,6 @@ Shader version: 450
32: 8(bool) FOrdGreaterThan 7(scf1) 7(scf1)
32: 8(bool) FOrdGreaterThan 7(scf1) 7(scf1)
34: 8(bool) FUnordNotEqual 7(scf1) 7(scf1)
34: 8(bool) FUnordNotEqual 7(scf1) 7(scf1)
43: 42 CompositeConstruct 39 40
43: 42 CompositeConstruct 39 40
45: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1)
46: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1)
47: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1)
49: 48 CompositeConstruct 46 47
49: 48 CompositeConstruct 46 47
Return
Return
FunctionEnd
FunctionEnd
Test/vulkan.ast.vert
View file @
230168d5
...
@@ -37,6 +37,6 @@ void main()
...
@@ -37,6 +37,6 @@ void main()
ivec2
(
sci2
,
sci2
);
// spec-const
ivec2
(
sci2
,
sci2
);
// spec-const
ivec2
[
2
](
ivec2
(
sci2
,
sci2
),
ivec2
(
sci2
,
sci2
));
// not a spec-const
ivec2
[
2
](
ivec2
(
sci2
,
sci2
),
ivec2
(
sci2
,
sci2
));
// not a spec-const
vec2
(
scf1
,
scf1
);
//
not
spec-const
vec2
(
scf1
,
scf1
);
// spec-const
vec2
[
2
](
vec2
(
scf1
,
scf1
),
vec2
(
scf1
,
scf1
));
// not a spec-const
vec2
[
2
](
vec2
(
scf1
,
scf1
),
vec2
(
scf1
,
scf1
));
// not a spec-const
}
}
glslang/MachineIndependent/ParseHelper.cpp
View file @
230168d5
...
@@ -3115,6 +3115,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -3115,6 +3115,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
bool
matrixInMatrix
=
false
;
bool
matrixInMatrix
=
false
;
bool
arrayArg
=
false
;
bool
arrayArg
=
false
;
bool
floatArgument
=
false
;
bool
floatArgument
=
false
;
bool
intArgument
=
false
;
for
(
int
arg
=
0
;
arg
<
function
.
getParamCount
();
++
arg
)
{
for
(
int
arg
=
0
;
arg
<
function
.
getParamCount
();
++
arg
)
{
if
(
function
[
arg
].
type
->
isArray
())
{
if
(
function
[
arg
].
type
->
isArray
())
{
if
(
function
[
arg
].
type
->
isUnsizedArray
())
{
if
(
function
[
arg
].
type
->
isUnsizedArray
())
{
...
@@ -3145,6 +3146,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -3145,6 +3146,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
specConstType
=
true
;
specConstType
=
true
;
if
(
function
[
arg
].
type
->
isFloatingDomain
())
if
(
function
[
arg
].
type
->
isFloatingDomain
())
floatArgument
=
true
;
floatArgument
=
true
;
if
(
function
[
arg
].
type
->
isIntegerDomain
())
intArgument
=
true
;
if
(
type
.
isStruct
())
{
if
(
type
.
isStruct
())
{
if
(
function
[
arg
].
type
->
contains16BitFloat
())
{
if
(
function
[
arg
].
type
->
contains16BitFloat
())
{
requireFloat16Arithmetic
(
loc
,
"constructor"
,
"can't construct structure containing 16-bit type"
);
requireFloat16Arithmetic
(
loc
,
"constructor"
,
"can't construct structure containing 16-bit type"
);
...
@@ -3250,6 +3253,15 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -3250,6 +3253,15 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
// and aren't making an array.
// and aren't making an array.
makeSpecConst
=
!
floatArgument
&&
!
type
.
isArray
();
makeSpecConst
=
!
floatArgument
&&
!
type
.
isArray
();
break
;
break
;
case
EOpConstructVec2
:
case
EOpConstructVec3
:
case
EOpConstructVec4
:
// This was the list of valid ones, if they aren't converting from int
// and aren't making an array.
makeSpecConst
=
!
intArgument
&&
!
type
.
isArray
();
break
;
default
:
default
:
// anything else wasn't white-listed in the spec as a conversion
// anything else wasn't white-listed in the spec as a conversion
makeSpecConst
=
false
;
makeSpecConst
=
false
;
...
...
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