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;
}
* 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) {
}
}
- 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;
}
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;
}
}
+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)
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;
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)