Dehardcode some more opaque types defined by macros

This commit is contained in:
twinaphex 2018-01-25 11:50:07 +01:00
parent 1657b9b7c4
commit 766f3b33c7
8 changed files with 32 additions and 42 deletions

View File

@ -25,8 +25,6 @@
/* Direct3D 9 */
#include <d3d9.h>
#define ID3DSURFACE IDirect3DSurface9
#define LPDIRECT3D LPDIRECT3D9
#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9
#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9
@ -41,8 +39,6 @@
#define D3DVERTEXELEMENT D3DVERTEXELEMENT9
#define D3DVIEWPORT D3DVIEWPORT9
#define D3DCREATE_CTX Direct3DCreate9
#ifndef D3DCREATE_SOFTWARE_VERTEXPROCESSING
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0
#endif
@ -67,9 +63,6 @@
#define D3DVERTEXELEMENT D3DVERTEXELEMENT8
#define D3DVIEWPORT D3DVIEWPORT8
#define ID3DSURFACE IDirect3DSurface8
#define D3DCREATE_CTX Direct3DCreate8
#if !defined(D3DLOCK_NOSYSLOCK) && defined(_XBOX)
#define D3DLOCK_NOSYSLOCK (0)
#endif

View File

@ -601,7 +601,7 @@ bool d3d_texture_get_surface_level(void *_tex,
if (!tex)
return false;
#ifdef __cplusplus
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (ID3DSURFACE**)_ppsurface_level)))
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (IDirect3DSurface9**)_ppsurface_level)))
return true;
#else
if (SUCCEEDED(IDirect3DTexture9_GetSurfaceLevel(tex, idx, (IDirect3DSurface9**)_ppsurface_level)))
@ -617,7 +617,7 @@ bool d3d_texture_get_surface_level(void *_tex,
if (!tex)
return false;
#ifdef __cplusplus
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (ID3DSURFACE**)_ppsurface_level)))
if (SUCCEEDED(tex->GetSurfaceLevel(idx, (IDirect3DSurface8**)_ppsurface_level)))
return true;
#else
if (SUCCEEDED(IDirect3DTexture8_GetSurfaceLevel(tex, idx, (IDirect3DSurface8**)_ppsurface_level)))

View File

@ -27,19 +27,10 @@
#define HAVE_WINDOW
#endif
#include "../../defines/d3d_defines.h"
#ifdef _XBOX1
#include <xfont.h>
#endif
#include "../../driver.h"
#include "../font_driver.h"
#include "../video_driver.h"
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
#include "../common/d3d_common.h"
#endif
#ifdef _XBOX
#include "../../defines/xdk_defines.h"
#endif
@ -111,7 +102,7 @@ typedef struct d3d_video
{
int size;
int offset;
LPDIRECT3DVERTEXBUFFER buffer;
void *buffer;
void *decl;
}menu_display;
@ -121,8 +112,7 @@ typedef struct d3d_video
#endif
} d3d_video_t;
void d3d_make_d3dpp(void *data,
const video_info_t *info, D3DPRESENT_PARAMETERS *d3dpp);
void d3d_make_d3dpp(void *data, const video_info_t *info, void *_d3dpp);
#endif

View File

@ -28,6 +28,8 @@
#include <retro_math.h>
#include "d3d.h"
#include "../../defines/d3d_defines.h"
#include "../common/d3d_common.h"
#include "../video_coord_array.h"
#include "../../configuration.h"
#include "../../dynamic.h"
@ -568,9 +570,10 @@ static bool d3d8_is_windowed_enable(bool info_fullscreen)
}
void d3d8_make_d3dpp(void *data,
const video_info_t *info, D3DPRESENT_PARAMETERS *d3dpp)
const video_info_t *info, void *_d3dpp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
D3DPRESENT_PARAMETERS *d3dpp = (D3DPRESENT_PARAMETERS*)_d3dpp;
bool windowed_enable = d3d8_is_windowed_enable(info->fullscreen);
memset(d3dpp, 0, sizeof(*d3dpp));

