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
e2176c91
Unverified
Commit
e2176c91
authored
Mar 10, 2020
by
John Kessenich
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2110 from jeffbolznv/escapeseq
EXT_debug_printf - make escape sequences better match C/C++
parents
dbb56a1d
ad3f10bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
37 deletions
+72
-37
spv.debugPrintf.frag.out
Test/baseResults/spv.debugPrintf.frag.out
+5
-1
spv.debugPrintf_Error.frag.out
Test/baseResults/spv.debugPrintf_Error.frag.out
+7
-0
spv.debugPrintf.frag
Test/spv.debugPrintf.frag
+6
-0
spv.debugPrintf_Error.frag
Test/spv.debugPrintf_Error.frag
+11
-0
PpScanner.cpp
glslang/MachineIndependent/preprocessor/PpScanner.cpp
+42
-36
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
Test/baseResults/spv.debugPrintf.frag.out
View file @
e2176c91
spv.debugPrintf.frag
spv.debugPrintf.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80008
// Generated by (magic number): 80008
// Id's are bound by 1
3
// Id's are bound by 1
7
Capability Shader
Capability Shader
Extension "SPV_KHR_non_semantic_info"
Extension "SPV_KHR_non_semantic_info"
...
@@ -11,6 +11,8 @@ spv.debugPrintf.frag
...
@@ -11,6 +11,8 @@ spv.debugPrintf.frag
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
6: String "ASDF \ ? \ %d %d %d"
6: String "ASDF \ ? \ %d %d %d"
13: String "ABAZ"
15: String "B#$B1Z"
Source GLSL 450
Source GLSL 450
SourceExtension "GL_EXT_debug_printf"
SourceExtension "GL_EXT_debug_printf"
Name 4 "main"
Name 4 "main"
...
@@ -23,5 +25,7 @@ spv.debugPrintf.frag
...
@@ -23,5 +25,7 @@ spv.debugPrintf.frag
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
12: 2 ExtInst 11(NonSemantic.DebugPrintf) 1(DebugPrintf) 6 8 9 10
12: 2 ExtInst 11(NonSemantic.DebugPrintf) 1(DebugPrintf) 6 8 9 10
14: 2 ExtInst 11(NonSemantic.DebugPrintf) 1(DebugPrintf) 13
16: 2 ExtInst 11(NonSemantic.DebugPrintf) 1(DebugPrintf) 15
Return
Return
FunctionEnd
FunctionEnd
Test/baseResults/spv.debugPrintf_Error.frag.out
0 → 100644
View file @
e2176c91
spv.debugPrintf_Error.frag
ERROR: 0:7: 'string' : Expected hex value in escape sequence
ERROR: 0:10: 'string' : Invalid escape sequence
ERROR: 2 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link
Test/spv.debugPrintf.frag
View file @
e2176c91
...
@@ -4,4 +4,10 @@
...
@@ -4,4 +4,10 @@
void
main
()
void
main
()
{
{
debugPrintfEXT
(
"ASDF
\\
\?
\x5C
%d %d %d"
,
1
,
2
,
3
);
debugPrintfEXT
(
"ASDF
\\
\?
\x5C
%d %d %d"
,
1
,
2
,
3
);
// ABA{backspace}Z
debugPrintfEXT
(
"
\x41\x0000
42
\x41
\x8Z"
);
// B#${bell, aka \a}B1Z
debugPrintfEXT
(
"
\102\043\44\7\102
1Z"
);
}
}
Test/spv.debugPrintf_Error.frag
0 → 100644
View file @
e2176c91
#version 450
#extension GL_EXT_debug_printf : enable
void
main
()
{
// invalid hex sequence
debugPrintfEXT
(
"\xZ"
);
// not an octal sequence
debugPrintfEXT
(
"\8"
);
}
glslang/MachineIndependent/preprocessor/PpScanner.cpp
View file @
e2176c91
...
@@ -1045,28 +1045,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
...
@@ -1045,28 +1045,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
case
't'
:
ch
=
0x09
;
break
;
case
't'
:
ch
=
0x09
;
break
;
case
'v'
:
ch
=
0x0b
;
break
;
case
'v'
:
ch
=
0x0b
;
break
;
case
'x'
:
case
'x'
:
// two character hex value
// Hex value, arbitrary number of characters. Terminated by the first
nextCh
=
getch
();
// non-hex digit
if
(
nextCh
>=
'0'
&&
nextCh
<=
'9'
)
{
nextCh
-=
'0'
;
int
numDigits
=
0
;
else
if
(
nextCh
>=
'A'
&&
nextCh
<=
'F'
)
ch
=
0
;
nextCh
-=
'A'
-
10
;
while
(
true
)
{
else
if
(
nextCh
>=
'a'
&&
nextCh
<=
'f'
)
nextCh
=
getch
();
nextCh
-=
'a'
-
10
;
if
(
nextCh
>=
'0'
&&
nextCh
<=
'9'
)
else
nextCh
-=
'0'
;
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected hex value in escape sequence"
,
"string"
,
""
);
else
if
(
nextCh
>=
'A'
&&
nextCh
<=
'F'
)
ch
=
nextCh
*
0x10
;
nextCh
-=
'A'
-
10
;
nextCh
=
getch
();
else
if
(
nextCh
>=
'a'
&&
nextCh
<=
'f'
)
if
(
nextCh
>=
'0'
&&
nextCh
<=
'9'
)
nextCh
-=
'a'
-
10
;
nextCh
-=
'0'
;
else
{
else
if
(
nextCh
>=
'A'
&&
nextCh
<=
'F'
)
ungetch
();
nextCh
-=
'A'
-
10
;
break
;
else
if
(
nextCh
>=
'a'
&&
nextCh
<=
'f'
)
}
nextCh
-=
'a'
-
10
;
numDigits
++
;
else
ch
=
ch
*
0x10
+
nextCh
;
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected hex value in escape sequence"
,
"string"
,
""
);
}
ch
+=
nextCh
;
if
(
numDigits
==
0
)
{
break
;
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected hex value in escape sequence"
,
"string"
,
""
);
}
break
;
}
case
'0'
:
case
'0'
:
case
'1'
:
case
'1'
:
case
'2'
:
case
'2'
:
...
@@ -1075,20 +1078,23 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
...
@@ -1075,20 +1078,23 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
case
'5'
:
case
'5'
:
case
'6'
:
case
'6'
:
case
'7'
:
case
'7'
:
// three character octal value
// Octal value, up to three octal digits
nextCh
=
getch
()
-
'0'
;
{
if
(
nextCh
>
3
)
int
numDigits
=
1
;
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected octal value in escape sequence"
,
"string"
,
""
);
ch
=
nextCh
-
'0'
;
ch
=
nextCh
*
8
*
8
;
while
(
numDigits
<
3
)
{
nextCh
=
getch
()
-
'0'
;
nextCh
=
getch
();
if
(
nextCh
>
7
)
if
(
nextCh
>=
'0'
&&
nextCh
<=
'7'
)
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected octal value in escape sequence"
,
"string"
,
""
);
nextCh
-=
'0'
;
ch
+=
nextCh
*
8
;
else
{
nextCh
=
getch
()
-
'0'
;
ungetch
();
if
(
nextCh
>
7
)
break
;
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Expected octal value in escape sequence"
,
"string"
,
""
);
}
ch
+=
nextCh
;
numDigits
++
;
break
;
ch
=
ch
*
8
+
nextCh
;
}
break
;
}
default
:
default
:
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Invalid escape sequence"
,
"string"
,
""
);
pp
->
parseContext
.
ppError
(
ppToken
->
loc
,
"Invalid escape sequence"
,
"string"
,
""
);
break
;
break
;
...
...
gtests/Spv.FromFile.cpp
View file @
e2176c91
...
@@ -310,6 +310,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -310,6 +310,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.dataOutIndirect.frag"
,
"spv.dataOutIndirect.frag"
,
"spv.dataOutIndirect.vert"
,
"spv.dataOutIndirect.vert"
,
"spv.debugPrintf.frag"
,
"spv.debugPrintf.frag"
,
"spv.debugPrintf_Error.frag"
,
"spv.demoteDisabled.frag"
,
"spv.demoteDisabled.frag"
,
"spv.deepRvalue.frag"
,
"spv.deepRvalue.frag"
,
"spv.depthOut.frag"
,
"spv.depthOut.frag"
,
...
...
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