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
e690332c
Commit
e690332c
authored
Oct 13, 2015
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Add modes for spacing, depth, depth replacing, winding, and point mode.
parent
f685df8c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
13 deletions
+55
-13
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+37
-5
spv.400.tese.out
Test/baseResults/spv.400.tese.out
+3
-0
spv.depthOut.frag.out
Test/baseResults/spv.depthOut.frag.out
+4
-3
spv.depthOut.frag
Test/spv.depthOut.frag
+5
-3
revision.h
glslang/Include/revision.h
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+1
-0
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+4
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
e690332c
...
@@ -445,15 +445,30 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
...
@@ -445,15 +445,30 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
case
glslang
:
:
ElgTriangles
:
mode
=
spv
::
ExecutionModeInputTriangles
;
break
;
case
glslang
:
:
ElgTriangles
:
mode
=
spv
::
ExecutionModeInputTriangles
;
break
;
case
glslang
:
:
ElgQuads
:
mode
=
spv
::
ExecutionModeInputQuads
;
break
;
case
glslang
:
:
ElgQuads
:
mode
=
spv
::
ExecutionModeInputQuads
;
break
;
case
glslang
:
:
ElgIsolines
:
mode
=
spv
::
ExecutionModeInputIsolines
;
break
;
case
glslang
:
:
ElgIsolines
:
mode
=
spv
::
ExecutionModeInputIsolines
;
break
;
default
:
mode
=
spv
::
BadValue
;
break
;
default
:
mode
=
spv
::
BadValue
;
break
;
}
}
if
(
mode
!=
spv
::
BadValue
)
if
(
mode
!=
spv
::
BadValue
)
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
// TODO
switch
(
glslangIntermediate
->
getVertexSpacing
())
{
//builder.addExecutionMode(spv::VertexSpacingMdName, glslangIntermediate->getVertexSpacing());
case
glslang
:
:
EvsEqual
:
mode
=
spv
::
ExecutionModeSpacingEqual
;
break
;
//builder.addExecutionMode(spv::VertexOrderMdName, glslangIntermediate->getVertexOrder());
case
glslang
:
:
EvsFractionalEven
:
mode
=
spv
::
ExecutionModeSpacingFractionalEven
;
break
;
//builder.addExecutionMode(spv::PointModeMdName, glslangIntermediate->getPointMode());
case
glslang
:
:
EvsFractionalOdd
:
mode
=
spv
::
ExecutionModeSpacingFractionalOdd
;
break
;
default
:
mode
=
spv
::
BadValue
;
break
;
}
if
(
mode
!=
spv
::
BadValue
)
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
switch
(
glslangIntermediate
->
getVertexOrder
())
{
case
glslang
:
:
EvoCw
:
mode
=
spv
::
ExecutionModeVertexOrderCw
;
break
;
case
glslang
:
:
EvoCcw
:
mode
=
spv
::
ExecutionModeVertexOrderCcw
;
break
;
default
:
mode
=
spv
::
BadValue
;
break
;
}
if
(
mode
!=
spv
::
BadValue
)
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
if
(
glslangIntermediate
->
getPointMode
())
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModePointMode
);
break
;
break
;
case
EShLangGeometry
:
case
EShLangGeometry
:
...
@@ -468,6 +483,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
...
@@ -468,6 +483,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
}
}
if
(
mode
!=
spv
::
BadValue
)
if
(
mode
!=
spv
::
BadValue
)
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeInvocations
,
glslangIntermediate
->
getInvocations
());
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeInvocations
,
glslangIntermediate
->
getInvocations
());
switch
(
glslangIntermediate
->
getOutputPrimitive
())
{
switch
(
glslangIntermediate
->
getOutputPrimitive
())
{
...
@@ -485,10 +501,26 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
...
@@ -485,10 +501,26 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
builder
.
addCapability
(
spv
::
CapabilityShader
);
builder
.
addCapability
(
spv
::
CapabilityShader
);
if
(
glslangIntermediate
->
getPixelCenterInteger
())
if
(
glslangIntermediate
->
getPixelCenterInteger
())
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModePixelCenterInteger
);
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModePixelCenterInteger
);
if
(
glslangIntermediate
->
getOriginUpperLeft
())
if
(
glslangIntermediate
->
getOriginUpperLeft
())
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeOriginUpperLeft
);
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeOriginUpperLeft
);
else
else
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeOriginLowerLeft
);
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeOriginLowerLeft
);
if
(
glslangIntermediate
->
getEarlyFragmentTests
())
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeEarlyFragmentTests
);
switch
(
glslangIntermediate
->
getDepth
())
{
case
glslang
:
:
EldAny
:
mode
=
spv
::
ExecutionModeDepthAny
;
break
;
case
glslang
:
:
EldGreater
:
mode
=
spv
::
ExecutionModeDepthGreater
;
break
;
case
glslang
:
:
EldLess
:
mode
=
spv
::
ExecutionModeDepthLess
;
break
;
default
:
mode
=
spv
::
BadValue
;
break
;
}
if
(
mode
!=
spv
::
BadValue
)
builder
.
addExecutionMode
(
shaderEntry
,
(
spv
::
ExecutionMode
)
mode
);
if
(
glslangIntermediate
->
getDepth
()
!=
glslang
::
EldUnchanged
&&
glslangIntermediate
->
isDepthReplacing
())
builder
.
addExecutionMode
(
shaderEntry
,
spv
::
ExecutionModeDepthReplacing
);
break
;
break
;
case
EShLangCompute
:
case
EShLangCompute
:
...
...
Test/baseResults/spv.400.tese.out
View file @
e690332c
...
@@ -16,6 +16,9 @@ Linked tessellation evaluation stage:
...
@@ -16,6 +16,9 @@ Linked tessellation evaluation stage:
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint TessellationEvaluation 4 "main"
EntryPoint TessellationEvaluation 4 "main"
ExecutionMode 4 InputTriangles
ExecutionMode 4 InputTriangles
ExecutionMode 4 SpacingFractionalOdd
ExecutionMode 4 VertexOrderCcw
ExecutionMode 4 PointMode
Name 4 "main"
Name 4 "main"
Name 8 "a"
Name 8 "a"
Name 13 "p"
Name 13 "p"
...
...
Test/baseResults/spv.depthOut.frag.out
View file @
e690332c
spv.depthOut.frag
spv.depthOut.frag
WARNING: 0:3: varying deprecated in version 130; may be removed in future release
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
WARNING: 0:4: varying deprecated in version 130; may be removed in future release
Linked fragment stage:
Linked fragment stage:
...
@@ -10,12 +9,14 @@ Linked fragment stage:
...
@@ -10,12 +9,14 @@ Linked fragment stage:
// Generated by (magic number): 51a00bb
// Generated by (magic number): 51a00bb
// Id's are bound by 18
// Id's are bound by 18
Source GLSL
13
0
Source GLSL
45
0
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
ExecutionMode 4 OriginLowerLeft
ExecutionMode 4 DepthAny
ExecutionMode 4 DepthReplacing
Name 4 "main"
Name 4 "main"
Name 8 "gl_FragDepth"
Name 8 "gl_FragDepth"
Name 10 "Depth"
Name 10 "Depth"
...
...
Test/spv.depthOut.frag
View file @
e690332c
#version
13
0
#version
45
0
varying
vec4
Color
;
in
vec4
Color
;
varying
float
Depth
;
in
float
Depth
;
layout
(
depth_any
)
out
float
gl_FragDepth
;
void
main
()
void
main
()
{
{
...
...
glslang/Include/revision.h
View file @
e690332c
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the version, it uses the latest git tag followed by the number of commits.
// 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 "3.0.78
5
"
#define GLSLANG_REVISION "3.0.78
6
"
#define GLSLANG_DATE "13-Oct-2015"
#define GLSLANG_DATE "13-Oct-2015"
glslang/MachineIndependent/ParseHelper.cpp
View file @
e690332c
...
@@ -1921,6 +1921,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
...
@@ -1921,6 +1921,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
message
=
"can't modify a readonly buffer"
;
message
=
"can't modify a readonly buffer"
;
break
;
break
;
case
EvqFragDepth
:
case
EvqFragDepth
:
intermediate
.
setDepthReplacing
();
// "In addition, it is an error to statically write to gl_FragDepth in the fragment shader."
// "In addition, it is an error to statically write to gl_FragDepth in the fragment shader."
if
(
profile
==
EEsProfile
&&
intermediate
.
getEarlyFragmentTests
())
if
(
profile
==
EEsProfile
&&
intermediate
.
getEarlyFragmentTests
())
message
=
"can't modify gl_FragDepth if using early_fragment_tests"
;
message
=
"can't modify gl_FragDepth if using early_fragment_tests"
;
...
...
glslang/MachineIndependent/localintermediate.h
View file @
e690332c
...
@@ -127,7 +127,7 @@ public:
...
@@ -127,7 +127,7 @@ public:
explicit
TIntermediate
(
EShLanguage
l
,
int
v
=
0
,
EProfile
p
=
ENoProfile
)
:
language
(
l
),
treeRoot
(
0
),
profile
(
p
),
version
(
v
),
explicit
TIntermediate
(
EShLanguage
l
,
int
v
=
0
,
EProfile
p
=
ENoProfile
)
:
language
(
l
),
treeRoot
(
0
),
profile
(
p
),
version
(
v
),
numMains
(
0
),
numErrors
(
0
),
recursive
(
false
),
numMains
(
0
),
numErrors
(
0
),
recursive
(
false
),
invocations
(
0
),
vertices
(
0
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
invocations
(
0
),
vertices
(
0
),
inputPrimitive
(
ElgNone
),
outputPrimitive
(
ElgNone
),
pixelCenterInteger
(
false
),
originUpperLeft
(
false
),
vertexSpacing
(
EvsNone
),
vertexOrder
(
EvoNone
),
pointMode
(
false
),
earlyFragmentTests
(
false
),
depthLayout
(
EldNone
),
blendEquations
(
0
),
xfbMode
(
false
)
vertexSpacing
(
EvsNone
),
vertexOrder
(
EvoNone
),
pointMode
(
false
),
earlyFragmentTests
(
false
),
depthLayout
(
EldNone
),
depthReplacing
(
false
),
blendEquations
(
0
),
xfbMode
(
false
)
{
{
localSize
[
0
]
=
1
;
localSize
[
0
]
=
1
;
localSize
[
1
]
=
1
;
localSize
[
1
]
=
1
;
...
@@ -276,6 +276,8 @@ public:
...
@@ -276,6 +276,8 @@ public:
return
true
;
return
true
;
}
}
TLayoutDepth
getDepth
()
const
{
return
depthLayout
;
}
TLayoutDepth
getDepth
()
const
{
return
depthLayout
;
}
void
setDepthReplacing
()
{
depthReplacing
=
true
;
}
bool
isDepthReplacing
()
const
{
return
depthReplacing
;
}
void
addBlendEquation
(
TBlendEquationShift
b
)
{
blendEquations
|=
(
1
<<
b
);
}
void
addBlendEquation
(
TBlendEquationShift
b
)
{
blendEquations
|=
(
1
<<
b
);
}
unsigned
int
getBlendEquations
()
const
{
return
blendEquations
;
}
unsigned
int
getBlendEquations
()
const
{
return
blendEquations
;
}
...
@@ -335,6 +337,7 @@ protected:
...
@@ -335,6 +337,7 @@ protected:
int
localSize
[
3
];
int
localSize
[
3
];
bool
earlyFragmentTests
;
bool
earlyFragmentTests
;
TLayoutDepth
depthLayout
;
TLayoutDepth
depthLayout
;
bool
depthReplacing
;
int
blendEquations
;
// an 'or'ing of masks of shifts of TBlendEquationShift
int
blendEquations
;
// an 'or'ing of masks of shifts of TBlendEquationShift
bool
xfbMode
;
bool
xfbMode
;
...
...
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