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
c2fafea9
Commit
c2fafea9
authored
Sep 20, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL/SPV: Fix #1900: Drop const on literal when doing an object copy.
parent
f7a48b15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
6 deletions
+36
-6
nonuniform.frag.out
Test/baseResults/nonuniform.frag.out
+14
-0
nonuniform.frag
Test/nonuniform.frag
+2
-2
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+20
-4
No files found.
Test/baseResults/nonuniform.frag.out
View file @
c2fafea9
...
@@ -40,6 +40,13 @@ ERROR: node is still EOpNull!
...
@@ -40,6 +40,13 @@ ERROR: node is still EOpNull!
0:27 2 (const int)
0:27 2 (const int)
0:28 'nu_li' ( nonuniform temp int)
0:28 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:30 move second child to first child ( temp int)
0:30 'nu_li' ( nonuniform temp int)
0:30 indirect index ( nonuniform temp int)
0:30 'table' ( temp 5-element array of int)
0:30 copy object ( nonuniform temp int)
0:30 Constant:
0:30 3 (const int)
0:? Linker Objects
0:? Linker Objects
0:? 'nonuniformEXT' ( global int)
0:? 'nonuniformEXT' ( global int)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
...
@@ -83,6 +90,13 @@ ERROR: node is still EOpNull!
...
@@ -83,6 +90,13 @@ ERROR: node is still EOpNull!
0:27 2 (const int)
0:27 2 (const int)
0:28 'nu_li' ( nonuniform temp int)
0:28 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:29 'nu_li' ( nonuniform temp int)
0:30 move second child to first child ( temp int)
0:30 'nu_li' ( nonuniform temp int)
0:30 indirect index ( nonuniform temp int)
0:30 'table' ( temp 5-element array of int)
0:30 copy object ( nonuniform temp int)
0:30 Constant:
0:30 3 (const int)
0:? Linker Objects
0:? Linker Objects
0:? 'nonuniformEXT' ( global int)
0:? 'nonuniformEXT' ( global int)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float)
...
...
Test/nonuniform.frag
View file @
c2fafea9
...
@@ -22,12 +22,12 @@ void main()
...
@@ -22,12 +22,12 @@ void main()
nonuniformEXT
const
int
nu_ci
=
2
;
// ERROR, const
nonuniformEXT
const
int
nu_ci
=
2
;
// ERROR, const
foo
(
nu_li
,
nu_li
);
foo
(
nu_li
,
nu_li
);
int
table
[
5
];
int
a
;
int
a
;
nu_li
=
nonuniformEXT
(
a
)
+
nonuniformEXT
(
a
*
2
);
nu_li
=
nonuniformEXT
(
a
)
+
nonuniformEXT
(
a
*
2
);
nu_li
=
nonuniformEXT
(
a
,
a
);
// ERROR, too many arguments
nu_li
=
nonuniformEXT
(
a
,
a
);
// ERROR, too many arguments
nu_li
=
nonuniformEXT
();
// ERROR, no arguments
nu_li
=
nonuniformEXT
();
// ERROR, no arguments
nu_li
=
table
[
nonuniformEXT
(
3
)];
}
}
layout
(
location
=
1
)
in
struct
S
{
float
a
;
nonuniformEXT
float
b
;
}
ins
;
// ERROR, not on member
layout
(
location
=
1
)
in
struct
S
{
float
a
;
nonuniformEXT
float
b
;
}
ins
;
// ERROR, not on member
layout
(
location
=
3
)
in
inbName
{
float
a
;
nonuniformEXT
float
b
;
}
inb
;
// ERROR, not on member
layout
(
location
=
3
)
in
inbName
{
float
a
;
nonuniformEXT
float
b
;
}
inb
;
// ERROR, not on member
glslang/MachineIndependent/ParseHelper.cpp
View file @
c2fafea9
...
@@ -2774,10 +2774,25 @@ bool TParseContext::builtInName(const TString& identifier)
...
@@ -2774,10 +2774,25 @@ bool TParseContext::builtInName(const TString& identifier)
//
//
bool
TParseContext
::
constructorError
(
const
TSourceLoc
&
loc
,
TIntermNode
*
node
,
TFunction
&
function
,
TOperator
op
,
TType
&
type
)
bool
TParseContext
::
constructorError
(
const
TSourceLoc
&
loc
,
TIntermNode
*
node
,
TFunction
&
function
,
TOperator
op
,
TType
&
type
)
{
{
type
.
shallowCopy
(
function
.
getType
());
// See if the constructor does not establish the main type, only requalifies
// it, in which case the type comes from the argument instead of from the
// constructor function.
switch
(
op
)
{
case
EOpConstructNonuniform
:
if
(
node
!=
nullptr
&&
node
->
getAsTyped
()
!=
nullptr
)
{
type
.
shallowCopy
(
node
->
getAsTyped
()
->
getType
());
type
.
getQualifier
().
makeTemporary
();
type
.
getQualifier
().
nonUniform
=
true
;
}
break
;
default
:
type
.
shallowCopy
(
function
.
getType
());
break
;
}
// See if it's a matrix
bool
constructingMatrix
=
false
;
bool
constructingMatrix
=
false
;
switch
(
op
)
{
switch
(
op
)
{
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
case
EOpConstructTextureSampler
:
case
EOpConstructTextureSampler
:
return
constructorTextureSamplerError
(
loc
,
function
);
return
constructorTextureSamplerError
(
loc
,
function
);
...
@@ -2871,6 +2886,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
...
@@ -2871,6 +2886,8 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
}
}
}
}
}
}
if
(
op
==
EOpConstructNonuniform
)
constType
=
false
;
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
switch
(
op
)
{
switch
(
op
)
{
...
@@ -7093,8 +7110,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
...
@@ -7093,8 +7110,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case
EOpConstructNonuniform
:
case
EOpConstructNonuniform
:
// Make a nonuniform copy of node
// Make a nonuniform copy of node
newNode
=
intermediate
.
addBuiltInFunctionCall
(
node
->
getLoc
(),
EOpCopyObject
,
true
,
node
,
node
->
getType
());
newNode
=
intermediate
.
addBuiltInFunctionCall
(
node
->
getLoc
(),
EOpCopyObject
,
true
,
node
,
type
);
newNode
->
getWritableType
().
getQualifier
().
nonUniform
=
true
;
return
newNode
;
return
newNode
;
case
EOpConstructReference
:
case
EOpConstructReference
:
...
...
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