From c5074ba81fd0dadae79b59f405e0da917db4849a Mon Sep 17 00:00:00 2001 From: Jake Date: Thu, 11 Jan 2018 07:11:28 -0600 Subject: [PATCH] d3d12: fix invalid framebuffer crash and shader compile --- rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp index d844cfbaa0..a959dc4a60 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12CommonDecompiler.cpp @@ -83,7 +83,7 @@ std::string getFunctionImp(FUNCTION f) case FUNCTION::FUNCTION_DFDY: return "ddy($0)"; case FUNCTION::FUNCTION_TEXTURE_SAMPLE2D_DEPTH_RGBA: - return "texture2DReconstruct($t.Sample($tsampler, $0.xy * $t_scale, texture_parameters[$_i].z))"; + return "texture2DReconstruct($t.Sample($tsampler, $0.xy * $t_scale), texture_parameters[$_i].z)"; } } diff --git a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp index 4db62cabec..bbea11ddb0 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.cpp @@ -103,11 +103,15 @@ namespace void D3D12GSRender::clear_surface(u32 arg) { + if ((arg & 0xf3) == 0) return; + std::chrono::time_point start_duration = steady_clock::now(); std::chrono::time_point rtt_duration_start = steady_clock::now(); prepare_render_targets(get_current_resource_storage().command_list.Get()); + if (!framebuffer_status_valid) return; + std::chrono::time_point rtt_duration_end = steady_clock::now(); m_timers.prepare_rtt_duration += std::chrono::duration_cast(rtt_duration_end - rtt_duration_start).count(); @@ -186,6 +190,8 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis get_color_surface_addresses(), get_zeta_surface_address(), m_device.Get(), clear_color, 1.f, 0); + framebuffer_status_valid = true; + // write descriptors DXGI_FORMAT dxgi_format = get_color_surface_format(rsx::method_registers.surface_color()); D3D12_RENDER_TARGET_VIEW_DESC rtt_view_desc = {};