SPV Capabilities: SampleRateShading, SparseResidency, MinLod, and ImageQuery.
This commit is contained in:
parent
b0364dcc3e
commit
5e80113939
@ -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
|
|||||||
// 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 TGlslangToSpvTraverser::TranslateInterpolationDecoration(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
|
|||||||
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
|
|||||||
// 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
|
|||||||
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;
|
||||||
|
|||||||
@ -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,
|
|||||||
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,
|
|||||||
// 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) {
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user