From 5d3719df442dbeaf82453da917f47125136be086 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 22 Jun 2021 13:43:31 +1000 Subject: [PATCH 1/4] (gfx) Fix uninitialized variables in gfx_display_draw_cursor --- gfx/gfx_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index d6ffcd542c..60e00aed04 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -1055,6 +1055,8 @@ void gfx_display_draw_cursor( draw.texture = texture; draw.prim_type = GFX_DISPLAY_PRIM_TRIANGLESTRIP; draw.pipeline_id = 0; + draw.scale_factor = 1.0f; + draw.rotation = 0.0f; if (dispctx->blend_begin) dispctx->blend_begin(userdata); From 9afa30af5e631ea06b9590ad5559e974613db7f3 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 22 Jun 2021 13:44:09 +1000 Subject: [PATCH 2/4] (d3d11) Disable DXGI's ALT+ENTER handling --- gfx/drivers/d3d11.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index f988a144ab..a81c21fadb 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -766,8 +766,19 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11, &desc, (IDXGISwapChain**)&d3d11->swapChain))) return false; } + +#ifdef HAVE_WINDOW + /* Don't let DXGI mess with the full screen state, because otherwise we end up with a mismatch + * between the window size and the buffers. RetroArch only uses windowed mode (see above). */ + if (FAILED(dxgiFactory->lpVtbl->MakeWindowAssociation(dxgiFactory, desc.OutputWindow, + DXGI_MWA_NO_ALT_ENTER))) + { + RARCH_ERR("[D3D11]: Failed to make disable DXGI ALT+ENTER handling.\n"); + } #endif +#endif // __WINRT__ + dxgiFactory->lpVtbl->Release(dxgiFactory); adapter->lpVtbl->Release(adapter); dxgiDevice->lpVtbl->Release(dxgiDevice); From ed2d6b17309fdfc89edd52b779d5188316b33f93 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 22 Jun 2021 13:44:30 +1000 Subject: [PATCH 3/4] (d3d11) Don't draw content without a texture bound --- gfx/drivers/d3d11.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index a81c21fadb..84479be872 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -1611,10 +1611,9 @@ static bool d3d11_gfx_frame( D3D11SetPShaderSamplers( context, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); D3D11SetVShaderConstantBuffers(context, 0, 1, &d3d11->frame.ubo); + D3D11Draw(context, 4, 0); } - D3D11Draw(context, 4, 0); - D3D11SetRasterizerState(context, d3d11->scissor_enabled); D3D11SetScissorRects(d3d11->context, 1, &d3d11->scissor); D3D11SetBlendState(context, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); From 322aeb4e46a7f607b9ef548552070c168da38ae8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 22 Jun 2021 13:44:47 +1000 Subject: [PATCH 4/4] (d3d11) Don't pass ALLOW_TEARING to present when unsupported --- gfx/drivers/d3d11.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 84479be872..1119cb89d7 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -1370,8 +1370,7 @@ static bool d3d11_gfx_frame( d3d11_video_t* d3d11 = (d3d11_video_t*)data; D3D11DeviceContext context = d3d11->context; bool vsync = d3d11->vsync; - /* TODO/FIXME - setting the conditional to (vsync || !d3d11->has_allow_tearing) causes a black screen on startup in fullscreen mode */ - unsigned present_flags = (vsync) ? 0 : DXGI_PRESENT_ALLOW_TEARING; + unsigned present_flags = (vsync || !d3d11->has_allow_tearing) ? 0 : DXGI_PRESENT_ALLOW_TEARING; const char *stat_text = video_info->stat_text; unsigned video_width = video_info->width; unsigned video_height = video_info->height;