wined3d: Send vertex declaration binding updates through the command stream.
This commit is contained in:
parent
fd5fc51bc5
commit
1f864bc9c3
|
@ -32,6 +32,7 @@ enum wined3d_cs_op
|
||||||
WINED3D_CS_OP_SET_SCISSOR_RECT,
|
WINED3D_CS_OP_SET_SCISSOR_RECT,
|
||||||
WINED3D_CS_OP_SET_RENDER_TARGET,
|
WINED3D_CS_OP_SET_RENDER_TARGET,
|
||||||
WINED3D_CS_OP_SET_DEPTH_STENCIL,
|
WINED3D_CS_OP_SET_DEPTH_STENCIL,
|
||||||
|
WINED3D_CS_OP_SET_VERTEX_DECLARATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wined3d_cs_present
|
struct wined3d_cs_present
|
||||||
|
@ -91,6 +92,12 @@ struct wined3d_cs_set_depth_stencil
|
||||||
struct wined3d_surface *depth_stencil;
|
struct wined3d_surface *depth_stencil;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct wined3d_cs_set_vertex_declaration
|
||||||
|
{
|
||||||
|
enum wined3d_cs_op opcode;
|
||||||
|
struct wined3d_vertex_declaration *declaration;
|
||||||
|
};
|
||||||
|
|
||||||
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||||
{
|
{
|
||||||
const struct wined3d_cs_present *op = data;
|
const struct wined3d_cs_present *op = data;
|
||||||
|
@ -284,6 +291,25 @@ void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_sur
|
||||||
cs->ops->submit(cs);
|
cs->ops->submit(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
|
||||||
|
{
|
||||||
|
const struct wined3d_cs_set_vertex_declaration *op = data;
|
||||||
|
|
||||||
|
cs->state.vertex_declaration = op->declaration;
|
||||||
|
device_invalidate_state(cs->device, STATE_VDECL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
|
||||||
|
{
|
||||||
|
struct wined3d_cs_set_vertex_declaration *op;
|
||||||
|
|
||||||
|
op = cs->ops->require_space(cs, sizeof(*op));
|
||||||
|
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
|
||||||
|
op->declaration = declaration;
|
||||||
|
|
||||||
|
cs->ops->submit(cs);
|
||||||
|
}
|
||||||
|
|
||||||
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||||
{
|
{
|
||||||
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
|
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
|
||||||
|
@ -293,6 +319,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||||
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
|
/* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
|
||||||
/* WINED3D_CS_OP_SET_RENDER_TARGET */ wined3d_cs_exec_set_render_target,
|
/* WINED3D_CS_OP_SET_RENDER_TARGET */ wined3d_cs_exec_set_render_target,
|
||||||
/* WINED3D_CS_OP_SET_DEPTH_STENCIL */ wined3d_cs_exec_set_depth_stencil,
|
/* WINED3D_CS_OP_SET_DEPTH_STENCIL */ wined3d_cs_exec_set_depth_stencil,
|
||||||
|
/* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
|
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
|
||||||
|
|
|
@ -2078,28 +2078,19 @@ void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device,
|
||||||
|
|
||||||
TRACE("device %p, declaration %p.\n", device, declaration);
|
TRACE("device %p, declaration %p.\n", device, declaration);
|
||||||
|
|
||||||
if (declaration)
|
|
||||||
wined3d_vertex_declaration_incref(declaration);
|
|
||||||
if (prev)
|
|
||||||
wined3d_vertex_declaration_decref(prev);
|
|
||||||
|
|
||||||
device->update_state->vertex_declaration = declaration;
|
|
||||||
|
|
||||||
if (device->recording)
|
if (device->recording)
|
||||||
{
|
|
||||||
TRACE("Recording... not performing anything.\n");
|
|
||||||
device->recording->changed.vertexDecl = TRUE;
|
device->recording->changed.vertexDecl = TRUE;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declaration == prev)
|
if (declaration == prev)
|
||||||
{
|
|
||||||
/* Checked after the assignment to allow proper stateblock recording. */
|
|
||||||
TRACE("Application is setting the old declaration over, nothing to do.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
device_invalidate_state(device, STATE_VDECL);
|
if (declaration)
|
||||||
|
wined3d_vertex_declaration_incref(declaration);
|
||||||
|
device->update_state->vertex_declaration = declaration;
|
||||||
|
if (!device->recording)
|
||||||
|
wined3d_cs_emit_set_vertex_declaration(device->cs, declaration);
|
||||||
|
if (prev)
|
||||||
|
wined3d_vertex_declaration_decref(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device)
|
struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device)
|
||||||
|
|
|
@ -2490,6 +2490,8 @@ void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_sur
|
||||||
void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx,
|
void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx,
|
||||||
struct wined3d_surface *render_target) DECLSPEC_HIDDEN;
|
struct wined3d_surface *render_target) DECLSPEC_HIDDEN;
|
||||||
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) DECLSPEC_HIDDEN;
|
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) DECLSPEC_HIDDEN;
|
||||||
|
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
|
||||||
|
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
|
||||||
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
|
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Direct3D terminology with little modifications. We do not have an issued state
|
/* Direct3D terminology with little modifications. We do not have an issued state
|
||||||
|
|
Loading…
Reference in New Issue