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
f911500d
Commit
f911500d
authored
Sep 18, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Non-functional; make flatten semantics be about aggregates, not just structures.
parent
fcea302d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
revision.h
glslang/Include/revision.h
+2
-2
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+13
-13
hlslParseHelper.h
hlsl/hlslParseHelper.h
+3
-3
No files found.
glslang/Include/revision.h
View file @
f911500d
...
...
@@ -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.149
1
"
#define GLSLANG_DATE "1
6
-Sep-2016"
#define GLSLANG_REVISION "Overload400-PrecQual.149
3
"
#define GLSLANG_DATE "1
8
-Sep-2016"
hlsl/hlslParseHelper.cpp
View file @
f911500d
...
...
@@ -700,9 +700,9 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
return
result
;
}
// Is this a
structur
e that can't be passed down the stack?
// Is this a
n aggregat
e that can't be passed down the stack?
// E.g., pipeline inputs to the vertex stage and outputs from the fragment stage.
bool
HlslParseContext
::
shouldFlatten
(
const
TType
&
type
)
bool
HlslParseContext
::
shouldFlatten
(
const
TType
&
type
)
const
{
if
(
!
inEntrypoint
)
return
false
;
...
...
@@ -714,13 +714,13 @@ bool HlslParseContext::shouldFlatten(const TType& type)
qualifier
==
EvqVaryingOut
);
}
// Figure out the mapping between a
structur
e's top members and an
// Figure out the mapping between a
n aggregat
e's top members and an
// equivalent set of individual variables.
//
// Assumes shouldFlatten() or equivalent was called first.
//
// TODO: generalize this to arbitrary nesting?
void
HlslParseContext
::
flatten
Struct
(
const
TVariable
&
variable
)
void
HlslParseContext
::
flatten
(
const
TVariable
&
variable
)
{
TVector
<
TVariable
*>
memberVariables
;
...
...
@@ -735,8 +735,8 @@ void HlslParseContext::flattenStruct(const TVariable& variable)
flattenMap
[
variable
.
getUniqueId
()]
=
memberVariables
;
}
// Turn an access into
structur
e that was flattened to instead be
// an access to the individual variable the member was flattened to.
// Turn an access into
aggregat
e that was flattened to instead be
// an access to the individual variable the
element/
member was flattened to.
// Assumes shouldFlatten() or equivalent was called first.
TIntermTyped
*
HlslParseContext
::
flattenAccess
(
TIntermTyped
*
base
,
int
member
)
{
...
...
@@ -855,7 +855,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
remapEntrypointIO
(
function
);
if
(
entryPointOutput
)
{
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
flatten
Struct
(
*
entryPointOutput
);
flatten
(
*
entryPointOutput
);
assignLocations
(
*
entryPointOutput
);
}
}
else
...
...
@@ -887,7 +887,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
// get IO straightened out
if
(
inEntrypoint
)
{
if
(
shouldFlatten
(
*
param
.
type
))
flatten
Struct
(
*
variable
);
flatten
(
*
variable
);
assignLocations
(
*
variable
);
}
...
...
@@ -1035,7 +1035,7 @@ void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*
// Some simple source assignments need to be flattened to a sequence
// of AST assignments. Catch these and flatten, otherwise, pass through
// to intermediate.addAssign().
TIntermTyped
*
HlslParseContext
::
handleAssign
(
const
TSourceLoc
&
loc
,
TOperator
op
,
TIntermTyped
*
left
,
TIntermTyped
*
right
)
TIntermTyped
*
HlslParseContext
::
handleAssign
(
const
TSourceLoc
&
loc
,
TOperator
op
,
TIntermTyped
*
left
,
TIntermTyped
*
right
)
const
{
const
auto
mustFlatten
=
[
&
](
const
TIntermTyped
&
node
)
{
return
shouldFlatten
(
node
.
getType
())
&&
node
.
getAsSymbolNode
()
&&
...
...
@@ -1064,12 +1064,12 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
return
subTree
;
};
TVector
<
TVariable
*>*
leftVariables
=
nullptr
;
TVector
<
TVariable
*>*
rightVariables
=
nullptr
;
const
TVector
<
TVariable
*>*
leftVariables
=
nullptr
;
const
TVector
<
TVariable
*>*
rightVariables
=
nullptr
;
if
(
flattenLeft
)
leftVariables
=
&
flattenMap
[
left
->
getAsSymbolNode
()
->
getId
()]
;
leftVariables
=
&
flattenMap
.
find
(
left
->
getAsSymbolNode
()
->
getId
())
->
second
;
if
(
flattenRight
)
rightVariables
=
&
flattenMap
[
right
->
getAsSymbolNode
()
->
getId
()]
;
rightVariables
=
&
flattenMap
.
find
(
right
->
getAsSymbolNode
()
->
getId
())
->
second
;
TIntermAggregate
*
assignList
=
nullptr
;
for
(
int
member
=
0
;
member
<
(
int
)
members
.
size
();
++
member
)
{
TIntermTyped
*
subRight
=
getMember
(
flattenRight
,
right
,
*
rightVariables
,
member
);
...
...
hlsl/hlslParseHelper.h
View file @
f911500d
...
...
@@ -83,8 +83,8 @@ public:
TIntermTyped
*
handleBinaryMath
(
const
TSourceLoc
&
,
const
char
*
str
,
TOperator
op
,
TIntermTyped
*
left
,
TIntermTyped
*
right
);
TIntermTyped
*
handleUnaryMath
(
const
TSourceLoc
&
,
const
char
*
str
,
TOperator
op
,
TIntermTyped
*
childNode
);
TIntermTyped
*
handleDotDereference
(
const
TSourceLoc
&
,
TIntermTyped
*
base
,
const
TString
&
field
);
bool
shouldFlatten
(
const
TType
&
);
void
flatten
Struct
(
const
TVariable
&
variable
);
bool
shouldFlatten
(
const
TType
&
)
const
;
void
flatten
(
const
TVariable
&
variable
);
TIntermTyped
*
flattenAccess
(
TIntermTyped
*
base
,
int
member
);
void
assignLocations
(
TVariable
&
variable
);
TFunction
&
handleFunctionDeclarator
(
const
TSourceLoc
&
,
TFunction
&
function
,
bool
prototype
);
...
...
@@ -94,7 +94,7 @@ public:
void
remapNonEntrypointIO
(
TFunction
&
function
);
TIntermNode
*
handleReturnValue
(
const
TSourceLoc
&
,
TIntermTyped
*
);
void
handleFunctionArgument
(
TFunction
*
,
TIntermTyped
*&
arguments
,
TIntermTyped
*
newArg
);
TIntermTyped
*
handleAssign
(
const
TSourceLoc
&
,
TOperator
,
TIntermTyped
*
left
,
TIntermTyped
*
right
);
TIntermTyped
*
handleAssign
(
const
TSourceLoc
&
,
TOperator
,
TIntermTyped
*
left
,
TIntermTyped
*
right
)
const
;
TIntermTyped
*
handleFunctionCall
(
const
TSourceLoc
&
,
TFunction
*
,
TIntermNode
*
);
void
decomposeIntrinsic
(
const
TSourceLoc
&
,
TIntermTyped
*&
node
,
TIntermNode
*
arguments
);
void
decomposeSampleMethods
(
const
TSourceLoc
&
,
TIntermTyped
*&
node
,
TIntermNode
*
arguments
);
...
...
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