wined3d: Pass a struct wined3d_fb_state * to context_apply_clear_state.

This commit is contained in:
Stefan Dösinger 2011-07-02 11:29:28 +02:00 committed by Alexandre Julliard
parent 053071e343
commit 718c614937
3 changed files with 14 additions and 13 deletions

View File

@ -2083,19 +2083,20 @@ static BOOL context_validate_rt_config(UINT rt_count,
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device, BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device,
UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil) UINT rt_count, const struct wined3d_fb_state *fb)
{ {
const struct StateEntry *state_table = device->StateTable; const struct StateEntry *state_table = device->StateTable;
DWORD rt_mask = 0; DWORD rt_mask = 0;
UINT i; UINT i;
struct wined3d_surface **rts = fb->render_targets;
if (!context_validate_rt_config(rt_count, rts, depth_stencil)) if (!context_validate_rt_config(rt_count, rts, fb->depth_stencil))
return FALSE; return FALSE;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{ {
context_validate_onscreen_formats(device, context, depth_stencil); context_validate_onscreen_formats(device, context, fb->depth_stencil);
ENTER_GL(); ENTER_GL();
@ -2112,7 +2113,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
context->blit_targets[i] = NULL; context->blit_targets[i] = NULL;
++i; ++i;
} }
context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, depth_stencil, SFLAG_INTEXTURE); context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, fb->depth_stencil, SFLAG_INTEXTURE);
glReadBuffer(GL_NONE); glReadBuffer(GL_NONE);
checkGLcall("glReadBuffer"); checkGLcall("glReadBuffer");
} }
@ -2124,7 +2125,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
LEAVE_GL(); LEAVE_GL();
/* TODO: This is not necessary if the rts are the device's current targets */ /* TODO: This is not necessary if the framebuffer is the device's current framebuffer */
context_invalidate_state(context, STATE_FRAMEBUFFER, device->StateTable); context_invalidate_state(context, STATE_FRAMEBUFFER, device->StateTable);
} }
else else

View File

@ -685,7 +685,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
return WINED3D_OK; return WINED3D_OK;
} }
if (!context_apply_clear_state(context, device, rt_count, fb->render_targets, fb->depth_stencil)) if (!context_apply_clear_state(context, device, rt_count, fb))
{ {
context_release(context); context_release(context);
WARN("Failed to apply clear state, skipping clear.\n"); WARN("Failed to apply clear state, skipping clear.\n");

View File

@ -1130,6 +1130,12 @@ struct wined3d_context
GLuint dummy_arbfp_prog; GLuint dummy_arbfp_prog;
}; };
struct wined3d_fb_state
{
struct wined3d_surface **render_targets;
struct wined3d_surface *depth_stencil;
};
typedef void (*APPLYSTATEFUNC)(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *ctx); typedef void (*APPLYSTATEFUNC)(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *ctx);
struct StateEntry struct StateEntry
@ -1223,7 +1229,7 @@ void context_alloc_occlusion_query(struct wined3d_context *context,
struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
void context_apply_blit_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN; void context_apply_blit_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN;
BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device, BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device,
UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN;
BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN;
void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN; struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
@ -1613,12 +1619,6 @@ void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
/* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */ /* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */
#define WINED3DCREATE_MULTITHREADED 0x00000004 #define WINED3DCREATE_MULTITHREADED 0x00000004
struct wined3d_fb_state
{
struct wined3d_surface **render_targets;
struct wined3d_surface *depth_stencil;
};
struct wined3d_device struct wined3d_device
{ {
LONG ref; LONG ref;