44 fColorLoadOp = colorInfo.
fLoadOp;
46 fStencilLoadOp = stencilInfo.
fLoadOp;
84 unsigned int stencilRef = 0;
102 float floatColors[4];
106 floatColors[0] = blendConst.
fR;
107 floatColors[1] = blendConst.
fG;
108 floatColors[2] = blendConst.
fB;
109 floatColors[3] = blendConst.
fA;
111 memset(floatColors, 0, 4 *
sizeof(
float));
117 D3D12_PRIMITIVE_TOPOLOGY topology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
118 switch (
info.primitiveType()) {
120 topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
123 topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
126 topology = D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
129 topology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
132 topology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
146 scissor.left = scissorRect.
fLeft;
147 scissor.right = scissorRect.
fRight;
149 scissor.top = scissorRect.
fTop;
154 scissor.bottom = scissor.top + scissorRect.
height();
162 D3D12_VIEWPORT viewport;
163 viewport.TopLeftX = 0.0f;
164 viewport.TopLeftY = 0.0f;
167 viewport.MinDepth = 0.0f;
168 viewport.MaxDepth = 1.0f;
175 rtRect.
roundOut(&fCurrentPipelineBounds);
181 fCurrentPipelineState =
183 if (!fCurrentPipelineState) {
194 if (!
info.pipeline().isScissorTestEnabled()) {
205 if (!combinedScissorRect.
intersect(fCurrentPipelineBounds, scissor)) {
238 fCurrentPipelineState->
setAndBindTextures(fGpu, geomProc, geomProcTextures, pipeline);
254 fCurrentPipelineState->
bindBuffers(fGpu, std::move(indexBuffer), std::move(instanceBuffer),
255 std::move(vertexBuffer), currCmdList);
266 int baseInstance,
int baseVertex) {
269 baseVertex, baseInstance);
274 constexpr unsigned int kSlot = 0;
284 constexpr unsigned int kSlot = 0;
296 D3D12_RECT clearRect;
302 d3dRect = scissor.
rect();
307 clearRect.left = d3dRect.
fLeft;
308 clearRect.right = d3dRect.
fRight;
309 clearRect.top = d3dRect.
fTop;
310 clearRect.bottom = d3dRect.
fBottom;
317 SkASSERT(d3dRT->grD3DResourceState()->getResourceState() == D3D12_RESOURCE_STATE_RENDER_TARGET);
331 uint8_t stencilColor = 0;
332 if (insideStencilMask) {
333 stencilColor = (1 << (stencilBitCount - 1));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
int GrBackendFormatStencilBits(const GrBackendFormat &format)
void set_blend_factor(GrD3DGpu *gpu, const GrProgramInfo &info)
void set_viewport(GrD3DGpu *gpu, const GrRenderTarget *renderTarget)
static D3D12_RECT scissor_to_d3d_clear_rect(const GrScissorState &scissor, const GrSurface *surface, GrSurfaceOrigin origin)
void set_scissor_rects(GrD3DGpu *gpu, const GrRenderTarget *renderTarget, GrSurfaceOrigin rtOrigin, const SkIRect &scissorRect)
void update_resource_state(GrTexture *tex, GrRenderTarget *rt, GrD3DGpu *gpu)
void set_primitive_topology(GrD3DGpu *gpu, const GrProgramInfo &info)
void set_stencil_ref(GrD3DGpu *gpu, const GrProgramInfo &info)
std::function< void(GrDeferredTextureUploadWritePixelsFn &)> GrDeferredTextureUploadFn
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
bool usePrimitiveRestart() const
void clearRenderTargetView(const GrD3DRenderTarget *renderTarget, std::array< float, 4 > color, const D3D12_RECT *rect)
void executeIndirect(const sk_sp< GrD3DCommandSignature > commandSig, unsigned int maxCommandCnt, const GrD3DBuffer *argumentBuffer, size_t argumentBufferOffset)
void setGraphicsRootSignature(const sk_sp< GrD3DRootSignature > &rootSignature)
void setStencilRef(unsigned int stencilRef)
void setPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY primitiveTopology)
void setRenderTarget(const GrD3DRenderTarget *renderTarget)
void setBlendFactor(const float blendFactor[4])
void setViewports(unsigned int numViewports, const D3D12_VIEWPORT *viewports)
void clearDepthStencilView(const GrD3DAttachment *, uint8_t stencilClearValue, const D3D12_RECT *rect)
void setPipelineState(const sk_sp< GrD3DPipeline > &pipeline)
void setScissorRects(unsigned int numRects, const D3D12_RECT *rects)
void drawInstanced(unsigned int vertexCount, unsigned int instanceCount, unsigned int startVertex, unsigned int startInstance)
void drawIndexedInstanced(unsigned int indexCount, unsigned int instanceCount, unsigned int startIndex, unsigned int baseVertex, unsigned int startInstance)
GrD3DDirectCommandList * currentCommandList() const
void endRenderPass(GrRenderTarget *target, GrSurfaceOrigin origin, const SkIRect &bounds)
GrD3DResourceProvider & resourceProvider()
bool protectedContext() const
void onClear(const GrScissorState &scissor, std::array< float, 4 > color) override
void inlineUpload(GrOpFlushState *state, GrDeferredTextureUploadFn &upload) override
void onClearStencilClip(const GrScissorState &scissor, bool insideStencilMask) override
bool onBindPipeline(const GrProgramInfo &, const SkRect &drawBounds) override
~GrD3DOpsRenderPass() override
void onDrawIndirect(const GrBuffer *, size_t offset, int drawCount) override
void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, int baseVertex) override
void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount, int baseVertex) override
bool onBindTextures(const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &) override
void onBindBuffers(sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrPrimitiveRestart) override
bool set(GrRenderTarget *, GrSurfaceOrigin, const SkIRect &bounds, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies)
void onDrawIndexedIndirect(const GrBuffer *, size_t offset, int drawCount) override
GrD3DOpsRenderPass(GrD3DGpu *)
void onSetScissorRect(const SkIRect &) override
void setAndBindTextures(GrD3DGpu *, const GrGeometryProcessor &, const GrSurfaceProxy *const geomProcTextures[], const GrPipeline &)
const sk_sp< GrD3DPipeline > & pipeline() const
void setAndBindConstants(GrD3DGpu *, const GrRenderTarget *, const GrProgramInfo &)
const sk_sp< GrD3DRootSignature > & rootSignature() const
void bindBuffers(GrD3DGpu *, sk_sp< const GrBuffer > indexBuffer, sk_sp< const GrBuffer > instanceBuffer, sk_sp< const GrBuffer > vertexBuffer, GrD3DDirectCommandList *commandList)
const GrD3DTextureResource * msaaTextureResource() const
sk_sp< GrD3DCommandSignature > findOrCreateCommandSignature(GrD3DCommandSignature::ForIndexed, unsigned int slot)
GrD3DPipelineState * findOrCreateCompatiblePipelineState(GrD3DRenderTarget *, const GrProgramInfo &)
void setResourceState(const GrD3DGpu *gpu, D3D12_RESOURCE_STATES newResourceState, unsigned int subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES)
GrDirectContextPriv priv()
int numTextureSamplers() const
const GrDirectContext * getContext() const
const GrCaps * caps() const
void set(GrRenderTarget *rt, GrSurfaceOrigin origin)
GrRenderTarget * fRenderTarget
void visitTextureEffects(const std::function< void(const GrTextureEffect &)> &) const
GrTexture * peekDstTexture() const
GrAttachment * getStencilAttachment(bool useMSAASurface) const
const SkIRect & rect() const
const Face & postOriginCCWFace(GrSurfaceOrigin origin) const
const Face & singleSidedFace() const
const Face & postOriginCWFace(GrSurfaceOrigin origin) const
virtual GrBackendFormat backendFormat() const =0
GrTexture * texture() const
skgpu::BlendInfo getBlendInfo() const
constexpr std::array< float, 4 > applyTo(std::array< float, 4 > color) const
static const uint8_t buffer[]
static constexpr bool BlendCoeffRefsConstant(const BlendCoeff coeff)
std::array< float, 4 > fClearColor
bool intersect(const SkIRect &r)
int32_t fBottom
larger y-axis bounds
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeEmpty()
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
int32_t fLeft
smaller x-axis bounds
void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
bool contains(int32_t x, int32_t y) const
int32_t fRight
larger x-axis bounds
static SkRect Make(const SkISize &size)
bool intersect(const SkRect &r)
void roundOut(SkIRect *dst) const
skgpu::BlendCoeff fDstBlend
SkPMColor4f fBlendConstant
skgpu::BlendCoeff fSrcBlend