summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-10-20 21:31:43 +0200
committerAxel Davy <[email protected]>2016-12-20 23:44:22 +0100
commitd671190df907b7643ba00143b2fbf0a1f5bee6c4 (patch)
treec39ec0821a338cde4ca0b3c6a99ab577ef5aae1c /src/gallium/state_trackers
parent1a735a99d0ab4d618802e4044f068f926aaf4513 (diff)
st/nine: Back ds to nine_context
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')
-rw-r--r--src/gallium/state_trackers/nine/device9.c7
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c33
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h5
3 files changed, 31 insertions, 14 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index bfbbd02a8dc..31765265e1c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1893,11 +1893,12 @@ HRESULT NINE_WINAPI
NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
IDirect3DSurface9 *pNewZStencil )
{
+ struct NineSurface9 *ds = NineSurface9(pNewZStencil);
DBG("This=%p pNewZStencil=%p\n", This, pNewZStencil);
- if (This->state.ds != NineSurface9(pNewZStencil)) {
- nine_bind(&This->state.ds, pNewZStencil);
- This->state.changed.group |= NINE_STATE_FB;
+ if (This->state.ds != ds) {
+ nine_bind(&This->state.ds, ds);
+ nine_context_set_depth_stencil(This, ds);
}
return D3D_OK;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 603fb894866..fe4241af3c3 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -445,10 +445,10 @@ update_framebuffer(struct NineDevice9 *device, bool is_clear)
* but render to depth buffer. We have to not take into account the render
* target info. TODO: know what should happen when there are several render targers
* and the first one is D3DFMT_NULL */
- if (rt0->desc.Format == D3DFMT_NULL && state->ds) {
- w = state->ds->desc.Width;
- h = state->ds->desc.Height;
- nr_samples = state->ds->base.info.nr_samples;
+ if (rt0->desc.Format == D3DFMT_NULL && context->ds) {
+ w = context->ds->desc.Width;
+ h = context->ds->desc.Height;
+ nr_samples = context->ds->base.info.nr_samples;
}
for (i = 0; i < device->caps.NumSimultaneousRTs; ++i) {
@@ -474,10 +474,10 @@ update_framebuffer(struct NineDevice9 *device, bool is_clear)
}
}
- if (state->ds && state->ds->desc.Width >= w &&
- state->ds->desc.Height >= h &&
- state->ds->base.info.nr_samples == nr_samples) {
- fb->zsbuf = NineSurface9_GetSurface(state->ds, 0);
+ if (context->ds && context->ds->desc.Width >= w &&
+ context->ds->desc.Height >= h &&
+ context->ds->base.info.nr_samples == nr_samples) {
+ fb->zsbuf = NineSurface9_GetSurface(context->ds, 0);
} else {
fb->zsbuf = NULL;
}
@@ -1067,10 +1067,9 @@ nine_update_state(struct NineDevice9 *device)
static void
NineDevice9_ResolveZ( struct NineDevice9 *device )
{
- struct nine_state *state = &device->state;
struct nine_context *context = &device->context;
const struct util_format_description *desc;
- struct NineSurface9 *source = state->ds;
+ struct NineSurface9 *source = context->ds;
struct NineBaseTexture9 *destination = context->texture[0];
struct pipe_resource *src, *dst;
struct pipe_blit_info blit;
@@ -1468,6 +1467,17 @@ nine_context_set_render_target(struct NineDevice9 *device,
}
void
+nine_context_set_depth_stencil(struct NineDevice9 *device,
+ struct NineSurface9 *ds)
+{
+ struct nine_state *state = &device->state;
+ struct nine_context *context = &device->context;
+
+ nine_bind(&context->ds, ds);
+ state->changed.group |= NINE_STATE_FB;
+}
+
+void
nine_context_set_viewport(struct NineDevice9 *device,
const D3DVIEWPORT9 *viewport)
{
@@ -1822,7 +1832,7 @@ nine_context_clear_fb(struct NineDevice9 *device,
const int sRGB = context->rs[D3DRS_SRGBWRITEENABLE] ? 1 : 0;
struct pipe_surface *cbuf, *zsbuf;
struct pipe_context *pipe = device->pipe;
- struct NineSurface9 *zsbuf_surf = device->state.ds;
+ struct NineSurface9 *zsbuf_surf = context->ds;
struct NineSurface9 *rt;
unsigned bufs = 0;
unsigned r, i;
@@ -2339,6 +2349,7 @@ nine_context_clear(struct nine_context *context)
for (i = 0; i < ARRAY_SIZE(context->rt); ++i)
nine_bind(&context->rt[i], NULL);
+ nine_bind(&context->ds, NULL);
nine_bind(&context->vs, NULL);
nine_bind(&context->vdecl, NULL);
for (i = 0; i < PIPE_MAX_ATTRIBS; ++i)
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 754a3de7eb0..78b12c68a05 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -232,6 +232,7 @@ struct nine_context {
uint32_t bumpmap_vars[6 * NINE_MAX_TEXTURE_STAGES];
struct NineSurface9 *rt[NINE_MAX_SIMULTANEOUS_RENDERTARGETS];
+ struct NineSurface9 *ds;
struct {
void *vs;
@@ -429,6 +430,10 @@ nine_context_set_render_target(struct NineDevice9 *device,
struct NineSurface9 *rt);
void
+nine_context_set_depth_stencil(struct NineDevice9 *device,
+ struct NineSurface9 *ds);
+
+void
nine_context_apply_stateblock(struct NineDevice9 *device,
const struct nine_state *src);