(D3D) Use defines to hide away D3D version-specific types

This commit is contained in:
twinaphex 2014-01-01 00:27:55 +01:00
parent 88194bcdae
commit 772383effc
2 changed files with 18 additions and 14 deletions

View File

@ -34,6 +34,14 @@
#include <string>
#include <vector>
#define LPDIRECT3D LPDIRECT3D9
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER9
#define LPDIRECT3DSURFACE LPDIRECT3DSURFACE9
#define LPDIRECT3DVERTEXDECLARATION LPDIRECT3DVERTEXDECLARATION9
#define D3DVIEWPORT D3DVIEWPORT9
class RenderChain;
typedef struct
@ -48,8 +56,8 @@ typedef struct
bool fullscreen;
bool enabled;
float alpha_mod;
IDirect3DTexture9 *tex;
IDirect3DVertexBuffer9 *vert_buf;
LPDIRECT3DTEXTURE tex;
LPDIRECT3DVERTEXBUFFER vert_buf;
} overlay_t;
class D3DVideo
@ -105,8 +113,8 @@ class D3DVideo
WNDCLASSEX windowClass;
HWND hWnd;
IDirect3D9 *g_pD3D;
IDirect3DDevice9 *dev;
LPDIRECT3D g_pD3D;
LPDIRECT3DDEVICE dev;
LPD3DXFONT font;
void recompute_pass_sizes();
@ -115,7 +123,7 @@ class D3DVideo
unsigned screen_width;
unsigned screen_height;
unsigned rotation;
D3DVIEWPORT9 final_viewport;
D3DVIEWPORT final_viewport;
std::string cg_shader;

View File

@ -343,8 +343,8 @@ bool D3DVideo::read_viewport(uint8_t *buffer)
RARCH_PERFORMANCE_INIT(d3d_read_viewport);
RARCH_PERFORMANCE_START(d3d_read_viewport);
bool ret = true;
IDirect3DSurface9 *target = NULL;
IDirect3DSurface9 *dest = NULL;
LPDIRECT3DSURFACE target = NULL;
LPDIRECT3DSURFACE dest = NULL;
if (FAILED(Callback::d3d_err = dev->GetRenderTarget(0, &target)))
{
@ -916,14 +916,10 @@ bool D3DVideo::set_shader(const std::string &path)
int D3DVideo::process_shader(void)
{
int ret = 0;
if (strcmp(path_get_extension(cg_shader.c_str()), "cgp") == 0)
ret = init_multipass();
else
ret = init_singlepass();
return init_multipass();
if (ret)
return ret;
return init_singlepass();
}
void D3DVideo::recompute_pass_sizes(void)
@ -1229,7 +1225,7 @@ void D3DVideo::overlay_render(overlay_t &overlay)
{0, 20, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
IDirect3DVertexDeclaration9 *vertex_decl;
LPDIRECT3DVERTEXDECLARATION vertex_decl;
dev->CreateVertexDeclaration(vElems, &vertex_decl);
dev->SetVertexDeclaration(vertex_decl);
vertex_decl->Release();