Implement GL_EXT_maximal_reconvergence
This commit is contained in:
parent
7eea61b5a3
commit
8066fa086b
16 changed files with 1452 additions and 1384 deletions
|
|
@ -56,5 +56,6 @@ static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragme
|
|||
static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
|
||||
static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_tracing_position_fetch";
|
||||
static const char* const E_SPV_KHR_cooperative_matrix = "SPV_KHR_cooperative_matrix";
|
||||
static const char* const E_SPV_KHR_maximal_reconvergence = "SPV_KHR_maximal_reconvergence";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
|
|
|||
|
|
@ -1635,6 +1635,10 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
|||
builder.addExtension(spv::E_SPV_KHR_subgroup_uniform_control_flow);
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeSubgroupUniformControlFlowKHR);
|
||||
}
|
||||
if (glslangIntermediate->getMaximalReconvergence()) {
|
||||
builder.addExtension(spv::E_SPV_KHR_maximal_reconvergence);
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeMaximallyReconvergesKHR);
|
||||
}
|
||||
|
||||
unsigned int mode;
|
||||
switch (glslangIntermediate->getStage()) {
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ const char* ExecutionModeString(int mode)
|
|||
case ExecutionModeStencilRefGreaterBackAMD: return "StencilRefGreaterBackAMD";
|
||||
case ExecutionModeStencilRefReplacingEXT: return "StencilRefReplacingEXT";
|
||||
case ExecutionModeSubgroupUniformControlFlowKHR: return "SubgroupUniformControlFlow";
|
||||
case ExecutionModeMaximallyReconvergesKHR: return "MaximallyReconverges";
|
||||
|
||||
case ExecutionModeOutputLinesNV: return "OutputLinesNV";
|
||||
case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV";
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ enum ExecutionMode {
|
|||
ExecutionModeNoGlobalOffsetINTEL = 5895,
|
||||
ExecutionModeNumSIMDWorkitemsINTEL = 5896,
|
||||
ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903,
|
||||
ExecutionModeMaximallyReconvergesKHR = 6023,
|
||||
ExecutionModeStreamingInterfaceINTEL = 6154,
|
||||
ExecutionModeNamedBarrierCountINTEL = 6417,
|
||||
ExecutionModeMax = 0x7fffffff,
|
||||
|
|
|
|||
22
Test/baseResults/spv.maximalReconvergence.vert.out
Normal file
22
Test/baseResults/spv.maximalReconvergence.vert.out
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
spv.maximalReconvergence.vert
|
||||
WARNING: 0:5: '' : attribute with arguments not recognized, skipping
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 6
|
||||
|
||||
Capability Shader
|
||||
Extension "SPV_KHR_maximal_reconvergence"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main"
|
||||
ExecutionMode 4 MaximallyReconverges
|
||||
Source GLSL 460
|
||||
SourceExtension "GL_EXT_maximal_reconvergence"
|
||||
Name 4 "main"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
7
Test/spv.maximalReconvergence.vert
Normal file
7
Test/spv.maximalReconvergence.vert
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#version 460
|
||||
|
||||
#extension GL_EXT_maximal_reconvergence : enable
|
||||
|
||||
[[random(4)]] void main() [[maximal_reconvergence]]
|
||||
{
|
||||
}
|
||||
|
|
@ -258,6 +258,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_subgroup_uniform_control_flow] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_maximal_reconvergence] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_EXT_fragment_shader_barycentric] = EBhDisable;
|
||||
|
||||
|
|
@ -446,6 +447,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
if (version >= 310) {
|
||||
preamble += "#define GL_EXT_null_initializer 1\n";
|
||||
preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n";
|
||||
preamble += "#define GL_EXT_maximal_reconvergence 1\n";
|
||||
}
|
||||
|
||||
} else { // !isEsProfile()
|
||||
|
|
@ -599,6 +601,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||
if (version >= 140) {
|
||||
preamble += "#define GL_EXT_null_initializer 1\n";
|
||||
preamble += "#define GL_EXT_subgroup_uniform_control_flow 1\n";
|
||||
preamble += "#define GL_EXT_maximal_reconvergence 1\n";
|
||||
}
|
||||
if (version >= 130) {
|
||||
preamble +="#define GL_FRAGMENT_PRECISION_HIGH 1\n";
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shade
|
|||
const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap";
|
||||
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";
|
||||
|
||||
// Arrays of extensions for the above viewportEXTs duplications
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ TAttributeType TParseContext::attributeFromName(const TString& name) const
|
|||
return EatSubgroupUniformControlFlow;
|
||||
else if (name == "export")
|
||||
return EatExport;
|
||||
else if (name == "maximal_reconvergence")
|
||||
return EatMaximalReconvergence;
|
||||
else
|
||||
return EatNone;
|
||||
}
|
||||
|
|
@ -360,6 +362,10 @@ void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttri
|
|||
requireExtensions(loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
|
||||
intermediate.setSubgroupUniformControlFlow();
|
||||
break;
|
||||
case EatMaximalReconvergence:
|
||||
requireExtensions(loc, 1, &E_GL_EXT_maximal_reconvergence, "attribute");
|
||||
intermediate.setMaximalReconvergence();
|
||||
break;
|
||||
default:
|
||||
warn(loc, "attribute does not apply to a function", "", "");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ namespace glslang {
|
|||
EatNonReadable,
|
||||
EatSubgroupUniformControlFlow,
|
||||
EatExport,
|
||||
EatMaximalReconvergence,
|
||||
};
|
||||
|
||||
class TIntermAggregate;
|
||||
|
|
|
|||
|
|
@ -964,18 +964,24 @@ function_prototype
|
|||
$$.function = $1;
|
||||
if (parseContext.compileOnly) $$.function->setExport();
|
||||
$$.loc = $2.loc;
|
||||
const char * extensions[2] = { E_GL_EXT_subgroup_uniform_control_flow, E_GL_EXT_maximal_reconvergence };
|
||||
parseContext.requireExtensions($2.loc, 2, extensions, "attribute");
|
||||
parseContext.handleFunctionAttributes($2.loc, *$3);
|
||||
}
|
||||
| attribute function_declarator RIGHT_PAREN {
|
||||
$$.function = $2;
|
||||
if (parseContext.compileOnly) $$.function->setExport();
|
||||
$$.loc = $3.loc;
|
||||
const char * extensions[2] = { E_GL_EXT_subgroup_uniform_control_flow, E_GL_EXT_maximal_reconvergence };
|
||||
parseContext.requireExtensions($3.loc, 2, extensions, "attribute");
|
||||
parseContext.handleFunctionAttributes($3.loc, *$1);
|
||||
}
|
||||
| attribute function_declarator RIGHT_PAREN attribute {
|
||||
$$.function = $2;
|
||||
if (parseContext.compileOnly) $$.function->setExport();
|
||||
$$.loc = $3.loc;
|
||||
const char * extensions[2] = { E_GL_EXT_subgroup_uniform_control_flow, E_GL_EXT_maximal_reconvergence };
|
||||
parseContext.requireExtensions($3.loc, 2, extensions, "attribute");
|
||||
parseContext.handleFunctionAttributes($3.loc, *$1);
|
||||
parseContext.handleFunctionAttributes($3.loc, *$4);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1512,6 +1512,9 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
if (getSubgroupUniformControlFlow())
|
||||
infoSink.debug << "subgroup_uniform_control_flow\n";
|
||||
|
||||
if (getMaximalReconvergence())
|
||||
infoSink.debug << "maximal_reconvergence\n";
|
||||
|
||||
switch (language) {
|
||||
case EShLangVertex:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@ public:
|
|||
needToLegalize(false),
|
||||
binaryDoubleOutput(false),
|
||||
subgroupUniformControlFlow(false),
|
||||
maximalReconvergence(false),
|
||||
usePhysicalStorageBuffer(false),
|
||||
spirvRequirement(nullptr),
|
||||
spirvExecutionMode(nullptr),
|
||||
|
|
@ -963,6 +964,9 @@ public:
|
|||
void setSubgroupUniformControlFlow() { subgroupUniformControlFlow = true; }
|
||||
bool getSubgroupUniformControlFlow() const { return subgroupUniformControlFlow; }
|
||||
|
||||
void setMaximalReconvergence() { maximalReconvergence = true; }
|
||||
bool getMaximalReconvergence() const { return maximalReconvergence; }
|
||||
|
||||
// GL_EXT_spirv_intrinsics
|
||||
void insertSpirvRequirement(const TSpirvRequirement* spirvReq);
|
||||
bool hasSpirvRequirement() const { return spirvRequirement != nullptr; }
|
||||
|
|
@ -1226,6 +1230,7 @@ protected:
|
|||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool subgroupUniformControlFlow;
|
||||
bool maximalReconvergence;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
TSpirvRequirement* spirvRequirement;
|
||||
|
|
|
|||
|
|
@ -436,6 +436,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
"spv.matFun.vert",
|
||||
"spv.matrix.frag",
|
||||
"spv.matrix2.frag",
|
||||
"spv.maximalReconvergence.vert",
|
||||
"spv.memoryQualifier.frag",
|
||||
"spv.merge-unreachable.frag",
|
||||
"spv.multiStruct.comp",
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
"site" : "github",
|
||||
"subrepo" : "KhronosGroup/SPIRV-Tools",
|
||||
"subdir" : "External/spirv-tools",
|
||||
"commit": "f0cc85efdbbe3a46eae90e0f915dc1509836d0fc"
|
||||
"commit": "de3d5acc04fd203e3e5120a00f168465ecb2e4e4"
|
||||
},
|
||||
{
|
||||
"name" : "spirv-tools/external/spirv-headers",
|
||||
"site" : "github",
|
||||
"subrepo" : "KhronosGroup/SPIRV-Headers",
|
||||
"subdir" : "External/spirv-tools/external/spirv-headers",
|
||||
"commit" : "1c6bb2743599e6eb6f37b2969acc0aef812e32e3"
|
||||
"commit" : "ae6a8b39717523d96683bc0d20b541944e28072f"
|
||||
},
|
||||
{
|
||||
"name": "googletest",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue