Remove DrawFace enum from GrPipelineBuilder

This gets GrPipelineBuilder.h out of the headers

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2165283002

Committed: https://skia.googlesource.com/skia/+/da152ebb032c61bb2561bbb3e9a78037ad174d34
Review-Url: https://codereview.chromium.org/2165283002
This commit is contained in:
robertphillips 2016-07-21 09:21:04 -07:00 committed by Commit bot
parent 0ae097d116
commit 5fa7f30331
23 changed files with 63 additions and 47 deletions

View File

@ -56,6 +56,14 @@ enum GrShaderFlags {
};
GR_MAKE_BITFIELD_OPS(GrShaderFlags);
enum class GrDrawFace {
kInvalid = -1,
kBoth,
kCCW,
kCW,
};
/**
* Precisions of shader language variables. Not all shading languages support precisions or actually
* vary the internal precision based on the qualifiers. These currently only apply to float types (

View File

@ -12,6 +12,7 @@
#include "GrDrawingManager.h"
#include "GrOvalRenderer.h"
#include "GrPathRenderer.h"
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetPriv.h"
#include "GrResourceProvider.h"

View File

@ -15,6 +15,7 @@
#include "GrPath.h"
#include "GrPipeline.h"
#include "GrMemoryPool.h"
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
#include "GrResourceProvider.h"
#include "GrRenderTargetPriv.h"

View File

@ -8,6 +8,7 @@
#ifndef GrPathRenderer_DEFINED
#define GrPathRenderer_DEFINED
#include "GrCaps.h"
#include "GrDrawContext.h"
#include "GrPaint.h"
#include "GrResourceProvider.h"

View File

@ -13,7 +13,6 @@
#include "GrGpu.h"
#include "GrNonAtomicRef.h"
#include "GrPendingProgramElement.h"
#include "GrPipelineBuilder.h"
#include "GrPrimitiveProcessor.h"
#include "GrProcOptInfo.h"
#include "GrProgramDesc.h"
@ -22,6 +21,11 @@
#include "SkMatrix.h"
#include "SkRefCnt.h"
#include "effects/GrCoverageSetOpXP.h"
#include "effects/GrDisableColorXP.h"
#include "effects/GrPorterDuffXferProcessor.h"
#include "effects/GrSimpleTextureEffect.h"
class GrBatch;
class GrDrawContext;
class GrDeviceCoordTexture;
@ -169,7 +173,7 @@ public:
* or both faces.
* @return the current draw face(s).
*/
GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
GrDrawFace getDrawFace() const { return fDrawFace; }
///////////////////////////////////////////////////////////////////////////
@ -212,7 +216,7 @@ private:
RenderTarget fRenderTarget;
GrScissorState fScissorState;
GrStencilSettings fStencilSettings;
GrPipelineBuilder::DrawFace fDrawFace;
GrDrawFace fDrawFace;
uint32_t fFlags;
ProgramXferProcessor fXferProcessor;
FragmentProcessorArray fFragmentProcessors;

View File

