Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
GrD3DDirectCommandList Class Reference

#include <GrD3DCommandList.h>

Inheritance diagram for GrD3DDirectCommandList:
GrD3DCommandList

Public Member Functions

 ~GrD3DDirectCommandList () override=default
 
void setPipelineState (const sk_sp< GrD3DPipeline > &pipeline)
 
void setStencilRef (unsigned int stencilRef)
 
void setBlendFactor (const float blendFactor[4])
 
void setPrimitiveTopology (D3D12_PRIMITIVE_TOPOLOGY primitiveTopology)
 
void setScissorRects (unsigned int numRects, const D3D12_RECT *rects)
 
void setViewports (unsigned int numViewports, const D3D12_VIEWPORT *viewports)
 
void setGraphicsRootSignature (const sk_sp< GrD3DRootSignature > &rootSignature)
 
void setComputeRootSignature (const sk_sp< GrD3DRootSignature > &rootSignature)
 
void setVertexBuffers (unsigned int startSlot, sk_sp< const GrBuffer > vertexBuffer, size_t vertexStride, sk_sp< const GrBuffer > instanceBuffer, size_t instanceStride)
 
void setIndexBuffer (sk_sp< const GrBuffer > indexBuffer)
 
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)
 
void executeIndirect (const sk_sp< GrD3DCommandSignature > commandSig, unsigned int maxCommandCnt, const GrD3DBuffer *argumentBuffer, size_t argumentBufferOffset)
 
void dispatch (unsigned int threadGroupCountX, unsigned int threadGroupCountY, unsigned int threadGroupCountZ=1)
 
void clearRenderTargetView (const GrD3DRenderTarget *renderTarget, std::array< float, 4 > color, const D3D12_RECT *rect)
 
void clearDepthStencilView (const GrD3DAttachment *, uint8_t stencilClearValue, const D3D12_RECT *rect)
 
void setRenderTarget (const GrD3DRenderTarget *renderTarget)
 
void resolveSubresourceRegion (const GrD3DTextureResource *dstTexture, unsigned int dstX, unsigned int dstY, const GrD3DTextureResource *srcTexture, D3D12_RECT *srcRect)
 
void setGraphicsRootConstantBufferView (unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation)
 
void setGraphicsRootDescriptorTable (unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE bufferLocation)
 
void setComputeRootConstantBufferView (unsigned int rootParameterIndex, D3D12_GPU_VIRTUAL_ADDRESS bufferLocation)
 
void setComputeRootDescriptorTable (unsigned int rootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE bufferLocation)
 
void setDescriptorHeaps (ID3D12DescriptorHeap *srvDescriptorHeap, ID3D12DescriptorHeap *samplerDescriptorHeap)
 
void addSampledTextureRef (GrD3DTexture *)
 
- Public Member Functions inherited from GrD3DCommandList
virtual ~GrD3DCommandList ()
 
SubmitResult submit (ID3D12CommandQueue *queue)
 
bool close ()
 
void reset ()
 
void resourceBarrier (sk_sp< GrManagedResource > managedResource, int numBarriers, const D3D12_RESOURCE_TRANSITION_BARRIER *barriers)
 
void uavBarrier (sk_sp< GrManagedResource > managedResource, ID3D12Resource *uavResource)
 
void aliasingBarrier (sk_sp< GrManagedResource > beforeManagedResource, ID3D12Resource *beforeResource, sk_sp< GrManagedResource > afterManagedResource, ID3D12Resource *afterResource)
 
void copyBufferToTexture (ID3D12Resource *srcBuffer, const GrD3DTextureResource *dstTexture, uint32_t subresourceCount, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *bufferFootprints, int left, int top)
 
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 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 copyTextureToTexture (const GrD3DTexture *dst, const GrD3DTexture *src, UINT subresourceIndex=-1)
 
void copyBufferToBuffer (sk_sp< GrD3DBuffer > dstBuffer, uint64_t dstOffset, ID3D12Resource *srcBuffer, uint64_t srcOffset, uint64_t numBytes)
 
void addGrBuffer (sk_sp< const GrBuffer > buffer)
 
void addRecycledResource (sk_sp< GrRecycledResource > resource)
 
void releaseResources ()
 
bool hasWork () const
 
void addFinishedCallback (sk_sp< skgpu::RefCntedCallback > callback)
 

