Start using wrappers for vertex declarations

This commit is contained in:
twinaphex 2015-11-12 01:48:36 +01:00
parent a4336fe89a
commit a09e8e0684
5 changed files with 16 additions and 5 deletions

View File

@ -1286,9 +1286,9 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
d3d_enable_blend_func(d3d->dev);
#ifndef _XBOX1
d3d->dev->CreateVertexDeclaration(vElems, &vertex_decl);
d3d_vertex_declaration_new(d3d->dev, vElems, &vertex_decl);
d3d_set_vertex_declaration(d3d->dev, vertex_decl);
vertex_decl->Release();
d3d_vertex_declaration_free(vertex_decl);
#endif
d3d_set_stream_source(d3d->dev, 0, overlay->vert_buf,

View File

@ -117,6 +117,14 @@ bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
return false;
}
void d3d_vertex_declaration_free(void *vertex_data)
{
#ifndef _XBOX1
LPDIRECT3DVERTEXDECLARATION vertex_decl = (LPDIRECT3DVERTEXDECLARATION)vertex_data;
vertex_decl->Release();
#endif
}
LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev,
unsigned length, unsigned usage,
unsigned fvf, D3DPOOL pool, void *handle)

View File

@ -96,6 +96,8 @@ void d3d_texture_blit(unsigned pixel_size,
bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev,
const void *vertex_data, void **decl_data);
void d3d_vertex_declaration_free(void *vertex_data);
void d3d_set_viewport(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp);
void d3d_enable_blend_func(void *data);

View File

@ -475,8 +475,8 @@ static bool cg_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
}
}
if (FAILED(chain->dev->CreateVertexDeclaration(
decl, &pass->vertex_decl)))
if (!d3d_vertex_declaration_new(chain->dev, decl,
&pass->vertex_decl))
return false;
return true;
@ -1372,6 +1372,7 @@ static void renderchain_render_pass(
translate_filter(pass->info.pass->filter));
d3d_set_vertex_declaration(d3dr, pass->vertex_decl);
for (i = 0; i < 4; i++)
d3d_set_stream_source(d3dr, i,
pass->vertex_buf, 0, sizeof(Vertex));

View File

@ -83,7 +83,7 @@ static bool xdk_renderchain_init_shader_fvf(void *data, void *pass_data)
D3DDECL_END()
};
if (FAILED(d3dr->CreateVertexDeclaration(VertexElements, &chain->vertex_decl)))
if (!d3d_vertex_declaration_new(d3dr, VertexElements, &chain->vertex_decl))
return false;
#endif