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
07c0bcea
Commit
07c0bcea
authored
Oct 21, 2017
by
Aaron Muir Hamilton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only try swizzles on vectors, numbers, and booleans.
parent
b1eaf82c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
16 deletions
+26
-16
invalidSwizzle.vert.out
Test/baseResults/invalidSwizzle.vert.out
+17
-13
invalidSwizzle.vert
Test/invalidSwizzle.vert
+3
-0
intermediate.h
glslang/Include/intermediate.h
+2
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+4
-3
No files found.
Test/baseResults/invalidSwizzle.vert.out
View file @
07c0bcea
invalidSwizzle.vert
invalidSwizzle.vert
ERROR: 0:6: 'xx' : does not apply to this type: global void
ERROR: 0:7: 'rr' : does not apply to this type: uniform sampler2D
ERROR: 0:7: 'xy' : does not apply to this type: global void
ERROR: 0:7: '=' : cannot convert from ' uniform sampler2D' to ' temp 2-component vector of float'
ERROR: 2 compilation errors. No code generated.
ERROR: 0:8: 'xx' : does not apply to this type: global void
ERROR: 0:9: 'xy' : does not apply to this type: global void
ERROR: 4 compilation errors. No code generated.
Shader version: 420
Shader version: 420
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:
5
Function Definition: main( ( global void)
0:
6
Function Definition: main( ( global void)
0:
5
Function Parameters:
0:
6
Function Parameters:
0:
6
Sequence
0:
?
Sequence
0:
6
Function Call: f( ( global void)
0:
8
Function Call: f( ( global void)
0:
7
Function Call: f( ( global void)
0:
9
Function Call: f( ( global void)
0:? Linker Objects
0:? Linker Objects
0:? 's' ( uniform sampler2D)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
...
@@ -23,12 +26,13 @@ ERROR: Linking vertex stage: No function definition (body) found:
...
@@ -23,12 +26,13 @@ ERROR: Linking vertex stage: No function definition (body) found:
Shader version: 420
Shader version: 420
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:
5
Function Definition: main( ( global void)
0:
6
Function Definition: main( ( global void)
0:
5
Function Parameters:
0:
6
Function Parameters:
0:
6
Sequence
0:
?
Sequence
0:
6
Function Call: f( ( global void)
0:
8
Function Call: f( ( global void)
0:
7
Function Call: f( ( global void)
0:
9
Function Call: f( ( global void)
0:? Linker Objects
0:? Linker Objects
0:? 's' ( uniform sampler2D)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
Test/invalidSwizzle.vert
View file @
07c0bcea
#version 420
#version 420
void
f
();
void
f
();
uniform
sampler2D
s
;
void
main
()
{
void
main
()
{
vec2
v
=
s
.
rr
;
// Swizzles do not apply to samplers
f
().
xx
;
// Scalar swizzle does not apply to void
f
().
xx
;
// Scalar swizzle does not apply to void
f
().
xy
;
// Vector swizzle does not apply either
f
().
xy
;
// Vector swizzle does not apply either
}
}
\ No newline at end of file
glslang/Include/intermediate.h
View file @
07c0bcea
...
@@ -875,6 +875,8 @@ public:
...
@@ -875,6 +875,8 @@ public:
virtual
bool
isVector
()
const
{
return
type
.
isVector
();
}
virtual
bool
isVector
()
const
{
return
type
.
isVector
();
}
virtual
bool
isScalar
()
const
{
return
type
.
isScalar
();
}
virtual
bool
isScalar
()
const
{
return
type
.
isScalar
();
}
virtual
bool
isStruct
()
const
{
return
type
.
isStruct
();
}
virtual
bool
isStruct
()
const
{
return
type
.
isStruct
();
}
virtual
bool
isFloatingDomain
()
const
{
return
type
.
isFloatingDomain
();
}
virtual
bool
isIntegerDomain
()
const
{
return
type
.
isIntegerDomain
();
}
TString
getCompleteString
()
const
{
return
type
.
getCompleteString
();
}
TString
getCompleteString
()
const
{
return
type
.
getCompleteString
();
}
protected
:
protected
:
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
07c0bcea
...
@@ -665,7 +665,8 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
...
@@ -665,7 +665,8 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
// leaving swizzles and struct/block dereferences.
// leaving swizzles and struct/block dereferences.
TIntermTyped
*
result
=
base
;
TIntermTyped
*
result
=
base
;
if
(
base
->
getBasicType
()
!=
EbtVoid
&&
(
base
->
isVector
()
||
base
->
isScalar
()))
{
if
((
base
->
isVector
()
||
base
->
isScalar
())
&&
(
base
->
isFloatingDomain
()
||
base
->
isIntegerDomain
()
||
base
->
getBasicType
()
==
EbtBool
))
{
if
(
base
->
isScalar
())
{
if
(
base
->
isScalar
())
{
const
char
*
dotFeature
=
"scalar swizzle"
;
const
char
*
dotFeature
=
"scalar swizzle"
;
requireProfile
(
loc
,
~
EEsProfile
,
dotFeature
);
requireProfile
(
loc
,
~
EEsProfile
,
dotFeature
);
...
@@ -4460,8 +4461,8 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
...
@@ -4460,8 +4461,8 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
switch
(
qualifier
.
storage
)
{
switch
(
qualifier
.
storage
)
{
case
EvqVaryingIn
:
case
EvqVaryingIn
:
case
EvqVaryingOut
:
case
EvqVaryingOut
:
if
(
type
.
getBasicType
()
!=
EbtBlock
||
if
(
type
.
getBasicType
()
!=
EbtBlock
||
(
!
(
*
type
.
getStruct
())[
0
].
type
->
getQualifier
().
hasLocation
()
&&
(
!
(
*
type
.
getStruct
())[
0
].
type
->
getQualifier
().
hasLocation
()
&&
(
*
type
.
getStruct
())[
0
].
type
->
getQualifier
().
builtIn
==
EbvNone
))
(
*
type
.
getStruct
())[
0
].
type
->
getQualifier
().
builtIn
==
EbvNone
))
error
(
loc
,
"SPIR-V requires location for user input/output"
,
"location"
,
""
);
error
(
loc
,
"SPIR-V requires location for user input/output"
,
"location"
,
""
);
break
;
break
;
...
...
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