wined3d: Propagate HRESULTs in context creation functions.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-05-08 12:04:06 +02:00 committed by Alexandre Julliard
parent 08d630e250
commit ad5a448d7e
2 changed files with 6 additions and 4 deletions

View File

@ -4277,17 +4277,18 @@ static void adapter_gl_destroy_device(struct wined3d_device *device)
static HRESULT adapter_gl_create_context(struct wined3d_swapchain *swapchain, struct wined3d_context **context) static HRESULT adapter_gl_create_context(struct wined3d_swapchain *swapchain, struct wined3d_context **context)
{ {
struct wined3d_context_gl *context_gl; struct wined3d_context_gl *context_gl;
HRESULT hr;
TRACE("swapchain %p, context %p.\n", swapchain, context); TRACE("swapchain %p, context %p.\n", swapchain, context);
if (!(context_gl = heap_alloc_zero(sizeof(*context_gl)))) if (!(context_gl = heap_alloc_zero(sizeof(*context_gl))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(wined3d_context_gl_init(context_gl, swapchain))) if (FAILED(hr = wined3d_context_gl_init(context_gl, swapchain)))
{ {
WARN("Failed to initialise context.\n"); WARN("Failed to initialise context.\n");
heap_free(context_gl); heap_free(context_gl);
return E_FAIL; return hr;
} }
TRACE("Created context %p.\n", context_gl); TRACE("Created context %p.\n", context_gl);

View File

@ -291,17 +291,18 @@ static void adapter_vk_destroy_device(struct wined3d_device *device)
static HRESULT adapter_vk_create_context(struct wined3d_swapchain *swapchain, struct wined3d_context **context) static HRESULT adapter_vk_create_context(struct wined3d_swapchain *swapchain, struct wined3d_context **context)
{ {
struct wined3d_context *context_vk; struct wined3d_context *context_vk;
HRESULT hr;
TRACE("swapchain %p, context %p.\n", swapchain, context); TRACE("swapchain %p, context %p.\n", swapchain, context);
if (!(context_vk = heap_alloc_zero(sizeof(*context_vk)))) if (!(context_vk = heap_alloc_zero(sizeof(*context_vk))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(wined3d_context_vk_init(context_vk, swapchain))) if (FAILED(hr = wined3d_context_vk_init(context_vk, swapchain)))
{ {
WARN("Failed to initialise context.\n"); WARN("Failed to initialise context.\n");
heap_free(context_vk); heap_free(context_vk);
return E_FAIL; return hr;
} }
TRACE("Created context %p.\n", context_vk); TRACE("Created context %p.\n", context_vk);