From 10f2de1e69faff4890b958cc647764e6b9d36542 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Wed, 25 Dec 2013 12:52:16 -0500 Subject: [PATCH] WinRT: utilized SDL_SetError's return value in the d3d11 renderer --- src/render/direct3d11/SDL_render_d3d11.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/render/direct3d11/SDL_render_d3d11.cpp b/src/render/direct3d11/SDL_render_d3d11.cpp index c17326fb9756a..9041a9dcd9a36 100644 --- a/src/render/direct3d11/SDL_render_d3d11.cpp +++ b/src/render/direct3d11/SDL_render_d3d11.cpp @@ -973,9 +973,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) HRESULT result; DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format); if (textureFormat == SDL_PIXELFORMAT_UNKNOWN) { - SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified", + return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified", __FUNCTION__, texture->format); - return -1; } textureData = new D3D11_TextureData; @@ -1106,8 +1105,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, // An error is already set. Attach some info to it, then return to // the caller. std::string errorMessage = string(__FUNCTION__ ", Lock Texture Failed: ") + SDL_GetError(); - SDL_SetError(errorMessage.c_str()); - return -1; + return SDL_SetError(errorMessage.c_str()); } // Copy pixel data to the locked texture's memory: @@ -1135,8 +1133,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, HRESULT result = S_OK; if (textureData->stagingTexture) { - SDL_SetError("texture is already locked"); - return -1; + return SDL_SetError("texture is already locked"); } // Create a 'staging' texture, which will be used to write to a portion @@ -1228,8 +1225,7 @@ D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) if (!textureData->mainTextureRenderTargetView) { std::string errorMessage = string(__FUNCTION__) + ": specified texture is not a render target"; - SDL_SetError(errorMessage.c_str()); - return -1; + return SDL_SetError(errorMessage.c_str()); } rendererData->currentOffscreenRenderTargetView = textureData->mainTextureRenderTargetView; @@ -1268,8 +1264,7 @@ D3D11_UpdateViewport(SDL_Renderer * renderer) XMStoreFloat4x4(&data->vertexShaderConstantsData.projection, XMMatrixRotationZ(-XM_PIDIV2)); break; default: - SDL_SetError("An unknown DisplayOrientation is being used"); - return -1; + return SDL_SetError("An unknown DisplayOrientation is being used"); } // @@ -1892,8 +1887,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, // When SDL_ConvertPixels fails, it'll have already set the format. // Get the error message, and attach some extra data to it. std::string errorMessage = string(__FUNCTION__ ", Convert Pixels failed: ") + SDL_GetError(); - SDL_SetError(errorMessage.c_str()); - return -1; + return SDL_SetError(errorMessage.c_str()); } // Unmap the texture: