mirror of
				https://github.com/encounter/dawn-cmake.git
				synced 2025-10-27 12:10:29 +00:00 
			
		
		
		
	Fix a memory leak in metal ShaderModule.
Make the MetalFunctionData object returned by GetFunction() own a reference to the MTLFunction and release it on destruction.
This commit is contained in:
		
							parent
							
								
									1ec5782bff
								
							
						
					
					
						commit
						8f2050540d
					
				| @ -76,8 +76,9 @@ namespace backend { namespace metal { | ||||
|             const auto& module = ToBackend(builder->GetStageInfo(stage).module); | ||||
| 
 | ||||
|             const auto& entryPoint = builder->GetStageInfo(stage).entryPoint; | ||||
|             id<MTLFunction> function = | ||||
|                 module->GetFunction(entryPoint.c_str(), ToBackend(GetLayout())).function; | ||||
|             ShaderModule::MetalFunctionData data = | ||||
|                 module->GetFunction(entryPoint.c_str(), ToBackend(GetLayout())); | ||||
|             id<MTLFunction> function = data.function; | ||||
| 
 | ||||
|             switch (stage) { | ||||
|                 case nxt::ShaderStage::Vertex: | ||||
|  | ||||
| @ -34,6 +34,9 @@ namespace backend { namespace metal { | ||||
|         struct MetalFunctionData { | ||||
|             id<MTLFunction> function; | ||||
|             MTLSize localWorkgroupSize; | ||||
|             ~MetalFunctionData() { | ||||
|                 [function release]; | ||||
|             } | ||||
|         }; | ||||
|         MetalFunctionData GetFunction(const char* functionName, const PipelineLayout* layout) const; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user