Reland "Destroy backend implementation for Buffers"

This reverts commit 9bf529ec94.

Reason for revert:
Fixed test failure by submitting basic render pass to clear out texture
before running the tests.

The test was failing previously because the texture pixel color was not
cleared before running the tests, causing unexpected
pixel colors to be compared. Creating a basic render pass clears
the texture, but since the first test fails on submit expectedly,
the pixel is never cleared.

Bug: dawn:46
Change-Id: Ic190c2d8d6af3f9d8def3370b92c6974a82a0096
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5500
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Natasha Lee <natlee@microsoft.com>
This commit is contained in:
Natasha Lee
2019-03-11 17:05:22 +00:00
committed by Commit Bot service account
parent 45f9730855
commit 718e1dbb89
14 changed files with 184 additions and 11 deletions

View File

@@ -27,6 +27,10 @@ namespace dawn_native { namespace opengl {
glBufferData(GL_ARRAY_BUFFER, GetSize(), nullptr, GL_STATIC_DRAW);
}
Buffer::~Buffer() {
DestroyImpl();
}
GLuint Buffer::GetHandle() const {
return mBuffer;
}
@@ -58,4 +62,9 @@ namespace dawn_native { namespace opengl {
glUnmapBuffer(GL_ARRAY_BUFFER);
}
void Buffer::DestroyImpl() {
glDeleteBuffers(1, &mBuffer);
mBuffer = 0;
}
}} // namespace dawn_native::opengl

View File

@@ -26,6 +26,7 @@ namespace dawn_native { namespace opengl {
class Buffer : public BufferBase {
public:
Buffer(Device* device, const BufferDescriptor* descriptor);
~Buffer();
GLuint GetHandle() const;
@@ -34,6 +35,7 @@ namespace dawn_native { namespace opengl {
void MapReadAsyncImpl(uint32_t serial) override;
void MapWriteAsyncImpl(uint32_t serial) override;
void UnmapImpl() override;
void DestroyImpl() override;
GLuint mBuffer = 0;
};