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
81d47149
Commit
81d47149
authored
Aug 29, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'HLSL_Semantic_Mapping' of
https://github.com/dankbaker/glslang…
Merge branch 'HLSL_Semantic_Mapping' of
https://github.com/dankbaker/glslang
into dankbaker-HLSL_Semantic_Mapping
parents
a88ef397
6f220c0f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
115 additions
and
24 deletions
+115
-24
revision.h
glslang/Include/revision.h
+2
-2
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+1
-1
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+111
-20
hlslParseHelper.h
hlsl/hlslParseHelper.h
+1
-1
No files found.
glslang/Include/revision.h
View file @
81d47149
...
...
@@ -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.144
4
"
#define GLSLANG_DATE "2
8
-Aug-2016"
#define GLSLANG_REVISION "Overload400-PrecQual.144
7
"
#define GLSLANG_DATE "2
9
-Aug-2016"
hlsl/hlslGrammar.cpp
View file @
81d47149
...
...
@@ -2670,7 +2670,7 @@ void HlslGrammar::acceptPostDecls(TType& type)
parseContext
.
handleRegister
(
registerDesc
.
loc
,
type
,
profile
.
string
,
*
registerDesc
.
string
,
subComponent
);
}
else
{
// semantic, in idToken.string
parseContext
.
handleSemantic
(
type
,
*
idToken
.
string
);
parseContext
.
handleSemantic
(
idToken
.
loc
,
type
,
*
idToken
.
string
);
}
}
else
if
(
acceptTokenClass
(
EHTokLeftAngle
))
{
// TODO: process annotations, just accepting them for now
...
...
hlsl/hlslParseHelper.cpp
View file @
81d47149
...
...
@@ -755,13 +755,19 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
inEntrypoint
=
(
function
.
getName
()
==
intermediate
.
getEntryPoint
().
c_str
());
if
(
inEntrypoint
)
{
// in parameters are actually shader-scoped inputs (in)
// parameters are actually shader-scoped inputs and outputs (in or out)
unsigned
int
inCount
=
0
;
unsigned
int
outCount
=
0
;
for
(
int
i
=
0
;
i
<
function
.
getParamCount
();
i
++
)
{
if
(
function
[
i
].
type
->
getQualifier
().
storage
==
EvqIn
||
function
[
i
].
type
->
getQualifier
().
storage
==
EvqConstReadOnly
)
if
(
function
[
i
].
type
->
getQualifier
().
isParamInput
())
{
if
(
function
[
i
].
type
->
getQualifier
().
builtIn
==
EbvNone
)
function
[
i
].
type
->
getQualifier
().
layoutLocation
=
inCount
++
;
function
[
i
].
type
->
getQualifier
().
storage
=
EvqVaryingIn
;
else
}
else
{
if
(
function
[
i
].
type
->
getQualifier
().
builtIn
==
EbvNone
&&
language
!=
EShLangFragment
)
function
[
i
].
type
->
getQualifier
().
layoutLocation
=
outCount
++
;
function
[
i
].
type
->
getQualifier
().
storage
=
EvqVaryingOut
;
}
}
// return value is actually shader-scoped output (out)
...
...
@@ -2287,32 +2293,117 @@ TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const
// Handle seeing a "COLON semantic" at the end of a type declaration,
// by updating the type according to the semantic.
//
void
HlslParseContext
::
handleSemantic
(
TType
&
type
,
const
TString
&
semantic
)
void
HlslParseContext
::
handleSemantic
(
T
SourceLoc
loc
,
T
Type
&
type
,
const
TString
&
semantic
)
{
// TODO: need to know if it's an input or an output
// The following sketches what needs to be done, but can't be right
// without taking into account stage and input/output.
TString
semanticUpperCase
=
semantic
;
std
::
transform
(
semanticUpperCase
.
begin
(),
semanticUpperCase
.
end
(),
semanticUpperCase
.
begin
(),
::
toupper
);
// in DX9, all outputs had to have a semantic associated with them, that was either consumed
// by the system or was a specific register assignment
// in DX10+, only semantics with the SV_ prefix have any meaning beyond decoration
// Fxc will only accept DX9 style semantics in compat mode
// Also, in DX10 if a SV value is present as the input of a stage, but isn't appropriate for that
// stage, it would just be ignored as it is likely there as part of an output struct from one stage
// to the next
if
(
semantic
==
"PSIZE"
)
type
.
getQualifier
().
builtIn
=
EbvPointSize
;
else
if
(
semantic
==
"POSITION"
)
bool
bParseDX9
=
false
;
if
(
bParseDX9
)
{
if
(
semanticUpperCase
==
"PSIZE"
)
type
.
getQualifier
().
builtIn
=
EbvPointSize
;
else
if
(
semantic
==
"FOG"
)
type
.
getQualifier
().
builtIn
=
EbvFogFragCoord
;
else
if
(
semanticUpperCase
==
"DEPTH"
)
type
.
getQualifier
().
builtIn
=
EbvFragDepth
;
else
if
(
semanticUpperCase
==
"VFACE"
)
type
.
getQualifier
().
builtIn
=
EbvFace
;
else
if
(
semanticUpperCase
==
"VPOS"
)
type
.
getQualifier
().
builtIn
=
EbvFragCoord
;
}
//SV Position has a different meaning in vertex vs fragment
if
(
semanticUpperCase
==
"SV_POSITION"
&&
language
!=
EShLangFragment
)
type
.
getQualifier
().
builtIn
=
EbvPosition
;
else
if
(
semantic
==
"FOG"
)
type
.
getQualifier
().
builtIn
=
EbvFogFragCoord
;
else
if
(
semantic
==
"DEPTH"
||
semantic
==
"SV_Depth"
)
type
.
getQualifier
().
builtIn
=
EbvFragDepth
;
else
if
(
semantic
==
"VFACE"
||
semantic
==
"SV_IsFrontFace"
)
type
.
getQualifier
().
builtIn
=
EbvFace
;
else
if
(
semantic
==
"VPOS"
||
semantic
==
"SV_Position"
)
else
if
(
semanticUpperCase
==
"SV_POSITION"
&&
language
==
EShLangFragment
)
type
.
getQualifier
().
builtIn
=
EbvFragCoord
;
else
if
(
semantic
==
"SV_ClipDistance
"
)
else
if
(
semantic
UpperCase
==
"SV_CLIPDISTANCE
"
)
type
.
getQualifier
().
builtIn
=
EbvClipDistance
;
else
if
(
semantic
==
"SV_CullDistance
"
)
else
if
(
semantic
UpperCase
==
"SV_CULLDISTANCE
"
)
type
.
getQualifier
().
builtIn
=
EbvCullDistance
;
else
if
(
semantic
==
"SV_Vertex
ID"
)
type
.
getQualifier
().
builtIn
=
EbvVertexI
d
;
else
if
(
semantic
==
"SV_ViewportArrayIndex
"
)
else
if
(
semantic
UpperCase
==
"SV_VERTEX
ID"
)
type
.
getQualifier
().
builtIn
=
EbvVertexI
ndex
;
else
if
(
semantic
UpperCase
==
"SV_VIEWPORTARRAYINDEX
"
)
type
.
getQualifier
().
builtIn
=
EbvViewportIndex
;
else
if
(
semanticUpperCase
==
"SV_TESSFACTOR"
)
type
.
getQualifier
().
builtIn
=
EbvTessLevelOuter
;
//Targets are defined 0-7
else
if
(
semanticUpperCase
==
"SV_TARGET"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
0
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET0"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
0
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET1"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
1
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET2"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
2
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET3"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
3
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET4"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
4
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET5"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
5
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET6"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
6
;
}
else
if
(
semanticUpperCase
==
"SV_TARGET7"
)
{
type
.
getQualifier
().
builtIn
=
EbvNone
;
type
.
getQualifier
().
layoutLocation
=
7
;
}
else
if
(
semanticUpperCase
==
"SV_SAMPLEINDEX"
)
type
.
getQualifier
().
builtIn
=
EbvSampleId
;
else
if
(
semanticUpperCase
==
"SV_RENDERTARGETARRAYINDEX"
)
type
.
getQualifier
().
builtIn
=
EbvLayer
;
else
if
(
semanticUpperCase
==
"SV_PRIMITIVEID"
)
type
.
getQualifier
().
builtIn
=
EbvPrimitiveId
;
else
if
(
semanticUpperCase
==
"SV_OUTPUTCONTROLPOINTID"
)
type
.
getQualifier
().
builtIn
=
EbvInvocationId
;
else
if
(
semanticUpperCase
==
"SV_ISFRONTFACE"
)
type
.
getQualifier
().
builtIn
=
EbvFace
;
else
if
(
semanticUpperCase
==
"SV_INSTANCEID"
)
type
.
getQualifier
().
builtIn
=
EbvInstanceIndex
;
else
if
(
semanticUpperCase
==
"SV_INSIDETESSFACTOR"
)
type
.
getQualifier
().
builtIn
=
EbvTessLevelInner
;
else
if
(
semanticUpperCase
==
"SV_GSINSTANCEID"
)
type
.
getQualifier
().
builtIn
=
EbvInvocationId
;
else
if
(
semanticUpperCase
==
"SV_GROUPTHREADID"
)
type
.
getQualifier
().
builtIn
=
EbvLocalInvocationId
;
else
if
(
semanticUpperCase
==
"SV_GROUPID"
)
type
.
getQualifier
().
builtIn
=
EbvWorkGroupId
;
else
if
(
semanticUpperCase
==
"SV_DOMAINLOCATION"
)
type
.
getQualifier
().
builtIn
=
EbvTessCoord
;
else
if
(
semanticUpperCase
==
"SV_DEPTH"
)
type
.
getQualifier
().
builtIn
=
EbvFragDepth
;
//TODO, these need to get refined to be more specific
else
if
(
semanticUpperCase
==
"SV_DEPTHGREATEREQUAL"
)
{
type
.
getQualifier
().
builtIn
=
EbvFragDepth
;
warn
(
loc
,
"depth mode unimplemented"
,
"SV_DEPTHGREATEREQUAL"
,
""
);
}
else
if
(
semanticUpperCase
==
"SV_DEPTHLESSEQUAL"
)
{
type
.
getQualifier
().
builtIn
=
EbvFragDepth
;
warn
(
loc
,
"depth mode unimplemented"
,
"SV_DEPTHLESSEQUAL"
,
""
);
}
else
if
(
semanticUpperCase
==
"SV_STENCILREF"
)
error
(
loc
,
"unimplemented"
,
"SV_STENCILREF"
,
""
);
else
if
(
semanticUpperCase
==
"SV_COVERAGE"
)
error
(
loc
,
"unimplemented"
,
"SV_COVERAGE"
,
""
);
}
//
...
...
hlsl/hlslParseHelper.h
View file @
81d47149
...
...
@@ -95,7 +95,7 @@ public:
TIntermTyped
*
addOutputArgumentConversions
(
const
TFunction
&
,
TIntermAggregate
&
)
const
;
void
builtInOpCheck
(
const
TSourceLoc
&
,
const
TFunction
&
,
TIntermOperator
&
);
TFunction
*
handleConstructorCall
(
const
TSourceLoc
&
,
const
TType
&
);
void
handleSemantic
(
TType
&
type
,
const
TString
&
semantic
);
void
handleSemantic
(
T
SourceLoc
,
T
Type
&
type
,
const
TString
&
semantic
);
void
handlePackOffset
(
const
TSourceLoc
&
,
TType
&
type
,
const
glslang
::
TString
&
location
,
const
glslang
::
TString
*
component
);
void
handleRegister
(
const
TSourceLoc
&
,
TType
&
type
,
const
glslang
::
TString
*
profile
,
const
glslang
::
TString
&
desc
,
...
...
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