@ -18,7 +18,7 @@
GrPipelineBuilder::GrPipelineBuilder()
: fFlags(0x0)
, fUserStencilSettings(&GrUserStencilSettings::kUnused)
, fDrawFace(kBoth_DrawFace) {
, fDrawFace(GrDrawFace::kBoth) {
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
}

View File

@ -266,27 +266,19 @@ public:
/// @name Face Culling
////
enum DrawFace {
kInvalid_DrawFace = -1,
kBoth_DrawFace,
kCCW_DrawFace,
kCW_DrawFace,
};
/**
* Gets whether the target is drawing clockwise, counterclockwise,
* or both faces.
* @return the current draw face(s).
*/
DrawFace getDrawFace() const { return fDrawFace; }
GrDrawFace getDrawFace() const { return fDrawFace; }
/**
* Controls whether clockwise, counterclockwise, or both faces are drawn.
* @param face the face(s) to draw.
*/
void setDrawFace(DrawFace face) {
SkASSERT(kInvalid_DrawFace != face);
void setDrawFace(GrDrawFace face) {
SkASSERT(GrDrawFace::kInvalid != face);
fDrawFace = face;
}
@ -305,7 +297,7 @@ private:
uint32_t fFlags;
const GrUserStencilSettings* fUserStencilSettings;
DrawFace fDrawFace;
GrDrawFace fDrawFace;
mutable sk_sp<GrXPFactory> fXPFactory;
FragmentProcessorArray fColorFragmentProcessors;
FragmentProcessorArray fCoverageFragmentProcessors;

View File

@ -8,6 +8,7 @@
#include "GrResourceProvider.h"
#include "GrBuffer.h"
#include "GrCaps.h"
#include "GrGpu.h"
#include "GrPathRendering.h"
#include "GrRenderTarget.h"

View File

@ -8,6 +8,7 @@
#include "GrSoftwarePathRenderer.h"
#include "GrAuditTrail.h"
#include "GrClip.h"
#include "GrPipelineBuilder.h"
#include "GrSWMaskHelper.h"
#include "GrTextureProvider.h"
#include "batches/GrRectBatchFactory.h"

View File

@ -7,8 +7,9 @@
#include "GrDashLinePathRenderer.h"
#include "GrGpu.h"
#include "GrAuditTrail.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "effects/GrDashingEffect.h"
bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {

View File

@ -433,7 +433,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
int passCount = 0;
const GrUserStencilSettings* passes[3];
GrPipelineBuilder::DrawFace drawFace[3];
GrDrawFace drawFace[3];
bool reverse = false;
bool lastPassIsBounds;
@ -445,7 +445,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[0] = &userStencilSettings;
}
lastPassIsBounds = false;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
drawFace[0] = GrDrawFace::kBoth;
} else {
if (single_pass_shape(shape)) {
passCount = 1;
@ -454,7 +454,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
} else {
passes[0] = &userStencilSettings;
}
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
drawFace[0] = GrDrawFace::kBoth;
lastPassIsBounds = false;
} else {
switch (path.getFillType()) {
@ -475,7 +475,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[1] = &gEOColorPass;
}
}
drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace;
drawFace[0] = drawFace[1] = GrDrawFace::kBoth;
break;
case SkPath::kInverseWinding_FillType:
@ -489,7 +489,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[0] = &gWindStencilSeparateNoWrap;
}
passCount = 2;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
drawFace[0] = GrDrawFace::kBoth;
} else {
if (fStencilWrapOps) {
passes[0] = &gWindSingleStencilWithWrapInc;
@ -499,8 +499,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[1] = &gWindSingleStencilNoWrapDec;
}
// which is cw and which is ccw is arbitrary.
drawFace[0] = GrPipelineBuilder::kCW_DrawFace;
drawFace[1] = GrPipelineBuilder::kCCW_DrawFace;
drawFace[0] = GrDrawFace::kCW;
drawFace[1] = GrDrawFace::kCCW;
passCount = 3;
}
if (stencilOnly) {
@ -508,7 +508,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
--passCount;
} else {
lastPassIsBounds = true;
drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace;
drawFace[passCount-1] = GrDrawFace::kBoth;
if (reverse) {
passes[passCount-1] = &gInvWindColorPass;
} else {
@ -554,7 +554,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]);
SkASSERT(GrDrawFace::kBoth == drawFace[p]);
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);

View File

@ -13,6 +13,7 @@
#include "GrDrawPathBatch.h"
#include "GrGpu.h"
#include "GrPath.h"
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
#include "GrResourceProvider.h"
#include "GrStencilPathBatch.h"

View File

@ -14,6 +14,7 @@
#include "GrDefaultGeoProcFactory.h"
#include "GrMesh.h"
#include "GrPathUtils.h"
#include "GrPipelineBuilder.h"
#include "GrResourceCache.h"
#include "GrResourceProvider.h"
#include "GrTessellator.h"

View File

