diff options
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 57 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_state.c | 32 |
2 files changed, 57 insertions, 32 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index c106ab12c8f..73b5888e4ec 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -2706,6 +2706,55 @@ NineDevice9_GetNPatchMode( struct NineDevice9 *This ) STUB(0); } +/* TODO: only go through dirty textures */ +static void +validate_textures(struct NineDevice9 *device) +{ + struct NineBaseTexture9 *tex, *ptr; + LIST_FOR_EACH_ENTRY_SAFE(tex, ptr, &device->update_textures, list) { + list_delinit(&tex->list); + NineBaseTexture9_Validate(tex); + } +} + +static void +update_managed_buffers(struct NineDevice9 *device) +{ + struct NineBuffer9 *buf, *ptr; + LIST_FOR_EACH_ENTRY_SAFE(buf, ptr, &device->update_buffers, managed.list) { + list_delinit(&buf->managed.list); + NineBuffer9_Upload(buf); + } +} + +static void +NineBeforeDraw( struct NineDevice9 *This ) +{ + /* Upload Managed dirty content */ + validate_textures(This); /* may clobber state */ + update_managed_buffers(This); +} + +static void +NineAfterDraw( struct NineDevice9 *This ) +{ + unsigned i; + struct nine_state *state = &This->state; + unsigned ps_mask = state->ps ? state->ps->rt_mask : 1; + + /* Flag render-targets with autogenmipmap for mipmap regeneration */ + for (i = 0; i < This->caps.NumSimultaneousRTs; ++i) { + struct NineSurface9 *rt = state->rt[i]; + + if (rt && rt->desc.Format != D3DFMT_NULL && (ps_mask & (1 << i)) && + rt->desc.Usage & D3DUSAGE_AUTOGENMIPMAP) { + assert(rt->texture == D3DRTYPE_TEXTURE || + rt->texture == D3DRTYPE_CUBETEXTURE); + NineBaseTexture9(rt->base.base.container)->dirty_mip = TRUE; + } + } +} + HRESULT NINE_WINAPI NineDevice9_DrawPrimitive( struct NineDevice9 *This, D3DPRIMITIVETYPE PrimitiveType, @@ -2715,7 +2764,9 @@ NineDevice9_DrawPrimitive( struct NineDevice9 *This, DBG("iface %p, PrimitiveType %u, StartVertex %u, PrimitiveCount %u\n", This, PrimitiveType, StartVertex, PrimitiveCount); + NineBeforeDraw(This); nine_context_draw_primitive(This, PrimitiveType, StartVertex, PrimitiveCount); + NineAfterDraw(This); return D3D_OK; } @@ -2737,9 +2788,11 @@ NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This, user_assert(This->state.idxbuf, D3DERR_INVALIDCALL); user_assert(This->state.vdecl, D3DERR_INVALIDCALL); + NineBeforeDraw(This); nine_context_draw_indexed_primitive(This, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, StartIndex, PrimitiveCount); + NineAfterDraw(This); return D3D_OK; } @@ -2778,7 +2831,9 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This, vtxbuf.user_buffer = NULL; } + NineBeforeDraw(This); nine_context_draw_primitive_from_vtxbuf(This, PrimitiveType, PrimitiveCount, &vtxbuf); + NineAfterDraw(This); pipe_resource_reference(&vtxbuf.buffer, NULL); @@ -2852,12 +2907,14 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, ibuf.user_buffer = NULL; } + NineBeforeDraw(This); nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(This, PrimitiveType, MinVertexIndex, NumVertices, PrimitiveCount, &vbuf, &ibuf); + NineAfterDraw(This); pipe_resource_reference(&vbuf.buffer, NULL); pipe_resource_reference(&ibuf.buffer, NULL); diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index e692dd3f4c6..226946031d6 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -455,12 +455,6 @@ update_framebuffer(struct NineDevice9 *device, bool is_clear) fb->cbufs[i] = NineSurface9_GetSurface(rt, sRGB); context->rt_mask |= 1 << i; fb->nr_cbufs = i + 1; - - if (unlikely(rt->desc.Usage & D3DUSAGE_AUTOGENMIPMAP)) { - assert(rt->texture == D3DRTYPE_TEXTURE || - rt->texture == D3DRTYPE_CUBETEXTURE); - NineBaseTexture9(rt->base.base.container)->dirty_mip = TRUE; - } } else { /* Color outputs must match RT slot, * drivers will have to handle NULL entries for GL, too. @@ -931,28 +925,6 @@ commit_ps(struct NineDevice9 *device) NINE_STATE_STENCIL_REF | \ NINE_STATE_SAMPLE_MASK) - -/* TODO: only go through dirty textures */ -static void -validate_textures(struct NineDevice9 *device) -{ - struct NineBaseTexture9 *tex, *ptr; - LIST_FOR_EACH_ENTRY_SAFE(tex, ptr, &device->update_textures, list) { - list_delinit(&tex->list); - NineBaseTexture9_Validate(tex); - } -} - -static void -update_managed_buffers(struct NineDevice9 *device) -{ - struct NineBuffer9 *buf, *ptr; - LIST_FOR_EACH_ENTRY_SAFE(buf, ptr, &device->update_buffers, managed.list) { - list_delinit(&buf->managed.list); - NineBuffer9_Upload(buf); - } -} - static void nine_update_state(struct NineDevice9 *device) { @@ -968,8 +940,6 @@ nine_update_state(struct NineDevice9 *device) * into update_textures. Except, we also need to re-validate textures that * may be dirty anyway, even if no texture bindings changed. */ - validate_textures(device); /* may clobber state */ - update_managed_buffers(device); /* ff_update may change VS/PS dirty bits */ if (unlikely(!context->programmable_vs || !context->ps)) @@ -1842,8 +1812,6 @@ nine_update_state_framebuffer_clear(struct NineDevice9 *device) { struct nine_context *context = &device->context; - validate_textures(device); - if (context->changed.group & NINE_STATE_FB) update_framebuffer(device, TRUE); } |