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:
parent
f02c0489c9
commit
7e829b2c28
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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());
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user