LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu - GrPipelineBuilder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 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 GrPipelineBuilder_DEFINED
       9             : #define GrPipelineBuilder_DEFINED
      10             : 
      11             : #include "GrGpuResourceRef.h"
      12             : #include "GrPipeline.h"
      13             : #include "GrProcessorSet.h"
      14             : #include "GrRenderTarget.h"
      15             : #include "GrUserStencilSettings.h"
      16             : #include "GrXferProcessor.h"
      17             : 
      18             : class GrCaps;
      19             : class GrDrawOp;
      20             : class GrPaint;
      21             : class GrTexture;
      22             : 
      23           0 : class GrPipelineBuilder : private SkNoncopyable {
      24             : public:
      25             :     /**
      26             :      * Initializes the GrPipelineBuilder based on a GrPaint and MSAA availability. Note
      27             :      * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
      28             :      * no GrPaint equivalents are set to default values with the exception of vertex attribute state
      29             :      * which is unmodified by this function and clipping which will be enabled.
      30             :      */
      31           0 :     GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
      32           0 :             : fFlags(0x0)
      33             :             , fDrawFace(GrDrawFace::kBoth)
      34             :             , fUserStencilSettings(&GrUserStencilSettings::kUnused)
      35           0 :             , fProcessors(std::move(paint)) {
      36           0 :         if (GrAATypeIsHW(aaType)) {
      37           0 :             fFlags |= GrPipeline::kHWAntialias_Flag;
      38             :         }
      39           0 :     }
      40             : 
      41             :     ///////////////////////////////////////////////////////////////////////////
      42             :     /// @name Fragment Processors
      43             :     ///
      44             :     /// GrFragmentProcessors are used to compute per-pixel color and per-pixel fractional coverage.
      45             :     /// There are two chains of FPs, one for color and one for coverage. The first FP in each
      46             :     /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It computes an output
      47             :     /// color/coverage which is fed to the next FP in the chain. The last color and coverage FPs
      48             :     /// feed their output to the GrXferProcessor which controls blending.
      49             :     ////
      50             : 
      51             :     int numColorFragmentProcessors() const { return fProcessors.numColorFragmentProcessors(); }
      52             :     int numCoverageFragmentProcessors() const {
      53             :         return fProcessors.numCoverageFragmentProcessors();
      54             :     }
      55             :     int numFragmentProcessors() const { return fProcessors.numFragmentProcessors(); }
      56             : 
      57             :     const GrFragmentProcessor* getColorFragmentProcessor(int idx) const {
      58             :         return fProcessors.colorFragmentProcessor(idx);
      59             :     }
      60             :     const GrFragmentProcessor* getCoverageFragmentProcessor(int idx) const {
      61             :         return fProcessors.coverageFragmentProcessor(idx);
      62             :     }
      63             : 
      64             :     const GrProcessorSet& processors() const { return fProcessors; }
      65             : 
      66           0 :     GrProcessorSet::Analysis finalizeProcessors(const GrProcessorAnalysisColor& colorInput,
      67             :                                                 const GrProcessorAnalysisCoverage coverageInput,
      68             :                                                 const GrAppliedClip* clip, bool isMixedSamples,
      69             :                                                 const GrCaps& caps, GrColor* overrideColor) {
      70             :         return fProcessors.finalize(colorInput, coverageInput, clip, isMixedSamples, caps,
      71           0 :                                     overrideColor);
      72             :     }
      73             : 
      74             :     /// @}
      75             : 
      76             : 
      77             :     ///////////////////////////////////////////////////////////////////////////
      78             :     /// @name Stencil
      79             :     ////
      80             : 
      81           0 :     bool hasUserStencilSettings() const { return !fUserStencilSettings->isUnused(); }
      82             : 
      83             :     /**
      84             :      * Sets the user stencil settings for the next draw.
      85             :      * This class only stores pointers to stencil settings objects.
      86             :      * The caller guarantees the pointer will remain valid until it
      87             :      * changes or goes out of scope.
      88             :      * @param settings  the stencil settings to use.
      89             :      */
      90           0 :     void setUserStencil(const GrUserStencilSettings* settings) { fUserStencilSettings = settings; }
      91             : 
      92             :     /// @}
      93             : 
      94             :     ///////////////////////////////////////////////////////////////////////////
      95             :     /// @name State Flags
      96             :     ////
      97             : 
      98           0 :     bool isHWAntialias() const { return SkToBool(fFlags & GrPipeline::kHWAntialias_Flag); }
      99             : 
     100           0 :     void setSnapVerticesToPixelCenters(bool enable) {
     101           0 :         if (enable) {
     102           0 :             fFlags |= GrPipeline::kSnapVerticesToPixelCenters_Flag;
     103             :         } else {
     104           0 :             fFlags &= ~GrPipeline::kSnapVerticesToPixelCenters_Flag;
     105             :         }
     106           0 :     }
     107             : 
     108             :     /// @}
     109             : 
     110             :     ///////////////////////////////////////////////////////////////////////////
     111             :     /// @name Face Culling
     112             :     ////
     113             : 
     114             :     /**
     115             :      * Controls whether clockwise, counterclockwise, or both faces are drawn.
     116             :      * @param face  the face(s) to draw.
     117             :      */
     118           0 :     void setDrawFace(GrDrawFace face) {
     119           0 :         SkASSERT(GrDrawFace::kInvalid != face);
     120           0 :         fDrawFace = face;
     121           0 :     }
     122             : 
     123             :     /// @}
     124             : 
     125           0 :     void getPipelineInitArgs(GrPipeline::InitArgs* args) const {
     126           0 :         args->fFlags = fFlags;
     127           0 :         args->fUserStencil = fUserStencilSettings;
     128           0 :         args->fDrawFace = fDrawFace;
     129           0 :         args->fProcessors = &fProcessors;
     130           0 :     }
     131             : 
     132             : private:
     133             :     uint32_t fFlags;
     134             :     GrDrawFace fDrawFace;
     135             :     const GrUserStencilSettings* fUserStencilSettings;
     136             :     GrProcessorSet fProcessors;
     137             : };
     138             : 
     139             : #endif

Generated by: LCOV version 1.13