Skip to content

Commit

Permalink
[WebGPU] GPUBuffer.destroy does not need to perform an unmap on an em…
Browse files Browse the repository at this point in the history
…pty buffer

https://bugs.webkit.org/show_bug.cgi?id=265433
<radar://118866396>

Reviewed by Dan Glastonbury.

GPUBuffer.destroy should be a no-op if the buffer was never mapped.

* Source/WebCore/Modules/WebGPU/GPUBuffer.cpp:
(WebCore::GPUBuffer::destroy):

Canonical link: https://commits.webkit.org/271245@main
  • Loading branch information
mwyrzykowski committed Nov 29, 2023
1 parent b1de44f commit 9e227c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/WebCore/Modules/WebGPU/GPUBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ void GPUBuffer::internalUnmap(ScriptExecutionContext& scriptExecutionContext)

void GPUBuffer::destroy(ScriptExecutionContext& scriptExecutionContext)
{
if (!m_bufferSize)
return;

internalUnmap(scriptExecutionContext);
m_bufferSize = 0;
m_backing->destroy();
Expand Down

0 comments on commit 9e227c0

Please sign in to comment.