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
dfbdd9eb
Commit
dfbdd9eb
authored
Mar 19, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Add implicit-this tracking to TFunction.
parent
f3d88bd4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
6 deletions
+25
-6
Types.h
glslang/Include/Types.h
+2
-2
SymbolTable.cpp
glslang/MachineIndependent/SymbolTable.cpp
+2
-1
SymbolTable.h
glslang/MachineIndependent/SymbolTable.h
+18
-2
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+3
-1
No files found.
glslang/Include/Types.h
View file @
dfbdd9eb
...
...
@@ -1802,7 +1802,7 @@ public:
}
// append this type's mangled name to the passed in 'name'
void
appendMangledName
(
TString
&
name
)
void
appendMangledName
(
TString
&
name
)
const
{
buildMangledName
(
name
);
name
+=
';'
;
...
...
@@ -1926,7 +1926,7 @@ protected:
}
void
buildMangledName
(
TString
&
);
void
buildMangledName
(
TString
&
)
const
;
TBasicType
basicType
:
8
;
int
vectorSize
:
4
;
// 1 means either scalar or 1-component vector; see vector1 to disambiguate.
...
...
glslang/MachineIndependent/SymbolTable.cpp
View file @
dfbdd9eb
...
...
@@ -50,7 +50,7 @@ namespace glslang {
//
// Recursively generate mangled names.
//
void
TType
::
buildMangledName
(
TString
&
mangledName
)
void
TType
::
buildMangledName
(
TString
&
mangledName
)
const
{
if
(
isMatrix
())
mangledName
+=
'm'
;
...
...
@@ -299,6 +299,7 @@ TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
op
=
copyOf
.
op
;
defined
=
copyOf
.
defined
;
prototyped
=
copyOf
.
prototyped
;
implicitThis
=
copyOf
.
implicitThis
;
defaultParamCount
=
copyOf
.
defaultParamCount
;
}
...
...
glslang/MachineIndependent/SymbolTable.h
View file @
dfbdd9eb
...
...
@@ -219,12 +219,12 @@ public:
explicit
TFunction
(
TOperator
o
)
:
TSymbol
(
0
),
op
(
o
),
defined
(
false
),
prototyped
(
false
),
defaultParamCount
(
0
)
{
}
defined
(
false
),
prototyped
(
false
),
implicitThis
(
false
),
defaultParamCount
(
0
)
{
}
TFunction
(
const
TString
*
name
,
const
TType
&
retType
,
TOperator
tOp
=
EOpNull
)
:
TSymbol
(
name
),
mangledName
(
*
name
+
'('
),
op
(
tOp
),
defined
(
false
),
prototyped
(
false
),
defaultParamCount
(
0
)
defined
(
false
),
prototyped
(
false
),
implicitThis
(
false
),
defaultParamCount
(
0
)
{
returnType
.
shallowCopy
(
retType
);
declaredBuiltIn
=
retType
.
getQualifier
().
builtIn
;
...
...
@@ -235,6 +235,9 @@ public:
virtual
TFunction
*
getAsFunction
()
override
{
return
this
;
}
virtual
const
TFunction
*
getAsFunction
()
const
override
{
return
this
;
}
// Install 'p' as the (non-'this') last parameter.
// Non-'this' parameters are reflected in both the list of parameters and the
// mangled name.
virtual
void
addParameter
(
TParameter
&
p
)
{
assert
(
writable
);
...
...
@@ -245,6 +248,16 @@ public:
if
(
p
.
defaultValue
!=
nullptr
)
defaultParamCount
++
;
}
// Install 'this' as the first parameter.
// 'this' is reflected in the list of parameters, but not the mangled name.
virtual
void
addThisParameter
(
TType
&
type
)
{
TParameter
p
=
{
NewPoolTString
(
"this"
),
new
TType
,
nullptr
};
p
.
type
->
shallowCopy
(
type
);
parameters
.
insert
(
parameters
.
begin
(),
p
);
}
virtual
void
addPrefix
(
const
char
*
prefix
)
override
{
TSymbol
::
addPrefix
(
prefix
);
...
...
@@ -261,6 +274,8 @@ public:
virtual
bool
isDefined
()
const
{
return
defined
;
}
virtual
void
setPrototyped
()
{
assert
(
writable
);
prototyped
=
true
;
}
virtual
bool
isPrototyped
()
const
{
return
prototyped
;
}
virtual
void
setImplicitThis
()
{
assert
(
writable
);
implicitThis
=
true
;
}
virtual
bool
hasImplicitThis
()
const
{
return
implicitThis
;
}
// Return total number of parameters
virtual
int
getParamCount
()
const
{
return
static_cast
<
int
>
(
parameters
.
size
());
}
...
...
@@ -287,6 +302,7 @@ protected:
TOperator
op
;
bool
defined
;
bool
prototyped
;
bool
implicitThis
;
int
defaultParamCount
;
};
...
...
hlsl/hlslGrammar.cpp
View file @
dfbdd9eb
...
...
@@ -2794,8 +2794,10 @@ bool HlslGrammar::acceptFunctionCall(HlslToken callToken, TIntermTyped*& node, T
// arguments
TIntermTyped
*
arguments
=
nullptr
;
if
(
baseObject
!=
nullptr
)
if
(
baseObject
!=
nullptr
)
{
// Non-static member functions have an implicit first argument of the base object.
parseContext
.
handleFunctionArgument
(
function
,
arguments
,
baseObject
);
}
if
(
!
acceptArguments
(
function
,
arguments
))
return
false
;
...
...
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