Create d3d_set_vertex_declaration

This commit is contained in:
twinaphex 2015-04-07 02:44:12 +02:00
parent 875adec249
commit d32af58250
4 changed files with 19 additions and 12 deletions

View File

@ -381,3 +381,18 @@ void d3d_disable_blend_func(void *data)
dev->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
}
void d3d_set_vertex_declaration(void *data, void *vertex_data)
{
LPDIRECT3DDEVICE dev = (LPDIRECT3DDEVICE)data;
#if defined(HAVE_D3D9)
LPDIRECT3DVERTEXDECLARATION decl = (LPDIRECT3DVERTEXDECLARATION)vertex_data;
#endif
if (!dev)
return;
#ifdef _XBOX1
d3d_set_vertex_shader(dev, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#elif defined(HAVE_D3D9)
dev->SetVertexDeclaration(decl);
#endif
}

View File

@ -87,4 +87,6 @@ void d3d_enable_blend_func(void *data);
void d3d_disable_blend_func(void *data);
void d3d_set_vertex_declaration(void *data, void *vertex_data);
#endif

View File

@ -42,9 +42,7 @@ struct Pass
LPDIRECT3DVERTEXBUFFER vertex_buf;
CGprogram vPrg, fPrg;
unsigned last_width, last_height;
#ifdef HAVE_D3D9
LPDIRECT3DVERTEXDECLARATION vertex_decl;
#endif
std::vector<unsigned> attrib_map;
};
@ -1374,11 +1372,7 @@ static void renderchain_render_pass(void *data, void *pass_data, unsigned pass_i
d3d_set_sampler_magfilter(d3dr, 0,
translate_filter(pass->info.pass->filter));
#ifdef _XBOX1
d3d_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#else
d3dr->SetVertexDeclaration(pass->vertex_decl);
#endif
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

@ -373,11 +373,7 @@ static bool xdk_renderchain_render(void *data, const void *frame,
d3d_set_sampler_magfilter(d3dr, 0, settings->video.smooth ?
D3DTEXF_LINEAR : D3DTEXF_POINT);
#if defined(_XBOX1)
d3d_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#elif defined(_XBOX360)
D3DDevice_SetVertexDeclaration(d3dr, d3d->vertex_decl);
#endif
d3d_set_vertex_declaration(d3dr, d3d->vertex_decl);
for (i = 0; i < 4; i++)
d3d_set_stream_source(d3dr, i, d3d->vertex_buf, 0, sizeof(Vertex));