src/render/metal/SDL_render_metal.m
changeset 11746 17cc18a8dd5b
parent 11744 4d97d8cdaa90
child 11749 799404c93d48
     1.1 --- a/src/render/metal/SDL_render_metal.m	Fri Dec 08 17:43:57 2017 -0500
     1.2 +++ b/src/render/metal/SDL_render_metal.m	Fri Dec 08 18:26:26 2017 -0500
     1.3 @@ -394,14 +394,10 @@
     1.4          default: return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format));
     1.5      }
     1.6  
     1.7 -    // !!! FIXME: autorelease or nah?
     1.8      MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:mtlpixfmt
     1.9                                              width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO];
    1.10  
    1.11      id<MTLTexture> mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
    1.12 -#if !__has_feature(objc_arc)
    1.13 -    [mtltexdesc release];
    1.14 -#endif
    1.15      if (mtltexture == nil) {
    1.16          return SDL_SetError("Texture allocation failed");
    1.17      }
    1.18 @@ -734,11 +730,6 @@
    1.19      [data.mtlcmdencoder endEncoding];
    1.20      [data.mtlcmdbuffer presentDrawable:data.mtlbackbuffer];
    1.21      [data.mtlcmdbuffer commit];
    1.22 -#if !__has_feature(objc_arc)
    1.23 -    [data.mtlcmdencoder release];
    1.24 -    [data.mtlcmdbuffer release];
    1.25 -    [data.mtlbackbuffer release];
    1.26 -#endif
    1.27      data.mtlcmdencoder = nil;
    1.28      data.mtlcmdbuffer = nil;
    1.29      data.mtlbackbuffer = nil;
    1.30 @@ -761,17 +752,14 @@
    1.31      if (renderer->driverdata) {
    1.32          METAL_RenderData *data = CFBridgingRelease(renderer->driverdata);
    1.33  
    1.34 -#if !__has_feature(objc_arc)
    1.35 -        if (data.mtlbackbuffer != nil) {
    1.36 -            [data.mtlbackbuffer release];
    1.37 -        }
    1.38          if (data.mtlcmdencoder != nil) {
    1.39              [data.mtlcmdencoder endEncoding];
    1.40 -            [data.mtlcmdencoder release];
    1.41          }
    1.42 -        if (data.mtlcmdbuffer != nil) {
    1.43 -            [data.mtlcmdbuffer release];
    1.44 -        }
    1.45 +
    1.46 +#if !__has_feature(objc_arc)
    1.47 +        [data.mtlbackbuffer release];
    1.48 +        [data.mtlcmdencoder release];
    1.49 +        [data.mtlcmdbuffer release];
    1.50          [data.mtlcmdqueue release];
    1.51          for (int i = 0; i < 4; i++) {
    1.52              [data.mtlpipelineprims[i] release];
    1.53 @@ -784,9 +772,9 @@
    1.54          [data.mtldevice release];
    1.55          [data.mtlpassdesc release];
    1.56          [data.mtllayer release];
    1.57 -        [data release];
    1.58  #endif
    1.59      }
    1.60 +
    1.61      SDL_free(renderer);
    1.62  }}
    1.63