Revert of Remove DrawFace enum from GrPipelineBuilder (patchset #2 id:20001 of https://codereview.chromium.org/2165283002/ )

Reason for revert:
No Vulkan bot in CQ :(

Original issue's description:
> 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

TBR=bsalomon@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2167193002
This commit is contained in:
robertphillips 2016-07-21 08:18:05 -07:00 committed by Commit bot
parent 9f071d1fa5
commit 5d1676c751
23 changed files with 45 additions and 61 deletions

View File

@ -56,14 +56,6 @@ 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,7 +12,6 @@
#include "GrDrawingManager.h"
#include "GrOvalRenderer.h"
#include "GrPathRenderer.h"
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetPriv.h"
#include "GrResourceProvider.h"

View File

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

View File

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

View File

@ -13,6 +13,7 @@
#include "GrGpu.h"
#include "GrNonAtomicRef.h"
#include "GrPendingProgramElement.h"
#include "GrPipelineBuilder.h"
#include "GrPrimitiveProcessor.h"
#include "GrProcOptInfo.h"
#include "GrProgramDesc.h"
@ -21,11 +22,6 @@
#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;
@ -173,7 +169,7 @@ public:
* or both faces.
* @return the current draw face(s).
*/
GrDrawFace getDrawFace() const { return fDrawFace; }
GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
///////////////////////////////////////////////////////////////////////////
@ -216,7 +212,7 @@ private:
RenderTarget fRenderTarget;
GrScissorState fScissorState;
GrStencilSettings fStencilSettings;
GrDrawFace fDrawFace;
GrPipelineBuilder::DrawFace fDrawFace;
uint32_t fFlags;
ProgramXferProcessor fXferProcessor;
FragmentProcessorArray fFragmentProcessors;

View File

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

View File

@ -266,19 +266,27 @@ 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).
*/
GrDrawFace getDrawFace() const { return fDrawFace; }
DrawFace getDrawFace() const { return fDrawFace; }
/**
* Controls whether clockwise, counterclockwise, or both faces are drawn.
* @param face the face(s) to draw.
*/
void setDrawFace(GrDrawFace face) {
SkASSERT(GrDrawFace::kInvalid != face);
void setDrawFace(DrawFace face) {
SkASSERT(kInvalid_DrawFace != face);
fDrawFace = face;
}
@ -297,7 +305,7 @@ private:
uint32_t fFlags;
const GrUserStencilSettings* fUserStencilSettings;
GrDrawFace fDrawFace;
DrawFace fDrawFace;
mutable sk_sp<GrXPFactory> fXPFactory;
FragmentProcessorArray fColorFragmentProcessors;
FragmentProcessorArray fCoverageFragmentProcessors;

View File

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

View File

@ -8,7 +8,6 @@
#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,9 +7,8 @@
#include "GrDashLinePathRenderer.h"
#include "GrAuditTrail.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "GrAuditTrail.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];
GrDrawFace drawFace[3];
GrPipelineBuilder::DrawFace drawFace[3];
bool reverse = false;
bool lastPassIsBounds;
@ -445,7 +445,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[0] = userStencilSettings;
}
lastPassIsBounds = false;
drawFace[0] = GrDrawFace::kBoth;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
} else {
if (single_pass_shape(shape)) {
passCount = 1;
@ -454,7 +454,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
} else {
passes[0] = userStencilSettings;
}
drawFace[0] = GrDrawFace::kBoth;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
lastPassIsBounds = false;
} else {
switch (path.getFillType()) {
@ -475,7 +475,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[1] = &gEOColorPass;
}
}
drawFace[0] = drawFace[1] = GrDrawFace::kBoth;
drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace;
break;
case SkPath::kInverseWinding_FillType:
@ -489,7 +489,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
passes[0] = &gWindStencilSeparateNoWrap;
}
passCount = 2;
drawFace[0] = GrDrawFace::kBoth;
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
} 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] = GrDrawFace::kCW;
drawFace[1] = GrDrawFace::kCCW;
drawFace[0] = GrPipelineBuilder::kCW_DrawFace;
drawFace[1] = GrPipelineBuilder::kCCW_DrawFace;
passCount = 3;
}
if (stencilOnly) {
@ -508,7 +508,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
--passCount;
} else {
lastPassIsBounds = true;
drawFace[passCount-1] = GrDrawFace::kBoth;
drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace;
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(GrDrawFace::kBoth == drawFace[p]);
SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]);
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);

View File

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

View File

@ -14,7 +14,6 @@
#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 = GrDrawFace::kInvalid;
fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
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(GrDrawFace::kBoth);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
if (!fHWStencilSettings.isDisabled()) {
GL_CALL(Disable(GR_GL_STENCIL_TEST));
}
@ -3359,18 +3359,18 @@ void GrGLGpu::flushColorWrite(bool writeColor) {
}
}
void GrGLGpu::flushDrawFace(GrDrawFace face) {
void GrGLGpu::flushDrawFace(GrPipelineBuilder::DrawFace face) {
if (fHWDrawFace != face) {
switch (face) {
case GrDrawFace::kCCW:
case GrPipelineBuilder::kCCW_DrawFace:
GL_CALL(Enable(GR_GL_CULL_FACE));
GL_CALL(CullFace(GR_GL_BACK));
break;
case GrDrawFace::kCW:
case GrPipelineBuilder::kCW_DrawFace:
GL_CALL(Enable(GR_GL_CULL_FACE));
GL_CALL(CullFace(GR_GL_FRONT));
break;
case GrDrawFace::kBoth:
case GrPipelineBuilder::kBoth_DrawFace:
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(GrDrawFace::kBoth);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
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(GrDrawFace::kBoth);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
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(GrDrawFace::kBoth);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
this->flushHWAAState(nullptr, false, false);
this->disableScissor();
GrStencilSettings stencil;

View File

@ -17,6 +17,7 @@
#include "GrGLTexture.h"
#include "GrGLVertexArray.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
#include "SkTArray.h"
@ -302,7 +303,7 @@ private:
};
void flushColorWrite(bool writeColor);
void flushDrawFace(GrDrawFace face);
void flushDrawFace(GrPipelineBuilder::DrawFace face);
// flushes the scissor. see the note on flushBoundTextureAndParams about
// flushing the scissor after that function is called.
@ -515,7 +516,7 @@ private:
TriState fHWStencilTestEnabled;
GrDrawFace fHWDrawFace;
GrPipelineBuilder::DrawFace 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(GrDrawFace::kBoth);
gpu->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fRenderTarget);
SkISize size = SkISize::Make(rt->width(), rt->height());

View File

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

View File

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

View File

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

View File

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

View File

@ -356,16 +356,16 @@ void setup_color_blend_state(const GrVkGpu* gpu,
// colorBlendInfo->blendConstants is set dynamically
}
VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace 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 == GrDrawFace::kBoth);
GR_STATIC_ASSERT(1 == GrDrawFace::kCCW);
GR_STATIC_ASSERT(2 == GrDrawFace::kCW);
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);
return gTable[drawFace];

View File

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

View File

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