mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
VideoCommon: Use std::span for BoundingBox::Write()
Crosses off a lingering TODO. Also amends a few nearby cases where a u32 cast was being repromoted to size_t.
This commit is contained in:
@ -77,7 +77,7 @@ std::vector<BBoxType> VKBoundingBox::Read(u32 index, u32 length)
|
||||
return values;
|
||||
}
|
||||
|
||||
void VKBoundingBox::Write(u32 index, const std::vector<BBoxType>& values)
|
||||
void VKBoundingBox::Write(u32 index, std::span<const BBoxType> values)
|
||||
{
|
||||
// We can't issue vkCmdUpdateBuffer within a render pass.
|
||||
// However, the writes must be serialized, so we can't put it in the init buffer.
|
||||
@ -91,8 +91,7 @@ void VKBoundingBox::Write(u32 index, const std::vector<BBoxType>& values)
|
||||
|
||||
// Write the values to the GPU buffer
|
||||
vkCmdUpdateBuffer(g_command_buffer_mgr->GetCurrentCommandBuffer(), m_gpu_buffer,
|
||||
index * sizeof(BBoxType), values.size() * sizeof(BBoxType),
|
||||
reinterpret_cast<const BBoxType*>(values.data()));
|
||||
index * sizeof(BBoxType), values.size() * sizeof(BBoxType), values.data());
|
||||
|
||||
// Restore fragment shader access to the buffer.
|
||||
StagingBuffer::BufferMemoryBarrier(
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
protected:
|
||||
std::vector<BBoxType> Read(u32 index, u32 length) override;
|
||||
void Write(u32 index, const std::vector<BBoxType>& values) override;
|
||||
void Write(u32 index, std::span<const BBoxType> values) override;
|
||||
|
||||
private:
|
||||
bool CreateGPUBuffer();
|
||||
|
Reference in New Issue
Block a user