mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 15:28:03 +00:00
wined3d: Store vertex declaration in the wined3d_stateblock_state structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cc88fb0b69
commit
61cc88675f
3 changed files with 36 additions and 13 deletions
|
@ -2199,21 +2199,29 @@ void CDECL wined3d_device_get_scissor_rects(const struct wined3d_device *device,
|
||||||
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device,
|
void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device,
|
||||||
struct wined3d_vertex_declaration *declaration)
|
struct wined3d_vertex_declaration *declaration)
|
||||||
{
|
{
|
||||||
struct wined3d_vertex_declaration *prev = device->update_state->vertex_declaration;
|
struct wined3d_vertex_declaration *prev = device->state.vertex_declaration;
|
||||||
|
|
||||||
TRACE("device %p, declaration %p.\n", device, declaration);
|
TRACE("device %p, declaration %p.\n", device, declaration);
|
||||||
|
|
||||||
|
if (declaration)
|
||||||
|
wined3d_vertex_declaration_incref(declaration);
|
||||||
|
if (device->update_stateblock_state->vertex_declaration)
|
||||||
|
wined3d_vertex_declaration_decref(device->update_stateblock_state->vertex_declaration);
|
||||||
|
device->update_stateblock_state->vertex_declaration = declaration;
|
||||||
|
|
||||||
if (device->recording)
|
if (device->recording)
|
||||||
|
{
|
||||||
device->recording->changed.vertexDecl = TRUE;
|
device->recording->changed.vertexDecl = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (declaration == prev)
|
if (declaration == prev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (declaration)
|
if (declaration)
|
||||||
wined3d_vertex_declaration_incref(declaration);
|
wined3d_vertex_declaration_incref(declaration);
|
||||||
device->update_state->vertex_declaration = declaration;
|
device->state.vertex_declaration = declaration;
|
||||||
if (!device->recording)
|
wined3d_cs_emit_set_vertex_declaration(device->cs, declaration);
|
||||||
wined3d_cs_emit_set_vertex_declaration(device->cs, declaration);
|
|
||||||
if (prev)
|
if (prev)
|
||||||
wined3d_vertex_declaration_decref(prev);
|
wined3d_vertex_declaration_decref(prev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,11 +523,18 @@ void state_unbind_resources(struct wined3d_state *state)
|
||||||
|
|
||||||
void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state)
|
void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state)
|
||||||
{
|
{
|
||||||
|
struct wined3d_vertex_declaration *decl;
|
||||||
struct wined3d_texture *texture;
|
struct wined3d_texture *texture;
|
||||||
struct wined3d_buffer *buffer;
|
struct wined3d_buffer *buffer;
|
||||||
struct wined3d_shader *shader;
|
struct wined3d_shader *shader;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if ((decl = state->vertex_declaration))
|
||||||
|
{
|
||||||
|
state->vertex_declaration = NULL;
|
||||||
|
wined3d_vertex_declaration_decref(decl);
|
||||||
|
}
|
||||||
|
|
||||||
if ((buffer = state->index_buffer))
|
if ((buffer = state->index_buffer))
|
||||||
{
|
{
|
||||||
state->index_buffer = NULL;
|
state->index_buffer = NULL;
|
||||||
|
@ -814,16 +821,16 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
||||||
stateblock->stateblock_state.index_format = state->index_format;
|
stateblock->stateblock_state.index_format = state->index_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration != src_state->vertex_declaration)
|
if (stateblock->changed.vertexDecl && stateblock->stateblock_state.vertex_declaration != state->vertex_declaration)
|
||||||
{
|
{
|
||||||
TRACE("Updating vertex declaration from %p to %p.\n",
|
TRACE("Updating vertex declaration from %p to %p.\n",
|
||||||
stateblock->state.vertex_declaration, src_state->vertex_declaration);
|
stateblock->stateblock_state.vertex_declaration, state->vertex_declaration);
|
||||||
|
|
||||||
if (src_state->vertex_declaration)
|
if (state->vertex_declaration)
|
||||||
wined3d_vertex_declaration_incref(src_state->vertex_declaration);
|
wined3d_vertex_declaration_incref(state->vertex_declaration);
|
||||||
if (stateblock->state.vertex_declaration)
|
if (stateblock->stateblock_state.vertex_declaration)
|
||||||
wined3d_vertex_declaration_decref(stateblock->state.vertex_declaration);
|
wined3d_vertex_declaration_decref(stateblock->stateblock_state.vertex_declaration);
|
||||||
stateblock->state.vertex_declaration = src_state->vertex_declaration;
|
stateblock->stateblock_state.vertex_declaration = state->vertex_declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateblock->changed.material
|
if (stateblock->changed.material
|
||||||
|
@ -1124,8 +1131,15 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
|
||||||
wined3d_device_set_base_vertex_index(device, stateblock->stateblock_state.base_vertex_index);
|
wined3d_device_set_base_vertex_index(device, stateblock->stateblock_state.base_vertex_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration)
|
if (stateblock->changed.vertexDecl && stateblock->stateblock_state.vertex_declaration)
|
||||||
wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration);
|
{
|
||||||
|
if (stateblock->stateblock_state.vertex_declaration)
|
||||||
|
wined3d_vertex_declaration_incref(stateblock->stateblock_state.vertex_declaration);
|
||||||
|
if (state->vertex_declaration)
|
||||||
|
wined3d_vertex_declaration_decref(state->vertex_declaration);
|
||||||
|
state->vertex_declaration = stateblock->stateblock_state.vertex_declaration;
|
||||||
|
wined3d_device_set_vertex_declaration(device, stateblock->stateblock_state.vertex_declaration);
|
||||||
|
}
|
||||||
|
|
||||||
if (stateblock->changed.material)
|
if (stateblock->changed.material)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2970,6 +2970,7 @@ struct wined3d_dummy_textures
|
||||||
|
|
||||||
struct wined3d_stateblock_state
|
struct wined3d_stateblock_state
|
||||||
{
|
{
|
||||||
|
struct wined3d_vertex_declaration *vertex_declaration;
|
||||||
struct wined3d_buffer *index_buffer;
|
struct wined3d_buffer *index_buffer;
|
||||||
enum wined3d_format_id index_format;
|
enum wined3d_format_id index_format;
|
||||||
int base_vertex_index;
|
int base_vertex_index;
|
||||||
|
|
Loading…
Reference in a new issue