Implement GL_KHR_blend_equation_advanced.
This commit is contained in:
parent
d6c37b190b
commit
c8b2e36f52
8 changed files with 148 additions and 4 deletions
|
|
@ -2379,6 +2379,9 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
|||
if (qualifier.storage != EvqVaryingIn && qualifier.storage != EvqVaryingOut)
|
||||
return;
|
||||
|
||||
if (publicType.shaderQualifiers.blendEquation)
|
||||
error(loc, "can only be applied to a standalone 'out'", "blend equation", "");
|
||||
|
||||
// now, knowing it is a shader in/out, do all the in/out semantic checks
|
||||
|
||||
if (publicType.basicType == EbtBool) {
|
||||
|
|
@ -3694,6 +3697,21 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (id.compare(0, 13, "blend_support") == 0) {
|
||||
bool found = false;
|
||||
for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) {
|
||||
if (id == TQualifier::getBlendEquationString(be)) {
|
||||
requireExtensions(loc, 1, &E_GL_KHR_blend_equation_advanced, "blend equation");
|
||||
intermediate.addBlendEquation(be);
|
||||
publicType.shaderQualifiers.blendEquation = true;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! found)
|
||||
error(loc, "unknown blend equation", "blend_support", "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), "");
|
||||
}
|
||||
|
|
@ -4232,6 +4250,9 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
|
|||
if (shaderQualifiers.localSize[i] > 1)
|
||||
error(loc, message, "local_size", "");
|
||||
}
|
||||
if (shaderQualifiers.blendEquation)
|
||||
error(loc, message, "blend equation", "");
|
||||
// TBD: correctness: are any of these missing? pixelCenterInteger, originUpperLeft, spacing, order, pointmode, earlyfragment, depth
|
||||
}
|
||||
|
||||
// Correct and/or advance an object's offset layout qualifier.
|
||||
|
|
@ -5480,6 +5501,10 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
else
|
||||
error(loc, "can only apply to 'in'", "early_fragment_tests", "");
|
||||
}
|
||||
if (publicType.shaderQualifiers.blendEquation) {
|
||||
if (publicType.qualifier.storage != EvqVaryingOut)
|
||||
error(loc, "can only apply to 'out'", "blend equation", "");
|
||||
}
|
||||
|
||||
const TQualifier& qualifier = publicType.qualifier;
|
||||
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ void TParseContext::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
|
||||
|
||||
// AEP
|
||||
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisablePartial;
|
||||
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisablePartial;
|
||||
extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable;
|
||||
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisable;
|
||||
extensionBehavior[E_GL_OES_sample_variables] = EBhDisable;
|
||||
extensionBehavior[E_GL_OES_shader_image_atomic] = EBhDisable;
|
||||
extensionBehavior[E_GL_OES_shader_multisample_interpolation] = EBhDisable;
|
||||
|
|
|
|||
|
|
@ -740,6 +740,15 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||
infoSink.debug << "using early_fragment_tests\n";
|
||||
if (depthLayout != EldNone)
|
||||
infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n";
|
||||
if (blendEquations != 0) {
|
||||
infoSink.debug << "using";
|
||||
// blendEquations is a mask, decode it
|
||||
for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) {
|
||||
if (blendEquations & (1 << be))
|
||||
infoSink.debug << " " << TQualifier::getBlendEquationString(be);
|
||||
}
|
||||
infoSink.debug << "\n";
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangCompute:
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
|
|||
else if (depthLayout != unit.depthLayout)
|
||||
error(infoSink, "Contradictory depth layouts");
|
||||
|
||||
blendEquations |= unit.blendEquations;
|
||||
|
||||
if (inputPrimitive == ElgNone)
|
||||
inputPrimitive = unit.inputPrimitive;
|
||||
else if (inputPrimitive != unit.inputPrimitive)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public:
|
|||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v),
|
||||
numMains(0), numErrors(0), recursive(false),
|
||||
invocations(0), vertices(0), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), xfbMode(false)
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), blendEquations(0), xfbMode(false)
|
||||
{
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
|
|
@ -277,6 +277,9 @@ public:
|
|||
}
|
||||
TLayoutDepth getDepth() const { return depthLayout; }
|
||||
|
||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||
unsigned int getBlendEquations() const { return blendEquations; }
|
||||
|
||||
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
|
||||
void merge(TInfoSink&, TIntermediate&);
|
||||
void finalCheck(TInfoSink&);
|
||||
|
|
@ -332,6 +335,7 @@ protected:
|
|||
int localSize[3];
|
||||
bool earlyFragmentTests;
|
||||
TLayoutDepth depthLayout;
|
||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||
bool xfbMode;
|
||||
|
||||
typedef std::list<TCall> TGraph;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue