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
6e2295d3
Commit
6e2295d3
authored
May 24, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Fix #902: Incorrect protection against zero arguments.
parent
2c6f48b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
6 deletions
+158
-6
hlsl.function.frag.out
Test/baseResults/hlsl.function.frag.out
+119
-0
hlsl.function.frag
Test/hlsl.function.frag
+26
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+12
-6
No files found.
Test/baseResults/hlsl.function.frag.out
0 → 100755
View file @
6e2295d3
hlsl.function.frag
ERROR: 0:24: 'fun1' : unknown variable
ERROR: 0:24: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 2 compilation errors. No code generated.
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:2 Function Definition: fun0( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Branch: Return with expression
0:3 Constant:
0:3 1.000000
0:3 1.000000
0:3 1.000000
0:3 1.000000
0:7 Function Definition: fun2(vf4; ( temp uint)
0:7 Function Parameters:
0:7 'col' ( in 4-component vector of float)
0:? Sequence
0:8 Branch: Return with expression
0:8 Constant:
0:8 7 (const uint)
0:12 Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
0:12 Function Parameters:
0:12 'id1' ( in uint)
0:12 'id2' ( in uint)
0:? Sequence
0:13 Branch: Return with expression
0:13 Construct vec4 ( temp 4-component vector of float)
0:13 Convert uint to float ( temp float)
0:13 component-wise multiply ( temp uint)
0:13 'id1' ( in uint)
0:13 'id2' ( in uint)
0:17 Function Definition: fun1(i1; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'index' ( in int)
0:? Sequence
0:18 Sequence
0:18 move second child to first child ( temp uint)
0:18 'entityId' ( temp uint)
0:18 Function Call: fun2(vf4; ( temp uint)
0:18 Function Call: fun0( ( temp 4-component vector of float)
0:19 Branch: Return with expression
0:19 Function Call: fun4(u1;u1; ( temp 4-component vector of float)
0:19 'entityId' ( temp uint)
0:19 'entityId' ( temp uint)
0:23 Function Definition: @main( ( temp int)
0:23 Function Parameters:
0:23 Function Definition: main( ( temp void)
0:23 Function Parameters:
0:? Sequence
0:23 move second child to first child ( temp int)
0:? '@entryPointOutput' (layout( location=0) out int)
0:23 Function Call: @main( ( temp int)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out int)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:2 Function Definition: fun0( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Branch: Return with expression
0:3 Constant:
0:3 1.000000
0:3 1.000000
0:3 1.000000
0:3 1.000000
0:7 Function Definition: fun2(vf4; ( temp uint)
0:7 Function Parameters:
0:7 'col' ( in 4-component vector of float)
0:? Sequence
0:8 Branch: Return with expression
0:8 Constant:
0:8 7 (const uint)
0:12 Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
0:12 Function Parameters:
0:12 'id1' ( in uint)
0:12 'id2' ( in uint)
0:? Sequence
0:13 Branch: Return with expression
0:13 Construct vec4 ( temp 4-component vector of float)
0:13 Convert uint to float ( temp float)
0:13 component-wise multiply ( temp uint)
0:13 'id1' ( in uint)
0:13 'id2' ( in uint)
0:17 Function Definition: fun1(i1; ( temp 4-component vector of float)
0:17 Function Parameters:
0:17 'index' ( in int)
0:? Sequence
0:18 Sequence
0:18 move second child to first child ( temp uint)
0:18 'entityId' ( temp uint)
0:18 Function Call: fun2(vf4; ( temp uint)
0:18 Function Call: fun0( ( temp 4-component vector of float)
0:19 Branch: Return with expression
0:19 Function Call: fun4(u1;u1; ( temp 4-component vector of float)
0:19 'entityId' ( temp uint)
0:19 'entityId' ( temp uint)
0:23 Function Definition: @main( ( temp int)
0:23 Function Parameters:
0:23 Function Definition: main( ( temp void)
0:23 Function Parameters:
0:? Sequence
0:23 move second child to first child ( temp int)
0:? '@entryPointOutput' (layout( location=0) out int)
0:23 Function Call: @main( ( temp int)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out int)
SPIR-V is not generated for failed compile or link
Test/hlsl.function.frag
0 → 100644
View file @
6e2295d3
float4
fun0
()
{
return
1
.
0
f
;
}
uint
fun2
(
float4
col
)
{
return
7
;
}
float4
fun4
(
uint
id1
,
uint
id2
)
{
return
id1
*
id2
;
}
float4
fun1
(
int
index
)
{
uint
entityId
=
fun2
(
fun0
());
return
fun4
(
entityId
,
entityId
);
}
int
main
()
:
SV_TARGET
{
return
fun1
;
}
\ No newline at end of file
gtests/Hlsl.FromFile.cpp
View file @
6e2295d3
...
@@ -131,6 +131,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -131,6 +131,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.domain.1.tese"
,
"main"
},
{
"hlsl.domain.1.tese"
,
"main"
},
{
"hlsl.domain.2.tese"
,
"main"
},
{
"hlsl.domain.2.tese"
,
"main"
},
{
"hlsl.domain.3.tese"
,
"main"
},
{
"hlsl.domain.3.tese"
,
"main"
},
{
"hlsl.function.frag"
,
"main"
},
{
"hlsl.hull.1.tesc"
,
"main"
},
{
"hlsl.hull.1.tesc"
,
"main"
},
{
"hlsl.hull.2.tesc"
,
"main"
},
{
"hlsl.hull.2.tesc"
,
"main"
},
{
"hlsl.hull.void.tesc"
,
"main"
},
{
"hlsl.hull.void.tesc"
,
"main"
},
...
...
hlsl/hlslParseHelper.cpp
View file @
6e2295d3
...
@@ -2988,13 +2988,19 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
...
@@ -2988,13 +2988,19 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
const
TOperator
op
=
node
->
getAsOperator
()
->
getOp
();
const
TOperator
op
=
node
->
getAsOperator
()
->
getOp
();
const
TIntermAggregate
*
argAggregate
=
arguments
?
arguments
->
getAsAggregate
()
:
nullptr
;
const
TIntermAggregate
*
argAggregate
=
arguments
?
arguments
->
getAsAggregate
()
:
nullptr
;
// Bail out if not a sampler method
// Bail out if not a sampler method.
// Note though this is odd to do before checking the op, because the op
// could be something that takes the arguments, and the function in question
// takes the result of the op. So, this is not the final word.
if
(
arguments
!=
nullptr
)
{
if
(
arguments
!=
nullptr
)
{
if
((
argAggregate
!=
nullptr
&&
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
))
if
(
argAggregate
==
nullptr
)
{
return
;
if
(
arguments
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
return
;
if
(
argAggregate
==
nullptr
&&
arguments
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
}
else
{
return
;
if
(
argAggregate
->
getSequence
().
size
()
==
0
||
argAggregate
->
getSequence
()[
0
]
->
getAsTyped
()
->
getBasicType
()
!=
EbtSampler
)
return
;
}
}
}
switch
(
op
)
{
switch
(
op
)
{
...
...
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