From abbc595fc127298dce07ba20fc5aeeb9708c0628 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 26 Sep 2013 09:31:54 +0200 Subject: [PATCH] wined3d: Initialize the fb state pointer in state_init(). --- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/stateblock.c | 9 +++++---- dlls/wined3d/wined3d_private.h | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index bcafa9f959..ab3364de3f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4708,7 +4708,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); - if (FAILED(hr = state_init(&device->state, &device->adapter->d3d_info))) + if (FAILED(hr = state_init(&device->state, &device->fb, &device->adapter->d3d_info))) ERR("Failed to initialize device state, hr %#x.\n", hr); state_init_default(&device->state, device); device->update_state = &device->state; @@ -4972,7 +4972,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->blitter = adapter->blitter; - if (FAILED(hr = state_init(&device->state, &adapter->d3d_info))) + if (FAILED(hr = state_init(&device->state, &device->fb, &adapter->d3d_info))) { ERR("Failed to initialize device state, hr %#x.\n", hr); for (i = 0; i < sizeof(device->multistate_funcs) / sizeof(device->multistate_funcs[0]); ++i) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 6bdbb1b866..5c90c224ef 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -598,10 +598,13 @@ void state_cleanup(struct wined3d_state *state) HeapFree(GetProcessHeap(), 0, state->ps_consts_f); } -HRESULT state_init(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info) +HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, + const struct wined3d_d3d_info *d3d_info) { unsigned int i; + state->fb = fb; + for (i = 0; i < LIGHTMAP_SIZE; i++) { list_init(&state->light_map[i]); @@ -1199,8 +1202,6 @@ void state_init_default(struct wined3d_state *state, struct wined3d_device *devi state->transforms[WINED3D_TS_WORLD_MATRIX(i)] = identity; } - state->fb = &device->fb; - TRACE("Render states\n"); /* Render states: */ state->render_states[WINED3D_RS_ZENABLE] = WINED3D_ZB_TRUE; @@ -1386,7 +1387,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, stateblock->ref = 1; stateblock->device = device; - if (FAILED(hr = state_init(&stateblock->state, d3d_info))) + if (FAILED(hr = state_init(&stateblock->state, NULL, d3d_info))) return hr; if (FAILED(hr = stateblock_allocate_shader_constants(stateblock))) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5525dd9dc8..515079ae87 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2447,7 +2447,8 @@ struct wined3d_stateblock void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; -HRESULT state_init(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info) DECLSPEC_HIDDEN; +HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb, + const struct wined3d_d3d_info *d3d_info) DECLSPEC_HIDDEN; void state_init_default(struct wined3d_state *state, struct wined3d_device *device) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;