(D3D8) Replace inline function calls with straight function calls

This commit is contained in:
twinaphex 2022-04-20 17:26:03 +02:00
parent 56b08940c2
commit 437051c112
4 changed files with 23 additions and 37 deletions

View File

@ -40,7 +40,6 @@
#endif
/* TODO/FIXME - static globals */
static UINT SDKVersion = 0;
#ifdef HAVE_DYNAMIC_D3D
static dylib_t g_d3d8_dll;
#ifdef HAVE_D3DX
@ -83,7 +82,12 @@ static D3DCreate_t D3DCreate;
void *d3d8_create(void)
{
return D3DCreate(SDKVersion);
#ifdef _XBOX
UINT ver = 0;
#else
UINT ver = 220;
#endif
return D3DCreate(ver);
}
#ifdef HAVE_DYNAMIC_D3D
@ -114,7 +118,6 @@ bool d3d8_initialize_symbols(enum gfx_ctx_api api)
return false;
#endif
SDKVersion = 220;
#ifdef HAVE_DYNAMIC_D3D
D3DCreate = (D3DCreate_t)dylib_proc(g_d3d8_dll, "Direct3DCreate8");
#ifdef HAVE_D3DX
@ -136,9 +139,6 @@ bool d3d8_initialize_symbols(enum gfx_ctx_api api)
if (!D3DCreate)
goto error;
#ifdef _XBOX
SDKVersion = 0;
#endif
#ifdef HAVE_DYNAMIC_D3D
dylib_initialized = true;
#endif

View File

@ -175,12 +175,6 @@ static INLINE void d3d8_texture_free(LPDIRECT3DTEXTURE8 tex)
IDirect3DTexture8_Release(tex);
}
static INLINE void d3d8_set_transform(LPDIRECT3DDEVICE8 dev,
D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
{
IDirect3DDevice8_SetTransform(dev, state, matrix);
}
static INLINE void d3d8_set_texture_stage_state(LPDIRECT3DDEVICE8 dev,
unsigned sampler, D3DTEXTURESTAGESTATETYPE type, unsigned value)
{
@ -246,15 +240,6 @@ static INLINE void d3d8_draw_primitive(LPDIRECT3DDEVICE8 dev,
d3d8_end_scene(dev);
}
static INLINE void d3d8_clear(LPDIRECT3DDEVICE8 dev,
unsigned count, const void *rects, unsigned flags,
INT32 color, float z, unsigned stencil)
{
if (dev)
IDirect3DDevice8_Clear(dev, count, (const D3DRECT*)rects, flags,
color, z, stencil);
}
static INLINE bool d3d8_lock_rectangle(
LPDIRECT3DTEXTURE8 tex,
unsigned level, D3DLOCKED_RECT *lr, RECT *rect,
@ -267,12 +252,6 @@ static INLINE bool d3d8_lock_rectangle(
return false;
}
static INLINE void d3d8_unlock_rectangle(LPDIRECT3DTEXTURE8 tex)
{
if (tex)
IDirect3DTexture8_UnlockRect(tex, 0);
}
static INLINE void d3d8_lock_rectangle_clear(
void *tex,
unsigned level, D3DLOCKED_RECT *lr, RECT *rect,
@ -282,7 +261,7 @@ static INLINE void d3d8_lock_rectangle_clear(
level = 0;
#endif
memset(lr->pBits, level, rectangle_height * lr->Pitch);
d3d8_unlock_rectangle(tex);
IDirect3DTexture8_UnlockRect(tex, 0);
}
static INLINE void d3d8_set_texture(

View File

@ -123,9 +123,9 @@ static D3D9Create_t D3D9Create;
void *d3d9_create(void)
{
#ifdef _XBOX
unsigned ver = 0;
UINT ver = 0;
#else
unsigned ver = 31;
UINT ver = 31;
#endif
return D3D9Create(ver);
}

View File

@ -87,7 +87,9 @@ static void gfx_display_d3d8_blend_begin(void *data)
if (!d3d)
return;
d3d8_enable_blend_func(d3d->dev);
IDirect3DDevice8_SetRenderState(d3d->dev, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
IDirect3DDevice8_SetRenderState(d3d->dev, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
IDirect3DDevice8_SetRenderState(d3d->dev, D3DRS_ALPHABLENDENABLE, true);
}
static void gfx_display_d3d8_blend_end(void *data)
@ -97,7 +99,7 @@ static void gfx_display_d3d8_blend_end(void *data)
if (!d3d)
return;
d3d8_disable_blend_func(d3d->dev);
IDirect3DDevice8_SetRenderState(d3d->dev, D3DRS_ALPHABLENDENABLE, false);
}
static void gfx_display_d3d8_bind_texture(gfx_display_ctx_draw_t *draw,
@ -105,11 +107,16 @@ static void gfx_display_d3d8_bind_texture(gfx_display_ctx_draw_t *draw,
{
LPDIRECT3DDEVICE8 dev = d3d->dev;
d3d8_set_texture(d3d->dev, 0, (void*)draw->texture);
d3d8_set_sampler_address_u(d3d->dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d8_set_sampler_address_v(d3d->dev, 0, D3DTADDRESS_COMM_CLAMP);
d3d8_set_sampler_minfilter(d3d->dev, 0, D3DTEXF_COMM_LINEAR);
d3d8_set_sampler_magfilter(d3d->dev, 0, D3DTEXF_COMM_LINEAR);
IDirect3DDevice8_SetTexture(d3d->dev, 0,
(IDirect3DBaseTexture8*)draw->texture);
IDirect3DDevice8_SetTextureStageState(d3d->dev, 0,
(D3DTEXTURESTAGESTATETYPE)D3DTSS_ADDRESSU, D3DTADDRESS_COMM_CLAMP);
IDirect3DDevice8_SetTextureStageState(d3d->dev, 0,
(D3DTEXTURESTAGESTATETYPE)D3DTSS_ADDRESSV, D3DTADDRESS_COMM_CLAMP);
IDirect3DDevice8_SetTextureStageState(d3d->dev, 0,
(D3DTEXTURESTAGESTATETYPE)D3DTSS_MINFILTER, D3DTEXF_COMM_LINEAR);
IDirect3DDevice8_SetTextureStageState(d3d->dev, 0,
(D3DTEXTURESTAGESTATETYPE)D3DTSS_MAGFILTER, D3DTEXF_COMM_LINEAR);
}
static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,