st/nine: Integrate nine_pipe_context_clear to nine_context_clear

Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2016-10-28 19:19:39 +02:00
parent b95205b1f2
commit eb884a4ac2
6 changed files with 28 additions and 33 deletions

View file

@ -498,12 +498,10 @@ NineDevice9_dtor( struct NineDevice9 *This )
DBG("This=%p\n", This);
if (This->context.pipe && This->context.cso)
nine_pipe_context_clear(This);
nine_ff_fini(This);
nine_state_destroy_sw(This);
nine_state_clear(&This->state, TRUE);
nine_context_clear(&This->context);
nine_context_clear(This);
if (This->vertex_uploader)
u_upload_destroy(This->vertex_uploader);
@ -871,9 +869,8 @@ NineDevice9_Reset( struct NineDevice9 *This,
break;
}
nine_pipe_context_clear(This);
nine_state_clear(&This->state, TRUE);
nine_context_clear(&This->context);
nine_context_clear(This);
NineDevice9_SetDefaultState(This, TRUE);
NineDevice9_SetRenderTarget(

View file

@ -257,9 +257,8 @@ NineDevice9Ex_Reset( struct NineDevice9Ex *This,
break;
}
nine_pipe_context_clear((struct NineDevice9 *)This);
nine_state_clear(&This->base.state, TRUE);
nine_context_clear(&This->base.context);
nine_context_clear(&This->base);
NineDevice9_SetDefaultState((struct NineDevice9 *)This, TRUE);
NineDevice9_SetRenderTarget(

View file

@ -249,28 +249,6 @@ nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss)
cso_single_sampler(ctx, PIPE_SHADER_VERTEX, idx - NINE_SAMPLER_VS(0), &samp);
}
void
nine_pipe_context_clear(struct NineDevice9 *This)
{
struct pipe_context *pipe = NineDevice9_GetPipe(This);
struct cso_context *cso = This->context.cso;
pipe->bind_vs_state(pipe, NULL);
pipe->bind_fs_state(pipe, NULL);
/* Don't unbind constant buffers, they're device-private and
* do not change on Reset.
*/
cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
cso_set_sampler_views(cso, PIPE_SHADER_VERTEX, 0, NULL);
cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
pipe->set_vertex_buffers(pipe, 0, This->caps.MaxStreams, NULL);
pipe->set_index_buffer(pipe, NULL);
}
const enum pipe_format nine_d3d9_to_pipe_format_map[120] =
{
[D3DFMT_UNKNOWN] = PIPE_FORMAT_NONE,

View file

@ -42,8 +42,6 @@ void nine_convert_rasterizer_state(struct NineDevice9 *, struct pipe_rasterizer_
void nine_convert_blend_state(struct pipe_blend_state *, const DWORD *);
void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
void nine_pipe_context_clear(struct NineDevice9 *);
#define is_ATI1_ATI2(format) (format == PIPE_FORMAT_RGTC1_UNORM || format == PIPE_FORMAT_RGTC2_UNORM)
static inline void

View file

@ -2419,10 +2419,33 @@ nine_state_clear(struct nine_state *state, const boolean device)
}
void
nine_context_clear(struct nine_context *context)
nine_context_clear(struct NineDevice9 *device)
{
struct nine_context *context = &device->context;
struct pipe_context *pipe = context->pipe;
struct cso_context *cso = context->cso;
unsigned i;
/* Early device ctor failure. Nothing to do */
if (!pipe || !cso)
return;
pipe->bind_vs_state(pipe, NULL);
pipe->bind_fs_state(pipe, NULL);
/* Don't unbind constant buffers, they're device-private and
* do not change on Reset.
*/
cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
cso_set_sampler_views(cso, PIPE_SHADER_VERTEX, 0, NULL);
cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
pipe->set_vertex_buffers(pipe, 0, device->caps.MaxStreams, NULL);
pipe->set_index_buffer(pipe, NULL);
for (i = 0; i < ARRAY_SIZE(context->rt); ++i)
nine_bind(&context->rt[i], NULL);
nine_bind(&context->ds, NULL);

View file

@ -510,7 +510,7 @@ void nine_state_restore_non_cso(struct NineDevice9 *device);
void nine_state_set_defaults(struct NineDevice9 *, const D3DCAPS9 *,
boolean is_reset);
void nine_state_clear(struct nine_state *, const boolean device);
void nine_context_clear(struct nine_context *);
void nine_context_clear(struct NineDevice9 *);
void nine_state_init_sw(struct NineDevice9 *device);
void nine_state_prepare_draw_sw(struct NineDevice9 *device,