Support extension EXT_shader_quad_control
This commit is contained in:
parent
f6f9840eab
commit
725017a588
15 changed files with 232 additions and 3 deletions
|
|
@ -2227,6 +2227,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
);
|
||||
}
|
||||
|
||||
// GL_EXT_shader_quad_control
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
commonBuiltins.append(
|
||||
"bool subgroupQuadAll(bool);\n"
|
||||
"bool subgroupQuadAny(bool);\n"
|
||||
);
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 460) {
|
||||
commonBuiltins.append(
|
||||
"bool anyInvocation(bool);"
|
||||
|
|
@ -8779,6 +8788,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
|
||||
}
|
||||
|
||||
// GL_EXT_shader_quad_control
|
||||
if ((profile != EEsProfile && version >= 140) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
symbolTable.setFunctionExtensions("subgroupQuadAll", 1, &E_GL_KHR_shader_subgroup_vote);
|
||||
symbolTable.setFunctionExtensions("subgroupQuadAny", 1, &E_GL_KHR_shader_subgroup_vote);
|
||||
}
|
||||
|
||||
// GL_EXT_shader_tile_image
|
||||
symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
|
||||
symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
|
||||
|
|
@ -9977,6 +9993,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
|
||||
}
|
||||
|
||||
// GL_EXT_shader_quad_control
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
symbolTable.relateToOperator("subgroupQuadAll", EOpSubgroupQuadAll);
|
||||
symbolTable.relateToOperator("subgroupQuadAny", EOpSubgroupQuadAny);
|
||||
}
|
||||
|
||||
if ((profile == EEsProfile && version >= 310) ||
|
||||
(profile != EEsProfile && version >= 140)) {
|
||||
symbolTable.relateToOperator("textureWeightedQCOM", EOpImageSampleWeightedQCOM);
|
||||
|
|
|
|||
|
|
@ -1351,6 +1351,10 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
|
|||
// - a user function.
|
||||
|
||||
// Error check for a function requiring specific extensions present.
|
||||
if (builtIn &&
|
||||
(fnCandidate->getBuiltInOp() == EOpSubgroupQuadAll || fnCandidate->getBuiltInOp() == EOpSubgroupQuadAny))
|
||||
requireExtensions(loc, 1, &E_GL_EXT_shader_quad_control, fnCandidate->getName().c_str());
|
||||
|
||||
if (builtIn && fnCandidate->getNumExtensions())
|
||||
requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str());
|
||||
|
||||
|
|
@ -3986,6 +3990,18 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q
|
|||
// Storage qualifier isn't ready for memberQualifierCheck, we should skip invariantCheck for it.
|
||||
if (!isMemberCheck || structNestingLevel > 0)
|
||||
invariantCheck(loc, qualifier);
|
||||
|
||||
if (qualifier.isFullQuads()) {
|
||||
if (qualifier.storage != EvqVaryingIn)
|
||||
error(loc, "can only apply to input layout", "full_quads ", "");
|
||||
intermediate.setReqFullQuadsMode();
|
||||
}
|
||||
|
||||
if (qualifier.isQuadDeriv()) {
|
||||
if (qualifier.storage != EvqVaryingIn)
|
||||
error(loc, "can only apply to input layout", "quad_derivatives", "");
|
||||
intermediate.setQuadDerivMode();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -5859,6 +5875,15 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
publicType.shaderQualifiers.layoutOverrideCoverage = true;
|
||||
return;
|
||||
}
|
||||
if (id == "full_quads")
|
||||
{
|
||||
const char* feature = "full_quads qualifier";
|
||||
requireProfile(loc, ECompatibilityProfile | ECoreProfile | EEsProfile, feature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 140, E_GL_EXT_shader_quad_control, feature);
|
||||
profileRequires(loc, EEsProfile, 310, E_GL_EXT_shader_quad_control, feature);
|
||||
publicType.qualifier.layoutFullQuads = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (language == EShLangVertex ||
|
||||
language == EShLangTessControl ||
|
||||
|
|
@ -5908,6 +5933,16 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
return;
|
||||
}
|
||||
|
||||
if (id == "quad_derivatives")
|
||||
{
|
||||
const char* feature = "quad_derivatives qualifier";
|
||||
requireProfile(loc, ECompatibilityProfile | ECoreProfile | EEsProfile, feature);
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 140, E_GL_EXT_shader_quad_control, feature);
|
||||
profileRequires(loc, EEsProfile, 310, E_GL_EXT_shader_quad_control, feature);
|
||||
publicType.qualifier.layoutQuadDeriv = true;
|
||||
return;
|
||||
}
|
||||
|
||||
error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), "");
|
||||
}
|
||||
|
||||
|
|
@ -6336,6 +6371,10 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
|
|||
dst.layoutSecondaryViewportRelativeOffset = src.layoutSecondaryViewportRelativeOffset;
|
||||
if (src.layoutShaderRecord)
|
||||
dst.layoutShaderRecord = true;
|
||||
if (src.layoutFullQuads)
|
||||
dst.layoutFullQuads = true;
|
||||
if (src.layoutQuadDeriv)
|
||||
dst.layoutQuadDeriv = true;
|
||||
if (src.layoutBindlessSampler)
|
||||
dst.layoutBindlessSampler = true;
|
||||
if (src.layoutBindlessImage)
|
||||
|
|
|
|||
|
|
@ -357,6 +357,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_opacity_micromap] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_quad_control] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_tracing_position_fetch] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_tile_image] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_texture_shadow_lod] = EBhDisable;
|
||||
|
|
@ -584,6 +585,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
"#define GL_EXT_shader_atomic_float2 1\n"
|
||||
|
||||
"#define GL_EXT_fragment_shader_barycentric 1\n"
|
||||
"#define GL_EXT_shader_quad_control 1\n"
|
||||
"#define GL_EXT_texture_array 1\n"
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,6 +215,7 @@ const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intr
|
|||
const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric";
|
||||
const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shader";
|
||||
const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap";
|
||||
const char* const E_GL_EXT_shader_quad_control = "GL_EXT_shader_quad_control";
|
||||
const char* const E_GL_EXT_draw_instanced = "GL_EXT_draw_instanced";
|
||||
const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array";
|
||||
const char* const E_GL_EXT_maximal_reconvergence = "GL_EXT_maximal_reconvergence";
|
||||
|
|
|
|||
|
|
@ -597,6 +597,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpSubgroupQuadSwapHorizontal: out.debug << "subgroupQuadSwapHorizontal"; break;
|
||||
case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||
case EOpSubgroupQuadAll: out.debug << "subgroupQuadAll"; break;
|
||||
case EOpSubgroupQuadAny: out.debug << "subgroupQuadAny"; break;
|
||||
|
||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||
|
|
@ -1032,6 +1034,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpSubgroupQuadSwapHorizontal: out.debug << "subgroupQuadSwapHorizontal"; break;
|
||||
case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break;
|
||||
case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break;
|
||||
case EOpSubgroupQuadAll: out.debug << "subgroupQuadAll"; break;
|
||||
case EOpSubgroupQuadAny: out.debug << "subgroupQuadAny"; break;
|
||||
|
||||
case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break;
|
||||
case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break;
|
||||
|
|
|
|||
|
|
@ -349,7 +349,8 @@ public:
|
|||
usePhysicalStorageBuffer(false),
|
||||
spirvRequirement(nullptr),
|
||||
spirvExecutionMode(nullptr),
|
||||
uniformLocationBase(0)
|
||||
uniformLocationBase(0),
|
||||
quadDerivMode(false), reqFullQuadsMode(false)
|
||||
{
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
|
|
@ -858,6 +859,10 @@ public:
|
|||
|
||||
void setXfbMode() { xfbMode = true; }
|
||||
bool getXfbMode() const { return xfbMode; }
|
||||
void setQuadDerivMode(bool mode = true) { quadDerivMode = mode; }
|
||||
bool getQuadDerivMode() const { return quadDerivMode; }
|
||||
void setReqFullQuadsMode(bool mode = true) { reqFullQuadsMode = mode; }
|
||||
bool getReqFullQuadsMode() const { return reqFullQuadsMode; }
|
||||
void setMultiStream() { multiStream = true; }
|
||||
bool isMultiStream() const { return multiStream; }
|
||||
bool setOutputPrimitive(TLayoutGeometry p)
|
||||
|
|
@ -1197,6 +1202,8 @@ protected:
|
|||
bool hlslFunctionality1;
|
||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||
bool xfbMode;
|
||||
bool quadDerivMode;
|
||||
bool reqFullQuadsMode;
|
||||
std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer
|
||||
bool multiStream;
|
||||
bool layoutOverrideCoverage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue