(D3D) Create wrapper for SetVertexShader

This commit is contained in:
twinaphex 2014-09-12 19:42:17 +02:00
parent 9c00855f71
commit da088073ec
8 changed files with 23 additions and 9 deletions

View File

@ -336,7 +336,7 @@ static bool texture_image_render(void *data,
d3d_set_texture(d3dr, 0, out_img->pixels);
d3d_set_stream_source(d3dr, 0,
out_img->vertex_buf, 0, sizeof(Vertex));
d3dr->SetVertexShader(D3DFVF_CUSTOMVERTEX);
d3d_set_vertex_shader(d3dr, D3DFVF_CUSTOMVERTEX, NULL);
if (force_fullscreen)
{

View File

@ -184,6 +184,19 @@ void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
#endif
}
HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
LPDIRECT3DVERTEXSHADER shader)
{
#if defined(_XBOX1)
return dev->SetVertexShader(index);
#elif defined(_XBOX360)
return D3DDevice_SetVertexShader(dev, shader);
#else
return dev->SetVertexShader(shader);
#endif
}
void d3d_textureblit(void *data, void *renderchain_data,
LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc,
D3DLOCKED_RECT lr, const void *frame,

View File

@ -53,6 +53,9 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler,
LPDIRECT3DTEXTURE tex);
HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index,
LPDIRECT3DVERTEXSHADER shader);
void d3d_textureblit(void *data,
LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc,
D3DLOCKED_RECT lr, const void *frame,

View File

@ -557,7 +557,7 @@ void renderchain_render_pass(void *data, Pass &pass, unsigned pass_index)
translate_filter(pass.info.pass->filter));
#ifdef _XBOX1
d3dr->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
d3d_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#else
d3dr->SetVertexDeclaration(pass.vertex_decl);
#endif

View File

@ -145,7 +145,7 @@ static void renderchain_render_pass(void *data, const void *frame, unsigned widt
d3d_set_sampler_magfilter(d3dr, 0, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
#if defined(_XBOX1)
RD3DDevice_SetVertexShader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1);
d3d_set_vertex_shader(d3dr, D3DFVF_XYZ | D3DFVF_TEX1, NULL);
#elif defined(_XBOX360)
D3DDevice_SetVertexDeclaration(d3dr, d3d->vertex_decl);
#endif

View File

@ -27,7 +27,6 @@
#define RD3DDevice_SetTransform(device, State, pMatrix) D3DDevice_SetTransform(State, pMatrix)
#define RD3DDevice_SetVertexShader(device, handle) D3DDevice_SetVertexShader(handle)
#define RD3DVertexBuffer_Lock(device, OffsetToLock, SizeToLock, ppbData, Flags) *ppbData = D3DVertexBuffer_Lock2(device, Flags) + OffsetToLock
#define RD3DVertexBuffer_Unlock(device)
#define RD3DDevice_Clear(device, Count, pRects, Flags, Color, Z, Stencil) D3DDevice_Clear(Count, pRects, Flags, Color, Z, Stencil)

View File

@ -280,7 +280,7 @@ static void xdk_render_msg_post(xdk360_video_font_t * font, void *video_data)
d3d_set_texture(d3dr, 0, NULL);
d3dr->SetVertexDeclaration(NULL);
D3DDevice_SetVertexShader(d3dr, NULL);
d3d_set_vertex_shader(d3dr, 0, NULL);
D3DDevice_SetPixelShader(d3dr, NULL);
d3dr->SetRenderState( D3DRS_VIEWPORTENABLE, font->m_dwSavedState );
}
@ -309,7 +309,7 @@ static void xdk_render_msg_pre(xdk360_video_font_t * font, void *video_data)
d3dr->SetRenderState( D3DRS_VIEWPORTENABLE, FALSE );
d3dr->SetVertexDeclaration(s_FontLocals.m_pFontVertexDecl);
d3dr->SetVertexShader(s_FontLocals.m_pFontVertexShader);
d3d_set_vertex_shader(d3dr, 0, s_FontLocals.m_pFontVertexShader);
d3dr->SetPixelShader(s_FontLocals.m_pFontPixelShader);
// Set the texture scaling factor as a vertex shader constant

View File

@ -350,7 +350,7 @@ static bool hlsl_init(void *data, const char *path)
for(unsigned i = 1; i <= cg_shader->passes; i++)
set_program_attributes(i);
d3d->dev->SetVertexShader(prg[1].vprg);
d3d_set_vertex_shader(d3d->dev, 1, prg[1].vprg);
d3d->dev->SetPixelShader(prg[1].fprg);
hlsl_active = true;
@ -373,11 +373,10 @@ static void hlsl_use(void *data, unsigned index)
if (hlsl_active && prg[index].vprg && prg[index].fprg)
{
active_index = index;
d3d_set_vertex_shader(d3dr, index, prg[index].vprg);
#ifdef _XBOX
D3DDevice_SetVertexShader(d3dr, prg[index].vprg);
D3DDevice_SetPixelShader(d3dr, prg[index].fprg);
#else
d3dr->SetVertexShader(prg[index].vprg);
d3dr->SetPixelShader(prg[index].fprg);
#endif
}