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
087a454a
Commit
087a454a
authored
Oct 06, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Add shape conversions for return values.
parent
ed33e057
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
8 deletions
+112
-8
hlsl.shapeConvRet.frag.out
Test/baseResults/hlsl.shapeConvRet.frag.out
+94
-0
hlsl.shapeConvRet.frag
Test/hlsl.shapeConvRet.frag
+9
-0
revision.h
glslang/Include/revision.h
+1
-1
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+1
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+6
-7
No files found.
Test/baseResults/hlsl.shapeConvRet.frag.out
0 → 100755
View file @
087a454a
hlsl.shapeConvRet.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: foo( (temp 3-component vector of int)
0:2 Function Parameters:
0:? Sequence
0:3 Branch: Return with expression
0:3 Constant:
0:3 13 (const int)
0:3 13 (const int)
0:3 13 (const int)
0:7 Function Definition: main(f1; (temp 4-component vector of float)
0:7 Function Parameters:
0:7 'f' (layout(location=0 ) in float)
0:? Sequence
0:8 Sequence
0:8 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:8 Construct vec4 (temp 4-component vector of float)
0:8 'f' (layout(location=0 ) in float)
0:8 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'f' (layout(location=0 ) in float)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: foo( (temp 3-component vector of int)
0:2 Function Parameters:
0:? Sequence
0:3 Branch: Return with expression
0:3 Constant:
0:3 13 (const int)
0:3 13 (const int)
0:3 13 (const int)
0:7 Function Definition: main(f1; (temp 4-component vector of float)
0:7 Function Parameters:
0:7 'f' (layout(location=0 ) in float)
0:? Sequence
0:8 Sequence
0:8 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:8 Construct vec4 (temp 4-component vector of float)
0:8 'f' (layout(location=0 ) in float)
0:8 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'f' (layout(location=0 ) in float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 24
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 18 20
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "foo("
Name 18 "@entryPointOutput"
Name 20 "f"
Decorate 18(@entryPointOutput) Location 0
Decorate 20(f) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeVector 6(int) 3
8: TypeFunction 7(ivec3)
11: 6(int) Constant 13
12: 7(ivec3) ConstantComposite 11 11 11
15: TypeFloat 32
16: TypeVector 15(float) 4
17: TypePointer Output 16(fvec4)
18(@entryPointOutput): 17(ptr) Variable Output
19: TypePointer Input 15(float)
20(f): 19(ptr) Variable Input
4(main): 2 Function None 3
5: Label
21: 15(float) Load 20(f)
22: 16(fvec4) CompositeConstruct 21 21 21 21
Store 18(@entryPointOutput) 22
Return
FunctionEnd
9(foo(): 7(ivec3) Function None 8
10: Label
ReturnValue 12
FunctionEnd
Test/hlsl.shapeConvRet.frag
0 → 100755
View file @
087a454a
int3
foo
()
{
return
13
;
}
float4
main
(
float
f
)
{
return
f
;
}
glslang/Include/revision.h
View file @
087a454a
...
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.155
6
"
#define GLSLANG_REVISION "Overload400-PrecQual.155
9
"
#define GLSLANG_DATE "06-Oct-2016"
glslang/MachineIndependent/Intermediate.cpp
View file @
087a454a
...
...
@@ -768,6 +768,7 @@ TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type,
case
EOpEqual
:
case
EOpNotEqual
:
case
EOpFunctionCall
:
case
EOpReturn
:
break
;
default
:
return
node
;
...
...
gtests/Hlsl.FromFile.cpp
View file @
087a454a
...
...
@@ -175,6 +175,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.samplelevel.offsetarray.dx10.frag"
,
"main"
},
{
"hlsl.semicolons.frag"
,
"main"
},
{
"hlsl.shapeConv.frag"
,
"main"
},
{
"hlsl.shapeConvRet.frag"
,
"main"
},
{
"hlsl.stringtoken.frag"
,
"main"
},
{
"hlsl.string.frag"
,
"main"
},
{
"hlsl.structin.vert"
,
"main"
},
...
...
hlsl/hlslParseHelper.cpp
View file @
087a454a
...
...
@@ -888,18 +888,17 @@ void HlslParseContext::remapNonEntryPointIO(TFunction& function)
TIntermNode
*
HlslParseContext
::
handleReturnValue
(
const
TSourceLoc
&
loc
,
TIntermTyped
*
value
)
{
functionReturnsValue
=
true
;
TIntermTyped
*
converted
=
value
;
if
(
currentFunctionType
->
getBasicType
()
==
EbtVoid
)
{
error
(
loc
,
"void function cannot return a value"
,
"return"
,
""
);
return
intermediate
.
addBranch
(
EOpReturn
,
loc
);
}
else
if
(
*
currentFunctionType
!=
value
->
getType
())
{
converted
=
intermediate
.
addConversion
(
EOpReturn
,
*
currentFunctionType
,
value
);
if
(
converted
)
{
return
intermediate
.
addBranch
(
EOpReturn
,
converted
,
loc
);
}
else
{
value
=
intermediate
.
addConversion
(
EOpReturn
,
*
currentFunctionType
,
value
);
if
(
value
&&
*
currentFunctionType
!=
value
->
getType
())
value
=
intermediate
.
addShapeConversion
(
EOpReturn
,
*
currentFunctionType
,
value
);
if
(
value
==
nullptr
)
{
error
(
loc
,
"type does not match, or is not convertible to, the function's return type"
,
"return"
,
""
);
converted
=
value
;
return
value
;
}
}
...
...
@@ -912,7 +911,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
assert
(
entryPointOutput
!=
nullptr
);
// should have been error tested at the beginning
TIntermSymbol
*
left
=
new
TIntermSymbol
(
entryPointOutput
->
getUniqueId
(),
entryPointOutput
->
getName
(),
entryPointOutput
->
getType
());
TIntermNode
*
returnSequence
=
handleAssign
(
loc
,
EOpAssign
,
left
,
converted
);
TIntermNode
*
returnSequence
=
handleAssign
(
loc
,
EOpAssign
,
left
,
value
);
returnSequence
=
intermediate
.
makeAggregate
(
returnSequence
);
returnSequence
=
intermediate
.
growAggregate
(
returnSequence
,
intermediate
.
addBranch
(
EOpReturn
,
loc
),
loc
);
returnSequence
->
getAsAggregate
()
->
setOperator
(
EOpSequence
);
...
...
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