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
4d5bcd31
Commit
4d5bcd31
authored
Jun 08, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Allow macro expansions to create the 'defined' operator.
parent
3fcb42cf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
1 deletion
+80
-1
hlsl.pp.vert.out
Test/baseResults/hlsl.pp.vert.out
+61
-0
hlsl.pp.vert
Test/hlsl.pp.vert
+17
-0
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+1
-1
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
No files found.
Test/baseResults/hlsl.pp.vert.out
0 → 100755
View file @
4d5bcd31
hlsl.pp.vert
Shader version: 500
0:? Sequence
0:17 Function Definition: @main( ( temp void)
0:17 Function Parameters:
0:17 Function Definition: main( ( temp void)
0:17 Function Parameters:
0:? Sequence
0:17 Function Call: @main( ( temp void)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform int goodGlobal1, uniform int goodGlobal2})
Linked vertex stage:
Shader version: 500
0:? Sequence
0:17 Function Definition: @main( ( temp void)
0:17 Function Parameters:
0:17 Function Definition: main( ( temp void)
0:17 Function Parameters:
0:? Sequence
0:17 Function Call: @main( ( temp void)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform int goodGlobal1, uniform int goodGlobal2})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 13
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
Source HLSL 500
Name 4 "main"
Name 6 "@main("
Name 10 "$Global"
MemberName 10($Global) 0 "goodGlobal1"
MemberName 10($Global) 1 "goodGlobal2"
Name 12 ""
MemberDecorate 10($Global) 0 Offset 0
MemberDecorate 10($Global) 1 Offset 4
Decorate 10($Global) Block
Decorate 12 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
9: TypeInt 32 1
10($Global): TypeStruct 9(int) 9(int)
11: TypePointer Uniform 10($Global)
12: 11(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
8: 2 FunctionCall 6(@main()
Return
FunctionEnd
6(@main(): 2 Function None 3
7: Label
Return
FunctionEnd
Test/hlsl.pp.vert
0 → 100644
View file @
4d5bcd31
#define A defined(B)
#if A
int
badGlobal1
;
#else
int
goodGlobal1
;
#endif
#define B
#if A
int
goodGlobal2
;
#else
int
badGlobal2
;
#endif
void
main
()
{}
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
4d5bcd31
...
...
@@ -393,7 +393,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
TSourceLoc
loc
=
ppToken
->
loc
;
// because we sometimes read the newline before reporting the error
if
(
token
==
PpAtomIdentifier
)
{
if
(
strcmp
(
"defined"
,
ppToken
->
name
)
==
0
)
{
if
(
isMacroInput
())
{
if
(
!
parseContext
.
isReadingHLSL
()
&&
isMacroInput
())
{
if
(
parseContext
.
relaxedErrors
())
parseContext
.
ppWarn
(
ppToken
->
loc
,
"nonportable when expanded from macros for preprocessor expression"
,
"defined"
,
""
);
...
...
gtests/Hlsl.FromFile.cpp
View file @
4d5bcd31
...
...
@@ -200,6 +200,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.params.default.frag"
,
"main"
},
{
"hlsl.params.default.negative.frag"
,
"main"
},
{
"hlsl.partialInit.frag"
,
"PixelShaderFunction"
},
{
"hlsl.pp.vert"
,
"main"
},
{
"hlsl.pp.line.frag"
,
"main"
},
{
"hlsl.precise.frag"
,
"main"
},
{
"hlsl.promote.atomic.frag"
,
"main"
},
...
...
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