mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
D3D12 Updates:
- Relocated 'd3d12_gfx_sync()' - Fixed swap interval option - Cleanups
This commit is contained in:
parent
81075aa5fa
commit
917fb1f796
@ -294,6 +294,7 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
desc.BufferCount = countof(d3d12->chain.renderTargets);
|
desc.BufferCount = countof(d3d12->chain.renderTargets);
|
||||||
|
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||||
#ifdef __WINRT__
|
#ifdef __WINRT__
|
||||||
desc.Width = width;
|
desc.Width = width;
|
||||||
desc.Height = height;
|
desc.Height = height;
|
||||||
@ -302,14 +303,11 @@ bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
|||||||
desc.BufferDesc.Width = width;
|
desc.BufferDesc.Width = width;
|
||||||
desc.BufferDesc.Height = height;
|
desc.BufferDesc.Height = height;
|
||||||
desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
desc.BufferDesc.RefreshRate.Numerator = 0;
|
||||||
|
desc.BufferDesc.RefreshRate.Denominator = 1;
|
||||||
#endif
|
#endif
|
||||||
desc.SampleDesc.Count = 1;
|
desc.SampleDesc.Count = 1;
|
||||||
#if 0
|
desc.SampleDesc.Quality = 0;
|
||||||
desc.BufferDesc.RefreshRate.Numerator = 60;
|
|
||||||
desc.BufferDesc.RefreshRate.Denominator = 1;
|
|
||||||
desc.SampleDesc.Quality = 0;
|
|
||||||
#endif
|
|
||||||
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
||||||
#ifdef HAVE_WINDOW
|
#ifdef HAVE_WINDOW
|
||||||
desc.OutputWindow = hwnd;
|
desc.OutputWindow = hwnd;
|
||||||
desc.Windowed = TRUE;
|
desc.Windowed = TRUE;
|
||||||
|
@ -1391,6 +1391,7 @@ typedef struct
|
|||||||
float clearcolor[4];
|
float clearcolor[4];
|
||||||
int frame_index;
|
int frame_index;
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
unsigned swap_interval;
|
||||||
} chain;
|
} chain;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
@ -1170,6 +1170,7 @@ static bool d3d12_gfx_frame(
|
|||||||
d3d12_texture_t* texture = NULL;
|
d3d12_texture_t* texture = NULL;
|
||||||
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
||||||
bool vsync = d3d12->chain.vsync;
|
bool vsync = d3d12->chain.vsync;
|
||||||
|
unsigned sync_interval = (vsync) ? d3d12->chain.swap_interval : 0;
|
||||||
unsigned present_flags = (vsync) ? 0 : DXGI_PRESENT_ALLOW_TEARING;
|
unsigned present_flags = (vsync) ? 0 : DXGI_PRESENT_ALLOW_TEARING;
|
||||||
const char *stat_text = video_info->stat_text;
|
const char *stat_text = video_info->stat_text;
|
||||||
bool statistics_show = video_info->statistics_show;
|
bool statistics_show = video_info->statistics_show;
|
||||||
@ -1182,8 +1183,6 @@ static bool d3d12_gfx_frame(
|
|||||||
bool widgets_active = video_info->widgets_active;
|
bool widgets_active = video_info->widgets_active;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
d3d12_gfx_sync(d3d12);
|
|
||||||
|
|
||||||
if (d3d12->resize_chain)
|
if (d3d12->resize_chain)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -1601,12 +1600,15 @@ static bool d3d12_gfx_frame(
|
|||||||
win32_update_title();
|
win32_update_title();
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
DXGIPresent(d3d12->chain.handle, !!vsync, present_flags);
|
DXGIPresent(d3d12->chain.handle, sync_interval, present_flags);
|
||||||
#else
|
#else
|
||||||
DXGI_PRESENT_PARAMETERS pp = { 0 };
|
DXGI_PRESENT_PARAMETERS pp = { 0 };
|
||||||
DXGIPresent1(d3d12->swapchain, 0, 0, &pp);
|
DXGIPresent1(d3d12->swapchain, 0, 0, &pp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Sync after Present for minimal delay */
|
||||||
|
d3d12_gfx_sync(d3d12);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1614,8 +1616,9 @@ static void d3d12_gfx_set_nonblock_state(void* data, bool toggle,
|
|||||||
bool adaptive_vsync_enabled,
|
bool adaptive_vsync_enabled,
|
||||||
unsigned swap_interval)
|
unsigned swap_interval)
|
||||||
{
|
{
|
||||||
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
||||||
d3d12->chain.vsync = !toggle;
|
d3d12->chain.vsync = !toggle;
|
||||||
|
d3d12->chain.swap_interval = swap_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool d3d12_gfx_alive(void* data)
|
static bool d3d12_gfx_alive(void* data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user