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
5f12d2f7
Commit
5f12d2f7
authored
Mar 11, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: non-functional: simplify handleBuiltInMethod() to isBuiltInMethod().
parent
523e20dc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
67 deletions
+23
-67
revision.h
glslang/Include/revision.h
+2
-2
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+10
-10
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+10
-53
hlslParseHelper.h
hlsl/hlslParseHelper.h
+1
-2
No files found.
glslang/Include/revision.h
View file @
5f12d2f7
...
...
@@ -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.189
7
"
#define GLSLANG_DATE "1
0
-Mar-2017"
#define GLSLANG_REVISION "Overload400-PrecQual.189
9
"
#define GLSLANG_DATE "1
1
-Mar-2017"
hlsl/hlslGrammar.cpp
View file @
5f12d2f7
...
...
@@ -2581,11 +2581,6 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
if
(
peekTokenClass
(
EHTokLeftParen
))
{
// member function
TIntermTyped
*
thisNode
=
node
;
node
=
parseContext
.
handleBuiltInMethod
(
field
.
loc
,
node
,
*
field
.
string
);
if
(
node
==
nullptr
)
{
expected
(
"built-in method"
);
return
false
;
}
// arguments
if
(
!
acceptFunctionCall
(
field
,
node
,
thisNode
))
{
...
...
@@ -2660,20 +2655,25 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node)
// function_call
// : [idToken] arguments
//
bool
HlslGrammar
::
acceptFunctionCall
(
HlslToken
id
Token
,
TIntermTyped
*&
node
,
TIntermTyped
*
base
)
bool
HlslGrammar
::
acceptFunctionCall
(
HlslToken
call
Token
,
TIntermTyped
*&
node
,
TIntermTyped
*
base
)
{
// arguments
TFunction
*
function
=
new
TFunction
(
id
Token
.
string
,
TType
(
EbtVoid
));
TFunction
*
function
=
new
TFunction
(
call
Token
.
string
,
TType
(
EbtVoid
));
TIntermTyped
*
arguments
=
nullptr
;
// methods have an implicit first argument of the calling object.
if
(
base
!=
nullptr
)
// member functions have an implicit first argument of the calling object.
if
(
base
!=
nullptr
)
{
if
(
!
parseContext
.
isBuiltInMethod
(
callToken
.
loc
,
node
,
*
callToken
.
string
))
{
expected
(
"built-in method"
);
return
false
;
}
parseContext
.
handleFunctionArgument
(
function
,
arguments
,
base
);
}
if
(
!
acceptArguments
(
function
,
arguments
))
return
false
;
node
=
parseContext
.
handleFunctionCall
(
id
Token
.
loc
,
function
,
arguments
);
node
=
parseContext
.
handleFunctionCall
(
call
Token
.
loc
,
function
,
arguments
);
return
true
;
}
...
...
hlsl/hlslParseHelper.cpp
View file @
5f12d2f7
...
...
@@ -805,36 +805,6 @@ TIntermTyped* HlslParseContext::handleUnaryMath(const TSourceLoc& loc, const cha
return
childNode
;
}
//
// Return true if the name is a sampler method
//
bool
HlslParseContext
::
isSamplerMethod
(
const
TString
&
name
)
const
{
return
name
==
"CalculateLevelOfDetail"
||
name
==
"CalculateLevelOfDetailUnclamped"
||
name
==
"Gather"
||
name
==
"GatherRed"
||
name
==
"GatherGreen"
||
name
==
"GatherBlue"
||
name
==
"GatherAlpha"
||
name
==
"GatherCmp"
||
name
==
"GatherCmpRed"
||
name
==
"GatherCmpGreen"
||
name
==
"GatherCmpBlue"
||
name
==
"GatherCmpAlpha"
||
name
==
"GetDimensions"
||
name
==
"GetSamplePosition"
||
name
==
"Load"
||
name
==
"Sample"
||
name
==
"SampleBias"
||
name
==
"SampleCmp"
||
name
==
"SampleCmpLevelZero"
||
name
==
"SampleGrad"
||
name
==
"SampleLevel"
;
}
//
// Return true if the name is a struct buffer method
//
...
...
@@ -983,37 +953,24 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
}
//
// Handle seeing a base.field dereference in the grammar, where 'field' is a
// built-in method name.
//
// Return nullptr if 'field' is not a built-in method.
// Return true if the field should be treated as a built-in method.
// Return false otherwise.
//
TIntermTyped
*
HlslParseContext
::
handle
BuiltInMethod
(
const
TSourceLoc
&
loc
,
TIntermTyped
*
base
,
const
TString
&
field
)
bool
HlslParseContext
::
is
BuiltInMethod
(
const
TSourceLoc
&
loc
,
TIntermTyped
*
base
,
const
TString
&
field
)
{
variableCheck
(
base
);
//
// Methods can't be resolved until we finish seeing the function-calling syntax.
// Save away the name in the AST for now.
//
if
(
isSamplerMethod
(
field
)
&&
base
->
getType
().
getBasicType
()
==
EbtSampler
)
{
// If it's not a method on a sampler object, we fall through to let other objects have a go.
const
TSampler
&
sampler
=
base
->
getType
().
getSampler
();
if
(
!
sampler
.
isPureSampler
())
{
const
int
vecSize
=
sampler
.
isShadow
()
?
1
:
4
;
// TODO: handle arbitrary sample return sizes
return
intermediate
.
addMethod
(
base
,
TType
(
sampler
.
type
,
EvqTemporary
,
vecSize
),
&
field
,
loc
);
}
}
else
if
(
isStructBufferType
(
base
->
getType
()))
{
TType
retType
(
base
->
getType
(),
0
);
return
intermediate
.
addMethod
(
base
,
retType
,
&
field
,
loc
);
if
(
base
->
getType
().
getBasicType
()
==
EbtSampler
)
{
return
true
;
}
else
if
(
isStructBufferType
(
base
->
getType
())
&&
isStructBufferMethod
(
field
))
{
return
true
;
}
else
if
(
field
==
"Append"
||
field
==
"RestartStrip"
)
{
// We cannot check the type here: it may be sanitized if we're not compiling a geometry shader, but
// the code is around in the shader source.
return
intermediate
.
addMethod
(
base
,
TType
(
EbtVoid
),
&
field
,
loc
);
}
return
nullptr
;
return
true
;
}
else
return
false
;
}
// Split the type of the given node into two structs:
...
...
hlsl/hlslParseHelper.h
View file @
5f12d2f7
...
...
@@ -70,7 +70,7 @@ 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
);
TIntermTyped
*
handle
BuiltInMethod
(
const
TSourceLoc
&
,
TIntermTyped
*
base
,
const
TString
&
field
);
bool
is
BuiltInMethod
(
const
TSourceLoc
&
,
TIntermTyped
*
base
,
const
TString
&
field
);
void
assignLocations
(
TVariable
&
variable
);
TFunction
&
handleFunctionDeclarator
(
const
TSourceLoc
&
,
TFunction
&
function
,
bool
prototype
);
TIntermAggregate
*
handleFunctionDefinition
(
const
TSourceLoc
&
,
TFunction
&
,
const
TAttributeMap
&
,
TIntermNode
*&
entryPointTree
);
...
...
@@ -249,7 +249,6 @@ protected:
void
clearUniformInputOutput
(
TQualifier
&
qualifier
);
// Test method names
bool
isSamplerMethod
(
const
TString
&
name
)
const
;
bool
isStructBufferMethod
(
const
TString
&
name
)
const
;
TType
*
getStructBufferContentType
(
const
TType
&
type
)
const
;
...
...
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