Revert "Make SkSL GLSL generator declare sk_FragColor inout when EXT fb fetch is used."

This reverts commit 7e1dd2017a.

Reason for revert: breaking fp compilation

Original change's description:
> Make SkSL GLSL generator declare sk_FragColor inout when EXT fb fetch is used.
> 
> Change-Id: I5e6e3263bb49febc757cd63d5d6c1518f174322d
> Reviewed-on: https://skia-review.googlesource.com/118420
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: I2aedfaff93150ba8cd1ed9fed22f3cfdd509695a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/118600
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-04-04 13:58:33 +00:00 committed by Skia Commit-Bot
parent a24d505f2a
commit d40133092a
10 changed files with 2 additions and 21 deletions

View File

@ -154,8 +154,6 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
settings.fCaps = this->gpu()->glCaps().shaderCaps();
settings.fFlipY = this->pipeline().proxy()->origin() != kTopLeft_GrSurfaceOrigin;
settings.fSharpenTextures = this->gpu()->getContext()->contextPriv().sharpenMipmappedTextures();
settings.fFragColorIsInOut = this->fragColorIsInOut();
SkSL::Program::Inputs inputs;
SkTDArray<GrGLuint> shadersToDelete;
bool cached = fGpu->glCaps().programBinarySupport() && nullptr != fCached.get();

View File

@ -170,11 +170,6 @@ const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const {
return fHasCustomColorOutput ? DeclaredColorOutputName() : "sk_FragColor";
}
bool GrGLSLFragmentShaderBuilder::primaryColorOutputIsInOut() const {
return fHasCustomColorOutput &&
fOutputs[fCustomColorOutputIndex].getTypeModifier() == GrShaderVar::kInOut_TypeModifier;
}
void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) {
va_list argp;
va_start(argp, fmt);

View File

@ -119,7 +119,6 @@ private:
void enableSecondaryOutput();
const char* getPrimaryColorOutputName() const;
const char* getSecondaryColorOutputName() const;
bool primaryColorOutputIsInOut() const;
#ifdef SK_DEBUG
// As GLSLProcessors emit code, there are some conditions we need to verify. We use the below

View File

@ -115,8 +115,6 @@ protected:
void finalizeShaders();
bool fragColorIsInOut() const { return fFS.primaryColorOutputIsInOut(); }
private:
// reset is called by program creator between each processor's emit code. It increments the
// stage offset for variable name mangling, and also ensures verfication variables in the

View File

@ -144,7 +144,6 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
settings.fCaps = this->caps()->shaderCaps();
settings.fFlipY = this->pipeline().proxy()->origin() != kTopLeft_GrSurfaceOrigin;
settings.fSharpenTextures = this->gpu()->getContext()->contextPriv().sharpenMipmappedTextures();
SkASSERT(!this->fragColorIsInOut());
SkAssertResult(this->createVkShaderModule(VK_SHADER_STAGE_VERTEX_BIT,
fVS,
&vertShaderModule,

View File

@ -1270,11 +1270,7 @@ void GLSLCodeGenerator::writeProgramElement(const ProgramElement& e) {
this->writeLine();
} else if (builtin == SK_FRAGCOLOR_BUILTIN &&
fProgram.fSettings.fCaps->mustDeclareFragmentShaderOutput()) {
if (fProgram.fSettings.fFragColorIsInOut) {
this->write("inout ");
} else {
this->write("out ");
}
this->write("out ");
if (usesPrecisionModifiers()) {
this->write("mediump ");
}

View File

@ -126,6 +126,7 @@ static void fill_caps(const SKSL_CAPS_CLASS& caps,
#define CAP(name) capsMap->insert(std::make_pair(String(#name), \
Program::Settings::Value(caps.name())));
CAP(fbFetchSupport);
CAP(fbFetchNeedsCustomOutput);
CAP(dropsTileOnZeroDivide);
CAP(flatInterpolationSupport);
CAP(noperspectiveInterpolationSupport);

View File

@ -451,8 +451,6 @@ void MetalCodeGenerator::writeFunction(const FunctionDefinition& f) {
}
this->writeLine(") {");
SkASSERT(!fProgram.fSettings.fFragColorIsInOut);
if ("main" == f.fDeclaration.fName) {
switch (fProgram.fKind) {
case Program::kFragment_Kind:

View File

@ -2545,7 +2545,6 @@ void SPIRVCodeGenerator::writeGlobalVars(Program::Kind kind, const VarDeclaratio
}
if (var->fModifiers.fLayout.fBuiltin == SK_FRAGCOLOR_BUILTIN &&
kind != Program::kFragment_Kind) {
SkASSERT(!fProgram.fSettings.fFragColorIsInOut);
continue;
}
if (!var->fReadCount && !var->fWriteCount &&

View File

@ -71,8 +71,6 @@ struct Program {
// if false, sk_FragCoord is exactly the same as gl_FragCoord. If true, the y coordinate
// must be flipped.
bool fFlipY = false;
// If true the destination fragment color is read sk_FragColor. It must be declared inout.
bool fFragColorIsInOut = false;
// if true, Setting objects (e.g. sk_Caps.fbFetchSupport) should be replaced with their
// constant equivalents during compilation
bool fReplaceSettings = true;