Move XferProcessors to glsl

This is basically a move and rename

TBR=bsalomon@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/1440073002
This commit is contained in:
egdaniel 2015-11-13 08:34:52 -08:00 committed by Commit bot
parent 266e2024ec
commit fa4cc8bf2a
13 changed files with 60 additions and 60 deletions

View File

@ -341,8 +341,6 @@
'<(skia_src_path)/gpu/gl/GrGLVertexArray.h',
'<(skia_src_path)/gpu/gl/GrGLVertexBuffer.cpp',
'<(skia_src_path)/gpu/gl/GrGLVertexBuffer.h',
'<(skia_src_path)/gpu/gl/GrGLXferProcessor.cpp',
'<(skia_src_path)/gpu/gl/GrGLXferProcessor.h',
# Files for building GLSL shaders
'<(skia_src_path)/gpu/gl/builders/GrGLProgramBuilder.cpp',
@ -377,6 +375,8 @@
'<(skia_src_path)/gpu/glsl/GrGLSLUtil.h',
'<(skia_src_path)/gpu/glsl/GrGLSLVertexShaderBuilder.cpp',
'<(skia_src_path)/gpu/glsl/GrGLSLVertexShaderBuilder.h',
'<(skia_src_path)/gpu/glsl/GrGLSLXferProcessor.cpp',
'<(skia_src_path)/gpu/glsl/GrGLSLXferProcessor.h',
# Sk files
'<(skia_include_path)/gpu/SkGr.h',

View File

