#include "src/gpu/graphite/BufferManager.h"
#include "include/gpu/graphite/Recording.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/ContextPriv.h"
#include "src/gpu/graphite/Log.h"
#include "src/gpu/graphite/QueueManager.h"
#include "src/gpu/graphite/RecordingPriv.h"
#include "src/gpu/graphite/ResourceProvider.h"
#include "src/gpu/graphite/SharedContext.h"
#include "src/gpu/graphite/UploadBufferManager.h"
#include "src/gpu/graphite/task/ClearBuffersTask.h"
#include "src/gpu/graphite/task/CopyTask.h"
#include "src/gpu/graphite/task/TaskList.h"
#include <limits>
namespace skgpu::graphite {
namespace {
static constexpr uint32_t kVertexBufferSize = …;
static constexpr uint32_t kIndexBufferSize = …;
static constexpr uint32_t kUniformBufferSize = …;
static constexpr uint32_t kStorageBufferSize = …;
[[maybe_unused]] static constexpr uint32_t kMaxStaticDataSize = …;
uint32_t validate_count_and_stride(size_t count, size_t stride) { … }
uint32_t validate_size(size_t requiredBytes) { … }
uint32_t sufficient_block_size(uint32_t requiredBytes, uint32_t blockSize) { … }
bool can_fit(uint32_t requestedSize,
uint32_t allocatedSize,
uint32_t currentOffset,
uint32_t alignment) { … }
uint32_t starting_alignment(BufferType type, bool useTransferBuffers, const Caps* caps) { … }
}
ScratchBuffer::ScratchBuffer(uint32_t size, uint32_t alignment,
sk_sp<Buffer> buffer, DrawBufferManager* owner)
: … { … }
ScratchBuffer::~ScratchBuffer() { … }
BindBufferInfo ScratchBuffer::suballocate(size_t requiredBytes) { … }
void ScratchBuffer::returnToPool() { … }
DrawBufferManager::DrawBufferManager(ResourceProvider* resourceProvider,
const Caps* caps,
UploadBufferManager* uploadManager)
: … { … }
DrawBufferManager::~DrawBufferManager() { … }
DrawBufferManager::BufferInfo::BufferInfo(BufferType type, uint32_t blockSize, const Caps* caps)
: … { … }
std::pair<VertexWriter, BindBufferInfo> DrawBufferManager::getVertexWriter(size_t count,
size_t stride) { … }
void DrawBufferManager::returnVertexBytes(size_t unusedBytes) { … }
std::pair<IndexWriter, BindBufferInfo> DrawBufferManager::getIndexWriter(size_t count,
size_t stride) { … }
std::pair<UniformWriter, BindBufferInfo> DrawBufferManager::getUniformWriter(size_t count,
size_t stride) { … }
std::pair<UniformWriter, BindBufferInfo> DrawBufferManager::getSsboWriter(size_t count,
size_t stride) { … }
std::pair<void* , BindBufferInfo> DrawBufferManager::getUniformPointer(
size_t requiredBytes) { … }
std::pair<void* , BindBufferInfo> DrawBufferManager::getStoragePointer(
size_t requiredBytes) { … }
BindBufferInfo DrawBufferManager::getStorage(size_t requiredBytes, ClearBuffer cleared) { … }
BindBufferInfo DrawBufferManager::getVertexStorage(size_t requiredBytes) { … }
BindBufferInfo DrawBufferManager::getIndexStorage(size_t requiredBytes) { … }
BindBufferInfo DrawBufferManager::getIndirectStorage(size_t requiredBytes, ClearBuffer cleared) { … }
ScratchBuffer DrawBufferManager::getScratchStorage(size_t requiredBytes) { … }
void DrawBufferManager::onFailedBuffer() { … }
bool DrawBufferManager::transferToRecording(Recording* recording) { … }
std::pair<void*, BindBufferInfo> DrawBufferManager::prepareMappedBindBuffer(
BufferInfo* info,
uint32_t requiredBytes,
std::string_view label) { … }
BindBufferInfo DrawBufferManager::prepareBindBuffer(BufferInfo* info,
uint32_t requiredBytes,
std::string_view label,
bool supportCpuUpload,
ClearBuffer cleared) { … }
sk_sp<Buffer> DrawBufferManager::findReusableSbo(size_t bufferSize) { … }
StaticBufferManager::StaticBufferManager(ResourceProvider* resourceProvider,
const Caps* caps)
: … { … }
StaticBufferManager::~StaticBufferManager() = default;
StaticBufferManager::BufferInfo::BufferInfo(BufferType type, const Caps* caps)
: … { … }
VertexWriter StaticBufferManager::getVertexWriter(size_t size, BindBufferInfo* binding) { … }
VertexWriter StaticBufferManager::getIndexWriter(size_t size, BindBufferInfo* binding) { … }
void* StaticBufferManager::prepareStaticData(BufferInfo* info,
size_t size,
BindBufferInfo* target) { … }
bool StaticBufferManager::BufferInfo::createAndUpdateBindings(
ResourceProvider* resourceProvider,
Context* context,
QueueManager* queueManager,
GlobalCache* globalCache,
std::string_view label) const { … }
StaticBufferManager::FinishResult StaticBufferManager::finalize(Context* context,
QueueManager* queueManager,
GlobalCache* globalCache) { … }
}