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
b5f003d7
Commit
b5f003d7
authored
May 01, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2191: Error check for indexing reference containing unsize array.
parent
2ac3c5b6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
spv.bufferhandle_Error.frag.out
Test/baseResults/spv.bufferhandle_Error.frag.out
+7
-4
spv.bufferhandle_Error.frag
Test/spv.bufferhandle_Error.frag
+1
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+12
-2
No files found.
Test/baseResults/spv.bufferhandle_Error.frag.out
View file @
b5f003d7
...
@@ -14,12 +14,15 @@ ERROR: 0:14: 'buffer_reference' : can only be used with buffer
...
@@ -14,12 +14,15 @@ ERROR: 0:14: 'buffer_reference' : can only be used with buffer
ERROR: 0:14: 'buffer_reference' : can only be used with buffer
ERROR: 0:14: 'buffer_reference' : can only be used with buffer
ERROR: 0:30: 'length' : array must be declared with a size before using this method
ERROR: 0:30: 'length' : array must be declared with a size before using this method
ERROR: 0:31: 'length' : array must be declared with a size before using this method
ERROR: 0:31: 'length' : array must be declared with a size before using this method
ERROR: 0:35: '=' : cannot convert from 'layout( column_major std430) buffer reference' to ' temp reference'
ERROR: 0:32: 'buffer reference indexing' : required extension not requested: GL_EXT_buffer_reference2
ERROR: 0:40: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:32: '' : cannot index reference to buffer containing an unsized array
ERROR: 0:32: '' : cannot index buffer reference
ERROR: 0:36: '=' : cannot convert from 'layout( column_major std430) buffer reference' to ' temp reference'
ERROR: 0:41: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:41: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:42: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:42: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 0:45: '' : syntax error, unexpected LEFT_BRACE, expecting COMMA or SEMICOLON
ERROR: 0:43: 'assign' : cannot convert from 'layout( column_major std430) buffer reference' to 'layout( column_major std430) buffer reference'
ERROR: 20 compilation errors. No code generated.
ERROR: 0:46: '' : syntax error, unexpected LEFT_BRACE, expecting COMMA or SEMICOLON
ERROR: 23 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
SPIR-V is not generated for failed compile or link
Test/spv.bufferhandle_Error.frag
View file @
b5f003d7
...
@@ -29,6 +29,7 @@ void f()
...
@@ -29,6 +29,7 @@ void f()
bufType6
b
;
bufType6
b
;
b
.
x
.
length
();
b
.
x
.
length
();
b4
.
b6
.
x
.
length
();
b4
.
b6
.
x
.
length
();
b
[
2
];
// ERROR, can't index due to unsized array
}
}
void
main
()
{
void
main
()
{
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
b5f003d7
...
@@ -428,8 +428,18 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
...
@@ -428,8 +428,18 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
#ifndef GLSLANG_WEB
#ifndef GLSLANG_WEB
if
(
base
->
isReference
()
&&
!
base
->
isArray
())
{
if
(
base
->
isReference
()
&&
!
base
->
isArray
())
{
requireExtensions
(
loc
,
1
,
&
E_GL_EXT_buffer_reference2
,
"buffer reference indexing"
);
requireExtensions
(
loc
,
1
,
&
E_GL_EXT_buffer_reference2
,
"buffer reference indexing"
);
result
=
intermediate
.
addBinaryMath
(
EOpAdd
,
base
,
index
,
loc
);
if
(
base
->
getType
().
getReferentType
()
->
containsUnsizedArray
())
{
result
->
setType
(
base
->
getType
());
error
(
loc
,
"cannot index reference to buffer containing an unsized array"
,
""
,
""
);
result
=
nullptr
;
}
else
{
result
=
intermediate
.
addBinaryMath
(
EOpAdd
,
base
,
index
,
loc
);
if
(
result
!=
nullptr
)
result
->
setType
(
base
->
getType
());
}
if
(
result
==
nullptr
)
{
error
(
loc
,
"cannot index buffer reference"
,
""
,
""
);
result
=
intermediate
.
addConstantUnion
(
0.0
,
EbtFloat
,
loc
);
}
return
result
;
return
result
;
}
}
if
(
base
->
getAsSymbolNode
()
&&
isIoResizeArray
(
base
->
getType
()))
if
(
base
->
getAsSymbolNode
()
&&
isIoResizeArray
(
base
->
getType
()))
...
...
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