Clean up GrD3DCommandList interface
Change-Id: I6a2c209fde3d5e8130cd23d2db0d68c894d6c9b4 Bug: skia:9935 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295556 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
4ca8884a02
commit
c88d9c6ae3
@ -83,7 +83,7 @@ void GrD3DCommandList::releaseResources() {
|
||||
|
||||
void GrD3DCommandList::resourceBarrier(sk_sp<GrManagedResource> resource,
|
||||
int numBarriers,
|
||||
D3D12_RESOURCE_TRANSITION_BARRIER* barriers) {
|
||||
const D3D12_RESOURCE_TRANSITION_BARRIER* barriers) {
|
||||
SkASSERT(fIsActive);
|
||||
SkASSERT(barriers);
|
||||
for (int i = 0; i < numBarriers; ++i) {
|
||||
@ -110,8 +110,8 @@ void GrD3DCommandList::submitResourceBarriers() {
|
||||
SkASSERT(!fResourceBarriers.count());
|
||||
}
|
||||
|
||||
void GrD3DCommandList::copyBufferToTexture(GrD3DBuffer* srcBuffer,
|
||||
GrD3DTextureResource* dstTexture,
|
||||
void GrD3DCommandList::copyBufferToTexture(const GrD3DBuffer* srcBuffer,
|
||||
const GrD3DTextureResource* dstTexture,
|
||||
uint32_t subresourceCount,
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT* bufferFootprints,
|
||||
int left, int top) {
|
||||
@ -151,9 +151,9 @@ void GrD3DCommandList::copyTextureRegion(sk_sp<GrManagedResource> dst,
|
||||
}
|
||||
|
||||
void GrD3DCommandList::copyBufferToBuffer(sk_sp<GrManagedResource> dst,
|
||||
ID3D12Resource * dstBuffer, uint64_t dstOffset,
|
||||
ID3D12Resource* dstBuffer, uint64_t dstOffset,
|
||||
sk_sp<GrManagedResource> src,
|
||||
ID3D12Resource * srcBuffer, uint64_t srcOffset,
|
||||
ID3D12Resource* srcBuffer, uint64_t srcOffset,
|
||||
uint64_t numBytes) {
|
||||
SkASSERT(fIsActive);
|
||||
|
||||
@ -333,7 +333,7 @@ void GrD3DDirectCommandList::drawIndexedInstanced(unsigned int indexCount,
|
||||
startInstance);
|
||||
}
|
||||
|
||||
void GrD3DDirectCommandList::clearRenderTargetView(GrD3DRenderTarget* renderTarget,
|
||||
void GrD3DDirectCommandList::clearRenderTargetView(const GrD3DRenderTarget* renderTarget,
|
||||
const SkPMColor4f& color,
|
||||
const GrScissorState& scissor) {
|
||||
SkASSERT(!scissor.enabled()); // no cliprects for now
|
||||
@ -344,7 +344,7 @@ void GrD3DDirectCommandList::clearRenderTargetView(GrD3DRenderTarget* renderTarg
|
||||
0, NULL);
|
||||
}
|
||||
|
||||
void GrD3DDirectCommandList::setRenderTarget(GrD3DRenderTarget * renderTarget) {
|
||||
void GrD3DDirectCommandList::setRenderTarget(const GrD3DRenderTarget* renderTarget) {
|
||||
this->addingWork();
|
||||
this->addResource(renderTarget->resource());
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = renderTarget->colorRenderTargetView();
|
||||
|
@ -50,11 +50,11 @@ public:
|
||||
// All barriers should reference subresources of managedResource
|
||||
void resourceBarrier(sk_sp<GrManagedResource> managedResource,
|
||||
int numBarriers,
|
||||
D3D12_RESOURCE_TRANSITION_BARRIER* barriers);
|
||||
const D3D12_RESOURCE_TRANSITION_BARRIER* barriers);
|
||||
|
||||
// Helper method that calls copyTextureRegion multiple times, once for each subresource
|
||||
void copyBufferToTexture(GrD3DBuffer* srcBuffer,
|
||||
GrD3DTextureResource* dstTexture,
|
||||
void copyBufferToTexture(const GrD3DBuffer* srcBuffer,
|
||||
const GrD3DTextureResource* dstTexture,
|
||||
uint32_t subresourceCount,
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT* bufferFootprints,
|
||||
int left, int top);
|
||||
@ -70,6 +70,17 @@ public:
|
||||
ID3D12Resource* srcBuffer, uint64_t srcOffset,
|
||||
uint64_t numBytes);
|
||||
|
||||
void releaseResources();
|
||||
|
||||
bool hasWork() const { return fHasWork; }
|
||||
|
||||
private:
|
||||
static const int kInitialTrackedResourcesCount = 32;
|
||||
|
||||
protected:
|
||||
GrD3DCommandList(gr_cp<ID3D12CommandAllocator> allocator,
|
||||
gr_cp<ID3D12GraphicsCommandList> commandList);
|
||||
|
||||
// Add ref-counted resource that will be tracked and released when this command buffer finishes
|
||||
// execution
|
||||
void addResource(sk_sp<GrManagedResource> resource) {
|
||||
@ -85,17 +96,6 @@ public:
|
||||
fTrackedRecycledResources.push_back(std::move(resource));
|
||||
}
|
||||
|
||||
void releaseResources();
|
||||
|
||||
bool hasWork() const { return fHasWork; }
|
||||
|
||||
private:
|
||||
static const int kInitialTrackedResourcesCount = 32;
|
||||
|
||||
protected:
|
||||
GrD3DCommandList(gr_cp<ID3D12CommandAllocator> allocator,
|
||||
gr_cp<ID3D12GraphicsCommandList> commandList);
|
||||
|
||||
void addingWork();
|
||||
virtual void onReset() {}
|
||||
|
||||
@ -142,9 +142,9 @@ public:
|
||||
unsigned int startIndex, unsigned int baseVertex,
|
||||
unsigned int startInstance);
|
||||
|
||||
void clearRenderTargetView(GrD3DRenderTarget* renderTarget, const SkPMColor4f& color,
|
||||
void clearRenderTargetView(const GrD3DRenderTarget* renderTarget, const SkPMColor4f& color,
|
||||
const GrScissorState& scissor);
|
||||
void setRenderTarget(GrD3DRenderTarget* renderTarget);
|
||||
void setRenderTarget(const GrD3DRenderTarget* renderTarget);
|
||||
|
||||
void setGraphicsRootConstantBufferView(unsigned int rootParameterIndex,
|
||||
D3D12_GPU_VIRTUAL_ADDRESS bufferLocation);
|
||||
@ -171,8 +171,8 @@ private:
|
||||
GrD3DConstantRingBuffer* fCurrentConstantRingBuffer;
|
||||
GrD3DConstantRingBuffer::SubmitData fConstantRingBufferSubmitData;
|
||||
|
||||
ID3D12DescriptorHeap* fCurrentSRVCRVDescriptorHeap;
|
||||
ID3D12DescriptorHeap* fCurrentSamplerDescriptorHeap;
|
||||
const ID3D12DescriptorHeap* fCurrentSRVCRVDescriptorHeap;
|
||||
const ID3D12DescriptorHeap* fCurrentSamplerDescriptorHeap;
|
||||
};
|
||||
|
||||
class GrD3DCopyCommandList : public GrD3DCommandList {
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
|
||||
GrBackendRenderTarget getBackendRenderTarget() const override;
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView() {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView() const {
|
||||
return fColorRenderTargetView;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user