@ -17,7 +17,7 @@
class GrShaderCaps;
class GrGLSLCaps;
class GrGLXferProcessor;
class GrGLSLXferProcessor;
class GrProcOptInfo;
/**
@ -100,7 +100,7 @@ public:
/** Returns a new instance of the appropriate *GL* implementation class
for the given GrXferProcessor; caller is responsible for deleting
the object. */
virtual GrGLXferProcessor* createGLInstance() const = 0;
virtual GrGLSLXferProcessor* createGLInstance() const = 0;
/**
* Optimizations for blending / coverage that an OptDrawState should apply to itself.

View File

@ -13,11 +13,11 @@
#include "GrInvariantOutput.h"
#include "GrProcessor.h"
#include "GrTexture.h"
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLXferProcessor.h"
static const bool gUseUnpremul = false;
@ -154,7 +154,7 @@ public:
const char* name() const override { return "Arithmetic"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
float k1() const { return fK1; }
float k2() const { return fK2; }
@ -191,7 +191,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLArithmeticXP : public GrGLXferProcessor {
class GLArithmeticXP : public GrGLSLXferProcessor {
public:
GLArithmeticXP(const ArithmeticXP& arithmeticXP)
: fEnforcePMColor(arithmeticXP.enforcePMColor()) {
@ -229,7 +229,7 @@ private:
GrGLSLProgramDataManager::UniformHandle fKUni;
bool fEnforcePMColor;
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -249,7 +249,7 @@ void ArithmeticXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
GLArithmeticXP::GenKey(*this, caps, b);
}
GrGLXferProcessor* ArithmeticXP::createGLInstance() const { return new GLArithmeticXP(*this); }
GrGLSLXferProcessor* ArithmeticXP::createGLInstance() const { return new GLArithmeticXP(*this); }
GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
const GrProcOptInfo& coveragePOI,

View File

@ -11,9 +11,9 @@
#include "GrColor.h"
#include "GrProcessor.h"
#include "GrProcOptInfo.h"
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLXferProcessor.h"
class CoverageSetOpXP : public GrXferProcessor {
public:
@ -25,7 +25,7 @@ public:
const char* name() const override { return "Coverage Set Op"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
bool invertCoverage() const { return fInvertCoverage; }
@ -56,7 +56,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLCoverageSetOpXP : public GrGLXferProcessor {
class GLCoverageSetOpXP : public GrGLSLXferProcessor {
public:
GLCoverageSetOpXP(const GrProcessor&) {}
@ -83,7 +83,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {};
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -101,7 +101,7 @@ void CoverageSetOpXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKey
GLCoverageSetOpXP::GenKey(*this, caps, b);
}
GrGLXferProcessor* CoverageSetOpXP::createGLInstance() const {
GrGLSLXferProcessor* CoverageSetOpXP::createGLInstance() const {
return new GLCoverageSetOpXP(*this);
}

View File

@ -15,13 +15,13 @@
#include "GrTexture.h"
#include "GrTextureAccess.h"
#include "SkXfermode.h"
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLXferProcessor.h"
bool GrCustomXfermode::IsSupportedMode(SkXfermode::Mode mode) {
return mode > SkXfermode::kLastCoeffMode && mode <= SkXfermode::kLastMode;
@ -88,7 +88,7 @@ public:
const char* name() const override { return "Custom Xfermode"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
SkXfermode::Mode mode() const { return fMode; }
bool hasHWBlendEquation() const { return -1 != static_cast<int>(fHWBlendEquation); }
@ -121,7 +121,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLCustomXP : public GrGLXferProcessor {
class GLCustomXP : public GrGLSLXferProcessor {
public:
GLCustomXP(const GrXferProcessor&) {}
~GLCustomXP() override {}
@ -170,7 +170,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {}
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -179,7 +179,7 @@ void CustomXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder
GLCustomXP::GenKey(*this, caps, b);
}
GrGLXferProcessor* CustomXP::createGLInstance() const {
GrGLSLXferProcessor* CustomXP::createGLInstance() const {
SkASSERT(this->willReadDstColor() != this->hasHWBlendEquation());
return new GLCustomXP(*this);
}

View File

@ -7,10 +7,10 @@
#include "effects/GrDisableColorXP.h"
#include "GrProcessor.h"
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLXferProcessor.h"
/**
* This xfer processor disables color writing. Thus color and coverage and ignored and no blending
@ -24,7 +24,7 @@ public:
const char* name() const override { return "Disable Color"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
private:
DisableColorXP();
@ -50,7 +50,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLDisableColorXP : public GrGLXferProcessor {
class GLDisableColorXP : public GrGLSLXferProcessor {
public:
GLDisableColorXP(const GrProcessor&) {}
@ -69,7 +69,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {}
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -82,7 +82,7 @@ void DisableColorXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
GLDisableColorXP::GenKey(*this, caps, b);
}
GrGLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisableColorXP(*this); }
GrGLSLXferProcessor* DisableColorXP::createGLInstance() const { return new GLDisableColorXP(*this); }
void DisableColorXP::onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
blendInfo->fWriteColor = false;

View File

@ -13,11 +13,11 @@
#include "GrProcOptInfo.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLXferProcessor.h"
/**
* Wraps the shader outputs and HW blend state that comprise a Porter Duff blend mode with coverage.
@ -347,7 +347,7 @@ public:
const char* name() const override { return "Porter Duff"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
BlendFormula getBlendFormula() const { return fBlendFormula; }
@ -428,7 +428,7 @@ static void append_color_output(const PorterDuffXferProcessor& xp,
}
}
class GLPorterDuffXferProcessor : public GrGLXferProcessor {
class GLPorterDuffXferProcessor : public GrGLSLXferProcessor {
public:
static void GenKey(const GrProcessor& processor, GrProcessorKeyBuilder* b) {
const PorterDuffXferProcessor& xp = processor.cast<PorterDuffXferProcessor>();
@ -454,7 +454,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {}
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -464,7 +464,7 @@ void PorterDuffXferProcessor::onGetGLProcessorKey(const GrGLSLCaps&,
GLPorterDuffXferProcessor::GenKey(*this, b);
}
GrGLXferProcessor* PorterDuffXferProcessor::createGLInstance() const {
GrGLSLXferProcessor* PorterDuffXferProcessor::createGLInstance() const {
return new GLPorterDuffXferProcessor;
}
@ -512,7 +512,7 @@ public:
const char* name() const override { return "Porter Duff Shader"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
SkXfermode::Mode getXfermode() const { return fXfermode; }
@ -536,7 +536,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLShaderPDXferProcessor : public GrGLXferProcessor {
class GLShaderPDXferProcessor : public GrGLSLXferProcessor {
public:
static void GenKey(const GrProcessor& processor, GrProcessorKeyBuilder* b) {
const ShaderPDXferProcessor& xp = processor.cast<ShaderPDXferProcessor>();
@ -554,7 +554,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {}
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -564,7 +564,7 @@ void ShaderPDXferProcessor::onGetGLProcessorKey(const GrGLSLCaps&,
GLShaderPDXferProcessor::GenKey(*this, b);
}
GrGLXferProcessor* ShaderPDXferProcessor::createGLInstance() const {
GrGLSLXferProcessor* ShaderPDXferProcessor::createGLInstance() const {
return new GLShaderPDXferProcessor;
}
@ -578,7 +578,7 @@ public:
const char* name() const override { return "Porter Duff LCD"; }
GrGLXferProcessor* createGLInstance() const override;
GrGLSLXferProcessor* createGLInstance() const override;
private:
PDLCDXferProcessor(GrColor blendConstant, uint8_t alpha);
@ -614,7 +614,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
class GLPDLCDXferProcessor : public GrGLXferProcessor {
class GLPDLCDXferProcessor : public GrGLSLXferProcessor {
public:
GLPDLCDXferProcessor(const GrProcessor&) {}
@ -632,7 +632,7 @@ private:
void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) override {};
typedef GrGLXferProcessor INHERITED;
typedef GrGLSLXferProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@ -668,7 +668,7 @@ void PDLCDXferProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLPDLCDXferProcessor::GenKey(*this, caps, b);
}
GrGLXferProcessor* PDLCDXferProcessor::createGLInstance() const {
GrGLSLXferProcessor* PDLCDXferProcessor::createGLInstance() const {
return new GLPDLCDXferProcessor(*this);
}

View File

@ -13,11 +13,11 @@
#include "GrGLGeometryProcessor.h"
#include "GrGLGpu.h"
#include "GrGLPathRendering.h"
#include "GrGLXferProcessor.h"
#include "GrPathProcessor.h"
#include "GrPipeline.h"
#include "GrXferProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLXferProcessor.h"
#include "SkXfermode.h"
#define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)

View File

@ -17,12 +17,12 @@
#include "gl/GrGLGpu.h"
#include "gl/GrGLProgram.h"
#include "gl/GrGLSLPrettyPrint.h"
#include "gl/GrGLXferProcessor.h"
#include "gl/builders/GrGLShaderStringBuilder.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLTextureSampler.h"
#include "glsl/GrGLSLXferProcessor.h"
#define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
#define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
@ -320,7 +320,7 @@ void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures());
this->emitSamplers(xp, &samplers, fXferProcessor);
GrGLXferProcessor::EmitArgs args(this, xp, colorIn.c_str(), coverageIn.c_str(),
GrGLSLXferProcessor::EmitArgs args(this, xp, colorIn.c_str(), coverageIn.c_str(),
fFS.getPrimaryColorOutputName(),
fFS.getSecondaryColorOutputName(), samplers);
fXferProcessor->fGLProc->emitCode(args);

View File

@ -8,13 +8,13 @@
#ifndef GrGLProgramBuilder_DEFINED
#define GrGLProgramBuilder_DEFINED
#include "GrPipeline.h"
#include "gl/GrGLPrimitiveProcessor.h"
#include "gl/GrGLProgramDataManager.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLTextureSampler.h"
#include "../GrGLPrimitiveProcessor.h"
#include "../GrGLXferProcessor.h"
#include "../../GrPipeline.h"
#include "glsl/GrGLSLXferProcessor.h"
class GrFragmentProcessor;
class GrGLContextInfo;
@ -31,7 +31,7 @@ struct GrGLInstalledProc {
};
typedef GrGLInstalledProc<GrGLPrimitiveProcessor> GrGLInstalledGeoProc;
typedef GrGLInstalledProc<GrGLXferProcessor> GrGLInstalledXferProc;
typedef GrGLInstalledProc<GrGLSLXferProcessor> GrGLInstalledXferProc;
typedef GrGLInstalledProc<GrGLSLFragmentProcessor> GrGLInstalledFragProc;
struct GrGLInstalledFragProcs : public SkRefCnt {

View File

@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
#include "gl/GrGLXferProcessor.h"
#include "glsl/GrGLSLXferProcessor.h"
#include "GrXferProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
void GrGLXferProcessor::emitCode(const EmitArgs& args) {
void GrGLSLXferProcessor::emitCode(const EmitArgs& args) {
if (!args.fXP.willReadDstColor()) {
this->emitOutputsForBlendState(args);
return;
@ -78,7 +78,7 @@ void GrGLXferProcessor::emitCode(const EmitArgs& args) {
}
}
void GrGLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp) {
void GrGLSLXferProcessor::setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp) {
if (xp.getDstTexture()) {
if (fDstTopLeftUni.isValid()) {
pdm.set2f(fDstTopLeftUni, static_cast<float>(xp.dstTextureOffset().fX),

View File

@ -1,12 +1,12 @@
/*
* Copyright 2014 Google Inc.
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrGLXferProcessor_DEFINED
#define GrGLXferProcessor_DEFINED
#ifndef GrGLSLXferProcessor_DEFINED
#define GrGLSLXferProcessor_DEFINED
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLTextureSampler.h"
@ -14,10 +14,10 @@
class GrGLSLXPBuilder;
class GrXferProcessor;
class GrGLXferProcessor {
class GrGLSLXferProcessor {
public:
GrGLXferProcessor() {}
virtual ~GrGLXferProcessor() {}
GrGLSLXferProcessor() {}
virtual ~GrGLSLXferProcessor() {}
typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray;
struct EmitArgs {
@ -50,12 +50,12 @@ public:
*/
void emitCode(const EmitArgs&);
/** A GrGLXferProcessor instance can be reused with any GrGLXferProcessor that produces
the same stage key; this function reads data from a GrGLXferProcessor and uploads any
/** A GrGLSLXferProcessor instance can be reused with any GrGLSLXferProcessor that produces
the same stage key; this function reads data from a GrGLSLXferProcessor and uploads any
uniform variables required by the shaders created in emitCode(). The GrXferProcessor
parameter is guaranteed to be of the same type that created this GrGLXferProcessor and
to have an identical processor key as the one that created this GrGLXferProcessor. This
function calls onSetData on the subclass of GrGLXferProcessor
parameter is guaranteed to be of the same type that created this GrGLSLXferProcessor and
to have an identical processor key as the one that created this GrGLSLXferProcessor. This
function calls onSetData on the subclass of GrGLSLXferProcessor
*/
void setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp);

View File

@ -1714,8 +1714,8 @@ SRCS = ['include/private/SkAtomics.h',
'src/gpu/gl/GrGLVertexArray.h',
'src/gpu/gl/GrGLVertexBuffer.cpp',
'src/gpu/gl/GrGLVertexBuffer.h',
'src/gpu/gl/GrGLXferProcessor.cpp',
'src/gpu/gl/GrGLXferProcessor.h',
'src/gpu/glsl/GrGLSLXferProcessor.cpp',
'src/gpu/glsl/GrGLSLXferProcessor.h',
'src/gpu/gl/SkGLContext.cpp',
'src/gpu/gl/SkNullGLContext.cpp',
'src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp',