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
d445bb28
Commit
d445bb28
authored
Dec 06, 2018
by
Greg Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create separate OpSource for each included file
parent
9ed38739
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
103 deletions
+130
-103
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+4
-0
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+17
-20
SpvBuilder.h
SPIRV/SpvBuilder.h
+23
-5
hlsl.pp.line3.frag.out
Test/baseResults/hlsl.pp.line3.frag.out
+80
-78
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+5
-0
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
d445bb28
...
@@ -1297,6 +1297,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
...
@@ -1297,6 +1297,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
text
.
append
(
"#line 1
\n
"
);
text
.
append
(
"#line 1
\n
"
);
text
.
append
(
glslangIntermediate
->
getSourceText
());
text
.
append
(
glslangIntermediate
->
getSourceText
());
builder
.
setSourceText
(
text
);
builder
.
setSourceText
(
text
);
// Pass name and text for all included files
const
std
::
map
<
std
::
string
,
std
::
string
>&
include_txt
=
glslangIntermediate
->
getIncludeText
();
for
(
auto
iItr
=
include_txt
.
begin
();
iItr
!=
include_txt
.
end
();
++
iItr
)
builder
.
addInclude
(
iItr
->
first
,
iItr
->
second
);
}
}
stdBuiltins
=
builder
.
import
(
"GLSL.std.450"
);
stdBuiltins
=
builder
.
import
(
"GLSL.std.450"
);
if
(
glslangIntermediate
->
usingVulkanMemoryModel
())
{
if
(
glslangIntermediate
->
usingVulkanMemoryModel
())
{
...
...
SPIRV/SpvBuilder.cpp
View file @
d445bb28
...
@@ -114,20 +114,8 @@ void Builder::setLine(int lineNum, const char* filename)
...
@@ -114,20 +114,8 @@ void Builder::setLine(int lineNum, const char* filename)
currentLine
=
lineNum
;
currentLine
=
lineNum
;
currentFile
=
filename
;
currentFile
=
filename
;
if
(
emitOpLines
)
{
if
(
emitOpLines
)
{
// If filename previously seen, use its id, else create a string
spv
::
Id
strId
=
getStringId
(
filename
);
// and put it in the map.
addLine
(
strId
,
currentLine
,
0
);
auto
sItr
=
stringIds
.
find
(
filename
);
if
(
sItr
!=
stringIds
.
end
())
{
addLine
(
sItr
->
second
,
currentLine
,
0
);
}
else
{
Instruction
*
fileString
=
new
Instruction
(
getUniqueId
(),
NoType
,
OpString
);
fileString
->
addStringOperand
(
filename
);
spv
::
Id
stringId
=
fileString
->
getResultId
();
strings
.
push_back
(
std
::
unique_ptr
<
Instruction
>
(
fileString
));
addLine
(
stringId
,
currentLine
,
0
);
stringIds
[
filename
]
=
stringId
;
}
}
}
}
}
}
}
...
@@ -2843,7 +2831,8 @@ void Builder::createConditionalBranch(Id condition, Block* thenBlock, Block* els
...
@@ -2843,7 +2831,8 @@ void Builder::createConditionalBranch(Id condition, Block* thenBlock, Block* els
// OpSource
// OpSource
// [OpSourceContinued]
// [OpSourceContinued]
// ...
// ...
void
Builder
::
dumpSourceInstructions
(
std
::
vector
<
unsigned
int
>&
out
)
const
void
Builder
::
dumpSourceInstructions
(
const
spv
::
Id
fileId
,
const
std
::
string
&
text
,
std
::
vector
<
unsigned
int
>&
out
)
const
{
{
const
int
maxWordCount
=
0xFFFF
;
const
int
maxWordCount
=
0xFFFF
;
const
int
opSourceWordCount
=
4
;
const
int
opSourceWordCount
=
4
;
...
@@ -2855,14 +2844,14 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
...
@@ -2855,14 +2844,14 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
sourceInst
.
addImmediateOperand
(
source
);
sourceInst
.
addImmediateOperand
(
source
);
sourceInst
.
addImmediateOperand
(
sourceVersion
);
sourceInst
.
addImmediateOperand
(
sourceVersion
);
// File operand
// File operand
if
(
sourceFileString
Id
!=
NoResult
)
{
if
(
file
Id
!=
NoResult
)
{
sourceInst
.
addIdOperand
(
sourceFileString
Id
);
sourceInst
.
addIdOperand
(
file
Id
);
// Source operand
// Source operand
if
(
sourceT
ext
.
size
()
>
0
)
{
if
(
t
ext
.
size
()
>
0
)
{
int
nextByte
=
0
;
int
nextByte
=
0
;
std
::
string
subString
;
std
::
string
subString
;
while
((
int
)
sourceT
ext
.
size
()
-
nextByte
>
0
)
{
while
((
int
)
t
ext
.
size
()
-
nextByte
>
0
)
{
subString
=
sourceT
ext
.
substr
(
nextByte
,
nonNullBytesPerInstruction
);
subString
=
t
ext
.
substr
(
nextByte
,
nonNullBytesPerInstruction
);
if
(
nextByte
==
0
)
{
if
(
nextByte
==
0
)
{
// OpSource
// OpSource
sourceInst
.
addStringOperand
(
subString
.
c_str
());
sourceInst
.
addStringOperand
(
subString
.
c_str
());
...
@@ -2882,6 +2871,14 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
...
@@ -2882,6 +2871,14 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
}
}
}
}
// Dump an OpSource[Continued] sequence for the source and every include file
void
Builder
::
dumpSourceInstructions
(
std
::
vector
<
unsigned
int
>&
out
)
const
{
dumpSourceInstructions
(
sourceFileStringId
,
sourceText
,
out
);
for
(
auto
iItr
=
includeFiles
.
begin
();
iItr
!=
includeFiles
.
end
();
++
iItr
)
dumpSourceInstructions
(
iItr
->
first
,
*
iItr
->
second
,
out
);
}
void
Builder
::
dumpInstructions
(
std
::
vector
<
unsigned
int
>&
out
,
const
std
::
vector
<
std
::
unique_ptr
<
Instruction
>
>&
instructions
)
const
void
Builder
::
dumpInstructions
(
std
::
vector
<
unsigned
int
>&
out
,
const
std
::
vector
<
std
::
unique_ptr
<
Instruction
>
>&
instructions
)
const
{
{
for
(
int
i
=
0
;
i
<
(
int
)
instructions
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
(
int
)
instructions
.
size
();
++
i
)
{
...
...
SPIRV/SpvBuilder.h
View file @
d445bb28
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#include <sstream>
#include <sstream>
#include <stack>
#include <stack>
#include <unordered_map>
#include <unordered_map>
#include <map>
namespace
spv
{
namespace
spv
{
...
@@ -74,20 +75,33 @@ public:
...
@@ -74,20 +75,33 @@ public:
source
=
lang
;
source
=
lang
;
sourceVersion
=
version
;
sourceVersion
=
version
;
}
}
void
setSourceFile
(
const
std
::
string
&
file
)
spv
::
Id
getStringId
(
const
std
::
string
&
str
)
{
{
Instruction
*
fileString
=
new
Instruction
(
getUniqueId
(),
NoType
,
OpString
);
auto
sItr
=
stringIds
.
find
(
str
);
const
char
*
file_c_str
=
file
.
c_str
();
if
(
sItr
!=
stringIds
.
end
())
return
sItr
->
second
;
spv
::
Id
strId
=
getUniqueId
();
Instruction
*
fileString
=
new
Instruction
(
strId
,
NoType
,
OpString
);
const
char
*
file_c_str
=
str
.
c_str
();
fileString
->
addStringOperand
(
file_c_str
);
fileString
->
addStringOperand
(
file_c_str
);
sourceFileStringId
=
fileString
->
getResultId
();
strings
.
push_back
(
std
::
unique_ptr
<
Instruction
>
(
fileString
));
strings
.
push_back
(
std
::
unique_ptr
<
Instruction
>
(
fileString
));
stringIds
[
file_c_str
]
=
sourceFileStringId
;
stringIds
[
file_c_str
]
=
strId
;
return
strId
;
}
void
setSourceFile
(
const
std
::
string
&
file
)
{
sourceFileStringId
=
getStringId
(
file
);
}
}
void
setSourceText
(
const
std
::
string
&
text
)
{
sourceText
=
text
;
}
void
setSourceText
(
const
std
::
string
&
text
)
{
sourceText
=
text
;
}
void
addSourceExtension
(
const
char
*
ext
)
{
sourceExtensions
.
push_back
(
ext
);
}
void
addSourceExtension
(
const
char
*
ext
)
{
sourceExtensions
.
push_back
(
ext
);
}
void
addModuleProcessed
(
const
std
::
string
&
p
)
{
moduleProcesses
.
push_back
(
p
.
c_str
());
}
void
addModuleProcessed
(
const
std
::
string
&
p
)
{
moduleProcesses
.
push_back
(
p
.
c_str
());
}
void
setEmitOpLines
()
{
emitOpLines
=
true
;
}
void
setEmitOpLines
()
{
emitOpLines
=
true
;
}
void
addExtension
(
const
char
*
ext
)
{
extensions
.
insert
(
ext
);
}
void
addExtension
(
const
char
*
ext
)
{
extensions
.
insert
(
ext
);
}
void
addInclude
(
const
std
::
string
&
name
,
const
std
::
string
&
text
)
{
spv
::
Id
incId
=
getStringId
(
name
);
includeFiles
[
incId
]
=
&
text
;
}
Id
import
(
const
char
*
);
Id
import
(
const
char
*
);
void
setMemoryModel
(
spv
::
AddressingModel
addr
,
spv
::
MemoryModel
mem
)
void
setMemoryModel
(
spv
::
AddressingModel
addr
,
spv
::
MemoryModel
mem
)
{
{
...
@@ -658,6 +672,7 @@ public:
...
@@ -658,6 +672,7 @@ public:
void
createAndSetNoPredecessorBlock
(
const
char
*
);
void
createAndSetNoPredecessorBlock
(
const
char
*
);
void
createSelectionMerge
(
Block
*
mergeBlock
,
unsigned
int
control
);
void
createSelectionMerge
(
Block
*
mergeBlock
,
unsigned
int
control
);
void
dumpSourceInstructions
(
std
::
vector
<
unsigned
int
>&
)
const
;
void
dumpSourceInstructions
(
std
::
vector
<
unsigned
int
>&
)
const
;
void
dumpSourceInstructions
(
const
spv
::
Id
fileId
,
const
std
::
string
&
text
,
std
::
vector
<
unsigned
int
>&
)
const
;
void
dumpInstructions
(
std
::
vector
<
unsigned
int
>&
,
const
std
::
vector
<
std
::
unique_ptr
<
Instruction
>
>&
)
const
;
void
dumpInstructions
(
std
::
vector
<
unsigned
int
>&
,
const
std
::
vector
<
std
::
unique_ptr
<
Instruction
>
>&
)
const
;
void
dumpModuleProcesses
(
std
::
vector
<
unsigned
int
>&
)
const
;
void
dumpModuleProcesses
(
std
::
vector
<
unsigned
int
>&
)
const
;
...
@@ -708,6 +723,9 @@ public:
...
@@ -708,6 +723,9 @@ public:
// map from strings to their string ids
// map from strings to their string ids
std
::
unordered_map
<
std
::
string
,
spv
::
Id
>
stringIds
;
std
::
unordered_map
<
std
::
string
,
spv
::
Id
>
stringIds
;
// map from include file name ids to their contents
std
::
map
<
spv
::
Id
,
const
std
::
string
*>
includeFiles
;
// The stream for outputting warnings and errors.
// The stream for outputting warnings and errors.
SpvBuildLogger
*
logger
;
SpvBuildLogger
*
logger
;
};
// end Builder class
};
// end Builder class
...
...
Test/baseResults/hlsl.pp.line3.frag.out
View file @
d445bb28
...
@@ -4,12 +4,12 @@ hlsl.pp.line3.frag
...
@@ -4,12 +4,12 @@ hlsl.pp.line3.frag
// Id's are bound by 78
// Id's are bound by 78
Capability Shader
Capability Shader
2
: ExtInstImport "GLSL.std.450"
3
: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment
5
"MainPs" 69 73
EntryPoint Fragment
6
"MainPs" 69 73
ExecutionMode
5
OriginUpperLeft
ExecutionMode
6
OriginUpperLeft
1: String "hlsl.pp.line3.frag"
1: String "hlsl.pp.line3.frag"
31
: String "./i1.h"
2
: String "./i1.h"
Source HLSL 500 1 "// OpModuleProcessed entry-point MainPs
Source HLSL 500 1 "// OpModuleProcessed entry-point MainPs
// OpModuleProcessed client vulkan100
// OpModuleProcessed client vulkan100
// OpModuleProcessed target-env vulkan1.0
// OpModuleProcessed target-env vulkan1.0
...
@@ -50,18 +50,20 @@ PS_OUTPUT MainPs ( PS_INPUT i )
...
@@ -50,18 +50,20 @@ PS_OUTPUT MainPs ( PS_INPUT i )
}
}
"
"
Name 5 "MainPs"
Source HLSL 500 2 " u = g_nDataIdx;
Name 9 "PS_INPUT"
"
MemberName 9(PS_INPUT) 0 "vTextureCoords"
Name 6 "MainPs"
Name 12 "PS_OUTPUT"
Name 10 "PS_INPUT"
MemberName 12(PS_OUTPUT) 0 "vColor"
MemberName 10(PS_INPUT) 0 "vTextureCoords"
Name 15 "@MainPs(struct-PS_INPUT-vf21;"
Name 13 "PS_OUTPUT"
Name 14 "i"
MemberName 13(PS_OUTPUT) 0 "vColor"
Name 18 "PerViewConstantBuffer_t"
Name 16 "@MainPs(struct-PS_INPUT-vf21;"
MemberName 18(PerViewConstantBuffer_t) 0 "g_nDataIdx"
Name 15 "i"
MemberName 18(PerViewConstantBuffer_t) 1 "g_nDataIdx2"
Name 19 "PerViewConstantBuffer_t"
MemberName 18(PerViewConstantBuffer_t) 2 "g_B"
MemberName 19(PerViewConstantBuffer_t) 0 "g_nDataIdx"
Name 20 ""
MemberName 19(PerViewConstantBuffer_t) 1 "g_nDataIdx2"
MemberName 19(PerViewConstantBuffer_t) 2 "g_B"
Name 21 ""
Name 33 "u"
Name 33 "u"
Name 42 "ps_output"
Name 42 "ps_output"
Name 47 "g_tColor"
Name 47 "g_tColor"
...
@@ -70,40 +72,40 @@ PS_OUTPUT MainPs ( PS_INPUT i )
...
@@ -70,40 +72,40 @@ PS_OUTPUT MainPs ( PS_INPUT i )
Name 69 "i.vTextureCoords"
Name 69 "i.vTextureCoords"
Name 73 "@entryPointOutput.vColor"
Name 73 "@entryPointOutput.vColor"
Name 74 "param"
Name 74 "param"
MemberDecorate 1
8
(PerViewConstantBuffer_t) 0 Offset 0
MemberDecorate 1
9
(PerViewConstantBuffer_t) 0 Offset 0
MemberDecorate 1
8
(PerViewConstantBuffer_t) 1 Offset 4
MemberDecorate 1
9
(PerViewConstantBuffer_t) 1 Offset 4
MemberDecorate 1
8
(PerViewConstantBuffer_t) 2 Offset 8
MemberDecorate 1
9
(PerViewConstantBuffer_t) 2 Offset 8
Decorate 1
8
(PerViewConstantBuffer_t) Block
Decorate 1
9
(PerViewConstantBuffer_t) Block
Decorate 47(g_tColor) DescriptorSet 0
Decorate 47(g_tColor) DescriptorSet 0
Decorate 47(g_tColor) Binding 0
Decorate 47(g_tColor) Binding 0
Decorate 54(g_sAniso) DescriptorSet 0
Decorate 54(g_sAniso) DescriptorSet 0
Decorate 54(g_sAniso) Binding 0
Decorate 54(g_sAniso) Binding 0
Decorate 69(i.vTextureCoords) Location 0
Decorate 69(i.vTextureCoords) Location 0
Decorate 73(@entryPointOutput.vColor) Location 0
Decorate 73(@entryPointOutput.vColor) Location 0
3
: TypeVoid
4
: TypeVoid
4: TypeFunction 3
5: TypeFunction 4
7
: TypeFloat 32
8
: TypeFloat 32
8: TypeVector 7
(float) 2
9: TypeVector 8
(float) 2
9(PS_INPUT): TypeStruct 8
(fvec2)
10(PS_INPUT): TypeStruct 9
(fvec2)
1
0: TypePointer Function 9
(PS_INPUT)
1
1: TypePointer Function 10
(PS_INPUT)
1
1: TypeVector 7
(float) 4
1
2: TypeVector 8
(float) 4
1
2(PS_OUTPUT): TypeStruct 11
(fvec4)
1
3(PS_OUTPUT): TypeStruct 12
(fvec4)
1
3: TypeFunction 12(PS_OUTPUT) 10
(ptr)
1
4: TypeFunction 13(PS_OUTPUT) 11
(ptr)
1
7
: TypeInt 32 0
1
8
: TypeInt 32 0
1
8(PerViewConstantBuffer_t): TypeStruct 17(int) 17(int) 17
(int)
1
9(PerViewConstantBuffer_t): TypeStruct 18(int) 18(int) 18
(int)
19: TypePointer PushConstant 18
(PerViewConstantBuffer_t)
20: TypePointer PushConstant 19
(PerViewConstantBuffer_t)
2
0: 19
(ptr) Variable PushConstant
2
1: 20
(ptr) Variable PushConstant
2
1
: TypeInt 32 1
2
2
: TypeInt 32 1
2
2: 21
(int) Constant 2
2
3: 22
(int) Constant 2
2
3: TypePointer PushConstant 17
(int)
2
4: TypePointer PushConstant 18
(int)
2
6
: TypeBool
2
7
: TypeBool
2
7: 17
(int) Constant 0
2
8: 18
(int) Constant 0
32: TypePointer Function 1
7
(int)
32: TypePointer Function 1
8
(int)
34: 2
1
(int) Constant 0
34: 2
2
(int) Constant 0
38: 2
1
(int) Constant 1
38: 2
2
(int) Constant 1
41: TypePointer Function 1
2
(PS_OUTPUT)
41: TypePointer Function 1
3
(PS_OUTPUT)
43: TypeImage
7
(float) 2D sampled format:Unknown
43: TypeImage
8
(float) 2D sampled format:Unknown
44: 1
7
(int) Constant 128
44: 1
8
(int) Constant 128
45: TypeArray 43 44
45: TypeArray 43 44
46: TypePointer UniformConstant 45
46: TypePointer UniformConstant 45
47(g_tColor): 46(ptr) Variable UniformConstant
47(g_tColor): 46(ptr) Variable UniformConstant
...
@@ -112,63 +114,63 @@ PS_OUTPUT MainPs ( PS_INPUT i )
...
@@ -112,63 +114,63 @@ PS_OUTPUT MainPs ( PS_INPUT i )
53: TypePointer UniformConstant 52
53: TypePointer UniformConstant 52
54(g_sAniso): 53(ptr) Variable UniformConstant
54(g_sAniso): 53(ptr) Variable UniformConstant
56: TypeSampledImage 43
56: TypeSampledImage 43
58: TypePointer Function
8
(fvec2)
58: TypePointer Function
9
(fvec2)
62: TypePointer Function 1
1
(fvec4)
62: TypePointer Function 1
2
(fvec4)
68: TypePointer Input
8
(fvec2)
68: TypePointer Input
9
(fvec2)
69(i.vTextureCoords): 68(ptr) Variable Input
69(i.vTextureCoords): 68(ptr) Variable Input
72: TypePointer Output 1
1
(fvec4)
72: TypePointer Output 1
2
(fvec4)
73(@entryPointOutput.vColor): 72(ptr) Variable Output
73(@entryPointOutput.vColor): 72(ptr) Variable Output
5(MainPs): 3 Function None 4
6(MainPs): 4 Function None 5
6
: Label
7
: Label
67(i): 1
0
(ptr) Variable Function
67(i): 1
1
(ptr) Variable Function
74(param): 1
0
(ptr) Variable Function
74(param): 1
1
(ptr) Variable Function
Line 1 23 0
Line 1 23 0
70:
8
(fvec2) Load 69(i.vTextureCoords)
70:
9
(fvec2) Load 69(i.vTextureCoords)
71: 58(ptr) AccessChain 67(i) 34
71: 58(ptr) AccessChain 67(i) 34
Store 71 70
Store 71 70
75:
9
(PS_INPUT) Load 67(i)
75:
10
(PS_INPUT) Load 67(i)
Store 74(param) 75
Store 74(param) 75
76:1
2(PS_OUTPUT) FunctionCall 15
(@MainPs(struct-PS_INPUT-vf21;) 74(param)
76:1
3(PS_OUTPUT) FunctionCall 16
(@MainPs(struct-PS_INPUT-vf21;) 74(param)
77: 1
1
(fvec4) CompositeExtract 76 0
77: 1
2
(fvec4) CompositeExtract 76 0
Store 73(@entryPointOutput.vColor) 77
Store 73(@entryPointOutput.vColor) 77
Return
Return
FunctionEnd
FunctionEnd
1
5(@MainPs(struct-PS_INPUT-vf21;):12(PS_OUTPUT) Function None 13
1
6(@MainPs(struct-PS_INPUT-vf21;):13(PS_OUTPUT) Function None 14
1
4(i): 10
(ptr) FunctionParameter
1
5(i): 11
(ptr) FunctionParameter
1
6
: Label
1
7
: Label
33(u): 32(ptr) Variable Function
33(u): 32(ptr) Variable Function
42(ps_output): 41(ptr) Variable Function
42(ps_output): 41(ptr) Variable Function
Line 1 27 0
Line 1 27 0
2
4: 23(ptr) AccessChain 20 22
2
5: 24(ptr) AccessChain 21 23
2
5: 17(int) Load 24
2
6: 18(int) Load 25
2
8: 26(bool) INotEqual 25 27
2
9: 27(bool) INotEqual 26 28
SelectionMerge 3
0
None
SelectionMerge 3
1
None
BranchConditional 2
8 29
37
BranchConditional 2
9 30
37
29
: Label
30
: Label
Line
31
1 0
Line
2
1 0
35: 2
3(ptr) AccessChain 20
34
35: 2
4(ptr) AccessChain 21
34
36: 1
7
(int) Load 35
36: 1
8
(int) Load 35
Store 33(u) 36
Store 33(u) 36
Branch 3
0
Branch 3
1
37: Label
37: Label
Line 1 30 0
Line 1 30 0
39: 2
3(ptr) AccessChain 20
38
39: 2
4(ptr) AccessChain 21
38
40: 1
7
(int) Load 39
40: 1
8
(int) Load 39
Store 33(u) 40
Store 33(u) 40
Branch 3
0
Branch 3
1
3
0
: Label
3
1
: Label
Line 1 31 0
Line 1 31 0
48: 1
7
(int) Load 33(u)
48: 1
8
(int) Load 33(u)
50: 49(ptr) AccessChain 47(g_tColor) 48
50: 49(ptr) AccessChain 47(g_tColor) 48
51: 43 Load 50
51: 43 Load 50
55: 52 Load 54(g_sAniso)
55: 52 Load 54(g_sAniso)
57: 56 SampledImage 51 55
57: 56 SampledImage 51 55
59: 58(ptr) AccessChain 1
4
(i) 34
59: 58(ptr) AccessChain 1
5
(i) 34
60:
8
(fvec2) Load 59
60:
9
(fvec2) Load 59
61: 1
1
(fvec4) ImageSampleImplicitLod 57 60
61: 1
2
(fvec4) ImageSampleImplicitLod 57 60
63: 62(ptr) AccessChain 42(ps_output) 34
63: 62(ptr) AccessChain 42(ps_output) 34
Store 63 61
Store 63 61
Line 1 32 0
Line 1 32 0
64:1
2
(PS_OUTPUT) Load 42(ps_output)
64:1
3
(PS_OUTPUT) Load 42(ps_output)
ReturnValue 64
ReturnValue 64
FunctionEnd
FunctionEnd
glslang/MachineIndependent/localintermediate.h
View file @
d445bb28
...
@@ -668,6 +668,8 @@ public:
...
@@ -668,6 +668,8 @@ public:
const
std
::
string
&
getSourceFile
()
const
{
return
sourceFile
;
}
const
std
::
string
&
getSourceFile
()
const
{
return
sourceFile
;
}
void
addSourceText
(
const
char
*
text
)
{
sourceText
=
sourceText
+
text
;
}
void
addSourceText
(
const
char
*
text
)
{
sourceText
=
sourceText
+
text
;
}
const
std
::
string
&
getSourceText
()
const
{
return
sourceText
;
}
const
std
::
string
&
getSourceText
()
const
{
return
sourceText
;
}
const
std
::
map
<
std
::
string
,
std
::
string
>&
getIncludeText
()
const
{
return
includeText
;
}
void
addIncludeText
(
const
char
*
name
,
const
char
*
text
,
size_t
len
)
{
includeText
[
name
].
assign
(
text
,
len
);
}
void
addProcesses
(
const
std
::
vector
<
std
::
string
>&
p
)
void
addProcesses
(
const
std
::
vector
<
std
::
string
>&
p
)
{
{
for
(
int
i
=
0
;
i
<
(
int
)
p
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
p
.
size
();
++
i
)
...
@@ -815,6 +817,9 @@ protected:
...
@@ -815,6 +817,9 @@ protected:
std
::
string
sourceFile
;
std
::
string
sourceFile
;
std
::
string
sourceText
;
std
::
string
sourceText
;
// Included text. First string is a name, second is the included text
std
::
map
<
std
::
string
,
std
::
string
>
includeText
;
// for OpModuleProcessed, or equivalent
// for OpModuleProcessed, or equivalent
TProcesses
processes
;
TProcesses
processes
;
...
...
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
d445bb28
...
@@ -653,6 +653,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
...
@@ -653,6 +653,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
epilogue
<<
(
res
->
headerData
[
res
->
headerLength
-
1
]
==
'\n'
?
""
:
"
\n
"
)
<<
epilogue
<<
(
res
->
headerData
[
res
->
headerLength
-
1
]
==
'\n'
?
""
:
"
\n
"
)
<<
"#line "
<<
directiveLoc
.
line
+
forNextLine
<<
" "
<<
directiveLoc
.
getStringNameOrNum
()
<<
"
\n
"
;
"#line "
<<
directiveLoc
.
line
+
forNextLine
<<
" "
<<
directiveLoc
.
getStringNameOrNum
()
<<
"
\n
"
;
pushInput
(
new
TokenizableIncludeFile
(
directiveLoc
,
prologue
.
str
(),
res
,
epilogue
.
str
(),
this
));
pushInput
(
new
TokenizableIncludeFile
(
directiveLoc
,
prologue
.
str
(),
res
,
epilogue
.
str
(),
this
));
parseContext
.
intermediate
.
addIncludeText
(
res
->
headerName
.
c_str
(),
res
->
headerData
,
res
->
headerLength
);
// There's no "current" location anymore.
// There's no "current" location anymore.
parseContext
.
setCurrentColumn
(
0
);
parseContext
.
setCurrentColumn
(
0
);
}
else
{
}
else
{
...
...
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