44 fColorLoadOp = colorInfo.
fLoadOp;
46 fStencilLoadOp = stencilInfo.
fLoadOp;
55GrGpu* GrD3DOpsRenderPass::gpu() {
return fGpu; }
57void GrD3DOpsRenderPass::onBegin() {
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()) {
203void GrD3DOpsRenderPass::onSetScissorRect(
const SkIRect& scissor) {
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);
258void GrD3DOpsRenderPass::onDrawInstanced(
int instanceCount,
int baseInstance,
int vertexCount,
265void GrD3DOpsRenderPass::onDrawIndexedInstanced(
int indexCount,
int baseIndex,
int instanceCount,
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;
314void GrD3DOpsRenderPass::onClear(
const GrScissorState& scissor, std::array<float, 4>
color) {
321void GrD3DOpsRenderPass::onClearStencilClip(
const GrScissorState& scissor,
bool insideStencilMask) {
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 inlineUpload(GrOpFlushState *state, GrDeferredTextureUploadFn &upload) override
~GrD3DOpsRenderPass() override
bool set(GrRenderTarget *, GrSurfaceOrigin, const SkIRect &bounds, const GrOpsRenderPass::LoadAndStoreInfo &, const GrOpsRenderPass::StencilLoadAndStoreInfo &, const skia_private::TArray< GrSurfaceProxy *, true > &sampledProxies)
GrD3DOpsRenderPass(GrD3DGpu *)
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 &)
D3D12_RESOURCE_STATES getResourceState() const
void setResourceState(const GrD3DGpu *gpu, D3D12_RESOURCE_STATES newResourceState, unsigned int subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES)
sk_sp< GrD3DResourceState > grD3DResourceState() const
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
Optional< SkRect > bounds
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace 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