From 25fb362c8b3b8d80fefb13ba9b8afae3e323d363 Mon Sep 17 00:00:00 2001 From: Zangetsu38 Date: Thu, 2 Feb 2017 10:44:11 +0100 Subject: [PATCH] Update Submodule GSL --- 3rdparty/GSL | 2 +- Utilities/GSL.h | 4 +- rpcs3-tests/ps3-rsx-common.cpp | 2 +- rpcs3/CMakeLists.txt | 2 +- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 64 ++++++++++----------- rpcs3/Emu/RSX/Common/BufferUtils.h | 6 +- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 4 +- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 44 +++++++------- rpcs3/Emu/RSX/Common/TextureUtils.h | 6 +- rpcs3/Emu/RSX/Common/surface_store.h | 44 +++++++------- rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp | 12 ++-- rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h | 4 +- rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp | 4 +- rpcs3/Emu/RSX/GL/GLRenderTargets.h | 4 +- rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp | 8 +-- rpcs3/Emu/RSX/RSXThread.cpp | 6 +- rpcs3/Emu/RSX/RSXThread.h | 10 ++-- rpcs3/Emu/RSX/VK/VKRenderTargets.h | 4 +- rpcs3/Emu/RSX/VK/VKTexture.cpp | 8 +-- rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp | 6 +- rpcs3/Gui/RSXDebugger.cpp | 26 ++++----- rpcs3_default.props | 2 +- 22 files changed, 136 insertions(+), 136 deletions(-) diff --git a/3rdparty/GSL b/3rdparty/GSL index fc5fce4f4f..96eaf274f8 160000 --- a/3rdparty/GSL +++ b/3rdparty/GSL @@ -1 +1 @@ -Subproject commit fc5fce4f4f8d64fbda523d1b0d55115f5ca68774 +Subproject commit 96eaf274f8c57829080100f7cd1d2e7744bae1ae diff --git a/Utilities/GSL.h b/Utilities/GSL.h index 6d4df0873f..5cd3afa408 100644 --- a/Utilities/GSL.h +++ b/Utilities/GSL.h @@ -1,10 +1,10 @@ -#pragma once +#pragma once #define GSL_THROW_ON_CONTRACT_VIOLATION #pragma push_macro("new") #undef new -#include +#include #pragma pop_macro("new") #undef Expects #undef Ensures diff --git a/rpcs3-tests/ps3-rsx-common.cpp b/rpcs3-tests/ps3-rsx-common.cpp index 960bef8ff0..c1246a7861 100644 --- a/rpcs3-tests/ps3-rsx-common.cpp +++ b/rpcs3-tests/ps3-rsx-common.cpp @@ -10,6 +10,6 @@ TEST_CLASS(rsx_common) std::vector dest_buffer(2200); std::vector src_buffer(100000); // Big enough - write_vertex_array_data_to_buffer(gsl::span(dest_buffer), src_buffer.data(), 0, 550, rsx::vertex_base_type::ub256, 4, 20, 4); + write_vertex_array_data_to_buffer(gsl::multi_span(dest_buffer), src_buffer.data(), 0, 550, rsx::vertex_base_type::ub256, 4, 20, 4); } }; diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 544204163c..9d61c3a9a8 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -133,7 +133,7 @@ ${LLVM_INCLUDE_DIRS} "${RPCS3_SRC_DIR}/.." "${RPCS3_SRC_DIR}/../Utilities/yaml-cpp/include" "${RPCS3_SRC_DIR}/../asmjit/src/asmjit" -"${RPCS3_SRC_DIR}/../3rdparty/GSL/include" +"${RPCS3_SRC_DIR}/../3rdparty/GSL/gsl" "${RPCS3_SRC_DIR}/../rsx_program_decompiler/rsx_decompiler" "${RPCS3_SRC_DIR}/../rsx_program_decompiler/shader_code" "${RPCS3_SRC_DIR}/../Vulkan/Vulkan-LoaderAndValidationLayers/include" diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index bdfd1b39dd..40069c94ff 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -1,15 +1,15 @@ -#include "stdafx.h" +#include "stdafx.h" #include "BufferUtils.h" #include "../rsx_methods.h" namespace { - // FIXME: GSL as_span break build if template parameter is non const with current revision. - // Replace with true as_span when fixed. + // FIXME: GSL as_multi_span break build if template parameter is non const with current revision. + // Replace with true as_multi_span when fixed. template - gsl::span as_span_workaround(gsl::span unformated_span) + gsl::multi_span as_multi_span_workaround(gsl::multi_span unformated_multi_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_multi_span.data(), ::narrow(unformated_multi_span.size_bytes() / sizeof(T)) }; } } @@ -33,11 +33,11 @@ namespace } template - void copy_whole_attribute_array(gsl::span dst, gsl::span src_ptr, u8 attribute_size, u8 dst_stride, u32 src_stride, u32 vertex_count) + void copy_whole_attribute_array(gsl::multi_span dst, gsl::multi_span src_ptr, u8 attribute_size, u8 dst_stride, u32 src_stride, u32 vertex_count) { for (u32 vertex = 0; vertex < vertex_count; ++vertex) { - gsl::span src = gsl::as_span(src_ptr.subspan(src_stride * vertex, attribute_size * sizeof(const U))); + gsl::multi_span src = gsl::as_multi_span(src_ptr.subspan(src_stride * vertex, attribute_size * sizeof(const U))); for (u32 i = 0; i < attribute_size; ++i) { dst[vertex * dst_stride / sizeof(T) + i] = src[i]; @@ -46,7 +46,7 @@ namespace } } -void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::span src_ptr, u32 count, rsx::vertex_base_type type, u32 vector_element_count, u32 attribute_src_stride, u8 dst_stride) +void write_vertex_array_data_to_buffer(gsl::multi_span raw_dst_multi_span, gsl::multi_span src_ptr, u32 count, rsx::vertex_base_type type, u32 vector_element_count, u32 attribute_src_stride, u8 dst_stride) { verify(HERE), (vector_element_count > 0); @@ -55,27 +55,27 @@ void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::s case rsx::vertex_base_type::ub: case rsx::vertex_base_type::ub256: { - gsl::span dst_span = as_span_workaround(raw_dst_span); - copy_whole_attribute_array(dst_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); + gsl::multi_span dst_multi_span = as_multi_span_workaround(raw_dst_multi_span); + copy_whole_attribute_array(dst_multi_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); return; } case rsx::vertex_base_type::s1: case rsx::vertex_base_type::sf: case rsx::vertex_base_type::s32k: { - gsl::span dst_span = as_span_workaround(raw_dst_span); - copy_whole_attribute_array>(dst_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); + gsl::multi_span dst_multi_span = as_multi_span_workaround(raw_dst_multi_span); + copy_whole_attribute_array>(dst_multi_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); return; } case rsx::vertex_base_type::f: { - gsl::span dst_span = as_span_workaround(raw_dst_span); - copy_whole_attribute_array>(dst_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); + gsl::multi_span dst_multi_span = as_multi_span_workaround(raw_dst_multi_span); + copy_whole_attribute_array>(dst_multi_span, src_ptr, vector_element_count, dst_stride, attribute_src_stride, count); return; } case rsx::vertex_base_type::cmp: { - gsl::span dst_span = as_span_workaround(raw_dst_span); + gsl::multi_span dst_multi_span = as_multi_span_workaround(raw_dst_multi_span); for (u32 i = 0; i < count; ++i) { be_t src_value; @@ -83,10 +83,10 @@ void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::s src_ptr.subspan(attribute_src_stride * i).data(), sizeof(be_t)); const auto& decoded_vector = decode_cmp_vector(src_value); - dst_span[i * dst_stride / sizeof(u16)] = decoded_vector[0]; - dst_span[i * dst_stride / sizeof(u16) + 1] = decoded_vector[1]; - dst_span[i * dst_stride / sizeof(u16) + 2] = decoded_vector[2]; - dst_span[i * dst_stride / sizeof(u16) + 3] = decoded_vector[3]; + dst_multi_span[i * dst_stride / sizeof(u16)] = decoded_vector[0]; + dst_multi_span[i * dst_stride / sizeof(u16) + 1] = decoded_vector[1]; + dst_multi_span[i * dst_stride / sizeof(u16) + 2] = decoded_vector[2]; + dst_multi_span[i * dst_stride / sizeof(u16) + 3] = decoded_vector[3]; } return; } @@ -96,7 +96,7 @@ void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::s namespace { template -std::tuple upload_untouched(gsl::span> src, gsl::span dst, bool is_primitive_restart_enabled, T primitive_restart_index) +std::tuple upload_untouched(gsl::multi_span> src, gsl::multi_span dst, bool is_primitive_restart_enabled, T primitive_restart_index) { T min_index = -1; T max_index = 0; @@ -122,7 +122,7 @@ std::tuple upload_untouched(gsl::span> src, gsl::span // FIXME: expanded primitive type may not support primitive restart correctly template -std::tuple expand_indexed_triangle_fan(gsl::span> src, gsl::span dst, bool is_primitive_restart_enabled, T primitive_restart_index) +std::tuple expand_indexed_triangle_fan(gsl::multi_span> src, gsl::multi_span dst, bool is_primitive_restart_enabled, T primitive_restart_index) { T min_index = -1; T max_index = 0; @@ -139,7 +139,7 @@ std::tuple expand_indexed_triangle_fan(gsl::span> src, gs size_t dst_idx = 0; while (src.size() > 2) { - gsl::span> tri_indexes = src.subspan(0, 2); + gsl::multi_span> tri_indexes = src.subspan(0, 2); T index1 = tri_indexes[0]; if (is_primitive_restart_enabled && index1 == primitive_restart_index) { @@ -172,7 +172,7 @@ std::tuple expand_indexed_triangle_fan(gsl::span> src, gs // FIXME: expanded primitive type may not support primitive restart correctly template -std::tuple expand_indexed_quads(gsl::span> src, gsl::span dst, bool is_primitive_restart_enabled, T primitive_restart_index) +std::tuple expand_indexed_quads(gsl::multi_span> src, gsl::multi_span dst, bool is_primitive_restart_enabled, T primitive_restart_index) { T min_index = -1; T max_index = 0; @@ -182,7 +182,7 @@ std::tuple expand_indexed_quads(gsl::span> src, gsl::span size_t dst_idx = 0; while (!src.empty()) { - gsl::span> quad_indexes = src.subspan(0, 4); + gsl::multi_span> quad_indexes = src.subspan(0, 4); T index0 = quad_indexes[0]; if (is_primitive_restart_enabled && index0 == primitive_restart_index) { @@ -367,8 +367,8 @@ namespace // TODO: Unify indexed and non indexed primitive expansion ? template - std::tuple write_index_array_data_to_buffer_impl(gsl::span dst, - gsl::span> src, + std::tuple write_index_array_data_to_buffer_impl(gsl::multi_span dst, + gsl::multi_span> src, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, const std::vector > &first_count_arguments, std::function expands) { @@ -396,19 +396,19 @@ namespace } } -std::tuple write_index_array_data_to_buffer(gsl::span dst, - gsl::span src, +std::tuple write_index_array_data_to_buffer(gsl::multi_span dst, + gsl::multi_span src, rsx::index_array_type type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, const std::vector > &first_count_arguments, std::function expands) { switch (type) { 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, expands); + return write_index_array_data_to_buffer_impl(as_multi_span_workaround(dst), + gsl::as_multi_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, 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, expands); + return write_index_array_data_to_buffer_impl(as_multi_span_workaround(dst), + gsl::as_multi_span>(src), draw_mode, restart_index_enabled, restart_index, first_count_arguments, expands); } fmt::throw_exception("Unknown index type" HERE); } diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index 63910f5244..7ac9c29162 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include @@ -10,7 +10,7 @@ * Write count vertex attributes from src_ptr. * src_ptr array layout is deduced from the type, vector element count and src_stride arguments. */ -void write_vertex_array_data_to_buffer(gsl::span raw_dst_span, gsl::span src_ptr, u32 count, rsx::vertex_base_type type, u32 vector_element_count, u32 attribute_src_stride, u8 dst_stride); +void write_vertex_array_data_to_buffer(gsl::multi_span raw_dst_multi_span, gsl::multi_span src_ptr, u32 count, rsx::vertex_base_type type, u32 vector_element_count, u32 attribute_src_stride, u8 dst_stride); /* * If primitive mode is not supported and need to be emulated (using an index buffer) returns false. @@ -32,7 +32,7 @@ u32 get_index_type_size(rsx::index_array_type type); * Returns min/max index found during the process. * The function expands index buffer for non native primitive type if expands(draw_mode) return true. */ -std::tuple write_index_array_data_to_buffer(gsl::span dst, gsl::span src, +std::tuple write_index_array_data_to_buffer(gsl::multi_span dst, gsl::multi_span src, rsx::index_array_type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, const std::vector > &first_count_arguments, std::function expands); diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index 0d182b7c11..b0c157777c 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Emu/RSX/RSXFragmentProgram.h" #include "Emu/RSX/RSXVertexProgram.h" @@ -217,7 +217,7 @@ public: return 0; } - void fill_fragment_constants_buffer(gsl::span dst_buffer, const RSXFragmentProgram &fragment_program) const + void fill_fragment_constants_buffer(gsl::multi_span dst_buffer, const RSXFragmentProgram &fragment_program) const { const auto I = m_fragment_shader_cache.find(fragment_program); if (I == m_fragment_shader_cache.end()) diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index d7dddfd1cb..510b417ec7 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/Memory/vm.h" #include "TextureUtils.h" #include "../RSXThread.h" @@ -7,18 +7,18 @@ namespace { - // FIXME: GSL as_span break build if template parameter is non const with current revision. - // Replace with true as_span when fixed. + // FIXME: GSL as_multi_span break build if template parameter is non const with current revision. + // Replace with true as_multi_span when fixed. template - gsl::span as_span_workaround(gsl::span unformated_span) + gsl::multi_span as_multi_span_workaround(gsl::multi_span unformated_multi_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_multi_span.data(), ::narrow(unformated_multi_span.size_bytes() / sizeof(T)) }; } // TODO: Make this function part of GSL // Note: Doesn't handle overlapping range detection. template - constexpr void copy(gsl::span dst, gsl::span src) + constexpr void copy(gsl::multi_span dst, gsl::multi_span src) { static_assert(std::is_convertible::value, "Cannot convert source and destination span type."); verify(HERE), (dst.size() == src.size()); @@ -28,7 +28,7 @@ namespace struct copy_unmodified_block { template - static void copy_mipmap_level(gsl::span dst, gsl::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) + static void copy_mipmap_level(gsl::multi_span dst, gsl::multi_span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block, u32 src_pitch_in_block) { size_t row_element_count = dst_pitch_in_block; static_assert(sizeof(T) == sizeof(U), "Type size doesn't match."); @@ -40,13 +40,13 @@ struct copy_unmodified_block struct copy_unmodified_block_swizzled { template - static void copy_mipmap_level(gsl::span dst, gsl::span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block) + static void copy_mipmap_level(gsl::multi_span dst, gsl::multi_span src, u16 width_in_block, u16 row_count, u16 depth, u32 dst_pitch_in_block) { std::unique_ptr temp_swizzled(new U[width_in_block * row_count]); for (int d = 0; d < depth; ++d) { rsx::convert_linear_swizzle((void*)src.subspan(d * width_in_block * row_count).data(), temp_swizzled.get(), width_in_block, row_count, true); - gsl::span swizzled_src{ temp_swizzled.get(), ::narrow(width_in_block * row_count) }; + gsl::multi_span swizzled_src{ temp_swizzled.get(), ::narrow(width_in_block * row_count) }; for (int row = 0; row < row_count; ++row) copy(dst.subspan((row + d * row_count) * dst_pitch_in_block, width_in_block), swizzled_src.subspan(row * width_in_block, width_in_block)); } @@ -96,7 +96,7 @@ namespace u32 src_pitch_in_block = padded_row ? suggested_pitch_in_bytes / block_size_in_bytes : miplevel_width_in_block; current_subresource_layout.pitch_in_bytes = src_pitch_in_block; - current_subresource_layout.data = gsl::span(texture_data_pointer + offset_in_src, src_pitch_in_block * block_size_in_bytes * miplevel_height_in_block * depth); + current_subresource_layout.data = gsl::multi_span(texture_data_pointer + offset_in_src, src_pitch_in_block * block_size_in_bytes * miplevel_height_in_block * depth); result.push_back(current_subresource_layout); offset_in_src += miplevel_height_in_block * src_pitch_in_block * block_size_in_bytes * depth; @@ -199,7 +199,7 @@ std::vector get_subresources_layout(const rsx::vertex_te return get_subresources_layout_impl(texture); } -void upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, size_t dst_row_pitch_multiple_of) +void upload_texture_subresource(gsl::multi_span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, size_t dst_row_pitch_multiple_of) { u16 w = src_layout.width_in_block; u16 h = src_layout.height_in_block; @@ -215,9 +215,9 @@ 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_multi_span_workaround(dst_buffer), gsl::as_multi_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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; } @@ -237,9 +237,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_multi_span_workaround(dst_buffer), gsl::as_multi_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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; } @@ -249,33 +249,33 @@ 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_multi_span_workaround(dst_buffer), gsl::as_multi_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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; } case CELL_GCM_TEXTURE_Y16_X16: case CELL_GCM_TEXTURE_Y16_X16_FLOAT: case CELL_GCM_TEXTURE_X32_FLOAT: - 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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: - 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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: - 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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span>(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; case CELL_GCM_TEXTURE_COMPRESSED_DXT1: - 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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; case CELL_GCM_TEXTURE_COMPRESSED_DXT23: case CELL_GCM_TEXTURE_COMPRESSED_DXT45: - 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_bytes); + copy_unmodified_block::copy_mipmap_level(as_multi_span_workaround(dst_buffer), gsl::as_multi_span(src_layout.data), w, h, depth, get_row_pitch_in_block(w, dst_row_pitch_multiple_of), src_layout.pitch_in_bytes); break; default: diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/Emu/RSX/Common/TextureUtils.h index 5de0dbc2f9..d11fba82f8 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "../RSXTexture.h" @@ -7,7 +7,7 @@ struct rsx_subresource_layout { - gsl::span data; + gsl::multi_span data; u16 width_in_block; u16 height_in_block; u16 depth; @@ -28,7 +28,7 @@ size_t get_placed_texture_storage_size(const rsx::vertex_texture &texture, size_ std::vector get_subresources_layout(const rsx::fragment_texture &texture); std::vector get_subresources_layout(const rsx::vertex_texture &texture); -void upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, size_t dst_row_pitch_multiple_of); +void upload_texture_subresource(gsl::multi_span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, size_t dst_row_pitch_multiple_of); u8 get_format_block_size_in_bytes(int format); u8 get_format_block_size_in_texel(int format); diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 1740276138..4cd5ee9fa0 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Utilities/GSL.h" #include "../GCM.h" @@ -41,14 +41,14 @@ namespace rsx * that generates command to download the given surface to some mappable buffer. * - a member function static issue_depth_download_command that does the same for depth surface * - a member function static issue_stencil_download_command that does the same for stencil surface - * - a member function gsl::span map_downloaded_buffer(download_buffer_object, ...) that maps a download_buffer_object + * - a member function gsl::multi_span map_downloaded_buffer(download_buffer_object, ...) that maps a download_buffer_object * - a member function static unmap_downloaded_buffer that unmaps it. */ template struct surface_store { template - void copy_pitched_src_to_dst(gsl::span dest, gsl::span src, size_t src_pitch_in_bytes, size_t width, size_t height) + void copy_pitched_src_to_dst(gsl::multi_span dest, gsl::multi_span src, size_t src_pitch_in_bytes, size_t width, size_t height) { for (int row = 0; row < height; row++) { @@ -240,7 +240,7 @@ namespace rsx if (std::get<0>(m_bound_render_targets[i]) == 0) continue; - gsl::span raw_src = Traits::map_downloaded_buffer(download_data[i], std::forward(args)...); + gsl::multi_span raw_src = Traits::map_downloaded_buffer(download_data[i], std::forward(args)...); size_t src_pitch = utility::get_aligned_pitch(color_format, ::narrow(width)); size_t dst_pitch = utility::get_packed_pitch(color_format, ::narrow(width)); @@ -259,14 +259,14 @@ namespace rsx case surface_color_format::x8r8g8b8_z8r8g8b8: 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); + gsl::multi_span> dst_multi_span{ (be_t*)result[i].data(), ::narrow(dst_pitch * height / sizeof(be_t)) }; + copy_pitched_src_to_dst(dst_multi_span, gsl::as_multi_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); + gsl::multi_span dst_multi_span{ (u8*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u8)) }; + copy_pitched_src_to_dst(dst_multi_span, gsl::as_multi_span(raw_src), src_pitch, width, height); break; } case surface_color_format::g8b8: @@ -274,21 +274,21 @@ namespace rsx case surface_color_format::x1r5g5b5_o1r5g5b5: 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); + gsl::multi_span> dst_multi_span{ (be_t*)result[i].data(), ::narrow(dst_pitch * height / sizeof(be_t)) }; + copy_pitched_src_to_dst(dst_multi_span, gsl::as_multi_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); + gsl::multi_span dst_multi_span{ (u128*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u128)) }; + copy_pitched_src_to_dst(dst_multi_span, gsl::as_multi_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); + gsl::multi_span dst_multi_span{ (u64*)result[i].data(), ::narrow(dst_pitch * height / sizeof(u64)) }; + copy_pitched_src_to_dst(dst_multi_span, gsl::as_multi_span(raw_src), src_pitch, width, height); break; } @@ -317,28 +317,28 @@ namespace rsx if (depth_format == surface_depth_format::z24s8) stencil_data = std::move(Traits::issue_stencil_download_command(std::get<1>(m_bound_depth_stencil), width, height, std::forward(args)...)); - gsl::span depth_buffer_raw_src = Traits::map_downloaded_buffer(depth_data, std::forward(args)...); + gsl::multi_span depth_buffer_raw_src = Traits::map_downloaded_buffer(depth_data, std::forward(args)...); if (depth_format == surface_depth_format::z16) { 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); + gsl::multi_span dest{ (u16*)result[0].data(), ::narrow(width * height) }; + copy_pitched_src_to_dst(dest, gsl::as_multi_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); + gsl::multi_span dest{ (u32*)result[0].data(), ::narrow(width * height) }; + copy_pitched_src_to_dst(dest, gsl::as_multi_span(depth_buffer_raw_src), row_pitch, width, height); } Traits::unmap_downloaded_buffer(depth_data, std::forward(args)...); if (depth_format == surface_depth_format::z16) return result; - gsl::span stencil_buffer_raw_src = Traits::map_downloaded_buffer(stencil_data, std::forward(args)...); + gsl::multi_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); + gsl::multi_span dest{ (u8*)result[1].data(), ::narrow(width * height) }; + copy_pitched_src_to_dst(dest, gsl::as_multi_span(stencil_buffer_raw_src), align(width, 256), width, height); Traits::unmap_downloaded_buffer(stencil_data, std::forward(args)...); return result; } diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp index ca5145fda2..ea0b6acc80 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Buffer.cpp @@ -1,4 +1,4 @@ -#ifdef _MSC_VER +#ifdef _MSC_VER #include "stdafx.h" #include "stdafx_d3d12.h" @@ -164,7 +164,7 @@ namespace void* mapped_buffer = m_buffer_data.map(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size)); - gsl::span mapped_buffer_span = { + gsl::multi_span mapped_buffer_span = { (gsl::byte*)mapped_buffer, gsl::narrow_cast(buffer_size)}; write_vertex_array_data_to_buffer(mapped_buffer_span, vertex_array.data, vertex_count, vertex_array.type, vertex_array.attribute_size, vertex_array.stride, element_size); @@ -286,8 +286,8 @@ namespace } std::tuple, size_t> upload_inlined_vertex_array( - gsl::span vertex_attribute_infos, - gsl::span inlined_array_raw_data, d3d12_data_heap& ring_buffer_data, + gsl::multi_span vertex_attribute_infos, + gsl::multi_span inlined_array_raw_data, d3d12_data_heap& ring_buffer_data, ID3D12Resource* vertex_buffer_placement, ID3D12GraphicsCommandList* command_list) { // We can't rely on vertex_attribute_infos strides here so compute it @@ -322,7 +322,7 @@ namespace void* mapped_buffer = ring_buffer_data.map(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size)); - gsl::span dst = {(gsl::byte*)mapped_buffer, buffer_size}; + gsl::multi_span dst = {(gsl::byte*)mapped_buffer, buffer_size}; for (u32 i = 0; i < element_count; i++) { auto subdst = dst.subspan(i * element_size, element_size); @@ -406,7 +406,7 @@ namespace void* mapped_buffer = m_buffer_data.map(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size)); u32 min_index, max_index; - gsl::span dst{ + gsl::multi_span dst{ reinterpret_cast(mapped_buffer), ::narrow(buffer_size)}; std::tie(min_index, max_index) = diff --git a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h index fd036b34a8..80027005bc 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12RenderTargetSets.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -225,7 +225,7 @@ struct render_target_traits } static - gsl::span map_downloaded_buffer(const std::tuple, HANDLE> &sync_data, + gsl::multi_span map_downloaded_buffer(const std::tuple, HANDLE> &sync_data, gsl::not_null device, gsl::not_null command_queue, d3d12_data_heap &readback_heap, resource_storage &res_store) { size_t offset; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp index 9cf2e25836..4e035218a4 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp @@ -1,4 +1,4 @@ -#ifdef _MSC_VER +#ifdef _MSC_VER #include "stdafx.h" #include "stdafx_d3d12.h" #include "D3D12GSRender.h" @@ -107,7 +107,7 @@ namespace { size_t mip_level = 0; void *mapped_buffer_ptr = texture_buffer_heap.map(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size)); - gsl::span mapped_buffer{ (gsl::byte*)mapped_buffer_ptr, ::narrow(buffer_size) }; + gsl::multi_span mapped_buffer{ (gsl::byte*)mapped_buffer_ptr, ::narrow(buffer_size) }; std::vector input_layouts = get_subresources_layout(texture); u8 block_size_in_bytes = get_format_block_size_in_bytes(format); u8 block_size_in_texel = get_format_block_size_in_texel(format); diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.h b/rpcs3/Emu/RSX/GL/GLRenderTargets.h index 761bbfa0f3..046534b756 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.h +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "../Common/surface_store.h" #include "GLHelpers.h" #include "stdafx.h" @@ -271,7 +271,7 @@ struct gl_render_target_traits } static - gsl::span map_downloaded_buffer(const std::vector &buffer) + gsl::multi_span map_downloaded_buffer(const std::vector &buffer) { return{ reinterpret_cast(buffer.data()), ::narrow(buffer.size()) }; } diff --git a/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp b/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp index daa275d6c9..778e9ce135 100644 --- a/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp +++ b/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "GLGSRender.h" #include "../rsx_methods.h" #include "../Common/BufferUtils.h" @@ -169,7 +169,7 @@ namespace return std::make_tuple(vertex_draw_count, mapping.second); } - std::tuple upload_index_buffer(gsl::span raw_index_buffer, void *ptr, rsx::index_array_type type, rsx::primitive_type draw_mode, const std::vector> first_count_commands, u32 initial_vertex_count) + std::tuple upload_index_buffer(gsl::multi_span raw_index_buffer, void *ptr, rsx::index_array_type type, rsx::primitive_type draw_mode, const std::vector> first_count_commands, u32 initial_vertex_count) { u32 min_index, max_index, vertex_draw_count = initial_vertex_count; @@ -179,7 +179,7 @@ namespace u32 type_size = ::narrow(get_index_type_size(type)); u32 block_sz = vertex_draw_count * type_size; - gsl::span dst{ reinterpret_cast(ptr), ::narrow(block_sz) }; + gsl::multi_span dst{ reinterpret_cast(ptr), ::narrow(block_sz) }; std::tie(min_index, max_index) = write_index_array_data_to_buffer(dst, raw_index_buffer, type, draw_mode, rsx::method_registers.restart_index_enabled(), rsx::method_registers.restart_index(), first_count_commands, [](auto prim) { return !gl::is_primitive_native(prim); }); @@ -229,7 +229,7 @@ namespace auto mapping = m_attrib_ring_info.alloc_from_heap(data_size, m_min_texbuffer_alignment); gsl::byte* dst = static_cast(mapping.first); buffer_offset = mapping.second; - gsl::span dest_span(dst, data_size); + gsl::multi_span dest_span(dst, data_size); prepare_buffer_for_writing(dst, vertex_array.type, vertex_array.attribute_size, vertex_count); diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index d9b7609ac3..9204c33490 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Utilities/Config.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" @@ -591,7 +591,7 @@ namespace rsx return get_system_time() * 1000; } - gsl::span thread::get_raw_index_array(const std::vector >& draw_indexed_clause) const + gsl::multi_span thread::get_raw_index_array(const std::vector >& draw_indexed_clause) const { u32 address = rsx::get_address(rsx::method_registers.index_array_address(), rsx::method_registers.index_array_location()); rsx::index_array_type type = rsx::method_registers.index_type(); @@ -613,7 +613,7 @@ namespace rsx return{ ptr, count * type_size }; } - gsl::span thread::get_raw_vertex_buffer(const rsx::data_array_format_info& vertex_array_info, u32 base_offset, const std::vector>& vertex_ranges) const + gsl::multi_span thread::get_raw_vertex_buffer(const rsx::data_array_format_info& vertex_array_info, u32 base_offset, const std::vector>& vertex_ranges) const { u32 offset = vertex_array_info.offset(); u32 address = base_offset + rsx::get_address(offset & 0x7fffffff, offset >> 31); diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 58e5d7a482..3bc0b8afe3 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -122,7 +122,7 @@ namespace rsx rsx::vertex_base_type type; u8 attribute_size; u8 stride; - gsl::span data; + gsl::multi_span data; u8 index; }; @@ -154,7 +154,7 @@ namespace rsx */ std::vector> ranges_to_fetch_in_index_buffer; - gsl::span raw_index_buffer; + gsl::multi_span raw_index_buffer; }; struct draw_inlined_array @@ -261,8 +261,8 @@ namespace rsx virtual u64 timestamp() const; virtual bool on_access_violation(u32 address, bool is_writing) { return false; } - gsl::span get_raw_index_array(const std::vector >& draw_indexed_clause) const; - gsl::span get_raw_vertex_buffer(const rsx::data_array_format_info&, u32 base_offset, const std::vector>& vertex_ranges) const; + gsl::multi_span get_raw_index_array(const std::vector >& draw_indexed_clause) const; + gsl::multi_span get_raw_vertex_buffer(const rsx::data_array_format_info&, u32 base_offset, const std::vector>& vertex_ranges) const; std::vector> get_vertex_buffers(const rsx::rsx_state& state, const std::vector>& vertex_ranges) const; std::variant diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index 8054532f81..444d448397 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "stdafx.h" #include "VKHelpers.h" @@ -173,7 +173,7 @@ namespace rsx return nullptr; } - gsl::span map_downloaded_buffer(download_buffer_object, ...) + gsl::multi_span map_downloaded_buffer(download_buffer_object, ...) { return{ (gsl::byte*)nullptr, 0 }; } diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index 21d8cad213..6491c739fb 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "VKHelpers.h" #include "../GCM.h" #include "../RSXThread.h" @@ -149,7 +149,7 @@ namespace vk size_t offset_in_buffer = upload_heap.alloc<512>(image_linear_size); void *mapped_buffer = upload_buffer->map(offset_in_buffer, image_linear_size); - gsl::span mapped{ (gsl::byte*)mapped_buffer, ::narrow(image_linear_size) }; + gsl::multi_span mapped{ (gsl::byte*)mapped_buffer, ::narrow(image_linear_size) }; upload_texture_subresource(mapped, layout, format, is_swizzled, 256); upload_buffer->unmap(); @@ -370,7 +370,7 @@ namespace vk } CHECK_RESULT(vkMapMemory((*owner), vram_allocation, 0, m_memory_layout.size, 0, (void**)&data)); - gsl::span mapped{ (gsl::byte*)(data + layout_alignment[0].second.offset), ::narrow(layout_alignment[0].second.size) }; + gsl::multi_span mapped{ (gsl::byte*)(data + layout_alignment[0].second.offset), ::narrow(layout_alignment[0].second.size) }; const std::vector &subresources_layout = get_subresources_layout(tex); for (const rsx_subresource_layout &layout : subresources_layout) @@ -401,7 +401,7 @@ namespace vk } CHECK_RESULT(vkMapMemory((*owner), vram_allocation, 0, m_memory_layout.size, 0, (void**)&data)); - gsl::span mapped{ (gsl::byte*)(data), ::narrow(m_memory_layout.size) }; + gsl::multi_span mapped{ (gsl::byte*)(data), ::narrow(m_memory_layout.size) }; const std::vector &subresources_layout = get_subresources_layout(tex); size_t idx = 0; diff --git a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp index f078b42111..33ccac6e38 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp +++ b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "VKGSRender.h" @@ -270,7 +270,7 @@ namespace VkDeviceSize offset_in_attrib_buffer = m_attrib_ring_info.alloc<256>(upload_size); void *dst = m_attrib_ring_info.map(offset_in_attrib_buffer, upload_size); vk::prepare_buffer_for_writing(dst, vertex_array.type, vertex_array.attribute_size, vertex_count); - gsl::span dest_span(static_cast(dst), upload_size); + gsl::multi_span dest_span(static_cast(dst), upload_size); write_vertex_array_data_to_buffer(dest_span, vertex_array.data, vertex_count, vertex_array.type, vertex_array.attribute_size, vertex_array.stride, real_element_size); @@ -413,7 +413,7 @@ namespace */ u32 min_index, max_index; std::tie(min_index, max_index) = write_index_array_data_to_buffer( - gsl::span(static_cast(buf), index_count * type_size), + gsl::multi_span(static_cast(buf), index_count * type_size), command.raw_index_buffer, index_type, rsx::method_registers.current_draw_clause.primitive, rsx::method_registers.restart_index_enabled(), diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index e7bfb58d15..f4627b5a48 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "stdafx_gui.h" #include "Emu/Memory/Memory.h" @@ -386,18 +386,18 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event) namespace { - std::array get_value(gsl::span orig_buffer, rsx::surface_color_format format, size_t idx) + std::array get_value(gsl::multi_span orig_buffer, rsx::surface_color_format format, size_t idx) { switch (format) { case rsx::surface_color_format::b8: { - u8 value = gsl::as_span(orig_buffer)[idx]; + u8 value = gsl::as_multi_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 = gsl::as_multi_span>(orig_buffer)[idx]; u32 swapped_val = stored_val; f32 float_val = (f32&)swapped_val; u8 val = float_val * 255.f; @@ -407,19 +407,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 = gsl::as_multi_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 = gsl::as_multi_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 = gsl::as_multi_span(orig_buffer); f16 h0 = f16(ptr[4 * idx]); f16 h1 = f16(ptr[4 * idx + 1]); f16 h2 = f16(ptr[4 * idx + 2]); @@ -445,7 +445,7 @@ namespace * Return a new buffer that can be passed to wxImage ctor. * The pointer seems to be freed by wxImage. */ - u8* convert_to_wximage_buffer(rsx::surface_color_format format, gsl::span orig_buffer, size_t width, size_t height) noexcept + u8* convert_to_wximage_buffer(rsx::surface_color_format format, gsl::multi_span orig_buffer, size_t width, size_t height) noexcept { unsigned char* buffer = (unsigned char*)malloc(width * height * 3); for (u32 i = 0; i < width * height; i++) @@ -492,7 +492,7 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event) { if (width && height && !draw_call.depth_stencil[0].empty()) { - gsl::span orig_buffer = draw_call.depth_stencil[0]; + gsl::multi_span orig_buffer = draw_call.depth_stencil[0]; unsigned char *buffer = (unsigned char *)malloc(width * height * 3); if (draw_call.state.surface_depth_fmt() == rsx::surface_depth_format::z24s8) @@ -501,7 +501,7 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event) { for (u32 col = 0; col < width; col++) { - u32 depth_val = gsl::as_span(orig_buffer)[row * width + col]; + u32 depth_val = gsl::as_multi_span(orig_buffer)[row * width + col]; u8 displayed_depth_val = 255 * depth_val / 0xFFFFFF; buffer[3 * col + 0 + width * row * 3] = displayed_depth_val; buffer[3 * col + 1 + width * row * 3] = displayed_depth_val; @@ -515,7 +515,7 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event) { for (u32 col = 0; col < width; col++) { - u16 depth_val = gsl::as_span(orig_buffer)[row * width + col]; + u16 depth_val = gsl::as_multi_span(orig_buffer)[row * width + col]; u8 displayed_depth_val = 255 * depth_val / 0xFFFF; buffer[3 * col + 0 + width * row * 3] = displayed_depth_val; buffer[3 * col + 1 + width * row * 3] = displayed_depth_val; @@ -536,14 +536,14 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event) { if (width && height && !draw_call.depth_stencil[1].empty()) { - gsl::span orig_buffer = draw_call.depth_stencil[1]; + gsl::multi_span orig_buffer = draw_call.depth_stencil[1]; unsigned char *buffer = (unsigned char *)malloc(width * height * 3); for (u32 row = 0; row < height; row++) { for (u32 col = 0; col < width; col++) { - u8 stencil_val = gsl::as_span(orig_buffer)[row * width + col]; + u8 stencil_val = gsl::as_multi_span(orig_buffer)[row * width + col]; buffer[3 * col + 0 + width * row * 3] = stencil_val; buffer[3 * col + 1 + width * row * 3] = stencil_val; buffer[3 * col + 2 + width * row * 3] = stencil_val; diff --git a/rpcs3_default.props b/rpcs3_default.props index 92456daf1b..509cd7babc 100644 --- a/rpcs3_default.props +++ b/rpcs3_default.props @@ -3,7 +3,7 @@ - .\;..\;..\asmjit\src\asmjit;..\Utilities\yaml-cpp\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\GSL\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src + .\;..\;..\asmjit\src\asmjit;..\Utilities\yaml-cpp\include;..\wxWidgets\src\zlib;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\GSL\gsl;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src $(SolutionDir)lib\$(Configuration)-$(Platform)\ $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) $(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\