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
5e801139
Commit
5e801139
authored
Feb 15, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV Capabilities: SampleRateShading, SparseResidency, MinLod, and ImageQuery.
parent
b0364dcc
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
6 deletions
+34
-6
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+17
-6
SpvBuilder.cpp
SPIRV/SpvBuilder.cpp
+9
-0
spv.130.frag.out
Test/baseResults/spv.130.frag.out
+1
-0
spv.140.frag.out
Test/baseResults/spv.140.frag.out
+1
-0
spv.image.frag.out
Test/baseResults/spv.image.frag.out
+1
-0
spv.newTexture.frag.out
Test/baseResults/spv.newTexture.frag.out
+1
-0
spv.queryL.frag.out
Test/baseResults/spv.queryL.frag.out
+1
-0
spv.sparseTexture.frag.out
Test/baseResults/spv.sparseTexture.frag.out
+1
-0
spv.sparseTextureClamp.frag.out
Test/baseResults/spv.sparseTextureClamp.frag.out
+2
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
5e801139
...
@@ -88,6 +88,7 @@ public:
...
@@ -88,6 +88,7 @@ public:
void
dumpSpv
(
std
::
vector
<
unsigned
int
>&
out
);
void
dumpSpv
(
std
::
vector
<
unsigned
int
>&
out
);
protected
:
protected
:
spv
::
Decoration
TranslateInterpolationDecoration
(
const
glslang
::
TQualifier
&
qualifier
);
spv
::
BuiltIn
TranslateBuiltInDecoration
(
glslang
::
TBuiltInVariable
);
spv
::
BuiltIn
TranslateBuiltInDecoration
(
glslang
::
TBuiltInVariable
);
spv
::
Id
createSpvVariable
(
const
glslang
::
TIntermSymbol
*
);
spv
::
Id
createSpvVariable
(
const
glslang
::
TIntermSymbol
*
);
spv
::
Id
getSampledType
(
const
glslang
::
TSampler
&
);
spv
::
Id
getSampledType
(
const
glslang
::
TSampler
&
);
...
@@ -301,7 +302,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
...
@@ -301,7 +302,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T
// Translate glslang type to SPIR-V interpolation decorations.
// Translate glslang type to SPIR-V interpolation decorations.
// Returns spv::Decoration(spv::BadValue) when no decoration
// Returns spv::Decoration(spv::BadValue) when no decoration
// should be applied.
// should be applied.
spv
::
Decoration
TranslateInterpolationDecoration
(
const
glslang
::
TQualifier
&
qualifier
)
spv
::
Decoration
T
GlslangToSpvTraverser
::
T
ranslateInterpolationDecoration
(
const
glslang
::
TQualifier
&
qualifier
)
{
{
if
(
qualifier
.
smooth
)
{
if
(
qualifier
.
smooth
)
{
// Smooth decoration doesn't exist in SPIR-V 1.0
// Smooth decoration doesn't exist in SPIR-V 1.0
...
@@ -315,9 +316,10 @@ spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qual
...
@@ -315,9 +316,10 @@ spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qual
return
spv
::
DecorationFlat
;
return
spv
::
DecorationFlat
;
else
if
(
qualifier
.
centroid
)
else
if
(
qualifier
.
centroid
)
return
spv
::
DecorationCentroid
;
return
spv
::
DecorationCentroid
;
else
if
(
qualifier
.
sample
)
else
if
(
qualifier
.
sample
)
{
builder
.
addCapability
(
spv
::
CapabilitySampleRateShading
);
return
spv
::
DecorationSample
;
return
spv
::
DecorationSample
;
else
}
else
return
(
spv
::
Decoration
)
spv
::
BadValue
;
return
(
spv
::
Decoration
)
spv
::
BadValue
;
}
}
...
@@ -358,6 +360,18 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -358,6 +360,18 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
// TODO: builder.addCapability(spv::CapabilityMultiViewport);
// TODO: builder.addCapability(spv::CapabilityMultiViewport);
return
spv
::
BuiltInViewportIndex
;
return
spv
::
BuiltInViewportIndex
;
case
glslang
:
:
EbvSampleId
:
builder
.
addCapability
(
spv
::
CapabilitySampleRateShading
);
return
spv
::
BuiltInSampleId
;
case
glslang
:
:
EbvSamplePosition
:
builder
.
addCapability
(
spv
::
CapabilitySampleRateShading
);
return
spv
::
BuiltInSamplePosition
;
case
glslang
:
:
EbvSampleMask
:
builder
.
addCapability
(
spv
::
CapabilitySampleRateShading
);
return
spv
::
BuiltInSampleMask
;
case
glslang
:
:
EbvPosition
:
return
spv
::
BuiltInPosition
;
case
glslang
:
:
EbvPosition
:
return
spv
::
BuiltInPosition
;
case
glslang
:
:
EbvVertexId
:
return
spv
::
BuiltInVertexId
;
case
glslang
:
:
EbvVertexId
:
return
spv
::
BuiltInVertexId
;
case
glslang
:
:
EbvInstanceId
:
return
spv
::
BuiltInInstanceId
;
case
glslang
:
:
EbvInstanceId
:
return
spv
::
BuiltInInstanceId
;
...
@@ -377,9 +391,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
...
@@ -377,9 +391,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
case
glslang
:
:
EbvFragCoord
:
return
spv
::
BuiltInFragCoord
;
case
glslang
:
:
EbvFragCoord
:
return
spv
::
BuiltInFragCoord
;
case
glslang
:
:
EbvPointCoord
:
return
spv
::
BuiltInPointCoord
;
case
glslang
:
:
EbvPointCoord
:
return
spv
::
BuiltInPointCoord
;
case
glslang
:
:
EbvFace
:
return
spv
::
BuiltInFrontFacing
;
case
glslang
:
:
EbvFace
:
return
spv
::
BuiltInFrontFacing
;
case
glslang
:
:
EbvSampleId
:
return
spv
::
BuiltInSampleId
;
case
glslang
:
:
EbvSamplePosition
:
return
spv
::
BuiltInSamplePosition
;
case
glslang
:
:
EbvSampleMask
:
return
spv
::
BuiltInSampleMask
;
case
glslang
:
:
EbvFragDepth
:
return
spv
::
BuiltInFragDepth
;
case
glslang
:
:
EbvFragDepth
:
return
spv
::
BuiltInFragDepth
;
case
glslang
:
:
EbvHelperInvocation
:
return
spv
::
BuiltInHelperInvocation
;
case
glslang
:
:
EbvHelperInvocation
:
return
spv
::
BuiltInHelperInvocation
;
case
glslang
:
:
EbvNumWorkGroups
:
return
spv
::
BuiltInNumWorkgroups
;
case
glslang
:
:
EbvNumWorkGroups
:
return
spv
::
BuiltInNumWorkgroups
;
...
...
SPIRV/SpvBuilder.cpp
View file @
5e801139
...
@@ -1340,6 +1340,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
...
@@ -1340,6 +1340,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
texArgs
[
numArgs
++
]
=
parameters
.
sample
;
texArgs
[
numArgs
++
]
=
parameters
.
sample
;
}
}
if
(
parameters
.
lodClamp
)
{
if
(
parameters
.
lodClamp
)
{
// capability if this bit is used
addCapability
(
CapabilityMinLod
);
mask
=
(
ImageOperandsMask
)(
mask
|
ImageOperandsMinLodMask
);
mask
=
(
ImageOperandsMask
)(
mask
|
ImageOperandsMinLodMask
);
texArgs
[
numArgs
++
]
=
parameters
.
lodClamp
;
texArgs
[
numArgs
++
]
=
parameters
.
lodClamp
;
}
}
...
@@ -1459,6 +1462,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
...
@@ -1459,6 +1462,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
Id
resultId
=
textureInst
->
getResultId
();
Id
resultId
=
textureInst
->
getResultId
();
if
(
sparse
)
{
if
(
sparse
)
{
// set capability
addCapability
(
CapabilitySparseResidency
);
// Decode the return type that was a special structure
// Decode the return type that was a special structure
createStore
(
createCompositeExtract
(
resultId
,
typeId1
,
1
),
parameters
.
texelOut
);
createStore
(
createCompositeExtract
(
resultId
,
typeId1
,
1
),
parameters
.
texelOut
);
resultId
=
createCompositeExtract
(
resultId
,
typeId0
,
0
);
resultId
=
createCompositeExtract
(
resultId
,
typeId0
,
0
);
...
@@ -1476,6 +1482,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
...
@@ -1476,6 +1482,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
// Comments in header
// Comments in header
Id
Builder
::
createTextureQueryCall
(
Op
opCode
,
const
TextureParameters
&
parameters
)
Id
Builder
::
createTextureQueryCall
(
Op
opCode
,
const
TextureParameters
&
parameters
)
{
{
// All these need a capability
addCapability
(
CapabilityImageQuery
);
// Figure out the result type
// Figure out the result type
Id
resultType
=
0
;
Id
resultType
=
0
;
switch
(
opCode
)
{
switch
(
opCode
)
{
...
...
Test/baseResults/spv.130.frag.out
View file @
5e801139
...
@@ -14,6 +14,7 @@ Linked fragment stage:
...
@@ -14,6 +14,7 @@ Linked fragment stage:
Capability SampledRect
Capability SampledRect
Capability Sampled1D
Capability Sampled1D
Capability SampledCubeArray
Capability SampledCubeArray
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 68 79 99 173 184 185 186
EntryPoint Fragment 4 "main" 17 68 79 99 173 184 185 186
...
...
Test/baseResults/spv.140.frag.out
View file @
5e801139
...
@@ -11,6 +11,7 @@ Linked fragment stage:
...
@@ -11,6 +11,7 @@ Linked fragment stage:
Capability ClipDistance
Capability ClipDistance
Capability SampledRect
Capability SampledRect
Capability SampledBuffer
Capability SampledBuffer
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 16 28 33 43
EntryPoint Fragment 4 "main" 16 28 33 43
...
...
Test/baseResults/spv.image.frag.out
View file @
5e801139
...
@@ -15,6 +15,7 @@ Linked fragment stage:
...
@@ -15,6 +15,7 @@ Linked fragment stage:
Capability SampledCubeArray
Capability SampledCubeArray
Capability SampledBuffer
Capability SampledBuffer
Capability ImageMSArray
Capability ImageMSArray
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 356
EntryPoint Fragment 4 "main" 356
...
...
Test/baseResults/spv.newTexture.frag.out
View file @
5e801139
...
@@ -12,6 +12,7 @@ Linked fragment stage:
...
@@ -12,6 +12,7 @@ Linked fragment stage:
Capability Shader
Capability Shader
Capability SampledRect
Capability SampledRect
Capability SampledCubeArray
Capability SampledCubeArray
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277
EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277
...
...
Test/baseResults/spv.queryL.frag.out
View file @
5e801139
...
@@ -14,6 +14,7 @@ Linked fragment stage:
...
@@ -14,6 +14,7 @@ Linked fragment stage:
Capability Sampled1D
Capability Sampled1D
Capability SampledCubeArray
Capability SampledCubeArray
Capability SampledBuffer
Capability SampledBuffer
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main"
...
...
Test/baseResults/spv.sparseTexture.frag.out
View file @
5e801139
...
@@ -11,6 +11,7 @@ Linked fragment stage:
...
@@ -11,6 +11,7 @@ Linked fragment stage:
Capability Shader
Capability Shader
Capability SampledRect
Capability SampledRect
Capability SparseResidency
Capability SampledCubeArray
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
...
...
Test/baseResults/spv.sparseTextureClamp.frag.out
View file @
5e801139
...
@@ -11,6 +11,8 @@ Linked fragment stage:
...
@@ -11,6 +11,8 @@ Linked fragment stage:
Capability Shader
Capability Shader
Capability SampledRect
Capability SampledRect
Capability SparseResidency
Capability MinLod
Capability SampledCubeArray
Capability SampledCubeArray
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
...
...
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