View File

@ -28,6 +28,8 @@
#include <retro_math.h>
#include "d3d.h"
#include "../../defines/d3d_defines.h"
#include "../common/d3d_common.h"
#include "../video_coord_array.h"
#include "../../configuration.h"
#include "../../dynamic.h"
@ -508,9 +510,10 @@ static bool d3d_is_windowed_enable(bool info_fullscreen)
}
void d3d_make_d3dpp(void *data,
const video_info_t *info, D3DPRESENT_PARAMETERS *d3dpp)
const video_info_t *info, void *_d3dpp)
{
d3d_video_t *d3d = (d3d_video_t*)data;
D3DPRESENT_PARAMETERS *d3dpp = (D3DPRESENT_PARAMETERS*)_d3dpp;
#ifdef _XBOX
/* TODO/FIXME - get rid of global state dependencies. */
global_t *global = global_get_ptr();

View File

@ -29,6 +29,7 @@
#include <compat/strl.h>
#include <string/stdstring.h>
#include "../common/d3d_common.h"
#include "../drivers/d3d.h"
#include "../drivers/d3d_shaders/opaque.cg.d3d9.h"
@ -73,13 +74,13 @@ struct CGVertex
struct Pass
{
unsigned last_width, last_height;
struct LinkInfo info;
D3DPOOL pool;
LPDIRECT3DTEXTURE9 tex;
LPDIRECT3DVERTEXBUFFER vertex_buf;
LPDIRECT3DVERTEXBUFFER9 vertex_buf;
CGprogram vPrg, fPrg;
unsigned last_width, last_height;
LPDIRECT3DVERTEXDECLARATION vertex_decl;
LPDIRECT3DVERTEXDECLARATION9 vertex_decl;
struct unsigned_vector_list *attrib_map;
};
@ -102,7 +103,7 @@ typedef struct cg_renderchain
struct
{
LPDIRECT3DTEXTURE9 tex[TEXTURES];
LPDIRECT3DVERTEXBUFFER vertex_buf[TEXTURES];
LPDIRECT3DVERTEXBUFFER9 vertex_buf[TEXTURES];
unsigned ptr;
unsigned last_width[TEXTURES];
unsigned last_height[TEXTURES];
@ -294,8 +295,8 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
bool stream_taken[4] = {false};
cg_renderchain_t *chain = (cg_renderchain_t*)data;
struct Pass *pass = (struct Pass*)pass_data;
static const D3DVERTEXELEMENT decl_end = D3DDECL_END();
D3DVERTEXELEMENT decl[MAXD3DDECLLENGTH] = {{0}};
static const D3DVERTEXELEMENT9 decl_end = D3DDECL_END();
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH] = {{0}};
bool *indices = NULL;
if (cgD3D9GetVertexDeclaration(pass->vPrg, decl) == CG_FALSE)
@ -327,7 +328,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
if (param)
{
static const D3DVERTEXELEMENT element =
static const D3DVERTEXELEMENT9 element =
{
0, 0 * sizeof(float),
D3DDECLTYPE_FLOAT3,
@ -349,7 +350,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
if (param)
{
static const D3DVERTEXELEMENT tex_coord0 = DECL_FVF_TEXCOORD(1, 3, 0);
static const D3DVERTEXELEMENT9 tex_coord0 = DECL_FVF_TEXCOORD(1, 3, 0);
stream_taken[1] = true;
texcoord0_taken = true;
RARCH_LOG("[FVF]: TEXCOORD0 semantic found.\n");
@ -361,7 +362,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
param = d3d9_cg_find_param_from_semantic(cgGetFirstParameter(pass->vPrg, CG_PROGRAM), "TEXCOORD1");
if (param)
{
static const D3DVERTEXELEMENT tex_coord1 = DECL_FVF_TEXCOORD(2, 5, 1);
static const D3DVERTEXELEMENT9 tex_coord1 = DECL_FVF_TEXCOORD(2, 5, 1);
stream_taken[2] = true;
texcoord1_taken = true;
RARCH_LOG("[FVF]: TEXCOORD1 semantic found.\n");
@ -376,7 +377,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
if (param)
{
static const D3DVERTEXELEMENT color = DECL_FVF_COLOR(3, 7, 0);
static const D3DVERTEXELEMENT9 color = DECL_FVF_COLOR(3, 7, 0);
stream_taken[3] = true;
RARCH_LOG("[FVF]: COLOR0 semantic found.\n");
index = cgGetParameterResourceIndex(param);
@ -405,7 +406,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(void *data, void *pass_data)
unsigned_vector_list_append(pass->attrib_map, 0);
else
{
D3DVERTEXELEMENT elem = DECL_FVF_TEXCOORD(index, 3, tex_index);
D3DVERTEXELEMENT9 elem = DECL_FVF_TEXCOORD(index, 3, tex_index);
unsigned_vector_list_append(pass->attrib_map, index);
@ -462,7 +463,7 @@ static void d3d9_cg_renderchain_bind_orig(cg_renderchain_t *chain,
param = cgGetNamedParameter(pass->vPrg, "ORIG.tex_coord");
if (param)
{
LPDIRECT3DVERTEXBUFFER vert_buf = (LPDIRECT3DVERTEXBUFFER)chain->passes->data[0].vertex_buf;
LPDIRECT3DVERTEXBUFFER9 vert_buf = (LPDIRECT3DVERTEXBUFFER9)chain->passes->data[0].vertex_buf;
index = pass->attrib_map->data[cgGetParameterResourceIndex(param)];
@ -537,7 +538,7 @@ static void d3d9_cg_renderchain_bind_prev(void *data, const void *pass_data)
param = cgGetNamedParameter(pass->vPrg, attr_coord);
if (param)
{
LPDIRECT3DVERTEXBUFFER vert_buf = (LPDIRECT3DVERTEXBUFFER)
LPDIRECT3DVERTEXBUFFER9 vert_buf = (LPDIRECT3DVERTEXBUFFER9)
chain->prev.vertex_buf[(chain->prev.ptr - (i + 1)) & TEXTURESMASK];
index = pass->attrib_map->data[cgGetParameterResourceIndex(param)];

View File

@ -19,6 +19,7 @@
#include <retro_math.h>
#include "../drivers/d3d.h"
#include "../../defines/d3d_defines.h"
#include "../common/d3d_common.h"
#include "../video_driver.h"
@ -35,9 +36,9 @@ typedef struct hlsl_d3d9_renderchain
unsigned tex_h;
uint64_t frame_count;
void *dev;
LPDIRECT3DTEXTURE tex;
LPDIRECT3DVERTEXBUFFER vertex_buf;
LPDIRECT3DVERTEXDECLARATION vertex_decl;
LPDIRECT3DTEXTURE9 tex;
LPDIRECT3DVERTEXBUFFER9 vertex_buf;
LPDIRECT3DVERTEXDECLARATION9 vertex_decl;
const video_info_t *video_info;
} hlsl_d3d9_renderchain_t;
@ -68,7 +69,7 @@ static void hlsl_d3d9_renderchain_clear(void *data)
static bool hlsl_d3d9_renderchain_init_shader_fvf(void *data, void *pass_data)
{
static const D3DVERTEXELEMENT VertexElements[] =
static const D3DVERTEXELEMENT9 VertexElements[] =
{
{ 0, 0 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 2 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },

View File

@ -172,8 +172,7 @@ static void menu_display_d3d_draw(void *data)
#ifdef _XBOX1
{
D3DSURFACE_DESC desc;
if (d3d_texture_get_level_desc((LPDIRECT3DTEXTURE)
draw->texture, 0, &desc))
if (d3d_texture_get_level_desc(draw->texture, 0, &desc))
{
pv[i].u *= desc.Width;
pv[i].v *= desc.Height;