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
6256146e
Commit
6256146e
authored
Jul 22, 2016
by
LoopDawg
Committed by
steve-lunarg
Jul 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: enable #line extension by default for HLSL source.
parent
b8d2a006
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
160 additions
and
2 deletions
+160
-2
hlsl.pp.line.frag.out
Test/baseResults/hlsl.pp.line.frag.out
+124
-0
hlsl.pp.line.frag
Test/hlsl.pp.line.frag
+24
-0
parseVersions.h
glslang/MachineIndependent/parseVersions.h
+1
-1
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+8
-0
hlslParseHelper.h
hlsl/hlslParseHelper.h
+2
-1
No files found.
Test/baseResults/hlsl.pp.line.frag.out
0 → 100644
View file @
6256146e
hlsl.pp.line.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:131 Function Definition: main( (global structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:4 Function Parameters:
0:? Sequence
0:124 Sequence
0:124 move second child to first child (temp int)
0:124 'thisLineIs' (temp int)
0:124 Constant:
0:124 124 (const int)
0:126 move second child to first child (temp 4-component vector of float)
0:126 Color: direct index for structure (temp 4-component vector of float)
0:126 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:126 Constant:
0:126 0 (const int)
0:? Construct vec4 (temp 4-component vector of float)
0:126 Convert int to float (temp float)
0:126 'thisLineIs' (temp int)
0:126 Constant:
0:126 0.000000
0:126 Constant:
0:126 0.000000
0:126 Constant:
0:126 1.000000
0:127 move second child to first child (temp float)
0:127 Depth: direct index for structure (temp float FragDepth)
0:127 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:127 Constant:
0:127 1 (const int)
0:127 Constant:
0:127 1.000000
0:129 Branch: Return with expression
0:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? Linker Objects
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:131 Function Definition: main( (global structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:4 Function Parameters:
0:? Sequence
0:124 Sequence
0:124 move second child to first child (temp int)
0:124 'thisLineIs' (temp int)
0:124 Constant:
0:124 124 (const int)
0:126 move second child to first child (temp 4-component vector of float)
0:126 Color: direct index for structure (temp 4-component vector of float)
0:126 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:126 Constant:
0:126 0 (const int)
0:? Construct vec4 (temp 4-component vector of float)
0:126 Convert int to float (temp float)
0:126 'thisLineIs' (temp int)
0:126 Constant:
0:126 0.000000
0:126 Constant:
0:126 0.000000
0:126 Constant:
0:126 1.000000
0:127 move second child to first child (temp float)
0:127 Depth: direct index for structure (temp float FragDepth)
0:127 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:127 Constant:
0:127 1 (const int)
0:127 Constant:
0:127 1.000000
0:129 Branch: Return with expression
0:129 'psout' (temp structure{temp 4-component vector of float Color, temp float FragDepth Depth})
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 28
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source HLSL 450
Name 4 "main"
Name 8 "thisLineIs"
Name 12 "PS_OUTPUT"
MemberName 12(PS_OUTPUT) 0 "Color"
MemberName 12(PS_OUTPUT) 1 "Depth"
Name 14 "psout"
MemberDecorate 12(PS_OUTPUT) 1 BuiltIn FragDepth
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: 6(int) Constant 124
10: TypeFloat 32
11: TypeVector 10(float) 4
12(PS_OUTPUT): TypeStruct 11(fvec4) 10(float)
13: TypePointer Function 12(PS_OUTPUT)
15: 6(int) Constant 0
18: 10(float) Constant 0
19: 10(float) Constant 1065353216
21: TypePointer Function 11(fvec4)
23: 6(int) Constant 1
24: TypePointer Function 10(float)
4(main): 2 Function None 3
5: Label
8(thisLineIs): 7(ptr) Variable Function
14(psout): 13(ptr) Variable Function
Store 8(thisLineIs) 9
16: 6(int) Load 8(thisLineIs)
17: 10(float) ConvertSToF 16
20: 11(fvec4) CompositeConstruct 17 18 18 19
22: 21(ptr) AccessChain 14(psout) 15
Store 22 20
25: 24(ptr) AccessChain 14(psout) 23
Store 25 19
26:12(PS_OUTPUT) Load 14(psout)
ReturnValue 26
FunctionEnd
Test/hlsl.pp.line.frag
0 → 100644
View file @
6256146e
#line 1
struct
PS_OUTPUT
{
float4
Color
:
SV_Target0
;
float
Depth
:
SV_Depth
;
};
#line 2
PS_OUTPUT
main
()
{
PS_OUTPUT
psout
;
#line 123 "SomeFile.frag"
int
thisLineIs
=
__LINE__
;
// gets 124
psout
.
Color
=
float4
(
thisLineIs
,
0
,
0
,
1
);
psout
.
Depth
=
1
.
0
;
return
psout
;
}
glslang/MachineIndependent/parseVersions.h
View file @
6256146e
...
...
@@ -119,12 +119,12 @@ public:
TIntermediate
&
intermediate
;
// helper for making and hooking up pieces of the parse tree
protected
:
TMap
<
TString
,
TExtensionBehavior
>
extensionBehavior
;
// for each extension string, what its current behavior is set to
EShMessages
messages
;
// errors/warnings/rule-sets
int
numErrors
;
// number of compile-time errors encountered
TInputScanner
*
currentScanner
;
private
:
TMap
<
TString
,
TExtensionBehavior
>
extensionBehavior
;
// for each extension string, what its current behavior is set to
explicit
TParseVersions
(
const
TParseVersions
&
);
TParseVersions
&
operator
=
(
const
TParseVersions
&
);
};
...
...
gtests/Hlsl.FromFile.cpp
View file @
6256146e
...
...
@@ -100,6 +100,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.load.basic.dx10.frag"
,
"main"
},
{
"hlsl.load.offset.dx10.frag"
,
"main"
},
{
"hlsl.load.offsetarray.dx10.frag"
,
"main"
},
{
"hlsl.pp.line.frag"
,
"main"
},
{
"hlsl.sample.array.dx10.frag"
,
"main"
},
{
"hlsl.sample.basic.dx10.frag"
,
"main"
},
{
"hlsl.sample.offset.dx10.frag"
,
"main"
},
...
...
hlsl/hlslParseHelper.cpp
View file @
6256146e
...
...
@@ -88,6 +88,14 @@ HlslParseContext::~HlslParseContext()
{
}
void
HlslParseContext
::
initializeExtensionBehavior
()
{
TParseContextBase
::
initializeExtensionBehavior
();
// HLSL allows #line by default.
extensionBehavior
[
E_GL_GOOGLE_cpp_style_line_directive
]
=
EBhEnable
;
}
void
HlslParseContext
::
setLimits
(
const
TBuiltInResource
&
r
)
{
resources
=
r
;
...
...
hlsl/hlslParseHelper.h
View file @
6256146e
...
...
@@ -47,6 +47,8 @@ public:
int
version
,
EProfile
,
const
SpvVersion
&
spvVersion
,
EShLanguage
,
TInfoSink
&
,
bool
forwardCompatible
=
false
,
EShMessages
messages
=
EShMsgDefault
);
virtual
~
HlslParseContext
();
void
initializeExtensionBehavior
();
void
setLimits
(
const
TBuiltInResource
&
);
bool
parseShaderStrings
(
TPpContext
&
,
TInputScanner
&
input
,
bool
versionWillBeError
=
false
);
void
getPreamble
(
std
::
string
&
);
...
...
@@ -184,7 +186,6 @@ protected:
HlslParseContext
(
HlslParseContext
&
);
HlslParseContext
&
operator
=
(
HlslParseContext
&
);
TMap
<
TString
,
TExtensionBehavior
>
extensionBehavior
;
// for each extension string, what its current behavior is set to
static
const
int
maxSamplerIndex
=
EsdNumDims
*
(
EbtNumTypes
*
(
2
*
2
*
2
));
// see computeSamplerTypeIndex()
bool
afterEOF
;
TQualifier
globalBufferDefaults
;
...
...
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