Metal: Don't crash on invalid shaders

MetalFunctionData::function was uninitialized when an error happened
its destructor would run, calling release on a garbage pointer.

Bug:

Change-Id: Ib72038da2a07b4e0f27ec929ec08f303c54dcc62
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17760
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-03-27 16:50:11 +00:00 committed by Commit Bot service account
parent ffd94da5f1
commit 12944c84c9

View File

@ -36,7 +36,7 @@ namespace dawn_native { namespace metal {
const ShaderModuleDescriptor* descriptor); const ShaderModuleDescriptor* descriptor);
struct MetalFunctionData { struct MetalFunctionData {
id<MTLFunction> function; id<MTLFunction> function = nil;
MTLSize localWorkgroupSize; MTLSize localWorkgroupSize;
bool needsStorageBufferLength; bool needsStorageBufferLength;
~MetalFunctionData() { ~MetalFunctionData() {