[Mesa-dev] [PATCH 33/84] st/nine: Integrate nine_pipe_context_clear to nine_context_clear
Axel Davy
axel.davy at ens.fr
Wed Dec 7 22:55:06 UTC 2016
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 at ens.fr>
---
src/gallium/state_trackers/nine/device9.c | 7 ++-----
src/gallium/state_trackers/nine/device9ex.c | 3 +--
src/gallium/state_trackers/nine/nine_pipe.c | 22 ----------------------
src/gallium/state_trackers/nine/nine_pipe.h | 2 --
src/gallium/state_trackers/nine/nine_state.c | 25 ++++++++++++++++++++++++-
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 4acccee..5a590d2 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 77a364a..30c8c65 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 2970b27..a28b4c6 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 df3b382..6bd4a0c 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 b5afc9b..b832db4 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -2424,10 +2424,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 0919025..11a213e 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,
--
2.10.2
More information about the mesa-dev
mailing list