diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index fdce2e3f4c..58b48af2c4 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -740,8 +740,12 @@ static MetalLibraryFunction METAL_INTERNAL_CompileShader( id function; if (format == SDL_GPU_SHADERFORMAT_MSL) { + NSString *codeString = [[NSString alloc] + initWithBytes:code + length:codeSize + encoding:NSUTF8StringEncoding]; library = [renderer->device - newLibraryWithSource:@((const char *)code) + newLibraryWithSource:codeString options:nil error:&error]; } else if (format == SDL_GPU_SHADERFORMAT_METALLIB) {