wined3d: Send flushes through the command stream.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-04-13 00:11:00 +02:00 committed by Alexandre Julliard
parent b7146d81f2
commit 972d9dae8b
3 changed files with 28 additions and 8 deletions

View File

@ -30,6 +30,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DISPATCH,
WINED3D_CS_OP_DRAW,
WINED3D_CS_OP_FLUSH,
WINED3D_CS_OP_SET_PREDICATION,
WINED3D_CS_OP_SET_VIEWPORT,
WINED3D_CS_OP_SET_SCISSOR_RECT,
@ -112,6 +113,11 @@ struct wined3d_cs_draw
BOOL indexed;
};
struct wined3d_cs_flush
{
enum wined3d_cs_op opcode;
};
struct wined3d_cs_set_predication
{
enum wined3d_cs_op opcode;
@ -759,6 +765,25 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base
cs->ops->submit(cs);
}
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
{
struct wined3d_context *context;
context = context_acquire(cs->device, NULL, 0);
context->gl_info->gl_ops.gl.p_glFlush();
context_release(context);
}
void wined3d_cs_emit_flush(struct wined3d_cs *cs)
{
struct wined3d_cs_flush *op;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_FLUSH;
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_predication *op = data;
@ -2007,6 +2032,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
/* WINED3D_CS_OP_FLUSH */ wined3d_cs_exec_flush,
/* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,

View File

@ -3374,8 +3374,6 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
{
struct wined3d_context *context;
TRACE("device %p.\n", device);
if (!device->inScene)
@ -3384,12 +3382,7 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
return WINED3DERR_INVALIDCALL;
}
context = context_acquire(device, NULL, 0);
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */
context->gl_info->gl_ops.gl.p_glFlush();
/* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
* fails. */
context_release(context);
wined3d_cs_emit_flush(device->cs);
device->inScene = FALSE;
return WINED3D_OK;

View File

@ -3258,6 +3258,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;