Add code that allows for debug D3D

This commit is contained in:
twinaphex 2018-01-07 10:46:30 +01:00
parent 8a6d5dbe91
commit 88d1e455e3
5 changed files with 38 additions and 4 deletions

View File

@ -21,8 +21,8 @@
#ifndef _XBOX
#include <windows.h>
#include <mmreg.h>
#include <mmsystem.h>
#include <mmreg.h>
#endif
#include <dsound.h>

View File

@ -174,7 +174,11 @@ bool d3d_initialize_symbols(void)
return true;
#if defined(HAVE_D3D9)
#if defined(DEBUG) || defined(_DEBUG)
g_d3d_dll = dylib_load("d3d9d.dll");
#else
g_d3d_dll = dylib_load("d3d9.dll");
#endif
#ifdef HAVE_D3DX
g_d3dx_dll = dylib_load_d3dx();
#endif
@ -187,8 +191,11 @@ bool d3d_initialize_symbols(void)
#endif
#elif defined(HAVE_D3D8)
#if defined(DEBUG) || defined(_DEBUG)
g_d3d_dll = dylib_load("d3d8d.dll");
#else
g_d3d_dll = dylib_load("d3d8.dll");
#endif
if (!g_d3d_dll)
return false;
#endif

View File

@ -576,6 +576,12 @@ void d3d_make_d3dpp(void *data,
}
}
#ifdef HAVE_D3D8
/* PresentationInterval must be zero for windowed mode on DX8. */
if (d3dpp->Windowed)
FS_PRESENTINTERVAL(d3dpp) = D3DPRESENT_INTERVAL_DEFAULT;
#endif
d3dpp->SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp->BackBufferCount = 2;
d3dpp->BackBufferFormat = d3d_get_color_format_backbuffer(info->rgb32, windowed_enable);
@ -670,10 +676,13 @@ static bool d3d_init_base(void *data, const video_info_t *info)
#endif
d3d_video_t *d3d = (d3d_video_t*)data;
d3d_make_d3dpp(d3d, info, &d3dpp);
memset(&d3dpp, 0, sizeof(d3dpp));
g_pD3D = (LPDIRECT3D)d3d_create();
/* this needs g_pD3D created first */
d3d_make_d3dpp(d3d, info, &d3dpp);
if (!g_pD3D)
{
RARCH_ERR("[D3D]: Failed to create D3D interface.\n");

View File

@ -209,7 +209,7 @@ static void d3d8_renderchain_free(void *data)
{
d3d_video_t *chain = (d3d_video_t*)data;
if (!chain)
if (!chain || !chain->renderchain_data)
return;
d3d8_renderchain_deinit(chain->renderchain_data);

View File

@ -28,6 +28,24 @@
#include <stdio.h>
#include <stdarg.h>
#if _MSC_VER < 1800
#define va_copy(dst, src) ((dst) = (src))
#endif
#if _MSC_VER < 1300
#define _vscprintf c89_vscprintf_retro__
static int c89_vscprintf_retro__(const char *format, va_list pargs)
{
int retval;
va_list argcopy;
va_copy(argcopy, pargs);
retval = vsnprintf(NULL, 0, format, argcopy);
va_end(argcopy);
return retval;
}
#endif
/* http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */
int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap)