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
6fccb3cd
Commit
6fccb3cd
authored
Sep 19, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non-functional: Sweep through the stack for consistent with "main" and entry point.
Partially addresses issue #513.
parent
142785f3
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
52 additions
and
52 deletions
+52
-52
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+7
-7
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+1
-1
SpvBuilder.h
SPIRV/SpvBuilder.h
+1
-1
120.frag.out
Test/baseResults/120.frag.out
+1
-1
420.geom.out
Test/baseResults/420.geom.out
+1
-1
420_size_gl_in.geom.out
Test/baseResults/420_size_gl_in.geom.out
+1
-1
430.vert.out
Test/baseResults/430.vert.out
+1
-1
440.frag.out
Test/baseResults/440.frag.out
+1
-1
440.vert.out
Test/baseResults/440.vert.out
+1
-1
450.comp.out
Test/baseResults/450.comp.out
+1
-1
badChars.frag.out
Test/baseResults/badChars.frag.out
+1
-1
cppBad.vert.out
Test/baseResults/cppBad.vert.out
+1
-1
dce.frag.out
Test/baseResults/dce.frag.out
+1
-1
errors.frag.out
Test/baseResults/errors.frag.out
+1
-1
mains1.frag.out
Test/baseResults/mains1.frag.out
+1
-1
noMain.vert.out
Test/baseResults/noMain.vert.out
+1
-1
nonVulkan.frag.out
Test/baseResults/nonVulkan.frag.out
+1
-1
revision.h
glslang/Include/revision.h
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+2
-2
SymbolTable.cpp
glslang/MachineIndependent/SymbolTable.cpp
+1
-1
linkValidate.cpp
glslang/MachineIndependent/linkValidate.cpp
+3
-3
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+4
-4
PpScanner.cpp
glslang/MachineIndependent/preprocessor/PpScanner.cpp
+1
-1
reflection.cpp
glslang/MachineIndependent/reflection.cpp
+5
-5
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+9
-9
hlslParseHelper.h
hlsl/hlslParseHelper.h
+3
-3
No files found.
SPIRV/GlslangToSpv.cpp
View file @
6fccb3cd
...
...
@@ -137,7 +137,7 @@ protected:
void
updateMemberOffset
(
const
glslang
::
TType
&
structType
,
const
glslang
::
TType
&
memberType
,
int
&
currentOffset
,
int
&
nextOffset
,
glslang
::
TLayoutPacking
,
glslang
::
TLayoutMatrix
);
void
declareUseOfStructMember
(
const
glslang
::
TTypeList
&
members
,
int
glslangMember
);
bool
isShaderEntry
p
oint
(
const
glslang
::
TIntermAggregate
*
node
);
bool
isShaderEntry
P
oint
(
const
glslang
::
TIntermAggregate
*
node
);
void
makeFunctions
(
const
glslang
::
TIntermSequence
&
);
void
makeGlobalInitializers
(
const
glslang
::
TIntermSequence
&
);
void
visitFunctions
(
const
glslang
::
TIntermSequence
&
);
...
...
@@ -713,7 +713,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
builder
.
setSource
(
TranslateSourceLanguage
(
glslangIntermediate
->
getSource
(),
glslangIntermediate
->
getProfile
()),
glslangIntermediate
->
getVersion
());
stdBuiltins
=
builder
.
import
(
"GLSL.std.450"
);
builder
.
setMemoryModel
(
spv
::
AddressingModelLogical
,
spv
::
MemoryModelGLSL450
);
shaderEntry
=
builder
.
makeEntry
p
oint
(
glslangIntermediate
->
getEntryPoint
().
c_str
());
shaderEntry
=
builder
.
makeEntry
P
oint
(
glslangIntermediate
->
getEntryPoint
().
c_str
());
entryPoint
=
builder
.
addEntryPoint
(
executionModel
,
shaderEntry
,
glslangIntermediate
->
getEntryPoint
().
c_str
());
// Add the source extensions
...
...
@@ -1279,7 +1279,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
// In all cases, still let the traverser visit the children for us.
makeFunctions
(
node
->
getAsAggregate
()
->
getSequence
());
// Also, we want all globals initializers to go into the
entry of main()
, before
// Also, we want all globals initializers to go into the
beginning of the entry point
, before
// anything else gets there, so visit out of order, doing them all now.
makeGlobalInitializers
(
node
->
getAsAggregate
()
->
getSequence
());
...
...
@@ -1313,7 +1313,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
}
case
glslang
:
:
EOpFunction
:
if
(
visit
==
glslang
::
EvPreVisit
)
{
if
(
isShaderEntry
p
oint
(
node
))
{
if
(
isShaderEntry
P
oint
(
node
))
{
inMain
=
true
;
builder
.
setBuildPoint
(
shaderEntry
->
getLastBlock
());
}
else
{
...
...
@@ -2451,7 +2451,7 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
}
}
bool
TGlslangToSpvTraverser
::
isShaderEntry
p
oint
(
const
glslang
::
TIntermAggregate
*
node
)
bool
TGlslangToSpvTraverser
::
isShaderEntry
P
oint
(
const
glslang
::
TIntermAggregate
*
node
)
{
// have to ignore mangling and just look at the base name
size_t
firstOpen
=
node
->
getName
().
find
(
'('
);
...
...
@@ -2463,7 +2463,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
{
for
(
int
f
=
0
;
f
<
(
int
)
glslFunctions
.
size
();
++
f
)
{
glslang
::
TIntermAggregate
*
glslFunction
=
glslFunctions
[
f
]
->
getAsAggregate
();
if
(
!
glslFunction
||
glslFunction
->
getOp
()
!=
glslang
::
EOpFunction
||
isShaderEntry
p
oint
(
glslFunction
))
if
(
!
glslFunction
||
glslFunction
->
getOp
()
!=
glslang
::
EOpFunction
||
isShaderEntry
P
oint
(
glslFunction
))
continue
;
// We're on a user function. Set up the basic interface for the function now,
...
...
@@ -2523,7 +2523,7 @@ void TGlslangToSpvTraverser::makeGlobalInitializers(const glslang::TIntermSequen
if
(
initializer
&&
initializer
->
getOp
()
!=
glslang
::
EOpFunction
&&
initializer
->
getOp
()
!=
glslang
::
EOpLinkerObjects
)
{
// We're on a top-level node that's not a function. Treat as an initializer, whose
// code goes into the beginning of
main
.
// code goes into the beginning of
the entry point
.
initializer
->
traverse
(
this
);
}
}
...
...
SPIRV/SpvBuilder.cpp
View file @
6fccb3cd
...
...
@@ -931,7 +931,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
}
// Comments in header
Function
*
Builder
::
makeEntry
p
oint
(
const
char
*
entryPoint
)
Function
*
Builder
::
makeEntry
P
oint
(
const
char
*
entryPoint
)
{
assert
(
!
mainFunction
);
...
...
SPIRV/SpvBuilder.h
View file @
6fccb3cd
...
...
@@ -210,7 +210,7 @@ public:
// Make the entry-point function. The returned pointer is only valid
// for the lifetime of this builder.
Function
*
makeEntry
p
oint
(
const
char
*
);
Function
*
makeEntry
P
oint
(
const
char
*
);
// Make a shader-style function, and create its entry block if entry is non-zero.
// Return the function, pass back the entry.
...
...
Test/baseResults/120.frag.out
View file @
6fccb3cd
...
...
@@ -23,7 +23,7 @@ ERROR: 0:84: 'z' : vector field selection out of range
ERROR: 0:85: 'assign' : l-value required
ERROR: 0:91: 'int' : overloaded functions must have the same return type
ERROR: 0:91: 'main' : function already has a body
ERROR: 0:91: 'int' :
main function
cannot return a value
ERROR: 0:91: 'int' :
entry point
cannot return a value
ERROR: 0:92: 'main' : function cannot take any parameter(s)
ERROR: 0:94: 'a' : variables with qualifier 'const' must be initialized
ERROR: 0:97: 'out' : overloaded functions must have the same parameter storage qualifiers for argument 1
...
...
Test/baseResults/420.geom.out
View file @
6fccb3cd
...
...
@@ -132,7 +132,7 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
...
...
Test/baseResults/420_size_gl_in.geom.out
View file @
6fccb3cd
...
...
@@ -39,7 +39,7 @@ ERROR: node is still EOpNull!
Linked geometry stage:
ERROR: Linking geometry stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
...
...
Test/baseResults/430.vert.out
View file @
6fccb3cd
...
...
@@ -266,7 +266,7 @@ ERROR: node is still EOpNull!
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
ERROR: xfb_buffer 3, xfb_stride 64, minimum stride needed: 80
...
...
Test/baseResults/440.frag.out
View file @
6fccb3cd
...
...
@@ -122,7 +122,7 @@ ERROR: node is still EOpNull!
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 440
ERROR: node is still EOpNull!
...
...
Test/baseResults/440.vert.out
View file @
6fccb3cd
...
...
@@ -160,7 +160,7 @@ ERROR: node is still EOpNull!
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
ERROR: xfb_buffer 0, xfb_stride 92, minimum stride needed: 96
ERROR: Linking vertex stage: xfb_stride must be multiple of 8 for buffer holding a double:
...
...
Test/baseResults/450.comp.out
View file @
6fccb3cd
...
...
@@ -9,7 +9,7 @@ local_size = (1, 1, 1)
Linked compute stage:
ERROR: Linking compute stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking compute stage: Missing entry point: Each stage requires one entry point
Shader version: 450
local_size = (1, 1, 1)
...
...
Test/baseResults/badChars.frag.out
View file @
6fccb3cd
...
...
@@ -17,7 +17,7 @@ ERROR: node is still EOpNull!
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 100
ERROR: node is still EOpNull!
...
...
Test/baseResults/cppBad.vert.out
View file @
6fccb3cd
...
...
@@ -14,7 +14,7 @@ ERROR: node is still EOpNull!
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Shader version: 100
ERROR: node is still EOpNull!
...
...
Test/baseResults/dce.frag.out
View file @
6fccb3cd
...
...
@@ -138,7 +138,7 @@ Shader version: 400
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 400
0:? Sequence
...
...
Test/baseResults/errors.frag.out
View file @
6fccb3cd
errors.frag
ERROR: 0:1: 'main' : function cannot take any parameter(s)
ERROR: 0:1: 'int' :
main function
cannot return a value
ERROR: 0:1: 'int' :
entry point
cannot return a value
ERROR: 2 compilation errors. No code generated.
...
...
Test/baseResults/mains1.frag.out
View file @
6fccb3cd
...
...
@@ -42,7 +42,7 @@ output primitive = line_strip
Linked geometry stage:
ERROR: Linking geometry stage: Contradictory output layout primitives
ERROR: Linking geometry stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
...
...
Test/baseResults/noMain.vert.out
View file @
6fccb3cd
...
...
@@ -23,7 +23,7 @@ ERROR: node is still EOpNull!
Linked vertex stage:
ERROR: Linking vertex stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Linked fragment stage:
...
...
Test/baseResults/nonVulkan.frag.out
View file @
6fccb3cd
...
...
@@ -18,7 +18,7 @@ ERROR: node is still EOpNull!
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one
"void main()"
entry point
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 450
ERROR: node is still EOpNull!
...
...
glslang/Include/revision.h
View file @
6fccb3cd
...
...
@@ -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
5
"
#define GLSLANG_REVISION "Overload400-PrecQual.149
6
"
#define GLSLANG_DATE "19-Sep-2016"
glslang/MachineIndependent/ParseHelper.cpp
View file @
6fccb3cd
...
...
@@ -1058,8 +1058,8 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
if
(
function
.
getParamCount
()
>
0
)
error
(
loc
,
"function cannot take any parameter(s)"
,
function
.
getName
().
c_str
(),
""
);
if
(
function
.
getType
().
getBasicType
()
!=
EbtVoid
)
error
(
loc
,
""
,
function
.
getType
().
getBasicTypeString
().
c_str
(),
"
main function
cannot return a value"
);
intermediate
.
addMain
Count
();
error
(
loc
,
""
,
function
.
getType
().
getBasicTypeString
().
c_str
(),
"
entry point
cannot return a value"
);
intermediate
.
incrementEntryPoint
Count
();
inMain
=
true
;
}
else
inMain
=
false
;
...
...
glslang/MachineIndependent/SymbolTable.cpp
View file @
6fccb3cd
...
...
@@ -35,7 +35,7 @@
//
//
// Symbol table for parsing. Most functionaliy and main ideas
// Symbol table for parsing. Most functionali
t
y and main ideas
// are documented in the header file.
//
...
...
glslang/MachineIndependent/linkValidate.cpp
View file @
6fccb3cd
...
...
@@ -81,7 +81,7 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
else
entryPoint
=
unit
.
entryPoint
;
}
num
Mains
+=
unit
.
numMain
s
;
num
EntryPoints
+=
unit
.
numEntryPoint
s
;
numErrors
+=
unit
.
numErrors
;
numPushConstants
+=
unit
.
numPushConstants
;
callGraph
.
insert
(
callGraph
.
end
(),
unit
.
callGraph
.
begin
(),
unit
.
callGraph
.
end
());
...
...
@@ -370,8 +370,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
//
void
TIntermediate
::
finalCheck
(
TInfoSink
&
infoSink
)
{
if
(
source
==
EShSourceGlsl
&&
num
Main
s
<
1
)
error
(
infoSink
,
"Missing entry point: Each stage requires one
\"
void main()
\"
entry point"
);
if
(
source
==
EShSourceGlsl
&&
num
EntryPoint
s
<
1
)
error
(
infoSink
,
"Missing entry point: Each stage requires one entry point"
);
if
(
numPushConstants
>
1
)
error
(
infoSink
,
"Only one push_constant block is allowed per stage"
);
...
...
glslang/MachineIndependent/localintermediate.h
View file @
6fccb3cd
...
...
@@ -137,7 +137,7 @@ class TIntermediate {
public
:
explicit
TIntermediate
(
EShLanguage
l
,
int
v
=
0
,
EProfile
p
=
ENoProfile
)
:
source
(
EShSourceNone
),
language
(
l
),
profile
(
p
),
version
(
v
),
treeRoot
(
0
),
num
Main
s
(
0
),
numErrors
(
0
),
numPushConstants
(
0
),
recursive
(
false
),
num
EntryPoint
s
(
0
),
numErrors
(
0
),
numPushConstants
(
0
),
recursive
(
false
),
invocations
(
TQualifier
::
layoutNotSet
),
vertices
(
TQualifier
::
layoutNotSet
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
vertexSpacing
(
EvsNone
),
vertexOrder
(
EvoNone
),
pointMode
(
false
),
earlyFragmentTests
(
false
),
depthLayout
(
EldNone
),
depthReplacing
(
false
),
blendEquations
(
0
),
...
...
@@ -173,8 +173,8 @@ public:
void
setTreeRoot
(
TIntermNode
*
r
)
{
treeRoot
=
r
;
}
TIntermNode
*
getTreeRoot
()
const
{
return
treeRoot
;
}
void
addMainCount
()
{
++
numMain
s
;
}
int
getNum
Mains
()
const
{
return
numMain
s
;
}
void
incrementEntryPointCount
()
{
++
numEntryPoint
s
;
}
int
getNum
EntryPoints
()
const
{
return
numEntryPoint
s
;
}
int
getNumErrors
()
const
{
return
numErrors
;
}
void
addPushConstantCount
()
{
++
numPushConstants
;
}
bool
isRecursive
()
const
{
return
recursive
;
}
...
...
@@ -370,7 +370,7 @@ protected:
TIntermNode
*
treeRoot
;
std
::
set
<
std
::
string
>
requestedExtensions
;
// cumulation of all enabled or required extensions; not connected to what subset of the shader used them
TBuiltInResource
resources
;
int
num
Main
s
;
int
num
EntryPoint
s
;
int
numErrors
;
int
numPushConstants
;
bool
recursive
;
...
...
glslang/MachineIndependent/preprocessor/PpScanner.cpp
View file @
6fccb3cd
...
...
@@ -696,7 +696,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
}
//
// The main functional entry
-
point into the preprocessor, which will
// The main functional entry
point into the preprocessor, which will
// scan the source strings to figure out and return the next processing token.
//
// Return string pointer to next token.
...
...
glslang/MachineIndependent/reflection.cpp
View file @
6fccb3cd
...
...
@@ -48,7 +48,7 @@
//
// High-level algorithm for one stage:
//
// 1. Put
main() on
list of live functions.
// 1. Put
the entry point on the
list of live functions.
//
// 2. Traverse any live function, while skipping if-tests with a compile-time constant
// condition of false, and while adding any encountered function calls to the live
...
...
@@ -59,7 +59,7 @@
// 3. Add any encountered uniform variables and blocks to the reflection database.
//
// Can be attempted with a failed link, but will return false if recursion had been detected, or
// there wasn't exactly one
main
.
// there wasn't exactly one
entry point
.
//
namespace
glslang
{
...
...
@@ -83,7 +83,7 @@ public:
virtual
void
visitSymbol
(
TIntermSymbol
*
base
);
virtual
bool
visitSelection
(
TVisit
,
TIntermSelection
*
node
);
// Track live funtions as well as uniforms, so that we don't visit dead functions
// Track live fun
c
tions as well as uniforms, so that we don't visit dead functions
// and only visit each function once.
void
addFunctionCall
(
TIntermAggregate
*
call
)
{
...
...
@@ -717,12 +717,12 @@ bool TLiveTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node)
// Returns false if the input is too malformed to do this.
bool
TReflection
::
addStage
(
EShLanguage
,
const
TIntermediate
&
intermediate
)
{
if
(
intermediate
.
getNum
Main
s
()
!=
1
||
intermediate
.
isRecursive
())
if
(
intermediate
.
getNum
EntryPoint
s
()
!=
1
||
intermediate
.
isRecursive
())
return
false
;
TLiveTraverser
it
(
intermediate
,
*
this
);
// put
main()
on functions to process
// put
the entry point
on functions to process
it
.
pushFunction
(
"main("
);
// process all the functions
...
...
hlsl/hlslParseHelper.cpp
View file @
6fccb3cd
...
...
@@ -704,7 +704,7 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
// E.g., pipeline inputs to the vertex stage and outputs from the fragment stage.
bool
HlslParseContext
::
shouldFlatten
(
const
TType
&
type
)
const
{
if
(
!
inEntry
p
oint
)
if
(
!
inEntry
P
oint
)
return
false
;
const
TStorageQualifier
qualifier
=
type
.
getQualifier
().
storage
;
...
...
@@ -850,16 +850,16 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
currentFunctionType
=
new
TType
(
EbtVoid
);
functionReturnsValue
=
false
;
inEntry
p
oint
=
(
function
.
getName
()
==
intermediate
.
getEntryPoint
().
c_str
());
if
(
inEntry
p
oint
)
{
remapEntry
p
ointIO
(
function
);
inEntry
P
oint
=
(
function
.
getName
()
==
intermediate
.
getEntryPoint
().
c_str
());
if
(
inEntry
P
oint
)
{
remapEntry
P
ointIO
(
function
);
if
(
entryPointOutput
)
{
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
flatten
(
*
entryPointOutput
);
assignLocations
(
*
entryPointOutput
);
}
}
else
remapNonEntry
p
ointIO
(
function
);
remapNonEntry
P
ointIO
(
function
);
//
// New symbol table scope for body of function plus its arguments
...
...
@@ -885,7 +885,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
error
(
loc
,
"redefinition"
,
variable
->
getName
().
c_str
(),
""
);
else
{
// get IO straightened out
if
(
inEntry
p
oint
)
{
if
(
inEntry
P
oint
)
{
if
(
shouldFlatten
(
*
param
.
type
))
flatten
(
*
variable
);
assignLocations
(
*
variable
);
...
...
@@ -925,7 +925,7 @@ void HlslParseContext::handleFunctionBody(const TSourceLoc& loc, TFunction& func
// AST I/O is done through shader globals declared in the 'in' or 'out'
// storage class. An HLSL entry point has a return value, input parameters
// and output parameters. These need to get remapped to the AST I/O.
void
HlslParseContext
::
remapEntry
p
ointIO
(
TFunction
&
function
)
void
HlslParseContext
::
remapEntry
P
ointIO
(
TFunction
&
function
)
{
// Will auto-assign locations here to the inputs/outputs defined by the entry point
...
...
@@ -969,7 +969,7 @@ void HlslParseContext::remapEntrypointIO(TFunction& function)
// An HLSL function that looks like an entry point, but is not,
// declares entry point IO built-ins, but these have to be undone.
void
HlslParseContext
::
remapNonEntry
p
ointIO
(
TFunction
&
function
)
void
HlslParseContext
::
remapNonEntry
P
ointIO
(
TFunction
&
function
)
{
const
auto
remapBuiltInType
=
[
&
](
TType
&
type
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
};
...
...
@@ -1007,7 +1007,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
// assignment subtree, and the second part being a return with no value.
//
// Otherwise, for a non entry point, just return a return statement.
if
(
inEntry
p
oint
)
{
if
(
inEntry
P
oint
)
{
assert
(
entryPointOutput
!=
nullptr
);
// should have been error tested at the beginning
TIntermSymbol
*
left
=
new
TIntermSymbol
(
entryPointOutput
->
getUniqueId
(),
entryPointOutput
->
getName
(),
entryPointOutput
->
getType
());
...
...
hlsl/hlslParseHelper.h
View file @
6fccb3cd
...
...
@@ -90,8 +90,8 @@ public:
TFunction
&
handleFunctionDeclarator
(
const
TSourceLoc
&
,
TFunction
&
function
,
bool
prototype
);
TIntermAggregate
*
handleFunctionDefinition
(
const
TSourceLoc
&
,
TFunction
&
);
void
handleFunctionBody
(
const
TSourceLoc
&
,
TFunction
&
,
TIntermNode
*
functionBody
,
TIntermNode
*&
node
);
void
remapEntry
p
ointIO
(
TFunction
&
function
);
void
remapNonEntry
p
ointIO
(
TFunction
&
function
);
void
remapEntry
P
ointIO
(
TFunction
&
function
);
void
remapNonEntry
P
ointIO
(
TFunction
&
function
);
TIntermNode
*
handleReturnValue
(
const
TSourceLoc
&
,
TIntermTyped
*
);
void
handleFunctionArgument
(
TFunction
*
,
TIntermTyped
*&
arguments
,
TIntermTyped
*
newArg
);
TIntermTyped
*
handleAssign
(
const
TSourceLoc
&
,
TOperator
,
TIntermTyped
*
left
,
TIntermTyped
*
right
)
const
;
...
...
@@ -185,7 +185,7 @@ protected:
int
structNestingLevel
;
// 0 if outside blocks and structures
int
controlFlowNestingLevel
;
// 0 if outside all flow control
TList
<
TIntermSequence
*>
switchSequenceStack
;
// case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting
bool
inEntry
p
oint
;
// if inside a function, true if the function is the entry point
bool
inEntry
P
oint
;
// if inside a function, true if the function is the entry point
bool
postMainReturn
;
// if inside a function, true if the function is the entry point and this is after a return statement
const
TType
*
currentFunctionType
;
// the return type of the function that's currently being parsed
bool
functionReturnsValue
;
// true if a non-void function has a return
...
...
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