@ -494,7 +494,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate();
fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate();
fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
fHWDrawFace = GrDrawFace::kInvalid;
if (kGL_GrGLStandard == this->glStandard()) {
// Desktop-only state that we never change
@ -2793,7 +2793,7 @@ void GrGLGpu::stampPLSSetupRect(const SkRect& bounds) {
blendInfo.reset();
this->flushBlend(blendInfo, GrSwizzle());
this->flushColorWrite(true);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
this->flushDrawFace(GrDrawFace::kBoth);
if (!fHWStencilSettings.isDisabled()) {
GL_CALL(Disable(GR_GL_STENCIL_TEST));
}
@ -3359,18 +3359,18 @@ void GrGLGpu::flushColorWrite(bool writeColor) {
}
}
void GrGLGpu::flushDrawFace(GrPipelineBuilder::DrawFace face) {
void GrGLGpu::flushDrawFace(GrDrawFace face) {
if (fHWDrawFace != face) {
switch (face) {
case GrPipelineBuilder::kCCW_DrawFace:
case GrDrawFace::kCCW:
GL_CALL(Enable(GR_GL_CULL_FACE));
GL_CALL(CullFace(GR_GL_BACK));
break;
case GrPipelineBuilder::kCW_DrawFace:
case GrDrawFace::kCW:
GL_CALL(Enable(GR_GL_CULL_FACE));
GL_CALL(CullFace(GR_GL_FRONT));
break;
case GrPipelineBuilder::kBoth_DrawFace:
case GrDrawFace::kBoth:
GL_CALL(Disable(GR_GL_CULL_FACE));
break;
default:
@ -4088,7 +4088,7 @@ void GrGLGpu::drawDebugWireRect(GrRenderTarget* rt, const SkIRect& rect, GrColor
blendInfo.reset();
this->flushBlend(blendInfo, GrSwizzle::RGBA());
this->flushColorWrite(true);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
this->flushDrawFace(GrDrawFace::kBoth);
this->flushHWAAState(glRT, false, false);
this->disableScissor();
GrStencilSettings stencil;
@ -4176,7 +4176,7 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst,
blendInfo.reset();
this->flushBlend(blendInfo, GrSwizzle::RGBA());
this->flushColorWrite(true);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
this->flushDrawFace(GrDrawFace::kBoth);
this->flushHWAAState(nullptr, false, false);
this->disableScissor();
GrStencilSettings stencil;
@ -4384,7 +4384,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, bool gammaCorrect) {
blendInfo.reset();
this->flushBlend(blendInfo, GrSwizzle::RGBA());
this->flushColorWrite(true);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
this->flushDrawFace(GrDrawFace::kBoth);
this->flushHWAAState(nullptr, false, false);
this->disableScissor();
GrStencilSettings stencil;

View File

@ -17,7 +17,6 @@
#include "GrGLTexture.h"
#include "GrGLVertexArray.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
#include "SkTArray.h"
@ -303,7 +302,7 @@ private:
};
void flushColorWrite(bool writeColor);
void flushDrawFace(GrPipelineBuilder::DrawFace face);
void flushDrawFace(GrDrawFace face);
// flushes the scissor. see the note on flushBoundTextureAndParams about
// flushing the scissor after that function is called.
@ -516,7 +515,7 @@ private:
TriState fHWStencilTestEnabled;
GrPipelineBuilder::DrawFace fHWDrawFace;
GrDrawFace fHWDrawFace;
TriState fHWWriteToColor;
uint32_t fHWBoundRenderTargetUniqueID;
TriState fHWSRGBFramebuffer;

View File

@ -119,7 +119,7 @@ void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
GrGLGpu* gpu = this->gpu();
SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport());
gpu->flushColorWrite(false);
gpu->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
gpu->flushDrawFace(GrDrawFace::kBoth);
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fRenderTarget);
SkISize size = SkISize::Make(rt->width(), rt->height());

View File

@ -8,6 +8,7 @@
#include "InstancedRendering.h"
#include "GrBatchFlushState.h"
#include "GrCaps.h"
#include "GrPipeline.h"
#include "GrResourceProvider.h"
#include "instanced/InstanceProcessor.h"

View File

@ -10,6 +10,7 @@
#include "GrBlurUtils.h"
#include "GrContext.h"
#include "GrDrawContext.h"
#include "GrPipelineBuilder.h"
#include "GrTextUtils.h"
#include "SkColorFilter.h"
#include "SkDrawFilter.h"

View File

@ -9,6 +9,7 @@
#define GrBatchFontCache_DEFINED
#include "GrBatchAtlas.h"
#include "GrCaps.h"
#include "GrGlyph.h"
#include "SkGlyphCache.h"
#include "SkTDynamicHash.h"

View File

@ -11,6 +11,7 @@
#include "GrDrawContext.h"
#include "GrPath.h"
#include "GrPathRange.h"
#include "GrPipelineBuilder.h"
#include "GrResourceProvider.h"
#include "GrTextUtils.h"
#include "SkAutoKern.h"

View File

@ -356,19 +356,19 @@ void setup_color_blend_state(const GrVkGpu* gpu,
// colorBlendInfo->blendConstants is set dynamically
}
VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace drawFace) {
VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
// Assumes that we've set the front face to be ccw
static const VkCullModeFlags gTable[] = {
VK_CULL_MODE_NONE, // kBoth_DrawFace
VK_CULL_MODE_BACK_BIT, // kCCW_DrawFace, cull back face
VK_CULL_MODE_FRONT_BIT, // kCW_DrawFace, cull front face
};
GR_STATIC_ASSERT(0 == GrPipelineBuilder::kBoth_DrawFace);
GR_STATIC_ASSERT(1 == GrPipelineBuilder::kCCW_DrawFace);
GR_STATIC_ASSERT(2 == GrPipelineBuilder::kCW_DrawFace);
SkASSERT((unsigned)drawFace <= 2);
GR_STATIC_ASSERT(0 == (int)GrDrawFace::kBoth);
GR_STATIC_ASSERT(1 == (int)GrDrawFace::kCCW);
GR_STATIC_ASSERT(2 == (int)GrDrawFace::kCW);
SkASSERT(-1 < (int)drawFace && (int)drawFace <= 2);
return gTable[drawFace];
return gTable[(int)drawFace];
}
void setup_raster_state(const GrVkGpu* gpu,

View File

@ -487,8 +487,8 @@ void GrVkPipelineState::BuildStateKey(const GrPipeline& pipeline, GrPrimitiveTyp
pipeline.getStencil().genKey(&b);
SkASSERT(sizeof(GrPipelineBuilder::DrawFace) <= sizeof(uint32_t));
b.add32(pipeline.getDrawFace());
SkASSERT(sizeof(GrDrawFace) <= sizeof(uint32_t));
b.add32((int32_t)pipeline.getDrawFace());
b.add32(get_blend_info_key(pipeline));

View File

@ -12,6 +12,7 @@
#include "GrDrawContextPriv.h"
#include "GrDrawingManager.h"
#include "GrGpuResourceCacheAccess.h"
#include "GrPipelineBuilder.h"
#include "GrResourceCache.h"
#include "SkGpuDevice.h"