From 1c6c24f8ac48278f7ed59f87199537bb0ff07918 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 24 Aug 2018 19:07:38 +0300 Subject: [PATCH] Update GSL and yaml-cpp submodules --- 3rdparty/GSL | 2 +- 3rdparty/yaml-cpp | 2 +- Utilities/GSL.h | 2 +- Utilities/types.h | 3 +- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 10 ++++- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 2 +- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 44 ++++++++++++--------- rpcs3/Emu/RSX/Common/surface_store.h | 43 ++++++++++++-------- rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp | 2 +- rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h | 32 +++++++-------- rpcs3/Emu/RSX/VK/VKRenderTargets.h | 2 +- rpcs3/rpcs3qt/rsx_debugger.cpp | 25 ++++++++---- 12 files changed, 100 insertions(+), 69 deletions(-) diff --git a/3rdparty/GSL b/3rdparty/GSL index fc5fce4f4f..1995e86d1a 160000 --- a/3rdparty/GSL +++ b/3rdparty/GSL @@ -1 +1 @@ -Subproject commit fc5fce4f4f8d64fbda523d1b0d55115f5ca68774 +Subproject commit 1995e86d1ad70519465374fb4876c6ef7c9f8c61 diff --git a/3rdparty/yaml-cpp b/3rdparty/yaml-cpp index 4fb1c4b92b..c90c08ccc9 160000 --- a/3rdparty/yaml-cpp +++ b/3rdparty/yaml-cpp @@ -1 +1 @@ -Subproject commit 4fb1c4b92bf8d94b32ebccdd890407d45b3bc794 +Subproject commit c90c08ccc9a08abcca609064fb9a856dfdbbb7b4 diff --git a/Utilities/GSL.h b/Utilities/GSL.h index 6d4df0873f..1ca9d77f92 100644 --- a/Utilities/GSL.h +++ b/Utilities/GSL.h @@ -4,7 +4,7 @@ #pragma push_macro("new") #undef new -#include +#include #pragma pop_macro("new") #undef Expects #undef Ensures diff --git a/Utilities/types.h b/Utilities/types.h index 854ae27b39..d19512e0af 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -90,7 +91,7 @@ using steady_clock = std::conditional< namespace gsl { - enum class byte : u8; + using std::byte; } // Formatting helper, type-specific preprocessing for improving safety and functionality diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index f5c03a5fb6..468656c542 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -24,6 +24,12 @@ namespace { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } + + template + gsl::span as_const_span(gsl::span unformated_span) + { + return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + } } namespace @@ -820,10 +826,10 @@ std::tuple write_index_array_data_to_buffer(gsl::span { case rsx::index_array_type::u16: return write_index_array_data_to_buffer_impl(as_span_workaround(dst), - gsl::as_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, base_index, expands); + as_const_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, base_index, expands); case rsx::index_array_type::u32: return write_index_array_data_to_buffer_impl(as_span_workaround(dst), - gsl::as_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, base_index, expands); + as_const_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, base_index, expands); } fmt::throw_exception("Unknown index type" HERE); } diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index 875685906f..d34f0de3d2 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -228,7 +228,7 @@ protected: } LOG_NOTICE(RSX, "FP not found in buffer!"); - gsl::not_null fragment_program_ucode_copy = malloc(rsx_fp.ucode_length); + void* fragment_program_ucode_copy = malloc(rsx_fp.ucode_length); std::memcpy(fragment_program_ucode_copy, rsx_fp.addr, rsx_fp.ucode_length); RSXFragmentProgram new_fp_key = rsx_fp; new_fp_key.addr = fragment_program_ucode_copy; diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 0619d18a9e..8064275d05 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -15,6 +15,12 @@ namespace return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } + template + gsl::span as_const_span(gsl::span unformated_span) + { + return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + } + // TODO: Make this function part of GSL // Note: Doesn't handle overlapping range detection. template @@ -288,16 +294,16 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre case CELL_GCM_TEXTURE_B8: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: { - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } @@ -316,9 +322,9 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre case CELL_GCM_TEXTURE_X16: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } @@ -326,9 +332,9 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: // Untested { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } @@ -336,9 +342,9 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre case CELL_GCM_TEXTURE_D8R8G8B8: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } @@ -347,27 +353,27 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre case CELL_GCM_TEXTURE_X32_FLOAT: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: { if (is_swizzled) - copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); + copy_unmodified_block_swizzled::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of)); else - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); break; } @@ -378,11 +384,11 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre // PS3 uses the Nvidia VTC memory layout for compressed 3D textures. // This is only supported using Nvidia OpenGL. // Remove the VTC tiling to support ATI and Vulkan. - copy_unmodified_block_vtc::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block_vtc::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); } else { - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); } break; } @@ -395,11 +401,11 @@ void upload_texture_subresource(gsl::span dst_buffer, const rsx_subre // PS3 uses the Nvidia VTC memory layout for compressed 3D textures. // This is only supported using Nvidia OpenGL. // Remove the VTC tiling to support ATI and Vulkan. - copy_unmodified_block_vtc::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block_vtc::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); } else { - copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), gsl::as_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); + copy_unmodified_block::copy_mipmap_level(as_span_workaround(dst_buffer), as_const_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_block); } break; } diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 874b90e80f..f997002a78 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -4,6 +4,15 @@ #include "../GCM.h" #include +namespace +{ + template + gsl::span as_const_span(gsl::span unformated_span) + { + return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + } +} + namespace rsx { namespace utility @@ -206,7 +215,7 @@ namespace rsx if (address >= memory_end) return; - surface_format_info info2; + surface_format_info info2{}; Traits::get_surface_info(surface, &info2); const auto offset = (address - memory_address); const auto offset_y = (offset / info.rsx_pitch); @@ -218,7 +227,7 @@ namespace rsx if (fits_w && fits_h) { - typename surface_hierachy_info::memory_overlap_t overlap; + typename surface_hierachy_info::memory_overlap_t overlap{}; overlap._ref = surface; overlap.memory_address = address; overlap.x = offset_x; @@ -237,7 +246,7 @@ namespace rsx auto process_block = [this, process_entry](u32 memory_address, surface_type surface) { surface_hierachy_info block_info; - surface_format_info info; + surface_format_info info{}; Traits::get_surface_info(surface, &info); const auto memory_end = memory_address + (info.rsx_pitch * info.surface_height); @@ -282,7 +291,7 @@ namespace rsx * returns the corresponding render target resource. */ template - gsl::not_null bind_address_as_render_targets( + surface_type bind_address_as_render_targets( command_list_type command_list, u32 address, surface_color_format color_format, size_t width, size_t height, @@ -369,7 +378,7 @@ namespace rsx } template - gsl::not_null bind_address_as_depth_stencil( + surface_type bind_address_as_depth_stencil( command_list_type command_list, u32 address, surface_depth_format depth_format, size_t width, size_t height, @@ -494,9 +503,9 @@ namespace rsx // Same for depth buffer if (std::get<1>(m_bound_depth_stencil) != nullptr) Traits::prepare_ds_for_sampling(command_list, std::get<1>(m_bound_depth_stencil)); - + m_bound_depth_stencil = std::make_tuple(0, nullptr); - + if (!address_z) return; @@ -584,13 +593,13 @@ namespace rsx case surface_color_format::x32: { gsl::span> dst_span{ (be_t*)result[i].data(), ::narrow(dst_pitch * height / sizeof(be_t)) }; - copy_pitched_src_to_dst(dst_span, gsl::as_span(raw_src), src_pitch, width, height); + copy_pitched_src_to_dst(dst_span, as_const_span(raw_src), src_pitch, width, height); break; } case surface_color_format::b8: { gsl::span dst_span{ (u8*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u8)) }; - copy_pitched_src_to_dst(dst_span, gsl::as_span(raw_src), src_pitch, width, height); + copy_pitched_src_to_dst(dst_span, as_const_span(raw_src), src_pitch, width, height); break; } case surface_color_format::g8b8: @@ -599,20 +608,20 @@ namespace rsx case surface_color_format::x1r5g5b5_z1r5g5b5: { gsl::span> dst_span{ (be_t*)result[i].data(), ::narrow(dst_pitch * height / sizeof(be_t)) }; - copy_pitched_src_to_dst(dst_span, gsl::as_span(raw_src), src_pitch, width, height); + copy_pitched_src_to_dst(dst_span, as_const_span(raw_src), src_pitch, width, height); break; } // Note : may require some big endian swap case surface_color_format::w32z32y32x32: { gsl::span dst_span{ (u128*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u128)) }; - copy_pitched_src_to_dst(dst_span, gsl::as_span(raw_src), src_pitch, width, height); + copy_pitched_src_to_dst(dst_span, as_const_span(raw_src), src_pitch, width, height); break; } case surface_color_format::w16z16y16x16: { gsl::span dst_span{ (u64*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u64)) }; - copy_pitched_src_to_dst(dst_span, gsl::as_span(raw_src), src_pitch, width, height); + copy_pitched_src_to_dst(dst_span, as_const_span(raw_src), src_pitch, width, height); break; } @@ -646,13 +655,13 @@ namespace rsx { result[0].resize(width * height * 2); gsl::span dest{ (u16*)result[0].data(), ::narrow(width * height) }; - copy_pitched_src_to_dst(dest, gsl::as_span(depth_buffer_raw_src), row_pitch, width, height); + copy_pitched_src_to_dst(dest, as_const_span(depth_buffer_raw_src), row_pitch, width, height); } if (depth_format == surface_depth_format::z24s8) { result[0].resize(width * height * 4); gsl::span dest{ (u32*)result[0].data(), ::narrow(width * height) }; - copy_pitched_src_to_dst(dest, gsl::as_span(depth_buffer_raw_src), row_pitch, width, height); + copy_pitched_src_to_dst(dest, as_const_span(depth_buffer_raw_src), row_pitch, width, height); } Traits::unmap_downloaded_buffer(depth_data, std::forward(args)...); @@ -662,7 +671,7 @@ namespace rsx gsl::span stencil_buffer_raw_src = Traits::map_downloaded_buffer(stencil_data, std::forward(args)...); result[1].resize(width * height); gsl::span dest{ (u8*)result[1].data(), ::narrow(width * height) }; - copy_pitched_src_to_dst(dest, gsl::as_span(stencil_buffer_raw_src), align(width, 256), width, height); + copy_pitched_src_to_dst(dest, as_const_span(stencil_buffer_raw_src), align(width, 256), width, height); Traits::unmap_downloaded_buffer(stencil_data, std::forward(args)...); return result; } @@ -774,7 +783,7 @@ namespace rsx } else { - surface_format_info info; + surface_format_info info{}; Traits::get_surface_info(surface, &info); bool doubled_x = false; @@ -862,7 +871,7 @@ namespace rsx { if (surface_overlaps_address(surface, this_address, texaddr, &x_offset, &y_offset)) { - surface_format_info info; + surface_format_info info{}; Traits::get_surface_info(surface, &info); u16 real_width = requested_width; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp index b8b8111ce5..dadc4751b2 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp @@ -262,7 +262,7 @@ namespace std::function>)> get_vertex_buffers, ID3D12Resource* m_vertex_buffer_data, d3d12_data_heap& m_buffer_data, - gsl::not_null command_list) + ID3D12GraphicsCommandList* command_list) { command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_vertex_buffer_data, diff --git a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h index ecd60addd2..5a3b2421c8 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h @@ -15,7 +15,7 @@ struct render_target_traits { using surface_storage_type = ComPtr; using surface_type = ID3D12Resource*; - using command_list_type = gsl::not_null; + using command_list_type = ID3D12GraphicsCommandList*; using download_buffer_object = std::tuple, HANDLE>; // heap offset, size, last_put_pos, fence, handle //TODO: Move this somewhere else @@ -26,7 +26,7 @@ struct render_target_traits u32 address, surface_color_format color_format, size_t width, size_t height, ID3D12Resource* /*old*/, - gsl::not_null device, const std::array &clear_color, float, u8) + ID3D12Device* device, const std::array &clear_color, float, u8) { DXGI_FORMAT dxgi_format = get_color_surface_format(color_format); ComPtr rtt; @@ -68,7 +68,7 @@ struct render_target_traits static void prepare_rtt_for_drawing( - gsl::not_null command_list, + ID3D12GraphicsCommandList* command_list, ID3D12Resource* rtt) { command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET)); @@ -76,7 +76,7 @@ struct render_target_traits static void prepare_rtt_for_sampling( - gsl::not_null command_list, + ID3D12GraphicsCommandList* command_list, ID3D12Resource* rtt) { command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(rtt, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_GENERIC_READ)); @@ -87,7 +87,7 @@ struct render_target_traits u32 address, surface_depth_format surfaceDepthFormat, size_t width, size_t height, ID3D12Resource* /*old*/, - gsl::not_null device, const std::array& , float clear_depth, u8 clear_stencil) + ID3D12Device* device, const std::array& , float clear_depth, u8 clear_stencil) { D3D12_CLEAR_VALUE clear_depth_value = {}; clear_depth_value.DepthStencil.Depth = clear_depth; @@ -113,7 +113,7 @@ struct render_target_traits static void prepare_ds_for_drawing( - gsl::not_null command_list, + ID3D12GraphicsCommandList* command_list, ID3D12Resource* ds) { // set the resource as depth write @@ -122,7 +122,7 @@ struct render_target_traits static void prepare_ds_for_sampling( - gsl::not_null command_list, + ID3D12GraphicsCommandList* command_list, ID3D12Resource* ds) { command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(ds, D3D12_RESOURCE_STATE_DEPTH_WRITE, D3D12_RESOURCE_STATE_GENERIC_READ)); @@ -130,7 +130,7 @@ struct render_target_traits static void invalidate_surface_contents( - gsl::not_null, + ID3D12GraphicsCommandList*, ID3D12Resource*, ID3D12Resource*) {} @@ -158,9 +158,9 @@ struct render_target_traits static std::tuple, HANDLE> issue_download_command( - gsl::not_null rtt, + ID3D12Resource* rtt, surface_color_format color_format, size_t width, size_t height, - gsl::not_null device, gsl::not_null command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store + ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store ) { ID3D12GraphicsCommandList* command_list = res_store.command_list.Get(); @@ -191,9 +191,9 @@ struct render_target_traits static std::tuple, HANDLE> issue_depth_download_command( - gsl::not_null ds, + ID3D12Resource* ds, surface_depth_format depth_format, size_t width, size_t height, - gsl::not_null device, gsl::not_null command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store + ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store ) { ID3D12GraphicsCommandList* command_list = res_store.command_list.Get(); @@ -224,9 +224,9 @@ struct render_target_traits static std::tuple, HANDLE> issue_stencil_download_command( - gsl::not_null stencil, + ID3D12Resource* stencil, size_t width, size_t height, - gsl::not_null device, gsl::not_null command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store + ID3D12Device* device, ID3D12CommandQueue* command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store ) { ID3D12GraphicsCommandList* command_list = res_store.command_list.Get(); @@ -256,7 +256,7 @@ struct render_target_traits static gsl::span map_downloaded_buffer(const std::tuple, HANDLE> &sync_data, - gsl::not_null, gsl::not_null, d3d12_data_heap &readback_heap, resource_storage&) + ID3D12Device*, ID3D12CommandQueue*, d3d12_data_heap &readback_heap, resource_storage&) { size_t offset; size_t buffer_size; @@ -273,7 +273,7 @@ struct render_target_traits static void unmap_downloaded_buffer(const std::tuple, HANDLE> &, - gsl::not_null, gsl::not_null, d3d12_data_heap &readback_heap, resource_storage&) + ID3D12Device*, ID3D12CommandQueue*, d3d12_data_heap &readback_heap, resource_storage&) { readback_heap.unmap(); } diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index 0cd4c3eb4f..cd8280cf1d 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -289,7 +289,7 @@ namespace rsx gsl::span map_downloaded_buffer(download_buffer_object, ...) { - return{ (gsl::byte*)nullptr, 0 }; + return {}; } static void unmap_downloaded_buffer(download_buffer_object, ...) diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index e68d2d50cf..1320a1a02c 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -10,6 +10,15 @@ enum GCMEnumTypes constexpr auto qstr = QString::fromStdString; +namespace +{ + template + gsl::span as_const_span(gsl::span unformated_span) + { + return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + } +} + rsx_debugger::rsx_debugger(std::shared_ptr gui_settings, QWidget* parent) : QDialog(parent) , m_gui_settings(gui_settings) @@ -416,12 +425,12 @@ namespace { case rsx::surface_color_format::b8: { - u8 value = gsl::as_span(orig_buffer)[idx]; + u8 value = as_const_span(orig_buffer)[idx]; return{ value, value, value }; } case rsx::surface_color_format::x32: { - be_t stored_val = gsl::as_span>(orig_buffer)[idx]; + be_t stored_val = as_const_span>(orig_buffer)[idx]; u32 swapped_val = stored_val; f32 float_val = (f32&)swapped_val; u8 val = float_val * 255.f; @@ -431,19 +440,19 @@ namespace case rsx::surface_color_format::x8b8g8r8_o8b8g8r8: case rsx::surface_color_format::x8b8g8r8_z8b8g8r8: { - auto ptr = gsl::as_span(orig_buffer); + auto ptr = as_const_span(orig_buffer); return{ ptr[1 + idx * 4], ptr[2 + idx * 4], ptr[3 + idx * 4] }; } case rsx::surface_color_format::a8r8g8b8: case rsx::surface_color_format::x8r8g8b8_o8r8g8b8: case rsx::surface_color_format::x8r8g8b8_z8r8g8b8: { - auto ptr = gsl::as_span(orig_buffer); + auto ptr = as_const_span(orig_buffer); return{ ptr[3 + idx * 4], ptr[2 + idx * 4], ptr[1 + idx * 4] }; } case rsx::surface_color_format::w16z16y16x16: { - auto ptr = gsl::as_span(orig_buffer); + auto ptr = as_const_span(orig_buffer); f16 h0 = f16(ptr[4 * idx]); f16 h1 = f16(ptr[4 * idx + 1]); f16 h2 = f16(ptr[4 * idx + 2]); @@ -524,7 +533,7 @@ void rsx_debugger::OnClickDrawCalls() { for (u32 col = 0; col < width; col++) { - u32 depth_val = gsl::as_span(orig_buffer)[row * width + col]; + u32 depth_val = as_const_span(orig_buffer)[row * width + col]; u8 displayed_depth_val = 255 * depth_val / 0xFFFFFF; buffer[4 * col + 0 + width * row * 4] = displayed_depth_val; buffer[4 * col + 1 + width * row * 4] = displayed_depth_val; @@ -539,7 +548,7 @@ void rsx_debugger::OnClickDrawCalls() { for (u32 col = 0; col < width; col++) { - u16 depth_val = gsl::as_span(orig_buffer)[row * width + col]; + u16 depth_val = as_const_span(orig_buffer)[row * width + col]; u8 displayed_depth_val = 255 * depth_val / 0xFFFF; buffer[4 * col + 0 + width * row * 4] = displayed_depth_val; buffer[4 * col + 1 + width * row * 4] = displayed_depth_val; @@ -563,7 +572,7 @@ void rsx_debugger::OnClickDrawCalls() { for (u32 col = 0; col < width; col++) { - u8 stencil_val = gsl::as_span(orig_buffer)[row * width + col]; + u8 stencil_val = as_const_span(orig_buffer)[row * width + col]; buffer[4 * col + 0 + width * row * 4] = stencil_val; buffer[4 * col + 1 + width * row * 4] = stencil_val; buffer[4 * col + 2 + width * row * 4] = stencil_val;