Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrD3DCommandList.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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
9
21
24 : fCommandList(std::move(commandList))
25 , fAllocator(std::move(allocator)) {
26}
27
29 SkASSERT(fIsActive);
31 HRESULT hr = fCommandList->Close();
32 SkDEBUGCODE(fIsActive = false;)
33 return SUCCEEDED(hr);
34}
35
37 SkASSERT(fIsActive);
38 if (!this->hasWork()) {
39 this->callFinishedCallbacks();
41 }
42
43 if (!this->close()) {
45 }
46 SkASSERT(!fIsActive);
47 ID3D12CommandList* ppCommandLists[] = { fCommandList.get() };
48 queue->ExecuteCommandLists(1, ppCommandLists);
49
51}
52
54 SkASSERT(!fIsActive);
55 GR_D3D_CALL_ERRCHECK(fAllocator->Reset());
56 GR_D3D_CALL_ERRCHECK(fCommandList->Reset(fAllocator.get(), nullptr));
57 this->onReset();
58
59 this->releaseResources();
60
61 SkDEBUGCODE(fIsActive = true;)
62 fHasWork = false;
63}
64
66 TRACE_EVENT0("skia.gpu", TRACE_FUNC);
67 if (fTrackedResources.size() == 0 && fTrackedRecycledResources.size() == 0) {
68 return;
69 }
70 SkASSERT(!fIsActive);
71 for (int i = 0; i < fTrackedRecycledResources.size(); ++i) {
72 auto resource = fTrackedRecycledResources[i].release();
73 resource->recycle();
74 }
75
76 fTrackedResources.clear();
78 fTrackedGpuBuffers.clear();
79
80 this->callFinishedCallbacks();
81}
82
86
87////////////////////////////////////////////////////////////////////////////////
88// GraphicsCommandList commands
89////////////////////////////////////////////////////////////////////////////////
90
92 int numBarriers,
93 const D3D12_RESOURCE_TRANSITION_BARRIER* barriers) {
94 SkASSERT(fIsActive);
95 SkASSERT(barriers);
96 for (int i = 0; i < numBarriers; ++i) {
97 // D3D will apply barriers in order so we can just add onto the end
98 D3D12_RESOURCE_BARRIER& newBarrier = fResourceBarriers.push_back();
99 newBarrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
100 newBarrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
101 newBarrier.Transition = barriers[i];
102 }
103
104 fHasWork = true;
105 if (resource) {
106 this->addResource(std::move(resource));
107 }
108}
109
111 ID3D12Resource* uavResource) {
112 SkASSERT(fIsActive);
113 // D3D will apply barriers in order so we can just add onto the end
114 D3D12_RESOURCE_BARRIER& newBarrier = fResourceBarriers.push_back();
115 newBarrier.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
116 newBarrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
117 newBarrier.UAV.pResource = uavResource;
118
119 fHasWork = true;
120 if (resource) {
121 this->addResource(std::move(resource));
122 }
123}
124
126 ID3D12Resource* beforeResource,
127 sk_sp<GrManagedResource> afterManagedResource,
128 ID3D12Resource* afterResource) {
129 SkASSERT(fIsActive);
130 // D3D will apply barriers in order so we can just add onto the end
131 D3D12_RESOURCE_BARRIER& newBarrier = fResourceBarriers.push_back();
132 newBarrier.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING;
133 newBarrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
134 newBarrier.Aliasing.pResourceBefore = beforeResource;
135 newBarrier.Aliasing.pResourceAfter = afterResource;
136
137 fHasWork = true;
138 if (beforeResource) {
139 SkASSERT(beforeManagedResource);
140 this->addResource(std::move(beforeManagedResource));
141 }
142 // Aliasing barriers can accept a null pointer for the second resource,
143 // but at this point we're not using that feature.
144 SkASSERT(afterResource);
145 SkASSERT(afterManagedResource);
146 this->addResource(std::move(afterManagedResource));
147}
148
150 SkASSERT(fIsActive);
151
152 if (fResourceBarriers.size()) {
153 fCommandList->ResourceBarrier(fResourceBarriers.size(), fResourceBarriers.begin());
154 fResourceBarriers.clear();
155 }
156 SkASSERT(!fResourceBarriers.size());
157}
158
159void GrD3DCommandList::copyBufferToTexture(ID3D12Resource* srcBuffer,
160 const GrD3DTextureResource* dstTexture,
161 uint32_t subresourceCount,
162 D3D12_PLACED_SUBRESOURCE_FOOTPRINT* bufferFootprints,
163 int left, int top) {
164 SkASSERT(fIsActive);
165 SkASSERT(subresourceCount == 1 || (left == 0 && top == 0));
166
167 this->addingWork();
168 this->addResource(dstTexture->resource());
169
170 for (uint32_t subresource = 0; subresource < subresourceCount; ++subresource) {
171 D3D12_TEXTURE_COPY_LOCATION src = {};
172 src.pResource = srcBuffer;
173 src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
174 src.PlacedFootprint = bufferFootprints[subresource];
175
176 D3D12_TEXTURE_COPY_LOCATION dst = {};
177 dst.pResource = dstTexture->d3dResource();
178 dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
179 dst.SubresourceIndex = subresource;
180
181 fCommandList->CopyTextureRegion(&dst, left, top, 0, &src, nullptr);
182 }
183}
184
186 const D3D12_TEXTURE_COPY_LOCATION* dstLocation,
187 UINT dstX, UINT dstY,
189 const D3D12_TEXTURE_COPY_LOCATION* srcLocation,
190 const D3D12_BOX* srcBox) {
191 SkASSERT(fIsActive);
192 SkASSERT(dst);
193 this->addingWork();
194 this->addResource(dst);
195 this->addResource(std::move(src));
196 fCommandList->CopyTextureRegion(dstLocation, dstX, dstY, 0, srcLocation, srcBox);
197}
198
200 const D3D12_TEXTURE_COPY_LOCATION* dstLocation,
201 UINT dstX,
202 UINT dstY,
204 const D3D12_TEXTURE_COPY_LOCATION* srcLocation,
205 const D3D12_BOX* srcBox) {
206 SkASSERT(fIsActive);
207 SkASSERT(dst);
208 this->addingWork();
209 this->addGrBuffer(std::move(dst));
210 this->addResource(std::move(src));
211 fCommandList->CopyTextureRegion(dstLocation, dstX, dstY, 0, srcLocation, srcBox);
212}
213
214
216 UINT subresourceIndex) {
217 SkASSERT(fIsActive);
218 SkASSERT(src);
219 SkASSERT(dst);
220 SkASSERT(src->width() == dst->width() && src->height() == dst->height());
221
222 this->addingWork();
223 ID3D12Resource* dstTexture = dst->d3dResource();
224 ID3D12Resource* srcTexture = src->d3dResource();
225 if (subresourceIndex == (UINT)-1) {
226 fCommandList->CopyResource(dstTexture, srcTexture);
227 } else {
228 SkASSERT(subresourceIndex < src->mipLevels() &&
229 subresourceIndex < dst->mipLevels());
230 D3D12_TEXTURE_COPY_LOCATION srcLoc = {};
231 srcLoc.pResource = srcTexture;
232 srcLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
233 srcLoc.SubresourceIndex = subresourceIndex;
234
235 D3D12_TEXTURE_COPY_LOCATION dstLoc = {};
236 dstLoc.pResource = dstTexture;
237 dstLoc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
238 dstLoc.SubresourceIndex = subresourceIndex;
239
240 fCommandList->CopyTextureRegion(&dstLoc, 0, 0, 0, &srcLoc, nullptr);
241 }
242 this->addResource(dst->resource());
243 this->addResource(src->resource());
244}
245
247 ID3D12Resource* srcBuffer, uint64_t srcOffset,
248 uint64_t numBytes) {
249 SkASSERT(fIsActive);
250
251 this->addingWork();
252 ID3D12Resource* dstBuffer = dst->d3dResource();
253 uint64_t dstSize = dstBuffer->GetDesc().Width;
254 uint64_t srcSize = srcBuffer->GetDesc().Width;
255 if (dstSize == srcSize && srcSize == numBytes) {
256 fCommandList->CopyResource(dstBuffer, srcBuffer);
257 } else {
258 fCommandList->CopyBufferRegion(dstBuffer, dstOffset, srcBuffer, srcOffset, numBytes);
259 }
260 this->addGrBuffer(std::move(dst));
261}
262
265 fHasWork = true;
266}
267
268////////////////////////////////////////////////////////////////////////////////////////////////////
269
270std::unique_ptr<GrD3DDirectCommandList> GrD3DDirectCommandList::Make(GrD3DGpu* gpu) {
271 ID3D12Device* device = gpu->device();
273 GR_D3D_CALL_ERRCHECK(device->CreateCommandAllocator(
274 D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator)));
275
277 GR_D3D_CALL_ERRCHECK(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT,
278 allocator.get(), nullptr,
279 IID_PPV_ARGS(&commandList)));
280
281 auto grCL = new GrD3DDirectCommandList(std::move(allocator), std::move(commandList),
283 return std::unique_ptr<GrD3DDirectCommandList>(grCL);
284}
285
286GrD3DDirectCommandList::GrD3DDirectCommandList(gr_cp<ID3D12CommandAllocator> allocator,
288 bool resolveSubregionSupported)
289 : GrD3DCommandList(std::move(allocator), std::move(commandList))
290 , fResolveSubregionSupported(resolveSubregionSupported) {
291 sk_bzero(fCurrentGraphicsRootDescTable, sizeof(fCurrentGraphicsRootDescTable));
292 sk_bzero(fCurrentComputeRootDescTable, sizeof(fCurrentComputeRootDescTable));
293}
294
296 fCurrentPipeline = nullptr;
297 fCurrentGraphicsRootSignature = nullptr;
298 fCurrentComputeRootSignature = nullptr;
299 fCurrentVertexBuffer = nullptr;
300 fCurrentVertexStride = 0;
301 fCurrentInstanceBuffer = nullptr;
302 fCurrentInstanceStride = 0;
303 fCurrentIndexBuffer = nullptr;
304 fCurrentGraphicsConstantBufferAddress = 0;
305 fCurrentComputeConstantBufferAddress = 0;
306 sk_bzero(fCurrentGraphicsRootDescTable, sizeof(fCurrentGraphicsRootDescTable));
307 sk_bzero(fCurrentComputeRootDescTable, sizeof(fCurrentComputeRootDescTable));
308 fCurrentSRVCRVDescriptorHeap = nullptr;
309 fCurrentSamplerDescriptorHeap = nullptr;
310}
311
313 SkASSERT(fIsActive);
314 if (pipeline.get() != fCurrentPipeline) {
315 fCommandList->SetPipelineState(pipeline->d3dPipelineState());
316 this->addResource(std::move(pipeline));
317 fCurrentPipeline = pipeline.get();
318 }
319}
320
321void GrD3DDirectCommandList::setStencilRef(unsigned int stencilRef) {
322 SkASSERT(fIsActive);
323 fCommandList->OMSetStencilRef(stencilRef);
324}
325
326void GrD3DDirectCommandList::setBlendFactor(const float blendFactor[4]) {
327 SkASSERT(fIsActive);
328 fCommandList->OMSetBlendFactor(blendFactor);
329}
330
331void GrD3DDirectCommandList::setPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY primitiveTopology) {
332 SkASSERT(fIsActive);
333 fCommandList->IASetPrimitiveTopology(primitiveTopology);
334}
335
336void GrD3DDirectCommandList::setScissorRects(unsigned int numRects, const D3D12_RECT* rects) {
337 SkASSERT(fIsActive);
338 fCommandList->RSSetScissorRects(numRects, rects);
339}
340
341void GrD3DDirectCommandList::setViewports(unsigned int numViewports,
342 const D3D12_VIEWPORT* viewports) {
343 SkASSERT(fIsActive);
344 fCommandList->RSSetViewports(numViewports, viewports);
345}
346
348 SkASSERT(fIsActive);
349 if (fCurrentGraphicsRootSignature != rootSig.get()) {
350 fCommandList->SetGraphicsRootSignature(rootSig->rootSignature());
351 this->addResource(rootSig);
352 fCurrentGraphicsRootSignature = rootSig.get();
353 // need to reset the current descriptor tables as well
354 sk_bzero(fCurrentGraphicsRootDescTable, sizeof(fCurrentGraphicsRootDescTable));
355 }
356}
357
359 SkASSERT(fIsActive);
360 if (fCurrentComputeRootSignature != rootSig.get()) {
361 fCommandList->SetComputeRootSignature(rootSig->rootSignature());
362 this->addResource(rootSig);
363 fCurrentComputeRootSignature = rootSig.get();
364 // need to reset the current descriptor tables as well
365 sk_bzero(fCurrentComputeRootDescTable, sizeof(fCurrentComputeRootDescTable));
366 }
367}
368
370 sk_sp<const GrBuffer> vertexBuffer,
371 size_t vertexStride,
372 sk_sp<const GrBuffer> instanceBuffer,
373 size_t instanceStride) {
374 if (fCurrentVertexBuffer != vertexBuffer.get() ||
375 fCurrentVertexStride != vertexStride ||
376 fCurrentInstanceBuffer != instanceBuffer.get() ||
377 fCurrentInstanceStride != instanceStride) {
378
379 fCurrentVertexBuffer = vertexBuffer.get();
380 fCurrentVertexStride = vertexStride;
381 fCurrentInstanceBuffer = instanceBuffer.get();
382 fCurrentInstanceStride = instanceStride;
383
384 D3D12_VERTEX_BUFFER_VIEW views[2];
385 int numViews = 0;
386 if (vertexBuffer) {
387 auto* d3dBuffer = static_cast<const GrD3DBuffer*>(vertexBuffer.get());
388 views[numViews].BufferLocation = d3dBuffer->d3dResource()->GetGPUVirtualAddress();
389 views[numViews].SizeInBytes = vertexBuffer->size();
390 views[numViews++].StrideInBytes = vertexStride;
391 this->addGrBuffer(std::move(vertexBuffer));
392 }
393 if (instanceBuffer) {
394 auto* d3dBuffer = static_cast<const GrD3DBuffer*>(instanceBuffer.get());
395 views[numViews].BufferLocation = d3dBuffer->d3dResource()->GetGPUVirtualAddress();
396 views[numViews].SizeInBytes = instanceBuffer->size();
397 views[numViews++].StrideInBytes = instanceStride;
398 this->addGrBuffer(std::move(instanceBuffer));
399 }
400 fCommandList->IASetVertexBuffers(startSlot, numViews, views);
401 }
402}
403
405 if (fCurrentIndexBuffer != indexBuffer.get()) {
406 auto* d3dBuffer = static_cast<const GrD3DBuffer*>(indexBuffer.get());
407
408 D3D12_INDEX_BUFFER_VIEW view = {};
409 view.BufferLocation = d3dBuffer->d3dResource()->GetGPUVirtualAddress();
410 view.SizeInBytes = indexBuffer->size();
411 view.Format = DXGI_FORMAT_R16_UINT;
412 fCommandList->IASetIndexBuffer(&view);
413
414 fCurrentIndexBuffer = indexBuffer.get();
415 this->addGrBuffer(std::move(indexBuffer));
416 }
417}
418
419void GrD3DDirectCommandList::drawInstanced(unsigned int vertexCount, unsigned int instanceCount,
420 unsigned int startVertex, unsigned int startInstance) {
421 SkASSERT(fIsActive);
422 this->addingWork();
423 fCommandList->DrawInstanced(vertexCount, instanceCount, startVertex, startInstance);
424}
425
427 unsigned int instanceCount,
428 unsigned int startIndex,
429 unsigned int baseVertex,
430 unsigned int startInstance) {
431 SkASSERT(fIsActive);
432 this->addingWork();
433 fCommandList->DrawIndexedInstanced(indexCount, instanceCount, startIndex, baseVertex,
434 startInstance);
435}
436
438 unsigned int maxCommandCount,
439 const GrD3DBuffer* argumentBuffer,
440 size_t argumentBufferOffset) {
441 SkASSERT(fIsActive);
442 this->addingWork();
443 this->addResource(commandSignature);
444 fCommandList->ExecuteIndirect(commandSignature->commandSignature(), maxCommandCount,
445 argumentBuffer->d3dResource(), argumentBufferOffset,
446 nullptr, 0);
447 this->addGrBuffer(sk_ref_sp<const GrBuffer>(argumentBuffer));
448}
449
450
451void GrD3DDirectCommandList::dispatch(unsigned int threadGroupCountX,
452 unsigned int threadGroupCountY,
453 unsigned int threadGroupCountZ) {
454 SkASSERT(fIsActive);
455 this->addingWork();
456 fCommandList->Dispatch(threadGroupCountX, threadGroupCountY, threadGroupCountZ);
457}
458
460 std::array<float, 4> color,
461 const D3D12_RECT* rect) {
462 this->addingWork();
463 this->addResource(renderTarget->resource());
464 const GrD3DTextureResource* msaaTextureResource = renderTarget->msaaTextureResource();
465 if (msaaTextureResource && msaaTextureResource != renderTarget) {
466 this->addResource(msaaTextureResource->resource());
467 }
468 unsigned int numRects = rect ? 1 : 0;
469 fCommandList->ClearRenderTargetView(renderTarget->colorRenderTargetView(), color.data(),
470 numRects, rect);
471}
472
474 uint8_t stencilClearValue,
475 const D3D12_RECT* rect) {
476 this->addingWork();
477 this->addResource(stencil->resource());
478 unsigned int numRects = rect ? 1 : 0;
479 fCommandList->ClearDepthStencilView(stencil->view(), D3D12_CLEAR_FLAG_STENCIL, 0,
480 stencilClearValue, numRects, rect);
481}
482
484 this->addingWork();
485 this->addResource(renderTarget->resource());
486 const GrD3DTextureResource* msaaTextureResource = renderTarget->msaaTextureResource();
487 if (msaaTextureResource && msaaTextureResource != renderTarget) {
488 this->addResource(msaaTextureResource->resource());
489 }
490 D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = renderTarget->colorRenderTargetView();
491
492 D3D12_CPU_DESCRIPTOR_HANDLE dsDescriptor;
493 D3D12_CPU_DESCRIPTOR_HANDLE* dsDescriptorPtr = nullptr;
494 if (auto stencil = renderTarget->getStencilAttachment()) {
495 GrD3DAttachment* d3dStencil = static_cast<GrD3DAttachment*>(stencil);
496 this->addResource(d3dStencil->resource());
497 dsDescriptor = d3dStencil->view();
498 dsDescriptorPtr = &dsDescriptor;
499 }
500
501 fCommandList->OMSetRenderTargets(1, &rtvDescriptor, false, dsDescriptorPtr);
502}
503
505 unsigned int dstX, unsigned int dstY,
506 const GrD3DTextureResource* srcTexture,
507 D3D12_RECT* srcRect) {
508 SkASSERT(dstTexture->dxgiFormat() == srcTexture->dxgiFormat());
509 SkASSERT(dstTexture->currentState() == D3D12_RESOURCE_STATE_RESOLVE_DEST);
510 SkASSERT(srcTexture->currentState() == D3D12_RESOURCE_STATE_RESOLVE_SOURCE);
511 this->addingWork();
512 this->addResource(dstTexture->resource());
513 this->addResource(srcTexture->resource());
514
515 if (fResolveSubregionSupported) {
517 HRESULT result = fCommandList->QueryInterface(IID_PPV_ARGS(&commandList1));
518 if (SUCCEEDED(result)) {
519 commandList1->ResolveSubresourceRegion(dstTexture->d3dResource(), 0, dstX, dstY,
520 srcTexture->d3dResource(), 0, srcRect,
521 srcTexture->dxgiFormat(),
522 D3D12_RESOLVE_MODE_AVERAGE);
523 return;
524 }
525 }
526
527 fCommandList->ResolveSubresource(dstTexture->d3dResource(), 0, srcTexture->d3dResource(), 0,
528 srcTexture->dxgiFormat());
529}
530
532 unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation) {
533 SkASSERT(rootParameterIndex ==
535 if (bufferLocation != fCurrentGraphicsConstantBufferAddress) {
536 fCommandList->SetGraphicsRootConstantBufferView(rootParameterIndex, bufferLocation);
537 fCurrentGraphicsConstantBufferAddress = bufferLocation;
538 }
539}
540
542 unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation) {
543 SkASSERT(rootParameterIndex ==
545 if (bufferLocation != fCurrentComputeConstantBufferAddress) {
546 fCommandList->SetComputeRootConstantBufferView(rootParameterIndex, bufferLocation);
547 fCurrentComputeConstantBufferAddress = bufferLocation;
548 }
549}
550
552 unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor) {
553 SkASSERT(rootParameterIndex ==
555 rootParameterIndex ==
557 if (fCurrentGraphicsRootDescTable[rootParameterIndex].ptr != baseDescriptor.ptr) {
558 fCommandList->SetGraphicsRootDescriptorTable(rootParameterIndex, baseDescriptor);
559 fCurrentGraphicsRootDescTable[rootParameterIndex] = baseDescriptor;
560 }
561}
562
564 unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor) {
565 SkASSERT(rootParameterIndex ==
567 rootParameterIndex ==
569 if (fCurrentComputeRootDescTable[rootParameterIndex].ptr != baseDescriptor.ptr) {
570 fCommandList->SetComputeRootDescriptorTable(rootParameterIndex, baseDescriptor);
571 fCurrentComputeRootDescTable[rootParameterIndex] = baseDescriptor;
572 }
573}
574
575// We don't need to add these resources to the command list.
576// They're added when we first allocate from a heap in a given submit.
577void GrD3DDirectCommandList::setDescriptorHeaps(ID3D12DescriptorHeap* srvCrvDescriptorHeap,
578 ID3D12DescriptorHeap* samplerDescriptorHeap) {
579 if (srvCrvDescriptorHeap != fCurrentSRVCRVDescriptorHeap ||
580 samplerDescriptorHeap != fCurrentSamplerDescriptorHeap) {
581 ID3D12DescriptorHeap* heaps[2] = {
582 srvCrvDescriptorHeap,
583 samplerDescriptorHeap
584 };
585
586 fCommandList->SetDescriptorHeaps(2, heaps);
587 fCurrentSRVCRVDescriptorHeap = srvCrvDescriptorHeap;
588 fCurrentSamplerDescriptorHeap = samplerDescriptorHeap;
589 }
590}
591
595
596////////////////////////////////////////////////////////////////////////////////////////////////////
597
598std::unique_ptr<GrD3DCopyCommandList> GrD3DCopyCommandList::Make(GrD3DGpu* gpu) {
599 ID3D12Device* device = gpu->device();
601 GR_D3D_CALL_ERRCHECK(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT,
602 IID_PPV_ARGS(&allocator)));
603
605 GR_D3D_CALL_ERRCHECK(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_COPY, allocator.get(),
606 nullptr, IID_PPV_ARGS(&commandList)));
607 auto grCL = new GrD3DCopyCommandList(std::move(allocator), std::move(commandList));
608 return std::unique_ptr<GrD3DCopyCommandList>(grCL);
609}
610
611GrD3DCopyCommandList::GrD3DCopyCommandList(gr_cp<ID3D12CommandAllocator> allocator,
613 : GrD3DCommandList(std::move(allocator), std::move(commandList)) {
614}
#define GR_D3D_CALL_ERRCHECK(X)
Definition GrD3DUtil.h:16
SkColor4f color
#define SkASSERT(cond)
Definition SkAssert.h:116
#define SkDEBUGCODE(...)
Definition SkDebug.h:23
static void sk_bzero(void *buffer, size_t size)
Definition SkMalloc.h:105
static bool left(const SkPoint &p0, const SkPoint &p1)
#define TRACE_FUNC
D3D12_CPU_DESCRIPTOR_HANDLE view() const
ID3D12Resource * d3dResource() const
Definition GrD3DBuffer.h:24
bool resolveSubresourceRegionSupport() const
Definition GrD3DCaps.h:108
void addGrBuffer(sk_sp< const GrBuffer > buffer)
gr_cp< ID3D12GraphicsCommandList > fCommandList
TrackedResourceArray< sk_sp< const GrBuffer > > fTrackedGpuBuffers
void aliasingBarrier(sk_sp< GrManagedResource > beforeManagedResource, ID3D12Resource *beforeResource, sk_sp< GrManagedResource > afterManagedResource, ID3D12Resource *afterResource)
virtual void onReset()
void copyTextureToTexture(const GrD3DTexture *dst, const GrD3DTexture *src, UINT subresourceIndex=-1)
void resourceBarrier(sk_sp< GrManagedResource > managedResource, int numBarriers, const D3D12_RESOURCE_TRANSITION_BARRIER *barriers)
SubmitResult submit(ID3D12CommandQueue *queue)
GrD3DCommandList(gr_cp< ID3D12CommandAllocator > allocator, gr_cp< ID3D12GraphicsCommandList > commandList)
void copyTextureRegionToTexture(sk_sp< GrManagedResource > dst, const D3D12_TEXTURE_COPY_LOCATION *dstLocation, UINT dstX, UINT dstY, sk_sp< GrManagedResource > src, const D3D12_TEXTURE_COPY_LOCATION *srcLocation, const D3D12_BOX *srcBox)
void uavBarrier(sk_sp< GrManagedResource > managedResource, ID3D12Resource *uavResource)
void copyBufferToTexture(ID3D12Resource *srcBuffer, const GrD3DTextureResource *dstTexture, uint32_t subresourceCount, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *bufferFootprints, int left, int top)
void copyTextureRegionToBuffer(sk_sp< const GrBuffer > dst, const D3D12_TEXTURE_COPY_LOCATION *dstLocation, UINT dstX, UINT dstY, sk_sp< GrManagedResource > src, const D3D12_TEXTURE_COPY_LOCATION *srcLocation, const D3D12_BOX *srcBox)
void addResource(sk_sp< GrManagedResource > resource)
void copyBufferToBuffer(sk_sp< GrD3DBuffer > dstBuffer, uint64_t dstOffset, ID3D12Resource *srcBuffer, uint64_t srcOffset, uint64_t numBytes)
TrackedResourceArray< sk_sp< GrRecycledResource > > fTrackedRecycledResources
TrackedResourceArray< sk_sp< GrManagedResource > > fTrackedResources
void addFinishedCallback(sk_sp< skgpu::RefCntedCallback > callback)
static std::unique_ptr< GrD3DCopyCommandList > Make(GrD3DGpu *gpu)
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 setComputeRootConstantBufferView(unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation)
void addSampledTextureRef(GrD3DTexture *)
void setComputeRootDescriptorTable(unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE bufferLocation)
void setGraphicsRootSignature(const sk_sp< GrD3DRootSignature > &rootSignature)
void setStencilRef(unsigned int stencilRef)
void setPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY primitiveTopology)
void setGraphicsRootConstantBufferView(unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation)
void setVertexBuffers(unsigned int startSlot, sk_sp< const GrBuffer > vertexBuffer, size_t vertexStride, sk_sp< const GrBuffer > instanceBuffer, size_t instanceStride)
void setDescriptorHeaps(ID3D12DescriptorHeap *srvDescriptorHeap, ID3D12DescriptorHeap *samplerDescriptorHeap)
static std::unique_ptr< GrD3DDirectCommandList > Make(GrD3DGpu *gpu)
void setRenderTarget(const GrD3DRenderTarget *renderTarget)
void setBlendFactor(const float blendFactor[4])
void resolveSubresourceRegion(const GrD3DTextureResource *dstTexture, unsigned int dstX, unsigned int dstY, const GrD3DTextureResource *srcTexture, D3D12_RECT *srcRect)
void setViewports(unsigned int numViewports, const D3D12_VIEWPORT *viewports)
void clearDepthStencilView(const GrD3DAttachment *, uint8_t stencilClearValue, const D3D12_RECT *rect)
void setIndexBuffer(sk_sp< const GrBuffer > indexBuffer)
void setPipelineState(const sk_sp< GrD3DPipeline > &pipeline)
void setScissorRects(unsigned int numRects, const D3D12_RECT *rects)
void dispatch(unsigned int threadGroupCountX, unsigned int threadGroupCountY, unsigned int threadGroupCountZ=1)
void setComputeRootSignature(const sk_sp< GrD3DRootSignature > &rootSignature)
void drawInstanced(unsigned int vertexCount, unsigned int instanceCount, unsigned int startVertex, unsigned int startInstance)
void setGraphicsRootDescriptorTable(unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE bufferLocation)
void drawIndexedInstanced(unsigned int indexCount, unsigned int instanceCount, unsigned int startIndex, unsigned int baseVertex, unsigned int startInstance)
const GrD3DCaps & d3dCaps() const
Definition GrD3DGpu.h:36
ID3D12Device * device() const
Definition GrD3DGpu.h:43
const GrD3DTextureResource * msaaTextureResource() const
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView() const
DXGI_FORMAT dxgiFormat() const
ID3D12Resource * d3dResource() const
D3D12_RESOURCE_STATES currentState() const
sk_sp< Resource > resource() const
GrAttachment * getStencilAttachment(bool useMSAASurface) const
T * get() const
Definition GrD3DTypes.h:108
T * get() const
Definition SkRefCnt.h:303
int size() const
Definition SkTArray.h:416
VkDevice device
Definition main.cc:53
VkQueue queue
Definition main.cc:55
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
GAsyncResult * result
FlTexture * texture
Definition ref_ptr.h:256
#define TRACE_EVENT0(category_group, name)
#define SUCCEEDED(hr)
unsigned int UINT