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
82d6baf8
Commit
82d6baf8
authored
Jul 29, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Implement packoffset production.
parent
1936eebe
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
19 deletions
+77
-19
hlsl.buffer.frag.out
Test/baseResults/hlsl.buffer.frag.out
+0
-0
hlsl.float4.frag.out
Test/baseResults/hlsl.float4.frag.out
+9
-6
hlsl.struct.frag.out
Test/baseResults/hlsl.struct.frag.out
+6
-6
hlsl.buffer.frag
Test/hlsl.buffer.frag
+7
-1
revision.h
glslang/Include/revision.h
+1
-1
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+13
-5
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+40
-0
hlslParseHelper.h
hlsl/hlslParseHelper.h
+1
-0
No files found.
Test/baseResults/hlsl.buffer.frag.out
View file @
82d6baf8
This diff is collapsed.
Click to expand it.
Test/baseResults/hlsl.float4.frag.out
View file @
82d6baf8
...
@@ -21,9 +21,9 @@ gl_FragCoord origin is upper left
...
@@ -21,9 +21,9 @@ gl_FragCoord origin is upper left
0:? Linker Objects
0:? Linker Objects
0:? 'AmbientColor' (global 4-component vector of float)
0:? 'AmbientColor' (global 4-component vector of float)
0:? 'ff1' (global bool Face)
0:? 'ff1' (global bool Face)
0:? 'ff2' (global 4-component vector of float)
0:? 'ff2' (
layout(offset=4 )
global 4-component vector of float)
0:? 'ff3' (global 4-component vector of float)
0:? 'ff3' (
layout(offset=4 )
global 4-component vector of float)
0:? 'ff4' (global 4-component vector of float FragCoord)
0:? 'ff4' (
layout(offset=4 )
global 4-component vector of float FragCoord)
Linked fragment stage:
Linked fragment stage:
...
@@ -51,9 +51,9 @@ gl_FragCoord origin is upper left
...
@@ -51,9 +51,9 @@ gl_FragCoord origin is upper left
0:? Linker Objects
0:? Linker Objects
0:? 'AmbientColor' (global 4-component vector of float)
0:? 'AmbientColor' (global 4-component vector of float)
0:? 'ff1' (global bool Face)
0:? 'ff1' (global bool Face)
0:? 'ff2' (global 4-component vector of float)
0:? 'ff2' (
layout(offset=4 )
global 4-component vector of float)
0:? 'ff3' (global 4-component vector of float)
0:? 'ff3' (
layout(offset=4 )
global 4-component vector of float)
0:? 'ff4' (global 4-component vector of float FragCoord)
0:? 'ff4' (
layout(offset=4 )
global 4-component vector of float FragCoord)
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
...
@@ -74,6 +74,9 @@ gl_FragCoord origin is upper left
...
@@ -74,6 +74,9 @@ gl_FragCoord origin is upper left
Name 28 "ff3"
Name 28 "ff3"
Name 29 "ff4"
Name 29 "ff4"
Decorate 26(ff1) BuiltIn FrontFacing
Decorate 26(ff1) BuiltIn FrontFacing
Decorate 27(ff2) Offset 4
Decorate 28(ff3) Offset 4
Decorate 29(ff4) Offset 4
Decorate 29(ff4) BuiltIn FragCoord
Decorate 29(ff4) BuiltIn FragCoord
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
...
...
Test/baseResults/hlsl.struct.frag.out
View file @
82d6baf8
...
@@ -14,8 +14,8 @@ gl_FragCoord origin is upper left
...
@@ -14,8 +14,8 @@ gl_FragCoord origin is upper left
0:37 's2' (global structure{temp 4-component vector of float i})
0:37 's2' (global structure{temp 4-component vector of float i})
0:37 Constant:
0:37 Constant:
0:37 0 (const int)
0:37 0 (const int)
0:37 ff4: direct index for structure (temp 4-component vector of float FragCoord)
0:37 ff4: direct index for structure (
layout(offset=4 )
temp 4-component vector of float FragCoord)
0:37 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
temp bool ff2, temp bool ff3,
temp 4-component vector of float FragCoord ff4})
0:37 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
layout(offset=4 ) temp bool ff2, layout(offset=4 ) temp bool ff3, layout(offset=4 )
temp 4-component vector of float FragCoord ff4})
0:37 Constant:
0:37 Constant:
0:37 7 (const int)
0:37 7 (const int)
0:39 Branch: Return with expression
0:39 Branch: Return with expression
...
@@ -23,7 +23,7 @@ gl_FragCoord origin is upper left
...
@@ -23,7 +23,7 @@ gl_FragCoord origin is upper left
0:? Linker Objects
0:? Linker Objects
0:? 's1' (global structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d})
0:? 's1' (global structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d})
0:? 's2' (global structure{temp 4-component vector of float i})
0:? 's2' (global structure{temp 4-component vector of float i})
0:? 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
temp bool ff2, temp bool ff3,
temp 4-component vector of float FragCoord ff4})
0:? 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
layout(offset=4 ) temp bool ff2, layout(offset=4 ) temp bool ff3, layout(offset=4 )
temp 4-component vector of float FragCoord ff4})
Linked fragment stage:
Linked fragment stage:
...
@@ -44,8 +44,8 @@ gl_FragCoord origin is upper left
...
@@ -44,8 +44,8 @@ gl_FragCoord origin is upper left
0:37 's2' (global structure{temp 4-component vector of float i})
0:37 's2' (global structure{temp 4-component vector of float i})
0:37 Constant:
0:37 Constant:
0:37 0 (const int)
0:37 0 (const int)
0:37 ff4: direct index for structure (temp 4-component vector of float FragCoord)
0:37 ff4: direct index for structure (
layout(offset=4 )
temp 4-component vector of float FragCoord)
0:37 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
temp bool ff2, temp bool ff3,
temp 4-component vector of float FragCoord ff4})
0:37 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
layout(offset=4 ) temp bool ff2, layout(offset=4 ) temp bool ff3, layout(offset=4 )
temp 4-component vector of float FragCoord ff4})
0:37 Constant:
0:37 Constant:
0:37 7 (const int)
0:37 7 (const int)
0:39 Branch: Return with expression
0:39 Branch: Return with expression
...
@@ -53,7 +53,7 @@ gl_FragCoord origin is upper left
...
@@ -53,7 +53,7 @@ gl_FragCoord origin is upper left
0:? Linker Objects
0:? Linker Objects
0:? 's1' (global structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d})
0:? 's1' (global structure{temp bool b, temp bool c, temp 4-component vector of float a, temp 4-component vector of float d})
0:? 's2' (global structure{temp 4-component vector of float i})
0:? 's2' (global structure{temp 4-component vector of float i})
0:? 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
temp bool ff2, temp bool ff3,
temp 4-component vector of float FragCoord ff4})
0:? 's4' (global structure{smooth in 4-component vector of float a, flat temp bool b, centroid noperspective temp 1-component vector of float c, centroid sample temp 2-component vector of float d, temp bool Face ff1,
layout(offset=4 ) temp bool ff2, layout(offset=4 ) temp bool ff3, layout(offset=4 )
temp 4-component vector of float FragCoord ff4})
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
...
...
Test/hlsl.buffer.frag
View file @
82d6baf8
...
@@ -13,7 +13,13 @@ cbuffer cbufName : register(b2) {
...
@@ -13,7 +13,13 @@ cbuffer cbufName : register(b2) {
tbuffer
tbufName
:
register
(
b8
)
{
tbuffer
tbufName
:
register
(
b8
)
{
float4
v4
:
packoffset
(
c1
);
float4
v4
:
packoffset
(
c1
);
int
i4
:
packoffset
(
c3
);
int
i4
:
packoffset
(
c3
);
float
f1
:
packoffset
(
c3
.
w
);
float
f3
:
packoffset
(
c4
.
x
);
float
f4
:
packoffset
(
c4
.
y
);
float
f5
:
packoffset
(
c4
.
z
);
float
f6
:
packoffset
(
c
);
float
f7
;
};
};
float4
PixelShaderFunction
(
float4
input
)
:
COLOR0
float4
PixelShaderFunction
(
float4
input
)
:
COLOR0
...
...
glslang/Include/revision.h
View file @
82d6baf8
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
// For the date, it uses the current date (when then script is run).
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.1362"
#define GLSLANG_REVISION "SPIRV99.1362"
#define GLSLANG_DATE "2
8
-Jul-2016"
#define GLSLANG_DATE "2
9
-Jul-2016"
hlsl/hlslGrammar.cpp
View file @
82d6baf8
...
@@ -2537,15 +2537,23 @@ void HlslGrammar::acceptPostDecls(TType& type)
...
@@ -2537,15 +2537,23 @@ void HlslGrammar::acceptPostDecls(TType& type)
expected
(
"("
);
expected
(
"("
);
return
;
return
;
}
}
acceptTokenClass
(
EHTokIdentifier
);
HlslToken
locationToken
;
acceptTokenClass
(
EHTokDot
);
if
(
!
acceptIdentifier
(
locationToken
))
{
acceptTokenClass
(
EHTokIdentifier
);
expected
(
"c[subcomponent][.component]"
);
return
;
}
HlslToken
componentToken
;
if
(
acceptTokenClass
(
EHTokDot
))
{
if
(
!
acceptIdentifier
(
componentToken
))
{
expected
(
"component"
);
return
;
}
}
if
(
!
acceptTokenClass
(
EHTokRightParen
))
{
if
(
!
acceptTokenClass
(
EHTokRightParen
))
{
expected
(
")"
);
expected
(
")"
);
break
;
break
;
}
}
// TODO: process the packoffset information
parseContext
.
handlePackOffset
(
locationToken
.
loc
,
type
,
*
locationToken
.
string
,
componentToken
.
string
);
// c1.y means component y of location slot 1
}
else
if
(
!
acceptIdentifier
(
idToken
))
{
}
else
if
(
!
acceptIdentifier
(
idToken
))
{
expected
(
"semantic or packoffset or register"
);
expected
(
"semantic or packoffset or register"
);
return
;
return
;
...
...
hlsl/hlslParseHelper.cpp
View file @
82d6baf8
...
@@ -2135,6 +2135,46 @@ void HlslParseContext::handleSemantic(TType& type, const TString& semantic)
...
@@ -2135,6 +2135,46 @@ void HlslParseContext::handleSemantic(TType& type, const TString& semantic)
}
}
//
//
// Handle seeing something like ": packoffset( c[Subcomponent][.component] )"
//
// 'location' has the "c[Subcomponent]" part.
// 'component' points to the "component" part, or nullptr if not present.
//
void
HlslParseContext
::
handlePackOffset
(
const
TSourceLoc
&
loc
,
TType
&
type
,
const
glslang
::
TString
&
location
,
const
glslang
::
TString
*
component
)
{
if
(
location
.
size
()
==
0
||
location
[
0
]
!=
'c'
)
{
error
(
loc
,
"expected 'c'"
,
"packoffset"
,
""
);
return
;
}
if
(
location
.
size
()
==
1
)
return
;
if
(
!
isdigit
(
location
[
1
]))
{
error
(
loc
,
"expected number after 'c'"
,
"packoffset"
,
""
);
return
;
}
type
.
getQualifier
().
layoutOffset
=
16
*
atoi
(
location
.
substr
(
1
,
location
.
size
()).
c_str
());
if
(
component
)
{
int
componentOffset
=
0
;
switch
((
*
component
)[
0
])
{
case
'x'
:
componentOffset
=
0
;
break
;
case
'y'
:
componentOffset
=
4
;
break
;
case
'z'
:
componentOffset
=
8
;
break
;
case
'w'
:
componentOffset
=
12
;
break
;
default
:
componentOffset
=
-
1
;
break
;
}
if
(
componentOffset
<
0
||
component
->
size
()
>
1
)
{
error
(
loc
,
"expected {x, y, z, w} for component"
,
"packoffset"
,
""
);
return
;
}
type
.
getQualifier
().
layoutOffset
+=
componentOffset
;
}
}
//
// Same error message for all places assignments don't work.
// Same error message for all places assignments don't work.
//
//
void
HlslParseContext
::
assignError
(
const
TSourceLoc
&
loc
,
const
char
*
op
,
TString
left
,
TString
right
)
void
HlslParseContext
::
assignError
(
const
TSourceLoc
&
loc
,
const
char
*
op
,
TString
left
,
TString
right
)
...
...
hlsl/hlslParseHelper.h
View file @
82d6baf8
...
@@ -95,6 +95,7 @@ public:
...
@@ -95,6 +95,7 @@ public:
void
builtInOpCheck
(
const
TSourceLoc
&
,
const
TFunction
&
,
TIntermOperator
&
);
void
builtInOpCheck
(
const
TSourceLoc
&
,
const
TFunction
&
,
TIntermOperator
&
);
TFunction
*
handleConstructorCall
(
const
TSourceLoc
&
,
const
TType
&
);
TFunction
*
handleConstructorCall
(
const
TSourceLoc
&
,
const
TType
&
);
void
handleSemantic
(
TType
&
type
,
const
TString
&
semantic
);
void
handleSemantic
(
TType
&
type
,
const
TString
&
semantic
);
void
handlePackOffset
(
const
TSourceLoc
&
,
TType
&
type
,
const
glslang
::
TString
&
location
,
const
glslang
::
TString
*
component
);
TIntermAggregate
*
handleSamplerTextureCombine
(
const
TSourceLoc
&
loc
,
TIntermTyped
*
argTex
,
TIntermTyped
*
argSampler
);
TIntermAggregate
*
handleSamplerTextureCombine
(
const
TSourceLoc
&
loc
,
TIntermTyped
*
argTex
,
TIntermTyped
*
argSampler
);
...
...
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