diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 9fa159167c..8c4e2e2fbc 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -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', diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h index fdb27a9a7e..21b89c53ad 100644 --- a/include/gpu/GrXferProcessor.h +++ b/include/gpu/GrXferProcessor.h @@ -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. diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp index 2ab5172b57..7cb02e24b2 100644 --- a/src/effects/SkArithmeticMode_gpu.cpp +++ b/src/effects/SkArithmeticMode_gpu.cpp @@ -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, diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index 126a639427..98bab2541a 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -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); } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index e54627c4e5..ff163e2fb6 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -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(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); } diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index 963b0dd1f2..9cfcaaf929 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -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; diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index 78d0f14d7b..41ced0f4e2 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -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(); @@ -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(); @@ -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); } diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index d6e7facde6..264d307d6a 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -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) diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 51f95237f6..8dca667e41 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -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); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index cb49c348a4..02fa88688b 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -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 GrGLInstalledGeoProc; -typedef GrGLInstalledProc GrGLInstalledXferProc; +typedef GrGLInstalledProc GrGLInstalledXferProc; typedef GrGLInstalledProc GrGLInstalledFragProc; struct GrGLInstalledFragProcs : public SkRefCnt { diff --git a/src/gpu/gl/GrGLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp similarity index 95% rename from src/gpu/gl/GrGLXferProcessor.cpp rename to src/gpu/glsl/GrGLSLXferProcessor.cpp index bf333bb317..38f2e6a131 100644 --- a/src/gpu/gl/GrGLXferProcessor.cpp +++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp @@ -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(xp.dstTextureOffset().fX), diff --git a/src/gpu/gl/GrGLXferProcessor.h b/src/gpu/glsl/GrGLSLXferProcessor.h similarity index 86% rename from src/gpu/gl/GrGLXferProcessor.h rename to src/gpu/glsl/GrGLSLXferProcessor.h index 1e505f3d07..79f59b8627 100644 --- a/src/gpu/gl/GrGLXferProcessor.h +++ b/src/gpu/glsl/GrGLSLXferProcessor.h @@ -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); diff --git a/tools/BUILD.public.expected b/tools/BUILD.public.expected index 023cd646e8..460fc0f8cb 100644 --- a/tools/BUILD.public.expected +++ b/tools/BUILD.public.expected @@ -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',