Static Public Member Functions

static std::unique_ptr< GrD3DDirectCommandListMake (GrD3DGpu *gpu)
 

Private Member Functions

void onReset () override
 

Additional Inherited Members

- Public Types inherited from GrD3DCommandList
enum class  SubmitResult { kNoWork , kSuccess , kFailure }
 
- Protected Types inherited from GrD3DCommandList
template<typename T >
using TrackedResourceArray = skia_private::STArray< kInitialTrackedResourcesCount, T >
 
- Protected Member Functions inherited from GrD3DCommandList
 GrD3DCommandList (gr_cp< ID3D12CommandAllocator > allocator, gr_cp< ID3D12GraphicsCommandList > commandList)
 
void addResource (sk_sp< GrManagedResource > resource)
 
void addingWork ()
 
void submitResourceBarriers ()
 
 SkDEBUGCODE (bool fIsActive=true;) bool fHasWork
 
- Protected Attributes inherited from GrD3DCommandList
gr_cp< ID3D12GraphicsCommandList > fCommandList
 
TrackedResourceArray< sk_sp< GrManagedResource > > fTrackedResources
 
TrackedResourceArray< sk_sp< GrRecycledResource > > fTrackedRecycledResources
 
TrackedResourceArray< sk_sp< const GrBuffer > > fTrackedGpuBuffers
 

Detailed Description

Definition at line 158 of file GrD3DCommandList.h.

Constructor & Destructor Documentation

◆ ~GrD3DDirectCommandList()

GrD3DDirectCommandList::~GrD3DDirectCommandList ( )
overridedefault

Member Function Documentation

◆ addSampledTextureRef()

void GrD3DDirectCommandList::addSampledTextureRef ( GrD3DTexture texture)

Definition at line 592 of file GrD3DCommandList.cpp.

592 {
593 this->addResource(texture->resource());
594}
void addResource(sk_sp< GrManagedResource > resource)
sk_sp< Resource > resource() const

◆ clearDepthStencilView()

void GrD3DDirectCommandList::clearDepthStencilView ( const GrD3DAttachment stencil,
uint8_t  stencilClearValue,
const D3D12_RECT *  rect 
)

Definition at line 473 of file GrD3DCommandList.cpp.

475 {
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}
D3D12_CPU_DESCRIPTOR_HANDLE view() const
gr_cp< ID3D12GraphicsCommandList > fCommandList
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350

◆ clearRenderTargetView()

void GrD3DDirectCommandList::clearRenderTargetView ( const GrD3DRenderTarget renderTarget,
std::array< float, 4 >  color,
const D3D12_RECT *  rect 
)

Definition at line 459 of file GrD3DCommandList.cpp.

461 {
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}
SkColor4f color
const GrD3DTextureResource * msaaTextureResource() const
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView() const

◆ dispatch()

void GrD3DDirectCommandList::dispatch ( unsigned int  threadGroupCountX,
unsigned int  threadGroupCountY,
unsigned int  threadGroupCountZ = 1 
)

Definition at line 451 of file GrD3DCommandList.cpp.

453 {
454 SkASSERT(fIsActive);
455 this->addingWork();
456 fCommandList->Dispatch(threadGroupCountX, threadGroupCountY, threadGroupCountZ);
457}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ drawIndexedInstanced()

void GrD3DDirectCommandList::drawIndexedInstanced ( unsigned int  indexCount,
unsigned int  instanceCount,
unsigned int  startIndex,
unsigned int  baseVertex,
unsigned int  startInstance 
)

Definition at line 426 of file GrD3DCommandList.cpp.

430 {
431 SkASSERT(fIsActive);
432 this->addingWork();
433 fCommandList->DrawIndexedInstanced(indexCount, instanceCount, startIndex, baseVertex,
434 startInstance);
435}

◆ drawInstanced()

void GrD3DDirectCommandList::drawInstanced ( unsigned int  vertexCount,
unsigned int  instanceCount,
unsigned int  startVertex,
unsigned int  startInstance 
)

Definition at line 419 of file GrD3DCommandList.cpp.

420 {
421 SkASSERT(fIsActive);
422 this->addingWork();
423 fCommandList->DrawInstanced(vertexCount, instanceCount, startVertex, startInstance);
424}

◆ executeIndirect()

