Metal: Fix leak of MTLVertexDescriptor when using vertex pulling

Bug: dawn:1175
Change-Id: I1fd833fef830de4165a397e07c3ddaae0d7bdca8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79762
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2022-02-09 15:56:32 +00:00 committed by Dawn LUCI CQ
parent 189b0cec37
commit 9fc28cf3b6
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ namespace dawn::native::metal {
private: private:
using RenderPipelineBase::RenderPipelineBase; using RenderPipelineBase::RenderPipelineBase;
MTLVertexDescriptor* MakeVertexDesc(); NSRef<MTLVertexDescriptor> MakeVertexDesc();
MTLPrimitiveType mMtlPrimitiveTopology; MTLPrimitiveType mMtlPrimitiveTopology;
MTLWinding mMtlFrontFace; MTLWinding mMtlFrontFace;

View File

@ -436,7 +436,7 @@ namespace dawn::native::metal {
return mStagesRequiringStorageBufferLength; return mStagesRequiringStorageBufferLength;
} }
MTLVertexDescriptor* RenderPipeline::MakeVertexDesc() { NSRef<MTLVertexDescriptor> RenderPipeline::MakeVertexDesc() {
MTLVertexDescriptor* mtlVertexDescriptor = [MTLVertexDescriptor new]; MTLVertexDescriptor* mtlVertexDescriptor = [MTLVertexDescriptor new];
// Vertex buffers are packed after all the buffers for the bind groups. // Vertex buffers are packed after all the buffers for the bind groups.
@ -491,7 +491,7 @@ namespace dawn::native::metal {
[attribDesc release]; [attribDesc release];
} }
return mtlVertexDescriptor; return AcquireNSRef(mtlVertexDescriptor);
} }
void RenderPipeline::InitializeAsync(Ref<RenderPipelineBase> renderPipeline, void RenderPipeline::InitializeAsync(Ref<RenderPipelineBase> renderPipeline,