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
efb84617
Commit
efb84617
authored
Jul 21, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26: Detect empty array constructors, require at least on operand.
parent
22245705
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
array.frag
Test/array.frag
+2
-0
array.frag.out
Test/baseResults/array.frag.out
+5
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+5
-1
No files found.
Test/array.frag
View file @
efb84617
...
...
@@ -100,3 +100,5 @@ void foo3()
resize2
.
length
();
resize2
[
5
]
=
4
.
0
;
// ERROR
}
int
[]
i
=
int
[]();
// ERROR, need constructor arguments
Test/baseResults/array.frag.out
View file @
efb84617
...
...
@@ -22,7 +22,9 @@ ERROR: 0:79: '' : array size required
ERROR: 0:84: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:93: 'length' : array must be declared with a size before using this method
ERROR: 0:101: '[' : array index out of range '5'
ERROR: 23 compilation errors. No code generated.
ERROR: 0:104: 'constructor' : array constructor must have at least one argument
ERROR: 0:104: '=' : cannot convert from 'const float' to 'global implicitly-sized array of int'
ERROR: 25 compilation errors. No code generated.
Shader version: 130
...
...
@@ -264,6 +266,7 @@ ERROR: node is still EOpNull!
0:? 'guns' (global implicitly-sized array of 3-component vector of float)
0:? 'f' (global float)
0:? 'gUnusedUnsized' (global implicitly-sized array of float)
0:? 'i' (global implicitly-sized array of int)
Linked fragment stage:
...
...
@@ -508,4 +511,5 @@ ERROR: node is still EOpNull!
0:? 'guns' (global 8-element array of 3-component vector of float)
0:? 'f' (global float)
0:? 'gUnusedUnsized' (global 1-element array of float)
0:? 'i' (global 1-element array of int)
glslang/MachineIndependent/ParseHelper.cpp
View file @
efb84617
...
...
@@ -1973,6 +1973,10 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio
type
.
getQualifier
().
storage
=
EvqConst
;
if
(
type
.
isArray
())
{
if
(
function
.
getParamCount
()
==
0
)
{
error
(
loc
,
"array constructor must have at least one argument"
,
"constructor"
,
""
);
return
true
;
}
if
(
type
.
isImplicitlySizedArray
())
{
// auto adapt the constructor type to the number of arguments
type
.
changeArraySize
(
function
.
getParamCount
());
...
...
@@ -1992,7 +1996,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio
// "If a matrix argument is given to a matrix constructor,
// it is a compile-time error to have any other arguments."
if
(
function
.
getParamCount
()
>
1
)
if
(
function
.
getParamCount
()
!=
1
)
error
(
loc
,
"matrix constructed from matrix can only have one argument"
,
"constructor"
,
""
);
return
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