void GrD3DDirectCommandList::executeIndirect ( const sk_sp< GrD3DCommandSignature commandSig,
unsigned int  maxCommandCnt,
const GrD3DBuffer argumentBuffer,
size_t  argumentBufferOffset 
)

Definition at line 437 of file GrD3DCommandList.cpp.

440 {
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}
ID3D12Resource * d3dResource() const
Definition GrD3DBuffer.h:24
void addGrBuffer(sk_sp< const GrBuffer > buffer)

◆ Make()

std::unique_ptr< GrD3DDirectCommandList > GrD3DDirectCommandList::Make ( GrD3DGpu gpu)
static

Definition at line 270 of file GrD3DCommandList.cpp.

270 {
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}
#define GR_D3D_CALL_ERRCHECK(X)
Definition GrD3DUtil.h:16
bool resolveSubresourceRegionSupport() const
Definition GrD3DCaps.h:108
const GrD3DCaps & d3dCaps() const
Definition GrD3DGpu.h:36
ID3D12Device * device() const
Definition GrD3DGpu.h:43
T * get() const
Definition GrD3DTypes.h:108
VkDevice device
Definition main.cc:53

◆ onReset()

void GrD3DDirectCommandList::onReset ( )
overrideprivatevirtual

Reimplemented from GrD3DCommandList.

Definition at line 295 of file GrD3DCommandList.cpp.

295 {
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}
static void sk_bzero(void *buffer, size_t size)
Definition SkMalloc.h:105

◆ resolveSubresourceRegion()

void GrD3DDirectCommandList::resolveSubresourceRegion ( const GrD3DTextureResource dstTexture,
unsigned int  dstX,
unsigned int  dstY,
const GrD3DTextureResource srcTexture,
D3D12_RECT *  srcRect 
)

Definition at line 504 of file GrD3DCommandList.cpp.

507 {
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}
DXGI_FORMAT dxgiFormat() const
ID3D12Resource * d3dResource() const
D3D12_RESOURCE_STATES currentState() const
GAsyncResult * result
#define SUCCEEDED(hr)

◆ setBlendFactor()

void GrD3DDirectCommandList::setBlendFactor ( const float  blendFactor[4])

Definition at line 326 of file GrD3DCommandList.cpp.

326 {
327 SkASSERT(fIsActive);
328 fCommandList->OMSetBlendFactor(blendFactor);
329}

◆ setComputeRootConstantBufferView()

void GrD3DDirectCommandList::setComputeRootConstantBufferView ( unsigned int  rootParameterIndex,
D3D12_GPU_VIRTUAL_ADDRESS  bufferLocation 
)

Definition at line 541 of file GrD3DCommandList.cpp.

