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,
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;
}
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;
}
vtxbuf.user_buffer = NULL;
}
+ NineBeforeDraw(This);
nine_context_draw_primitive_from_vtxbuf(This, PrimitiveType, PrimitiveCount, &vtxbuf);
+ NineAfterDraw(This);
pipe_resource_reference(&vtxbuf.buffer, NULL);
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);
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.
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)
{
* 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))
{
struct nine_context *context = &device->context;
- validate_textures(device);
-
if (context->changed.group & NINE_STATE_FB)
update_framebuffer(device, TRUE);
}