Pārlūkot izejas kodu

Fix memory leak related to vertex/pixel/compute shader functions (#18998) (#19007)

Signed-off-by: Sidharth Moudgil <[email protected]>
Co-authored-by: moudgils <[email protected]>
Nicholas Lawson 1 mēnesi atpakaļ
vecāks
revīzija
fb950ddf22
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12 0
      Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp

+ 12 - 0
Gems/Atom/RHI/Metal/Code/Source/RHI/PipelineState.cpp

@@ -419,6 +419,14 @@ namespace AZ
         {
             if (m_graphicsPipelineState)
             {
+                if (m_renderPipelineDesc.vertexFunction)
+                {
+                    [m_renderPipelineDesc.vertexFunction release];
+                }
+                if (m_renderPipelineDesc.fragmentFunction)
+                {
+                    [m_renderPipelineDesc.fragmentFunction release];
+                }
                 [m_renderPipelineDesc release];
                 m_renderPipelineDesc = nil;
                 [m_graphicsPipelineState release];
@@ -427,6 +435,10 @@ namespace AZ
             
             if (m_computePipelineState)
             {
+                if (m_computePipelineDesc.computeFunction)
+                {
+                    [m_computePipelineDesc.computeFunction release];
+                }
                 [m_computePipelineDesc release];
                 m_computePipelineDesc = nil;
                 [m_computePipelineState release];