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
94dfb7a5
Commit
94dfb7a5
authored
Jan 18, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non-functional: Factor out entry-point logic from handleFunctionDefinition().
parent
33dadd12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
29 deletions
+43
-29
revision.h
glslang/Include/revision.h
+2
-2
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+40
-27
hlslParseHelper.h
hlsl/hlslParseHelper.h
+1
-0
No files found.
glslang/Include/revision.h
View file @
94dfb7a5
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// 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).
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.177
0
"
#define GLSLANG_REVISION "Overload400-PrecQual.177
2
"
#define GLSLANG_DATE "1
3
-Jan-2017"
#define GLSLANG_DATE "1
8
-Jan-2017"
hlsl/hlslParseHelper.cpp
View file @
94dfb7a5
...
@@ -1572,20 +1572,9 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
...
@@ -1572,20 +1572,9 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
currentFunctionType
=
new
TType
(
EbtVoid
);
currentFunctionType
=
new
TType
(
EbtVoid
);
functionReturnsValue
=
false
;
functionReturnsValue
=
false
;
inEntryPoint
=
function
.
getName
().
compare
(
intermediate
.
getEntryPointName
().
c_str
())
==
0
;
// Entry points need different I/O and other handling, transform it so the
if
(
inEntryPoint
)
{
// rest of this function doesn't care.
intermediate
.
setEntryPointMangledName
(
function
.
getMangledName
().
c_str
());
transformEntryPoint
(
loc
,
function
,
attributes
);
intermediate
.
incrementEntryPointCount
();
remapEntryPointIO
(
function
);
if
(
entryPointOutput
)
{
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
flatten
(
loc
,
*
entryPointOutput
);
if
(
shouldSplit
(
entryPointOutput
->
getType
()))
split
(
*
entryPointOutput
);
assignLocations
(
*
entryPointOutput
);
}
}
else
remapNonEntryPointIO
(
function
);
// Insert the $Global constant buffer.
// Insert the $Global constant buffer.
// TODO: this design fails if new members are declared between function definitions.
// TODO: this design fails if new members are declared between function definitions.
...
@@ -1649,23 +1638,47 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
...
@@ -1649,23 +1638,47 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
controlFlowNestingLevel
=
0
;
controlFlowNestingLevel
=
0
;
postEntryPointReturn
=
false
;
postEntryPointReturn
=
false
;
// Handle function attributes
return
paramNodes
;
if
(
inEntryPoint
)
{
}
const
TIntermAggregate
*
numThreads
=
attributes
[
EatNumThreads
];
if
(
numThreads
!=
nullptr
)
{
const
TIntermSequence
&
sequence
=
numThreads
->
getSequence
();
for
(
int
lid
=
0
;
lid
<
int
(
sequence
.
size
());
++
lid
)
//
intermediate
.
setLocalSize
(
lid
,
sequence
[
lid
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
());
// Do all special handling for the entry point.
}
//
void
HlslParseContext
::
transformEntryPoint
(
const
TSourceLoc
&
loc
,
TFunction
&
function
,
const
TAttributeMap
&
attributes
)
{
inEntryPoint
=
function
.
getName
().
compare
(
intermediate
.
getEntryPointName
().
c_str
())
==
0
;
const
TIntermAggregate
*
maxVertexCount
=
attributes
[
EatMaxVertexCount
];
if
(
!
inEntryPoint
)
{
if
(
maxVertexCount
!=
nullptr
)
{
remapNonEntryPointIO
(
function
);
intermediate
.
setVertices
(
maxVertexCount
->
getSequence
()[
0
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
());
return
;
}
}
}
return
paramNodes
;
// entry point logic...
intermediate
.
setEntryPointMangledName
(
function
.
getMangledName
().
c_str
());
intermediate
.
incrementEntryPointCount
();
// Handle parameters and return value
remapEntryPointIO
(
function
);
if
(
entryPointOutput
)
{
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
flatten
(
loc
,
*
entryPointOutput
);
if
(
shouldSplit
(
entryPointOutput
->
getType
()))
split
(
*
entryPointOutput
);
assignLocations
(
*
entryPointOutput
);
}
// Handle function attributes
const
TIntermAggregate
*
numThreads
=
attributes
[
EatNumThreads
];
if
(
numThreads
!=
nullptr
)
{
const
TIntermSequence
&
sequence
=
numThreads
->
getSequence
();
for
(
int
lid
=
0
;
lid
<
int
(
sequence
.
size
());
++
lid
)
intermediate
.
setLocalSize
(
lid
,
sequence
[
lid
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
());
}
const
TIntermAggregate
*
maxVertexCount
=
attributes
[
EatMaxVertexCount
];
if
(
maxVertexCount
!=
nullptr
)
intermediate
.
setVertices
(
maxVertexCount
->
getSequence
()[
0
]
->
getAsConstantUnion
()
->
getConstArray
()[
0
].
getIConst
());
}
}
void
HlslParseContext
::
handleFunctionBody
(
const
TSourceLoc
&
loc
,
TFunction
&
function
,
TIntermNode
*
functionBody
,
TIntermNode
*&
node
)
void
HlslParseContext
::
handleFunctionBody
(
const
TSourceLoc
&
loc
,
TFunction
&
function
,
TIntermNode
*
functionBody
,
TIntermNode
*&
node
)
...
...
hlsl/hlslParseHelper.h
View file @
94dfb7a5
...
@@ -73,6 +73,7 @@ public:
...
@@ -73,6 +73,7 @@ public:
void
assignLocations
(
TVariable
&
variable
);
void
assignLocations
(
TVariable
&
variable
);
TFunction
&
handleFunctionDeclarator
(
const
TSourceLoc
&
,
TFunction
&
function
,
bool
prototype
);
TFunction
&
handleFunctionDeclarator
(
const
TSourceLoc
&
,
TFunction
&
function
,
bool
prototype
);
TIntermAggregate
*
handleFunctionDefinition
(
const
TSourceLoc
&
,
TFunction
&
,
const
TAttributeMap
&
);
TIntermAggregate
*
handleFunctionDefinition
(
const
TSourceLoc
&
,
TFunction
&
,
const
TAttributeMap
&
);
void
transformEntryPoint
(
const
TSourceLoc
&
,
TFunction
&
,
const
TAttributeMap
&
);
void
handleFunctionBody
(
const
TSourceLoc
&
,
TFunction
&
,
TIntermNode
*
functionBody
,
TIntermNode
*&
node
);
void
handleFunctionBody
(
const
TSourceLoc
&
,
TFunction
&
,
TIntermNode
*
functionBody
,
TIntermNode
*&
node
);
void
remapEntryPointIO
(
TFunction
&
function
);
void
remapEntryPointIO
(
TFunction
&
function
);
void
remapNonEntryPointIO
(
TFunction
&
function
);
void
remapNonEntryPointIO
(
TFunction
&
function
);
...
...
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