Add SPV_AMD_shader_early_and_late_fragment_tests

This commit is contained in:
dwang102 2022-07-15 14:36:03 +08:00
parent 68c1880c09
commit 070863af69
14 changed files with 207 additions and 22 deletions

View file

@ -443,6 +443,18 @@ enum TLayoutDepth {
EldCount
};
enum TLayoutStencil {
ElsNone,
ElsRefUnchangedFrontAMD,
ElsRefGreaterFrontAMD,
ElsRefLessFrontAMD,
ElsRefUnchangedBackAMD,
ElsRefGreaterBackAMD,
ElsRefLessBackAMD,
ElsCount
};
enum TBlendEquationShift {
// No 'EBlendNone':
// These are used as bit-shift amounts. A mask of such shifts will have type 'int',
@ -705,6 +717,7 @@ public:
case EvqVaryingOut:
case EvqFragColor:
case EvqFragDepth:
case EvqFragStencil:
return true;
default:
return false;
@ -772,6 +785,7 @@ public:
case EvqVaryingOut:
case EvqFragColor:
case EvqFragDepth:
case EvqFragStencil:
return true;
default:
return false;
@ -1239,6 +1253,18 @@ public:
default: return "none";
}
}
static const char* getLayoutStencilString(TLayoutStencil s)
{
switch (s) {
case ElsRefUnchangedFrontAMD: return "stencil_ref_unchanged_front_amd";
case ElsRefGreaterFrontAMD: return "stencil_ref_greater_front_amd";
case ElsRefLessFrontAMD: return "stencil_ref_less_front_amd";
case ElsRefUnchangedBackAMD: return "stencil_ref_unchanged_back_amd";
case ElsRefGreaterBackAMD: return "stencil_ref_greater_back_amd";
case ElsRefLessBackAMD: return "stencil_ref_less_back_amd";
default: return "none";
}
}
static const char* getBlendEquationString(TBlendEquationShift e)
{
switch (e) {
@ -1336,7 +1362,9 @@ struct TShaderQualifiers {
#ifndef GLSLANG_WEB
bool earlyFragmentTests; // fragment input
bool postDepthCoverage; // fragment input
bool earlyAndLateFragmentTestsAMD; //fragment input
TLayoutDepth layoutDepth;
TLayoutStencil layoutStencil;
bool blendEquation; // true if any blend equation was specified
int numViews; // multiview extenstions
TInterlockOrdering interlockOrdering;
@ -1346,6 +1374,7 @@ struct TShaderQualifiers {
int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set
bool layoutPrimitiveCulling; // true if layout primitive_culling set
TLayoutDepth getDepth() const { return layoutDepth; }
TLayoutStencil getStencil() const { return layoutStencil; }
#else
TLayoutDepth getDepth() const { return EldNone; }
#endif
@ -1371,8 +1400,10 @@ struct TShaderQualifiers {
localSizeSpecId[2] = TQualifier::layoutNotSet;
#ifndef GLSLANG_WEB
earlyFragmentTests = false;
earlyAndLateFragmentTestsAMD = false;
postDepthCoverage = false;
layoutDepth = EldNone;
layoutStencil = ElsNone;
blendEquation = false;
numViews = TQualifier::layoutNotSet;
layoutOverrideCoverage = false;
@ -1424,10 +1455,14 @@ struct TShaderQualifiers {
#ifndef GLSLANG_WEB
if (src.earlyFragmentTests)
earlyFragmentTests = true;
if (src.earlyAndLateFragmentTestsAMD)
earlyAndLateFragmentTestsAMD = true;
if (src.postDepthCoverage)
postDepthCoverage = true;
if (src.layoutDepth)
layoutDepth = src.layoutDepth;
if (src.layoutStencil)
layoutStencil = src.layoutStencil;
if (src.blendEquation)
blendEquation = src.blendEquation;
if (src.numViews != TQualifier::layoutNotSet)