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
b56e0e44
Unverified
Commit
b56e0e44
authored
Jun 02, 2020
by
rdb
Committed by
GitHub
Jun 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Recognize POSITION semantic et al in DX9 compatibility mode (#2255)
parent
d8edfd8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
StandAlone.cpp
StandAlone/StandAlone.cpp
+2
-1
ShaderLang.h
glslang/Public/ShaderLang.h
+1
-1
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+26
-0
No files found.
StandAlone/StandAlone.cpp
View file @
b56e0e44
...
...
@@ -1593,7 +1593,8 @@ void usage()
" --hlsl-iomap perform IO mapping in HLSL register space
\n
"
" --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL
\n
"
" --hlsl-dx9-compatible interprets sampler declarations as a
\n
"
" texture/sampler combo like DirectX9 would.
\n
"
" texture/sampler combo like DirectX9 would,
\n
"
" and recognizes DirectX9-specific semantics
\n
"
" --invert-y | --iy invert position.Y output in vertex shader
\n
"
" --keep-uncalled | --ku don't eliminate uncalled functions
\n
"
" --nan-clamp favor non-NaN operand in min, max, and clamp
\n
"
...
...
glslang/Public/ShaderLang.h
View file @
b56e0e44
...
...
@@ -255,7 +255,7 @@ enum EShMessages : unsigned {
EShMsgDebugInfo
=
(
1
<<
10
),
// save debug information
EShMsgHlslEnable16BitTypes
=
(
1
<<
11
),
// enable use of 16-bit types in SPIR-V for HLSL
EShMsgHlslLegalization
=
(
1
<<
12
),
// enable HLSL Legalization messages
EShMsgHlslDX9Compatible
=
(
1
<<
13
),
// enable HLSL DX9 compatible mode (
right now only for sampler
s)
EShMsgHlslDX9Compatible
=
(
1
<<
13
),
// enable HLSL DX9 compatible mode (
for samplers and semantic
s)
EShMsgBuiltinSymbolTable
=
(
1
<<
14
),
// print the builtin symbol table
LAST_ELEMENT_MARKER
(
EShMsgCount
),
};
...
...
hlsl/hlslParseHelper.cpp
View file @
b56e0e44
...
...
@@ -6129,6 +6129,32 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu
return
semanticNum
;
};
if
(
builtIn
==
EbvNone
&&
hlslDX9Compatible
())
{
if
(
language
==
EShLangVertex
)
{
if
(
qualifier
.
isParamOutput
())
{
if
(
upperCase
==
"POSITION"
)
{
builtIn
=
EbvPosition
;
}
if
(
upperCase
==
"PSIZE"
)
{
builtIn
=
EbvPointSize
;
}
}
}
else
if
(
language
==
EShLangFragment
)
{
if
(
qualifier
.
isParamInput
()
&&
upperCase
==
"VPOS"
)
{
builtIn
=
EbvFragCoord
;
}
if
(
qualifier
.
isParamOutput
())
{
if
(
upperCase
.
compare
(
0
,
5
,
"COLOR"
)
==
0
)
{
qualifier
.
layoutLocation
=
getSemanticNumber
(
upperCase
,
0
,
nullptr
);
nextOutLocation
=
std
::
max
(
nextOutLocation
,
qualifier
.
layoutLocation
+
1u
);
}
if
(
upperCase
==
"DEPTH"
)
{
builtIn
=
EbvFragDepth
;
}
}
}
}
switch
(
builtIn
)
{
case
EbvNone
:
// Get location numbers from fragment outputs, instead of
...
...
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