diff options
author | Axel Davy <[email protected]> | 2016-10-28 19:19:39 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:22 +0100 |
commit | eb884a4ac2579a8c15a0548e0a72cf9cc07530e0 (patch) | |
tree | a1c4feb107eeefa1d7c1f800d534830b084c4c01 /src/gallium/state_trackers/nine | |
parent | b95205b1f28ba23d88bc24bbb663b1e4938bbb48 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 7 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/device9ex.c | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.c | 22 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 25 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.h | 2 |
6 files changed, 28 insertions, 33 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 05fa71cec7c..c106ab12c8f 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -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( diff --git a/src/gallium/state_trackers/nine/device9ex.c b/src/gallium/state_trackers/nine/device9ex.c index 77a364a31a7..30c8c65e2b6 100644 --- a/src/gallium/state_trackers/nine/device9ex.c +++ b/src/gallium/state_trackers/nine/device9ex.c @@ -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( diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index 2970b27e0e8..a28b4c6d57a 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -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, diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h index df3b38245c0..6bd4a0c8972 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.h +++ b/src/gallium/state_trackers/nine/nine_pipe.h @@ -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 diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 2ae917c4faa..e692dd3f4c6 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -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); diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h index 091902518bd..11a213e3066 100644 --- a/src/gallium/state_trackers/nine/nine_state.h +++ b/src/gallium/state_trackers/nine/nine_state.h @@ -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, |