542 {
543 SkASSERT(rootParameterIndex ==
545 if (bufferLocation != fCurrentComputeConstantBufferAddress) {
546 fCommandList->SetComputeRootConstantBufferView(rootParameterIndex, bufferLocation);
547 fCurrentComputeConstantBufferAddress = bufferLocation;
548 }
549}

◆ setComputeRootDescriptorTable()

void GrD3DDirectCommandList::setComputeRootDescriptorTable ( unsigned int  rootParameterIndex,
D3D12_GPU_DESCRIPTOR_HANDLE  bufferLocation 
)

Definition at line 563 of file GrD3DCommandList.cpp.

564 {
565 SkASSERT(rootParameterIndex ==
567 rootParameterIndex ==
569 if (fCurrentComputeRootDescTable[rootParameterIndex].ptr != baseDescriptor.ptr) {
570 fCommandList->SetComputeRootDescriptorTable(rootParameterIndex, baseDescriptor);
571 fCurrentComputeRootDescTable[rootParameterIndex] = baseDescriptor;
572 }
573}

◆ setComputeRootSignature()

void GrD3DDirectCommandList::setComputeRootSignature ( const sk_sp< GrD3DRootSignature > &  rootSignature)

Definition at line 358 of file GrD3DCommandList.cpp.

358 {
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}

◆ setDescriptorHeaps()

void GrD3DDirectCommandList::setDescriptorHeaps ( ID3D12DescriptorHeap *  srvDescriptorHeap,
ID3D12DescriptorHeap *  samplerDescriptorHeap 
)

Definition at line 577 of file GrD3DCommandList.cpp.

578 {
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}

◆ setGraphicsRootConstantBufferView()

void GrD3DDirectCommandList::setGraphicsRootConstantBufferView ( unsigned int  rootParameterIndex,
D3D12_GPU_VIRTUAL_ADDRESS  bufferLocation 
)

Definition at line 531 of file GrD3DCommandList.cpp.

532 {
533 SkASSERT(rootParameterIndex ==
535 if (bufferLocation != fCurrentGraphicsConstantBufferAddress) {
536 fCommandList->SetGraphicsRootConstantBufferView(rootParameterIndex, bufferLocation);
537 fCurrentGraphicsConstantBufferAddress = bufferLocation;
538 }
539}

◆ setGraphicsRootDescriptorTable()

void GrD3DDirectCommandList::setGraphicsRootDescriptorTable ( unsigned int  rootParameterIndex,
D3D12_GPU_DESCRIPTOR_HANDLE  bufferLocation 
)

Definition at line 551 of file GrD3DCommandList.cpp.

552 {
553 SkASSERT(rootParameterIndex ==
555 rootParameterIndex ==
557 if (fCurrentGraphicsRootDescTable[rootParameterIndex].ptr != baseDescriptor.ptr) {
558 fCommandList->SetGraphicsRootDescriptorTable(rootParameterIndex, baseDescriptor);
559 fCurrentGraphicsRootDescTable[rootParameterIndex] = baseDescriptor;
560 }
561}

◆ setGraphicsRootSignature()

void GrD3DDirectCommandList::setGraphicsRootSignature ( const sk_sp< GrD3DRootSignature > &  rootSignature)

Definition at line 347 of file GrD3DCommandList.cpp.

347 {
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}

◆ setIndexBuffer()

void GrD3DDirectCommandList::setIndexBuffer ( sk_sp< const GrBuffer indexBuffer)

Definition at line 404 of file GrD3DCommandList.cpp.

404 {
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}
virtual size_t size() const =0
T * get() const
Definition SkRefCnt.h:303

◆ setPipelineState()

void GrD3DDirectCommandList::setPipelineState ( const sk_sp< GrD3DPipeline > &  pipeline)

Definition at line 312 of file GrD3DCommandList.cpp.

312 {
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}
ID3D12PipelineState * d3dPipelineState() const

◆ setPrimitiveTopology()

void GrD3DDirectCommandList::setPrimitiveTopology ( D3D12_PRIMITIVE_TOPOLOGY  primitiveTopology)

Definition at line 331 of file GrD3DCommandList.cpp.

331 {
332 SkASSERT(fIsActive);
333 fCommandList->IASetPrimitiveTopology(primitiveTopology);
334}

◆ setRenderTarget()

void GrD3DDirectCommandList::setRenderTarget ( const GrD3DRenderTarget renderTarget)

Definition at line 483 of file GrD3DCommandList.cpp.

483 {
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}
GrAttachment * getStencilAttachment(bool useMSAASurface) const

◆ setScissorRects()

void GrD3DDirectCommandList::setScissorRects ( unsigned int  numRects,
const D3D12_RECT *  rects 
)

Definition at line 336 of file GrD3DCommandList.cpp.

336 {
337 SkASSERT(fIsActive);
338 fCommandList->RSSetScissorRects(numRects, rects);
339}

◆ setStencilRef()

void GrD3DDirectCommandList::setStencilRef ( unsigned int  stencilRef)

Definition at line 321 of file GrD3DCommandList.cpp.

321 {
322 SkASSERT(fIsActive);
323 fCommandList->OMSetStencilRef(stencilRef);
324}

◆ setVertexBuffers()

void GrD3DDirectCommandList::setVertexBuffers ( unsigned int  startSlot,
sk_sp< const GrBuffer vertexBuffer,
size_t  vertexStride,
sk_sp< const GrBuffer instanceBuffer,
size_t  instanceStride 
)

Definition at line 369 of file GrD3DCommandList.cpp.

373 {
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}

◆ setViewports()

void GrD3DDirectCommandList::setViewports ( unsigned int  numViewports,
const D3D12_VIEWPORT *  viewports 
)

Definition at line 341 of file GrD3DCommandList.cpp.

342 {
343 SkASSERT(fIsActive);
344 fCommandList->RSSetViewports(numViewports, viewports);
345}

The documentation for this class was generated from the following files: