LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu/glsl - GrGLSLXferProcessor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2015 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : 
       8             : #ifndef GrGLSLXferProcessor_DEFINED
       9             : #define GrGLSLXferProcessor_DEFINED
      10             : 
      11             : #include "SkPoint.h"
      12             : #include "glsl/GrGLSLProgramDataManager.h"
      13             : #include "glsl/GrGLSLUniformHandler.h"
      14             : 
      15             : class GrXferProcessor;
      16             : class GrGLSLXPBuilder;
      17             : class GrGLSLXPFragmentBuilder;
      18             : class GrShaderCaps;
      19             : class GrTexture;
      20             : 
      21             : class GrGLSLXferProcessor {
      22             : public:
      23           0 :     GrGLSLXferProcessor() {}
      24           0 :     virtual ~GrGLSLXferProcessor() {}
      25             : 
      26             :     using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
      27             :     using ImageStorageHandle = GrGLSLUniformHandler::ImageStorageHandle;
      28             : 
      29             :     struct EmitArgs {
      30           0 :         EmitArgs(GrGLSLXPFragmentBuilder* fragBuilder,
      31             :                  GrGLSLUniformHandler* uniformHandler,
      32             :                  const GrShaderCaps* caps,
      33             :                  const GrXferProcessor& xp,
      34             :                  const char* inputColor,
      35             :                  const char* inputCoverage,
      36             :                  const char* outputPrimary,
      37             :                  const char* outputSecondary,
      38             :                  const SamplerHandle dstTextureSamplerHandle,
      39             :                  GrSurfaceOrigin dstTextureOrigin)
      40           0 :                 : fXPFragBuilder(fragBuilder)
      41             :                 , fUniformHandler(uniformHandler)
      42             :                 , fShaderCaps(caps)
      43             :                 , fXP(xp)
      44             :                 , fInputColor(inputColor)
      45             :                 , fInputCoverage(inputCoverage)
      46             :                 , fOutputPrimary(outputPrimary)
      47             :                 , fOutputSecondary(outputSecondary)
      48             :                 , fDstTextureSamplerHandle(dstTextureSamplerHandle)
      49           0 :                 , fDstTextureOrigin(dstTextureOrigin) {}
      50             :         GrGLSLXPFragmentBuilder* fXPFragBuilder;
      51             :         GrGLSLUniformHandler* fUniformHandler;
      52             :         const GrShaderCaps* fShaderCaps;
      53             :         const GrXferProcessor& fXP;
      54             :         const char* fInputColor;
      55             :         const char* fInputCoverage;
      56             :         const char* fOutputPrimary;
      57             :         const char* fOutputSecondary;
      58             :         const SamplerHandle fDstTextureSamplerHandle;
      59             :         GrSurfaceOrigin fDstTextureOrigin;
      60             :     };
      61             :     /**
      62             :      * This is similar to emitCode() in the base class, except it takes a full shader builder.
      63             :      * This allows the effect subclass to emit vertex code.
      64             :      */
      65             :     void emitCode(const EmitArgs&);
      66             : 
      67             :     /** A GrGLSLXferProcessor instance can be reused with any GrGLSLXferProcessor that produces
      68             :         the same stage key; this function reads data from a GrGLSLXferProcessor and uploads any
      69             :         uniform variables required  by the shaders created in emitCode(). The GrXferProcessor
      70             :         parameter is guaranteed to be of the same type that created this GrGLSLXferProcessor and
      71             :         to have an identical processor key as the one that created this GrGLSLXferProcessor. This
      72             :         function calls onSetData on the subclass of GrGLSLXferProcessor
      73             :      */
      74             :     void setData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp,
      75             :                  const GrTexture* dstTexture, const SkIPoint& dstTextureOffset);
      76             : 
      77             : protected:
      78             :     static void DefaultCoverageModulation(GrGLSLXPFragmentBuilder* fragBuilder,
      79             :                                           const char* srcCoverage,
      80             :                                           const char* dstColor,
      81             :                                           const char* outColor,
      82             :                                           const char* outColorSecondary,
      83             :                                           const GrXferProcessor& proc);
      84             : 
      85             : private:
      86             :     /**
      87             :      * Called by emitCode() when the XP will not be performing a dst read. This method is
      88             :      * responsible for both blending and coverage. A subclass only needs to implement this method if
      89             :      * it can construct a GrXferProcessor that will not read the dst color.
      90             :      */
      91           0 :     virtual void emitOutputsForBlendState(const EmitArgs&) {
      92           0 :         SkFAIL("emitOutputsForBlendState not implemented.");
      93           0 :     }
      94             : 
      95             :     /**
      96             :      * Called by emitCode() when the XP will perform a dst read. This method only needs to supply
      97             :      * the blending logic. The base class applies coverage. A subclass only needs to implement this
      98             :      * method if it can construct a GrXferProcessor that reads the dst color.
      99             :      */
     100           0 :     virtual void emitBlendCodeForDstRead(GrGLSLXPFragmentBuilder*,
     101             :                                          GrGLSLUniformHandler*,
     102             :                                          const char* srcColor,
     103             :                                          const char* srcCoverage,
     104             :                                          const char* dstColor,
     105             :                                          const char* outColor,
     106             :                                          const char* outColorSecondary,
     107             :                                          const GrXferProcessor&) {
     108           0 :         SkFAIL("emitBlendCodeForDstRead not implemented.");
     109           0 :     }
     110             : 
     111             :     virtual void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) = 0;
     112             : 
     113             :     GrGLSLProgramDataManager::UniformHandle fDstTopLeftUni;
     114             :     GrGLSLProgramDataManager::UniformHandle fDstScaleUni;
     115             : };
     116             : #endif

Generated by: LCOV version 1.13