Skip to content

Commit

Permalink
WinRT: utilized SDL_SetError's return value in the d3d11 renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLudwig committed Dec 25, 2013
1 parent 43e27aa commit 10f2de1
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/render/direct3d11/SDL_render_d3d11.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}

//
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 10f2de1

Please sign in to comment.