From cd96c59d9168fbda25536d328edb24c0bc0e5139 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Wed, 8 Jun 2011 00:27:15 +0200 Subject: [PATCH] wined3d: Track framebuffer changes. --- dlls/wined3d/context.c | 7 ++++--- dlls/wined3d/device.c | 4 ++++ dlls/wined3d/surface.c | 2 ++ dlls/wined3d/swapchain.c | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index cddd5f0d89a..94ed896f82e 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2061,6 +2061,7 @@ void context_apply_blit_state(struct wined3d_context *context, struct wined3d_de LEAVE_GL(); SetupForBlit(device, context); + context_invalidate_state(context, STATE_FRAMEBUFFER, device->StateTable); } static BOOL context_validate_rt_config(UINT rt_count, @@ -2122,6 +2123,9 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d } LEAVE_GL(); + + /* TODO: This is not necessary if the rts are the device's current targets */ + context_invalidate_state(context, STATE_FRAMEBUFFER, device->StateTable); } else { @@ -2265,9 +2269,6 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de state_table[rep].apply(rep, device->stateBlock, context); } - /* FIXME */ - state_table[STATE_FRAMEBUFFER].apply(STATE_FRAMEBUFFER, device->stateBlock, context); - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { context_check_fbo_status(context, GL_FRAMEBUFFER); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f3fceac20d1..e9a98c4d100 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5129,6 +5129,8 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, device_invalidate_state(device, STATE_SCISSORRECT); } + device_invalidate_state(device, STATE_FRAMEBUFFER); + return WINED3D_OK; } @@ -5179,6 +5181,8 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st device_invalidate_state(device, STATE_RENDER(WINED3DRS_DEPTHBIAS)); } + device_invalidate_state(device, STATE_FRAMEBUFFER); + return WINED3D_OK; } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 8fbad095968..d4151593223 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3993,6 +3993,7 @@ static void read_from_framebuffer_texture(struct wined3d_surface *surface, BOOL */ context = context_acquire(device, surface); gl_info = context->gl_info; + device_invalidate_state(device, STATE_FRAMEBUFFER); surface_prepare_texture(surface, gl_info, srgb); surface_bind_and_dirtify(surface, gl_info, srgb); @@ -5104,6 +5105,7 @@ static void surface_blt_fbo(struct wined3d_device *device, const WINED3DTEXTUREF context_set_draw_buffer(context, GL_COLOR_ATTACHMENT0); } context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER); + device_invalidate_state(device, STATE_FRAMEBUFFER); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); device_invalidate_state(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE)); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 2242f66b439..dc1800a9ead 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -309,6 +309,7 @@ static void swapchain_blit(struct wined3d_swapchain *swapchain, context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL); context_set_draw_buffer(context, GL_BACK); + device_invalidate_state(device, STATE_FRAMEBUFFER); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); device_invalidate_state(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE)); -- 2.11.4.GIT