Hoist up uniform GrRingBuffer to GrGpu

Change-Id: Ib829c883c260ef8ff4a3f5326922d66476b7306f
Bug: skia:10530
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306949
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2020-07-30 17:04:35 -04:00 committed by Skia Commit-Bot
parent f02c0489c9
commit 7e829b2c28
5 changed files with 10 additions and 6 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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());

View File

@ -48,8 +48,7 @@ public:
GrStagingBufferManager* stagingBufferManager() override { return &fStagingBufferManager; }
void takeOwnershipOfBuffer(sk_sp<GrGpuBuffer>) override;
// TODO: hoist up to GrGpu
GrRingBuffer* constantsRingBuffer() { return &fConstantsRingBuffer; }
GrRingBuffer* uniformsRingBuffer() override { return &fConstantsRingBuffer; }
bool protectedContext() const { return false; }

View File

@ -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<char*>(slice.fBuffer->map()) + slice.fOffset;
memcpy(destPtr, data, size);