diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 2bd5ce83bd..2aff1a02b5 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -26,6 +26,7 @@ #include "src/gpu/GrRenderTarget.h" #include "src/gpu/GrResourceCache.h" #include "src/gpu/GrResourceProvider.h" +#include "src/gpu/GrRingBuffer.h" #include "src/gpu/GrSemaphore.h" #include "src/gpu/GrStagingBufferManager.h" #include "src/gpu/GrStencilAttachment.h" @@ -659,6 +660,10 @@ bool GrGpu::submitToGpu(bool syncCpu) { manager->detachBuffers(); } + if (auto uniformsBuffer = this->uniformsRingBuffer()) { + uniformsBuffer->startSubmit(this); + } + bool submitted = this->onSubmitToGpu(syncCpu); this->callSubmittedProcs(submitted); diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 6883d736a0..8cd9bd040a 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -33,6 +33,7 @@ class GrPathRendering; class GrPipeline; class GrPrimitiveProcessor; class GrRenderTarget; +class GrRingBuffer; class GrSemaphore; class GrStagingBufferManager; class GrStencilAttachment; @@ -59,6 +60,8 @@ public: virtual GrStagingBufferManager* stagingBufferManager() { return nullptr; } + virtual GrRingBuffer* uniformsRingBuffer() { return nullptr; } + enum class DisconnectType { // No cleanup should be attempted, immediately cease making backend API calls kAbandon, diff --git a/src/gpu/d3d/GrD3DGpu.cpp b/src/gpu/d3d/GrD3DGpu.cpp index 07b8a08060..1f91bf9a91 100644 --- a/src/gpu/d3d/GrD3DGpu.cpp +++ b/src/gpu/d3d/GrD3DGpu.cpp @@ -120,9 +120,6 @@ GrOpsRenderPass* GrD3DGpu::getOpsRenderPass( bool GrD3DGpu::submitDirectCommandList(SyncQueue sync) { SkASSERT(fCurrentDirectCommandList); - // set up constant data - fConstantsRingBuffer.startSubmit(this); - fResourceProvider.prepForSubmit(); GrD3DDirectCommandList::SubmitResult result = fCurrentDirectCommandList->submit(fQueue.get()); diff --git a/src/gpu/d3d/GrD3DGpu.h b/src/gpu/d3d/GrD3DGpu.h index 2b93b80c4c..d28912bb38 100644 --- a/src/gpu/d3d/GrD3DGpu.h +++ b/src/gpu/d3d/GrD3DGpu.h @@ -48,8 +48,7 @@ public: GrStagingBufferManager* stagingBufferManager() override { return &fStagingBufferManager; } void takeOwnershipOfBuffer(sk_sp) override; - // TODO: hoist up to GrGpu - GrRingBuffer* constantsRingBuffer() { return &fConstantsRingBuffer; } + GrRingBuffer* uniformsRingBuffer() override { return &fConstantsRingBuffer; } bool protectedContext() const { return false; } diff --git a/src/gpu/d3d/GrD3DResourceProvider.cpp b/src/gpu/d3d/GrD3DResourceProvider.cpp index ccaee3b4fb..14ff7bd8c9 100644 --- a/src/gpu/d3d/GrD3DResourceProvider.cpp +++ b/src/gpu/d3d/GrD3DResourceProvider.cpp @@ -199,7 +199,7 @@ D3D12_GPU_VIRTUAL_ADDRESS GrD3DResourceProvider::uploadConstantData(void* data, // upload the data size_t paddedSize = GrAlignTo(size, kConstantAlignment); - GrRingBuffer::Slice slice = fGpu->constantsRingBuffer()->suballocate(paddedSize); + GrRingBuffer::Slice slice = fGpu->uniformsRingBuffer()->suballocate(paddedSize); char* destPtr = static_cast(slice.fBuffer->map()) + slice.fOffset; memcpy(destPtr, data, size);