DBG("This=%p\n", This);
user_assert(This->in_scene, D3DERR_INVALIDCALL);
This->in_scene = FALSE;
+ This->end_scene_since_present++;
+ /* EndScene() is supposed to flush the GPU commands.
+ * The idea is to flush ahead of the Present() call.
+ * (Apps could take advantage of this by inserting CPU
+ * work between EndScene() and Present()).
+ * Most apps will have one EndScene per frame.
+ * Some will have 2 or 3.
+ * Some bad behaving apps do a lot of them.
+ * As flushing has a cost, do it only once. */
+ if (This->end_scene_since_present <= 1) {
+ nine_context_pipe_flush(This);
+ nine_csmt_flush(This);
+ }
return D3D_OK;
}
boolean is_recording;
boolean in_scene;
+ unsigned end_scene_since_present;
uint16_t vs_const_size;
uint16_t ps_const_size;
nine_csmt_wait_processed(ctx);
}
+void
+nine_csmt_flush( struct NineDevice9* device )
+{
+ if (!device->csmt_active)
+ return;
+
+ nine_queue_flush(device->csmt_ctx->pool);
+}
+
+
/* Destroys a CSMT context.
* Waits for the worker thread to terminate.
*/
return ret;
}
+CSMT_ITEM_NO_WAIT(nine_context_pipe_flush)
+{
+ struct nine_context *context = &device->context;
+
+ context->pipe->flush(context->pipe, NULL, PIPE_FLUSH_ASYNC);
+}
+
/* State defaults */
static const DWORD nine_render_state_defaults[NINED3DRS_LAST + 1] =
unsigned *counter, boolean flush, boolean wait,
union pipe_query_result *result);
+void
+nine_context_pipe_flush(struct NineDevice9 *device);
+
void nine_state_restore_non_cso(struct NineDevice9 *device);
void nine_state_set_defaults(struct NineDevice9 *, const D3DCAPS9 *,
boolean is_reset);
void
nine_csmt_destroy( struct NineDevice9 *This, struct csmt_context *ctx );
+/* Flushes and waits everything is executed */
void
nine_csmt_process( struct NineDevice9 *This );
+/* Flushes and doesn't wait */
+void
+nine_csmt_flush( struct NineDevice9 *This );
/* Get the pipe_context (should not be called from the worker thread).
* All the work in the worker thread is finished before returning. */
if (FAILED(hr)) { UNTESTED(3);return hr; }
}
+ This->base.device->end_scene_since_present = 0;
return D3D_OK;
}