Fixed bug 3336 - Failure to build with MinGW-w64
authorSam Lantinga <slouken@libsdl.org>
Sat, 01 Oct 2016 10:28:00 -0700
changeset 103936cf7d55773b3
parent 10392 1122571639b6
child 10394 c65f7a25fb0e
Fixed bug 3336 - Failure to build with MinGW-w64

Kai Sterker
There are already patches available from mingw64 that fix the issue

https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-SDL2

With those applied, I could compile SDL2 without problems. But of course, it would be preferable if SDL built cleanly from source.
include/SDL_stdinc.h
src/render/direct3d11/SDL_render_d3d11.c
     1.1 --- a/include/SDL_stdinc.h	Sat Oct 01 10:08:34 2016 -0700
     1.2 +++ b/include/SDL_stdinc.h	Sat Oct 01 10:28:00 2016 -0700
     1.3 @@ -94,6 +94,13 @@
     1.4  #define SDL_TABLESIZE(table)    SDL_arraysize(table)
     1.5  
     1.6  /**
     1.7 + *  Macro useful for building other macros with strings in them
     1.8 + *
     1.9 + *  e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
    1.10 + */
    1.11 +#define SDL_STRINGIFY_ARG(arg)  #arg
    1.12 +
    1.13 +/**
    1.14   *  \name Cast operators
    1.15   *
    1.16   *  Use proper C++ casts when compiled as C++ to be compatible with the option
     2.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Sat Oct 01 10:08:34 2016 -0700
     2.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Sat Oct 01 10:28:00 2016 -0700
     2.3 @@ -51,6 +51,8 @@
     2.4  #endif  /* __WINRT__ */
     2.5  
     2.6  
     2.7 +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
     2.8 +
     2.9  #define SAFE_RELEASE(X) if ((X)) { IUnknown_Release(SDL_static_cast(IUnknown*, X)); X = NULL; }
    2.10  
    2.11  
    2.12 @@ -137,13 +139,27 @@
    2.13  
    2.14  
    2.15  /* Defined here so we don't have to include uuid.lib */
    2.16 +#ifndef __IDXGIFactory2_INTERFACE_DEFINED__
    2.17  static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
    2.18 +#endif
    2.19 +#ifndef __IDXGIDevice1_INTERFACE_DEFINED__
    2.20  static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
    2.21 +#endif
    2.22 +#ifndef __IDXGIDevice3_INTERFACE_DEFINED__
    2.23  static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
    2.24 +#endif
    2.25 +#ifndef __ID3D11Texture2D_INTERFACE_DEFINED__
    2.26  static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
    2.27 +#endif
    2.28 +#ifndef __ID3D11Device1_INTERFACE_DEFINED__
    2.29  static const GUID IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } };
    2.30 +#endif
    2.31 +#ifndef __ID3D11DeviceContext1_INTERFACE_DEFINED__
    2.32  static const GUID IID_ID3D11DeviceContext1 = { 0xbb2c6faa, 0xb5fb, 0x4082, { 0x8e, 0x6b, 0x38, 0x8b, 0x8c, 0xfa, 0x90, 0xe1 } };
    2.33 +#endif
    2.34 +#ifndef __ID3D11Debug_INTERFACE_DEFINED__
    2.35  static const GUID IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x36, 0x1e, 0x46, 0x92, 0xdc, 0x57, 0x60 } };
    2.36 +#endif
    2.37  
    2.38  /* Direct3D 11.x shaders
    2.39  
    2.40 @@ -961,7 +977,7 @@
    2.41      blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
    2.42      result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, blendStateOutput);
    2.43      if (FAILED(result)) {
    2.44 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBlendState", result);
    2.45 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result);
    2.46          return result;
    2.47      }
    2.48  
    2.49 @@ -1043,14 +1059,14 @@
    2.50  
    2.51      result = CreateDXGIFactoryFunc(&IID_IDXGIFactory2, &data->dxgiFactory);
    2.52      if (FAILED(result)) {
    2.53 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory", result);
    2.54 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("CreateDXGIFactory"), result);
    2.55          goto done;
    2.56      }
    2.57  
    2.58      /* FIXME: Should we use the default adapter? */
    2.59      result = IDXGIFactory2_EnumAdapters(data->dxgiFactory, 0, &data->dxgiAdapter);
    2.60      if (FAILED(result)) {
    2.61 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
    2.62 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
    2.63          goto done;
    2.64      }
    2.65  
    2.66 @@ -1079,25 +1095,25 @@
    2.67          &d3dContext /* Returns the device immediate context. */
    2.68          );
    2.69      if (FAILED(result)) {
    2.70 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
    2.71 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("D3D11CreateDevice"), result);
    2.72          goto done;
    2.73      }
    2.74  
    2.75      result = ID3D11Device_QueryInterface(d3dDevice, &IID_ID3D11Device1, &data->d3dDevice);
    2.76      if (FAILED(result)) {
    2.77 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to ID3D11Device1", result);
    2.78 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to ID3D11Device1"), result);
    2.79          goto done;
    2.80      }
    2.81  
    2.82      result = ID3D11DeviceContext_QueryInterface(d3dContext, &IID_ID3D11DeviceContext1, &data->d3dContext);
    2.83      if (FAILED(result)) {
    2.84 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext to ID3D11DeviceContext1", result);
    2.85 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext to ID3D11DeviceContext1"), result);
    2.86          goto done;
    2.87      }
    2.88  
    2.89      result = ID3D11Device_QueryInterface(d3dDevice, &IID_IDXGIDevice1, &dxgiDevice);
    2.90      if (FAILED(result)) {
    2.91 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to IDXGIDevice1", result);
    2.92 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device to IDXGIDevice1"), result);
    2.93          goto done;
    2.94      }
    2.95  
    2.96 @@ -1106,7 +1122,7 @@
    2.97       */
    2.98      result = IDXGIDevice1_SetMaximumFrameLatency(dxgiDevice, 1);
    2.99      if (FAILED(result)) {
   2.100 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result);
   2.101 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIDevice1::SetMaximumFrameLatency"), result);
   2.102          goto done;
   2.103      }
   2.104  
   2.105 @@ -1135,7 +1151,7 @@
   2.106              break;
   2.107  
   2.108          default:
   2.109 -            SDL_SetError(__FUNCTION__ ", Unexpected feature level: %d", data->featureLevel);
   2.110 +            SDL_SetError("%s, Unexpected feature level: %d", __FUNCTION__, data->featureLevel);
   2.111              result = E_FAIL;
   2.112              goto done;
   2.113      }
   2.114 @@ -1148,7 +1164,7 @@
   2.115          &data->vertexShader
   2.116          );
   2.117      if (FAILED(result)) {
   2.118 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateVertexShader", result);
   2.119 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result);
   2.120          goto done;
   2.121      }
   2.122  
   2.123 @@ -1161,7 +1177,7 @@
   2.124          &data->inputLayout
   2.125          );
   2.126      if (FAILED(result)) {
   2.127 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateInputLayout", result);
   2.128 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result);
   2.129          goto done;
   2.130      }
   2.131  
   2.132 @@ -1173,7 +1189,7 @@
   2.133          &data->colorPixelShader
   2.134          );
   2.135      if (FAILED(result)) {
   2.136 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['color' shader]", result);
   2.137 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['color' shader]"), result);
   2.138          goto done;
   2.139      }
   2.140  
   2.141 @@ -1184,7 +1200,7 @@
   2.142          &data->texturePixelShader
   2.143          );
   2.144      if (FAILED(result)) {
   2.145 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['textures' shader]", result);
   2.146 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['textures' shader]"), result);
   2.147          goto done;
   2.148      }
   2.149  
   2.150 @@ -1195,7 +1211,7 @@
   2.151          &data->yuvPixelShader
   2.152          );
   2.153      if (FAILED(result)) {
   2.154 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['yuv' shader]", result);
   2.155 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['yuv' shader]"), result);
   2.156          goto done;
   2.157      }
   2.158  
   2.159 @@ -1210,7 +1226,7 @@
   2.160          &data->vertexShaderConstants
   2.161          );
   2.162      if (FAILED(result)) {
   2.163 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result);
   2.164 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex shader constants]"), result);
   2.165          goto done;
   2.166      }
   2.167  
   2.168 @@ -1230,7 +1246,7 @@
   2.169          &data->nearestPixelSampler
   2.170          );
   2.171      if (FAILED(result)) {
   2.172 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [nearest-pixel filter]", result);
   2.173 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [nearest-pixel filter]"), result);
   2.174          goto done;
   2.175      }
   2.176  
   2.177 @@ -1240,7 +1256,7 @@
   2.178          &data->linearSampler
   2.179          );
   2.180      if (FAILED(result)) {
   2.181 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [linear filter]", result);
   2.182 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateSamplerState [linear filter]"), result);
   2.183          goto done;
   2.184      }
   2.185  
   2.186 @@ -1258,14 +1274,14 @@
   2.187      rasterDesc.SlopeScaledDepthBias = 0.0f;
   2.188      result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->mainRasterizer);
   2.189      if (FAILED(result)) {
   2.190 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [main rasterizer]", result);
   2.191 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [main rasterizer]"), result);
   2.192          goto done;
   2.193      }
   2.194  
   2.195      rasterDesc.ScissorEnable = TRUE;
   2.196      result = ID3D11Device_CreateRasterizerState(data->d3dDevice, &rasterDesc, &data->clippedRasterizer);
   2.197      if (FAILED(result)) {
   2.198 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [clipped rasterizer]", result);
   2.199 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRasterizerState [clipped rasterizer]"), result);
   2.200          goto done;
   2.201      }
   2.202  
   2.203 @@ -1444,7 +1460,7 @@
   2.204              &data->swapChain
   2.205              );
   2.206          if (FAILED(result)) {
   2.207 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForCoreWindow", result);
   2.208 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForCoreWindow"), result);
   2.209              goto done;
   2.210          }
   2.211      } else if (usingXAML) {
   2.212 @@ -1454,18 +1470,18 @@
   2.213              NULL,
   2.214              &data->swapChain);
   2.215          if (FAILED(result)) {
   2.216 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForComposition", result);
   2.217 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForComposition"), result);
   2.218              goto done;
   2.219          }
   2.220  
   2.221  #if WINAPI_FAMILY == WINAPI_FAMILY_APP
   2.222          result = ISwapChainBackgroundPanelNative_SetSwapChain(WINRT_GlobalSwapChainBackgroundPanelNative, (IDXGISwapChain *) data->swapChain);
   2.223          if (FAILED(result)) {
   2.224 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ISwapChainBackgroundPanelNative::SetSwapChain", result);
   2.225 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ISwapChainBackgroundPanelNative::SetSwapChain"), result);
   2.226              goto done;
   2.227          }
   2.228  #else
   2.229 -        SDL_SetError(__FUNCTION__ ", XAML support is not yet available for Windows Phone");
   2.230 +        SDL_SetError(SDL_COMPOSE_ERROR("XAML support is not yet available for Windows Phone"));
   2.231          result = E_FAIL;
   2.232          goto done;
   2.233  #endif
   2.234 @@ -1484,7 +1500,7 @@
   2.235              &data->swapChain
   2.236              );
   2.237          if (FAILED(result)) {
   2.238 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForHwnd", result);
   2.239 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory2::CreateSwapChainForHwnd"), result);
   2.240              goto done;
   2.241          }
   2.242  
   2.243 @@ -1545,7 +1561,7 @@
   2.244               */
   2.245              goto done;
   2.246          } else if (FAILED(result)) {
   2.247 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::ResizeBuffers", result);
   2.248 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::ResizeBuffers"), result);
   2.249              goto done;
   2.250          }
   2.251  #endif
   2.252 @@ -1576,7 +1592,7 @@
   2.253      if (data->swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) {
   2.254          result = IDXGISwapChain1_SetRotation(data->swapChain, data->rotation);
   2.255          if (FAILED(result)) {
   2.256 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::SetRotation", result);
   2.257 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::SetRotation"), result);
   2.258              goto done;
   2.259          }
   2.260      }
   2.261 @@ -1588,7 +1604,7 @@
   2.262          &backBuffer
   2.263          );
   2.264      if (FAILED(result)) {
   2.265 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::GetBuffer [back-buffer]", result);
   2.266 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::GetBuffer [back-buffer]"), result);
   2.267          goto done;
   2.268      }
   2.269  
   2.270 @@ -1599,7 +1615,7 @@
   2.271          &data->mainRenderTargetView
   2.272          );
   2.273      if (FAILED(result)) {
   2.274 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device::CreateRenderTargetView", result);
   2.275 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateRenderTargetView"), result);
   2.276          goto done;
   2.277      }
   2.278  
   2.279 @@ -1747,7 +1763,7 @@
   2.280          );
   2.281      if (FAILED(result)) {
   2.282          D3D11_DestroyTexture(renderer, texture);
   2.283 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result);
   2.284 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
   2.285          return -1;
   2.286      }
   2.287  
   2.288 @@ -1765,7 +1781,7 @@
   2.289              );
   2.290          if (FAILED(result)) {
   2.291              D3D11_DestroyTexture(renderer, texture);
   2.292 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result);
   2.293 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
   2.294              return -1;
   2.295          }
   2.296  
   2.297 @@ -1776,7 +1792,7 @@
   2.298              );
   2.299          if (FAILED(result)) {
   2.300              D3D11_DestroyTexture(renderer, texture);
   2.301 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result);
   2.302 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
   2.303              return -1;
   2.304          }
   2.305      }
   2.306 @@ -1792,7 +1808,7 @@
   2.307          );
   2.308      if (FAILED(result)) {
   2.309          D3D11_DestroyTexture(renderer, texture);
   2.310 -        WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result);
   2.311 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
   2.312          return -1;
   2.313      }
   2.314  
   2.315 @@ -1804,7 +1820,7 @@
   2.316              );
   2.317          if (FAILED(result)) {
   2.318              D3D11_DestroyTexture(renderer, texture);
   2.319 -            WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result);
   2.320 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
   2.321              return -1;
   2.322          }
   2.323          result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
   2.324 @@ -1814,7 +1830,7 @@
   2.325              );
   2.326          if (FAILED(result)) {
   2.327              D3D11_DestroyTexture(renderer, texture);
   2.328 -            WIN_SetErrorFromHRESULT(__FUNCTION__ "ID3D11Device1::CreateShaderResourceView", result);
   2.329 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
   2.330              return -1;
   2.331          }
   2.332      }
   2.333 @@ -1831,7 +1847,7 @@
   2.334              &textureData->mainTextureRenderTargetView);
   2.335          if (FAILED(result)) {
   2.336              D3D11_DestroyTexture(renderer, texture);
   2.337 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result);
   2.338 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
   2.339              return -1;
   2.340          }
   2.341      }
   2.342 @@ -1887,7 +1903,7 @@
   2.343          NULL,
   2.344          &stagingTexture);
   2.345      if (FAILED(result)) {
   2.346 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result);
   2.347 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
   2.348          return -1;
   2.349      }
   2.350  
   2.351 @@ -1900,7 +1916,7 @@
   2.352          &textureMemory
   2.353          );
   2.354      if (FAILED(result)) {
   2.355 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result);
   2.356 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
   2.357          SAFE_RELEASE(stagingTexture);
   2.358          return -1;
   2.359      }
   2.360 @@ -2062,7 +2078,7 @@
   2.361          NULL,
   2.362          &textureData->stagingTexture);
   2.363      if (FAILED(result)) {
   2.364 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result);
   2.365 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
   2.366          return -1;
   2.367      }
   2.368  
   2.369 @@ -2075,7 +2091,7 @@
   2.370          &textureMemory
   2.371          );
   2.372      if (FAILED(result)) {
   2.373 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result);
   2.374 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
   2.375          SAFE_RELEASE(textureData->stagingTexture);
   2.376          return -1;
   2.377      }
   2.378 @@ -2359,7 +2375,7 @@
   2.379              &mappedResource
   2.380              );
   2.381          if (FAILED(result)) {
   2.382 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [vertex buffer]", result);
   2.383 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result);
   2.384              return -1;
   2.385          }
   2.386          SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes);
   2.387 @@ -2383,7 +2399,7 @@
   2.388              &rendererData->vertexBuffer
   2.389              );
   2.390          if (FAILED(result)) {
   2.391 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex buffer]", result);
   2.392 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result);
   2.393              return -1;
   2.394          }
   2.395  
   2.396 @@ -2853,7 +2869,7 @@
   2.397          &backBuffer
   2.398          );
   2.399      if (FAILED(result)) {
   2.400 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::GetBuffer [get back buffer]", result);
   2.401 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain1::GetBuffer [get back buffer]"), result);
   2.402          goto done;
   2.403      }
   2.404  
   2.405 @@ -2870,7 +2886,7 @@
   2.406          NULL,
   2.407          &stagingTexture);
   2.408      if (FAILED(result)) {
   2.409 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D [create staging texture]", result);
   2.410 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result);
   2.411          goto done;
   2.412      }
   2.413  
   2.414 @@ -2902,7 +2918,7 @@
   2.415          0,
   2.416          &textureMemory);
   2.417      if (FAILED(result)) {
   2.418 -        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext1::Map [map staging texture]", result);
   2.419 +        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
   2.420          goto done;
   2.421      }
   2.422  
   2.423 @@ -2921,7 +2937,7 @@
   2.424           * Get the error message, and attach some extra data to it.
   2.425           */
   2.426          char errorMessage[1024];
   2.427 -        SDL_snprintf(errorMessage, sizeof(errorMessage), __FUNCTION__ ", Convert Pixels failed: %s", SDL_GetError());
   2.428 +        SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", SDL_GetError());
   2.429          SDL_SetError("%s", errorMessage);
   2.430          goto done;
   2.431      }
   2.432 @@ -2991,7 +3007,7 @@
   2.433              /* We probably went through a fullscreen <-> windowed transition */
   2.434              D3D11_CreateWindowSizeDependentResources(renderer);
   2.435          } else {
   2.436 -            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain::Present", result);
   2.437 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGISwapChain::Present"), result);
   2.438          }
   2.439      }
   2.440  }