mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Delete StagingBuffer in favor of mappable buffers
This CL removes StagingBuffer to start to unify implementation code paths for WriteTexture/Buffer and CopyBufferToTexture/Buffer. This will help implementing a buffer-to-stencil copy workaround. Bug: dawn:1389 Change-Id: Ieb23b8d871f14544ef01445a495dc1077274c9f2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117167 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -161,13 +161,13 @@ MaybeError Buffer::MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size)
|
||||
mappedData = gl.MapBufferRange(GL_ARRAY_BUFFER, offset, size, GL_MAP_WRITE_BIT);
|
||||
}
|
||||
|
||||
// The frontend asks that the pointer returned by GetMappedPointerImpl is from the start of
|
||||
// The frontend asks that the pointer returned by GetMappedPointer is from the start of
|
||||
// the resource but OpenGL gives us the pointer at offset. Remove the offset.
|
||||
mMappedData = static_cast<uint8_t*>(mappedData) - offset;
|
||||
return {};
|
||||
}
|
||||
|
||||
void* Buffer::GetMappedPointerImpl() {
|
||||
void* Buffer::GetMappedPointer() {
|
||||
// The mapping offset has already been removed.
|
||||
return mMappedData;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class Buffer final : public BufferBase {
|
||||
void DestroyImpl() override;
|
||||
bool IsCPUWritableAtCreation() const override;
|
||||
MaybeError MapAtCreationImpl() override;
|
||||
void* GetMappedPointerImpl() override;
|
||||
void* GetMappedPointer() override;
|
||||
|
||||
void InitializeToZero();
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "dawn/native/BindGroupLayout.h"
|
||||
#include "dawn/native/ErrorData.h"
|
||||
#include "dawn/native/Instance.h"
|
||||
#include "dawn/native/StagingBuffer.h"
|
||||
#include "dawn/native/opengl/BindGroupGL.h"
|
||||
#include "dawn/native/opengl/BindGroupLayoutGL.h"
|
||||
#include "dawn/native/opengl/BufferGL.h"
|
||||
@@ -414,11 +413,7 @@ ResultOrError<ExecutionSerial> Device::CheckAndUpdateCompletedSerials() {
|
||||
return fenceSerial;
|
||||
}
|
||||
|
||||
ResultOrError<std::unique_ptr<StagingBufferBase>> Device::CreateStagingBuffer(size_t size) {
|
||||
return DAWN_UNIMPLEMENTED_ERROR("Device unable to create staging buffer.");
|
||||
}
|
||||
|
||||
MaybeError Device::CopyFromStagingToBufferImpl(StagingBufferBase* source,
|
||||
MaybeError Device::CopyFromStagingToBufferImpl(BufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
uint64_t destinationOffset,
|
||||
@@ -426,7 +421,7 @@ MaybeError Device::CopyFromStagingToBufferImpl(StagingBufferBase* source,
|
||||
return DAWN_UNIMPLEMENTED_ERROR("Device unable to copy from staging buffer.");
|
||||
}
|
||||
|
||||
MaybeError Device::CopyFromStagingToTextureImpl(const StagingBufferBase* source,
|
||||
MaybeError Device::CopyFromStagingToTextureImpl(const BufferBase* source,
|
||||
const TextureDataLayout& src,
|
||||
TextureCopy* dst,
|
||||
const Extent3D& copySizePixels) {
|
||||
|
||||
@@ -67,14 +67,13 @@ class Device final : public DeviceBase {
|
||||
|
||||
MaybeError TickImpl() override;
|
||||
|
||||
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
||||
MaybeError CopyFromStagingToBufferImpl(StagingBufferBase* source,
|
||||
MaybeError CopyFromStagingToBufferImpl(BufferBase* source,
|
||||
uint64_t sourceOffset,
|
||||
BufferBase* destination,
|
||||
uint64_t destinationOffset,
|
||||
uint64_t size) override;
|
||||
|
||||
MaybeError CopyFromStagingToTextureImpl(const StagingBufferBase* source,
|
||||
MaybeError CopyFromStagingToTextureImpl(const BufferBase* source,
|
||||
const TextureDataLayout& src,
|
||||
TextureCopy* dst,
|
||||
const Extent3D& copySizePixels) override;
|
||||
|
||||
Reference in New Issue
Block a user