From ef368c51718d2849043009213635e75b049d726b Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 15:17:41 +0100 Subject: [PATCH 1/9] =?UTF-8?q?rsx:=20Replace=20gsl::byte=20with=20C++17?= =?UTF-8?q?=E2=80=99s=20std::byte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utilities/types.h | 5 ----- rpcs3/Emu/RSX/Capture/rsx_trace.h | 6 +++--- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 10 +++++----- rpcs3/Emu/RSX/Common/BufferUtils.h | 4 ++-- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 12 ++++++------ rpcs3/Emu/RSX/Common/TextureUtils.h | 4 ++-- rpcs3/Emu/RSX/Common/surface_store.h | 2 +- rpcs3/Emu/RSX/Common/texture_cache.h | 4 ++-- rpcs3/Emu/RSX/GL/GLGSRender.h | 4 ++-- rpcs3/Emu/RSX/GL/GLRenderTargets.cpp | 4 ++-- rpcs3/Emu/RSX/GL/GLTexture.cpp | 4 ++-- rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp | 2 +- rpcs3/Emu/RSX/RSXThread.cpp | 12 ++++++------ rpcs3/Emu/RSX/RSXThread.h | 16 ++++++++-------- rpcs3/Emu/RSX/VK/VKRenderTargets.h | 2 +- rpcs3/Emu/RSX/VK/VKTexture.cpp | 2 +- rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp | 6 +++--- rpcs3/rpcs3qt/rsx_debugger.cpp | 10 +++++----- 18 files changed, 52 insertions(+), 57 deletions(-) diff --git a/Utilities/types.h b/Utilities/types.h index 4bf7c94849..967da7475a 100644 --- a/Utilities/types.h +++ b/Utilities/types.h @@ -171,11 +171,6 @@ using get_uint_t = typename get_int_impl::utype; template using get_sint_t = typename get_int_impl::stype; -namespace gsl -{ - using std::byte; -} - // Formatting helper, type-specific preprocessing for improving safety and functionality template struct fmt_unveil; diff --git a/rpcs3/Emu/RSX/Capture/rsx_trace.h b/rpcs3/Emu/RSX/Capture/rsx_trace.h index 1b13ca2781..3bfd0c05a9 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_trace.h +++ b/rpcs3/Emu/RSX/Capture/rsx_trace.h @@ -14,9 +14,9 @@ struct frame_trace_data std::string name; std::pair programs; rsx::rsx_state state; - std::array, 4> color_buffer; - std::array, 2> depth_stencil; - std::vector index; + std::array, 4> color_buffer; + std::array, 2> depth_stencil; + std::vector index; u32 vertex_count; }; diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 5ce83e5ee0..cb13b65de7 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -42,13 +42,13 @@ namespace // FIXME: GSL as_span break build if template parameter is non const with current revision. // Replace with true as_span when fixed. template - gsl::span as_span_workaround(gsl::span unformated_span) + gsl::span as_span_workaround(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } template - gsl::span as_const_span(gsl::span unformated_span) + gsl::span as_const_span(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } @@ -457,7 +457,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, bool swap_endianness) +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, bool swap_endianness) { verify(HERE), (vector_element_count > 0); const u32 src_read_stride = rsx::get_vertex_type_size_on_host(type, vector_element_count); @@ -1171,8 +1171,8 @@ namespace } } -std::tuple write_index_array_data_to_buffer(gsl::span dst_ptr, - gsl::span src_ptr, +std::tuple write_index_array_data_to_buffer(gsl::span dst_ptr, + gsl::span src_ptr, rsx::index_array_type type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, const std::function& expands) { diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index bd24aa4ce5..689b2e9f62 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -9,7 +9,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, bool swap_endianness); +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, bool swap_endianness); /* * If primitive mode is not supported and need to be emulated (using an index buffer) returns false. @@ -36,7 +36,7 @@ u32 get_index_type_size(rsx::index_array_type type); * Returns min/max index found during the process and the number of valid indices written to the buffer. * 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::span dst, gsl::span src, rsx::index_array_type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index, const std::function& expands); diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 8b3122cb82..5400bd8c38 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -28,13 +28,13 @@ namespace // FIXME: GSL as_span break build if template parameter is non const with current revision. // Replace with true as_span when fixed. template - gsl::span as_span_workaround(gsl::span unformated_span) + gsl::span as_span_workaround(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } template - gsl::span as_const_span(gsl::span unformated_span) + gsl::span as_const_span(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } @@ -326,7 +326,7 @@ namespace * Sometimes texture provides a pitch even if texture is swizzled (and then packed) and in such case it's ignored. It's passed via suggested_pitch and is used only if padded_row is false. */ template - std::vector get_subresources_layout_impl(const gsl::byte *texture_data_pointer, u16 width_in_texel, u16 height_in_texel, u16 depth, u8 layer_count, u16 mipmap_count, u32 suggested_pitch_in_bytes, bool padded_row, bool border) + std::vector get_subresources_layout_impl(const std::byte *texture_data_pointer, u16 width_in_texel, u16 height_in_texel, u16 depth, u8 layer_count, u16 mipmap_count, u32 suggested_pitch_in_bytes, bool padded_row, bool border) { /** * Note about size type: RSX texture width is stored in a 16 bits int and pitch is stored in a 20 bits int. @@ -387,7 +387,7 @@ namespace slice_sz = src_pitch_in_block * block_size_in_bytes * full_height_in_block * depth; current_subresource_layout.pitch_in_block = src_pitch_in_block; - current_subresource_layout.data = gsl::span(texture_data_pointer + offset_in_src, slice_sz); + current_subresource_layout.data = gsl::span(texture_data_pointer + offset_in_src, slice_sz); offset_in_src += slice_sz; miplevel_width_in_texel = std::max(miplevel_width_in_texel / 2, 1); @@ -461,7 +461,7 @@ std::vector get_subresources_layout_impl(const RsxTextur int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN); const u32 texaddr = rsx::get_address(texture.offset(), texture.location()); - auto pixels = vm::_ptr(texaddr); + auto pixels = vm::_ptr(texaddr); const bool is_swizzled = !(texture.format() & CELL_GCM_TEXTURE_LN); const bool has_border = !texture.border_type(); @@ -516,7 +516,7 @@ std::vector get_subresources_layout(const rsx::vertex_te return get_subresources_layout_impl(texture); } -texture_memory_info upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, const texture_uploader_capabilities& caps) +texture_memory_info upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, const texture_uploader_capabilities& caps) { u16 w = src_layout.width_in_block; u16 h = src_layout.height_in_block; diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/Emu/RSX/Common/TextureUtils.h index e15858e4e2..b72fd493dc 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -88,7 +88,7 @@ namespace rsx struct rsx_subresource_layout { - gsl::span data; + gsl::span data; u16 width_in_texel; u16 height_in_texel; u16 width_in_block; @@ -132,7 +132,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); -texture_memory_info upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, const texture_uploader_capabilities& caps); +texture_memory_info upload_texture_subresource(gsl::span dst_buffer, const rsx_subresource_layout &src_layout, int format, bool is_swizzled, const texture_uploader_capabilities& caps); 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 6266b9d3d1..12b0391982 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -10,7 +10,7 @@ namespace { template - gsl::span as_const_span(gsl::span unformated_span) + gsl::span as_const_span(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 86a3f050a1..ce415ce367 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -2405,7 +2405,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = image_height; subres.pitch_in_block = full_width; subres.depth = 1; - subres.data = { vm::_ptr(image_base), src.pitch * image_height }; + subres.data = { vm::_ptr(image_base), src.pitch * image_height }; subresource_layout.push_back(subres); vram_texture = upload_image_from_cpu(cmd, rsx_range, image_width, image_height, 1, 1, src.pitch, gcm_format, texture_upload_context::blit_engine_src, @@ -2537,7 +2537,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = dst_dimensions.height; subres.pitch_in_block = pitch_in_block; subres.depth = 1; - subres.data = { vm::get_super_ptr(dst.rsx_address), dst.pitch * dst_dimensions.height }; + subres.data = { vm::get_super_ptr(dst.rsx_address), dst.pitch * dst_dimensions.height }; subresource_layout.push_back(subres); cached_dest = upload_image_from_cpu(cmd, rsx_range, dst_dimensions.width, dst_dimensions.height, 1, 1, dst.pitch, diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/Emu/RSX/GL/GLGSRender.h index 2abf5e786b..ef24dc66fb 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -177,8 +177,8 @@ protected: void notify_tile_unbound(u32 tile) override; void on_semaphore_acquire_wait() override; - std::array, 4> copy_render_targets_to_memory() override; - std::array, 2> copy_depth_stencil_buffer_to_memory() override; + std::array, 4> copy_render_targets_to_memory() override; + std::array, 2> copy_depth_stencil_buffer_to_memory() override; void on_decompiler_init() override; void on_decompiler_exit() override; diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index a6d0255187..d9b8a0a18d 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -414,12 +414,12 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk } } -std::array, 4> GLGSRender::copy_render_targets_to_memory() +std::array, 4> GLGSRender::copy_render_targets_to_memory() { return {}; } -std::array, 2> GLGSRender::copy_depth_stencil_buffer_to_memory() +std::array, 2> GLGSRender::copy_depth_stencil_buffer_to_memory() { return {}; } diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 1afa02e506..fd743fb1bf 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -456,7 +456,7 @@ namespace gl } void fill_texture(rsx::texture_dimension_extended dim, u16 mipmap_count, int format, u16 width, u16 height, u16 depth, - const std::vector &input_layouts, bool is_swizzled, GLenum gl_format, GLenum gl_type, std::vector& staging_buffer) + const std::vector &input_layouts, bool is_swizzled, GLenum gl_format, GLenum gl_type, std::vector& staging_buffer) { int mip_level = 0; texture_uploader_capabilities caps{ true, false, false, 4 }; @@ -635,7 +635,7 @@ namespace gl // Calculate staging buffer size const u32 aligned_pitch = align(width * get_format_block_size_in_bytes(gcm_format), 4); size_t texture_data_sz = depth * height * aligned_pitch; - std::vector data_upload_buf(texture_data_sz); + std::vector data_upload_buf(texture_data_sz); // TODO: GL drivers support byteswapping and this should be used instead of doing so manually const auto format_type = get_format_type(gcm_format); diff --git a/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp b/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp index 414d22f2c7..057c9dc505 100644 --- a/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp +++ b/rpcs3/Emu/RSX/GL/GLVertexBuffers.cpp @@ -107,7 +107,7 @@ namespace u32 offset_in_index_buffer = mapping.second; std::tie(min_index, max_index, index_count) = write_index_array_data_to_buffer( - { reinterpret_cast(ptr), max_size }, + { reinterpret_cast(ptr), max_size }, command.raw_index_buffer, type, rsx::method_registers.current_draw_clause.primitive, rsx::method_registers.restart_index_enabled(), diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 87cc313bfe..0c2565afaa 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -830,12 +830,12 @@ namespace rsx return t + timestamp_subvalue; } - gsl::span thread::get_raw_index_array(const draw_clause& draw_indexed_clause) const + gsl::span thread::get_raw_index_array(const draw_clause& draw_indexed_clause) const { if (!element_push_buffer.empty()) { //Indices provided via immediate mode - return{(const gsl::byte*)element_push_buffer.data(), ::narrow(element_push_buffer.size() * sizeof(u32))}; + return{(const std::byte*)element_push_buffer.data(), ::narrow(element_push_buffer.size() * sizeof(u32))}; } const rsx::index_array_type type = rsx::method_registers.index_type(); @@ -850,11 +850,11 @@ namespace rsx const u32 first = draw_indexed_clause.min_index(); const u32 count = draw_indexed_clause.get_elements_count(); - const auto ptr = vm::_ptr(address); + const auto ptr = vm::_ptr(address); return{ ptr + first * type_size, count * type_size }; } - gsl::span thread::get_raw_vertex_buffer(const rsx::data_array_format_info& vertex_array_info, u32 base_offset, const draw_clause& draw_array_clause) const + gsl::span thread::get_raw_vertex_buffer(const rsx::data_array_format_info& vertex_array_info, u32 base_offset, const draw_clause& draw_array_clause) const { u32 offset = vertex_array_info.offset(); u32 address = rsx::get_address(rsx::get_vertex_offset_from_base(base_offset, offset & 0x7fffffff), offset >> 31); @@ -864,7 +864,7 @@ namespace rsx const u32 first = draw_array_clause.min_index(); const u32 count = draw_array_clause.get_elements_count(); - const gsl::byte* ptr = vm::_ptr(address); + const std::byte* ptr = vm::_ptr(address); return {ptr + first * vertex_array_info.stride(), count * vertex_array_info.stride() + element_size}; } @@ -896,7 +896,7 @@ namespace rsx const auto& info = vertex_push_buffers[index]; const u8 element_size = info.size * sizeof(u32); - gsl::span vertex_src = { (const gsl::byte*)vertex_push_buffers[index].data.data(), vertex_push_buffers[index].vertex_count * element_size }; + gsl::span vertex_src = { (const std::byte*)vertex_push_buffers[index].data.data(), vertex_push_buffers[index].vertex_count * element_size }; result.emplace_back(vertex_array_buffer{ info.type, info.size, element_size, vertex_src, index, false }); continue; } diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index f481f564bf..291125164f 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -128,7 +128,7 @@ namespace rsx rsx::vertex_base_type type; u8 attribute_size; u8 stride; - gsl::span data; + gsl::span data; u8 index; bool is_be; }; @@ -153,7 +153,7 @@ namespace rsx struct draw_indexed_array_command { - gsl::span raw_index_buffer; + gsl::span raw_index_buffer; }; struct draw_inlined_array @@ -714,8 +714,8 @@ namespace rsx flags32_t read_barrier(u32 memory_address, u32 memory_range, bool unconditional); virtual void sync_hint(FIFO_hint /*hint*/, u64 /*arg*/) {} - gsl::span get_raw_index_array(const draw_clause& draw_indexed_clause) const; - gsl::span get_raw_vertex_buffer(const rsx::data_array_format_info&, u32 base_offset, const draw_clause& draw_array_clause) const; + gsl::span get_raw_index_array(const draw_clause& draw_indexed_clause) const; + gsl::span get_raw_vertex_buffer(const rsx::data_array_format_info&, u32 base_offset, const draw_clause& draw_array_clause) const; std::vector> get_vertex_buffers(const rsx::rsx_state& state, u64 consumed_attrib_mask) const; @@ -821,16 +821,16 @@ namespace rsx * Copy rtt values to buffer. * TODO: It's more efficient to combine multiple call of this function into one. */ - virtual std::array, 4> copy_render_targets_to_memory() { - return std::array, 4>(); + virtual std::array, 4> copy_render_targets_to_memory() { + return std::array, 4>(); } /** * Copy depth and stencil content to buffers. * TODO: It's more efficient to combine multiple call of this function into one. */ - virtual std::array, 2> copy_depth_stencil_buffer_to_memory() { - return std::array, 2>(); + virtual std::array, 2> copy_depth_stencil_buffer_to_memory() { + return std::array, 2>(); } virtual std::pair get_programs() const { return std::make_pair("", ""); } diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index c3da1301df..21fa553715 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -245,7 +245,7 @@ namespace vk subres.height_in_block = subres.height_in_texel = surface_height * samples_y; subres.pitch_in_block = rsx_pitch / get_bpp(); subres.depth = 1; - subres.data = { (const gsl::byte*)vm::get_super_ptr(base_addr), s32(rsx_pitch * surface_height * samples_y) }; + subres.data = { (const std::byte*)vm::get_super_ptr(base_addr), s32(rsx_pitch * surface_height * samples_y) }; if (LIKELY(g_cfg.video.resolution_scale_percent == 100 && samples() == 1)) { diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index f7b661e0b7..c5c4569997 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -722,7 +722,7 @@ namespace vk check_caps = false; } - gsl::span mapped{ (gsl::byte*)mapped_buffer, ::narrow(image_linear_size) }; + gsl::span mapped{ (std::byte*)mapped_buffer, ::narrow(image_linear_size) }; opt = upload_texture_subresource(mapped, layout, format, is_swizzled, caps); upload_heap.unmap(); diff --git a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp index ead8bbcdf3..a7a495e81f 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp +++ b/rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp @@ -144,8 +144,8 @@ namespace VkDeviceSize offset_in_index_buffer = m_index_buffer_ring_info.alloc<4>(upload_size); void* buf = m_index_buffer_ring_info.map(offset_in_index_buffer, upload_size); - gsl::span dst; - std::vector tmp; + gsl::span dst; + std::vector tmp; if (emulate_restart) { tmp.resize(upload_size); @@ -153,7 +153,7 @@ namespace } else { - dst = gsl::span(static_cast(buf), upload_size); + dst = gsl::span(static_cast(buf), upload_size); } /** diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index 3f7ae7070e..c7b49d971e 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -13,7 +13,7 @@ constexpr auto qstr = QString::fromStdString; namespace { template - gsl::span as_const_span(gsl::span unformated_span) + gsl::span as_const_span(gsl::span unformated_span) { return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; } @@ -427,7 +427,7 @@ void Buffer::ShowWindowed() namespace { - std::array get_value(gsl::span orig_buffer, rsx::surface_color_format format, size_t idx) + std::array get_value(gsl::span orig_buffer, rsx::surface_color_format format, size_t idx) { switch (format) { @@ -486,7 +486,7 @@ namespace /** * Return a new buffer that can be passed to QImage. */ - u8* convert_to_QImage_buffer(rsx::surface_color_format format, gsl::span orig_buffer, size_t width, size_t height) noexcept + u8* convert_to_QImage_buffer(rsx::surface_color_format format, gsl::span orig_buffer, size_t width, size_t height) noexcept { unsigned char* buffer = (unsigned char*)malloc(width * height * 4); for (u32 i = 0; i < width * height; i++) @@ -532,7 +532,7 @@ void rsx_debugger::OnClickDrawCalls() { if (width && height && !draw_call.depth_stencil[0].empty()) { - gsl::span orig_buffer = draw_call.depth_stencil[0]; + gsl::span orig_buffer = draw_call.depth_stencil[0]; unsigned char *buffer = (unsigned char *)malloc(width * height * 4); if (draw_call.state.surface_depth_fmt() == rsx::surface_depth_format::z24s8) @@ -573,7 +573,7 @@ void rsx_debugger::OnClickDrawCalls() { if (width && height && !draw_call.depth_stencil[1].empty()) { - gsl::span orig_buffer = draw_call.depth_stencil[1]; + gsl::span orig_buffer = draw_call.depth_stencil[1]; unsigned char *buffer = (unsigned char *)malloc(width * height * 4); for (u32 row = 0; row < height; row++) From a83cbf63c6cc086e09eec5ac2fde5a9512aa7ffd Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sat, 9 Nov 2019 19:11:01 +0300 Subject: [PATCH 2/9] Remove gsl::finally only use --- rpcs3/Emu/Cell/PPUThread.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index fd9a3d8529..a1e1bcf59b 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -52,7 +52,6 @@ #include #include -#include "Utilities/GSL.h" const bool s_use_ssse3 = utils::has_ssse3(); From 25144caf12309a5e0f1a9954e808268d1de7c86c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 16:09:09 +0100 Subject: [PATCH 3/9] =?UTF-8?q?Add=20tcbrindle=E2=80=99s=20span=20implemen?= =?UTF-8?q?tation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 +++ 3rdparty/CMakeLists.txt | 6 ++++++ 3rdparty/span | 1 + rpcs3/Emu/CMakeLists.txt | 5 +++-- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 160000 3rdparty/span diff --git a/.gitmodules b/.gitmodules index 1c2d62d043..6508eebf8c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -56,3 +56,6 @@ path = 3rdparty/FAudio url = https://github.com/FNA-XNA/FAudio.git ignore = dirty +[submodule "3rdparty/span"] + path = 3rdparty/span + url = https://github.com/tcbrindle/span diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 6dfd7d21a1..1203764c79 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -209,6 +209,11 @@ add_library(3rdparty_gsl INTERFACE) target_include_directories(3rdparty_gsl INTERFACE GSL/include) +# span +add_library(3rdparty_span INTERFACE) +target_include_directories(3rdparty_span INTERFACE span/include) + + # stblib add_library(3rdparty_stblib INTERFACE) target_include_directories(3rdparty_stblib INTERFACE stblib) @@ -425,6 +430,7 @@ add_library(3rdparty::libpng ALIAS ${LIBPNG_TARGET}) add_library(3rdparty::cereal ALIAS 3rdparty_cereal) add_library(3rdparty::opengl ALIAS 3rdparty_opengl) add_library(3rdparty::gsl ALIAS 3rdparty_gsl) +add_library(3rdparty::span ALIAS 3rdparty_span) add_library(3rdparty::stblib ALIAS 3rdparty_stblib) add_library(3rdparty::discord-rpc ALIAS 3rdparty_discord-rpc) add_library(3rdparty::alsa ALIAS ${ALSA_TARGET}) diff --git a/3rdparty/span b/3rdparty/span new file mode 160000 index 0000000000..9d7559aabd --- /dev/null +++ b/3rdparty/span @@ -0,0 +1 @@ +Subproject commit 9d7559aabdebf569cab3480a7ea2a87948c0ae47 diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index b9910349e9..c0b8857ddd 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -49,7 +49,8 @@ target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}") target_link_libraries(rpcs3_emu PUBLIC 3rdparty::pugixml - 3rdparty::gsl) + 3rdparty::gsl + 3rdparty::span) if (MSVC) set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS /GR-) @@ -412,7 +413,7 @@ target_link_libraries(rpcs3_emu 3rdparty::vulkan 3rdparty::glew 3rdparty::libusb PRIVATE - 3rdparty::gsl 3rdparty::xxhash + 3rdparty::gsl 3rdparty::span 3rdparty::xxhash ) From 72cdf0b04c13c1a20f8557d4aa0e62d530aa3789 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 15:45:32 +0100 Subject: [PATCH 4/9] =?UTF-8?q?Replace=20gsl::span=E2=80=99s=20implementat?= =?UTF-8?q?ion=20with=20tcbrindle=E2=80=99s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This implementation optimises correctly on all relevant compilers, unlike GSL’s which gave extremely slow code on any compiler other than MSVC. Supersedes #6948. --- Utilities/GSL.h | 10 ---------- rpcs3/Emu/RSX/Common/BufferUtils.h | 4 +++- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 6 ++++-- rpcs3/Emu/RSX/Common/TextureUtils.h | 4 +++- rpcs3/Emu/RSX/Common/surface_store.h | 4 +++- rpcs3/Emu/RSX/RSXThread.cpp | 4 +++- rpcs3/rpcs3qt/rsx_debugger.h | 2 -- 7 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 Utilities/GSL.h diff --git a/Utilities/GSL.h b/Utilities/GSL.h deleted file mode 100644 index 1ca9d77f92..0000000000 --- a/Utilities/GSL.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#define GSL_THROW_ON_CONTRACT_VIOLATION - -#pragma push_macro("new") -#undef new -#include -#pragma pop_macro("new") -#undef Expects -#undef Ensures diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index 689b2e9f62..85ffd9df3b 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -2,7 +2,9 @@ #include -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "../gcm_enums.h" /** diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index 63decff4eb..fc0b8a0809 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -3,7 +3,9 @@ #include "Emu/RSX/RSXFragmentProgram.h" #include "Emu/RSX/RSXVertexProgram.h" -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Utilities/hash.h" #include "Utilities/mutex.h" #include "Utilities/Log.h" @@ -520,7 +522,7 @@ public: return 0; } - void fill_fragment_constants_buffer(gsl::span dst_buffer, const RSXFragmentProgram &fragment_program, bool sanitize = false) const + void fill_fragment_constants_buffer(gsl::span dst_buffer, const RSXFragmentProgram &fragment_program, bool sanitize = false) 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.h b/rpcs3/Emu/RSX/Common/TextureUtils.h index b72fd493dc..e6b146b4a0 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -3,7 +3,9 @@ #include "../RSXTexture.h" #include -#include "Utilities/GSL.h" + +#define TCB_SPAN_NAMESPACE_NAME gsl +#include namespace rsx { diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 12b0391982..5e580dcd04 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -1,6 +1,8 @@ #pragma once -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Emu/Memory/vm.h" #include "surface_utils.h" #include "../GCM.h" diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 0c2565afaa..52fa1fe41f 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -15,7 +15,9 @@ #include "Emu/Cell/lv2/sys_event.h" #include "Emu/Cell/Modules/cellGcmSys.h" -#include "Utilities/GSL.h" +#define TCB_SPAN_NAMESPACE_NAME gsl +#include + #include "Utilities/StrUtil.h" #include diff --git a/rpcs3/rpcs3qt/rsx_debugger.h b/rpcs3/rpcs3qt/rsx_debugger.h index 71f22005c2..3e50f70725 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.h +++ b/rpcs3/rpcs3qt/rsx_debugger.h @@ -8,8 +8,6 @@ #include "Emu/RSX/GSRender.h" #include "Emu/RSX/GCM.h" -#include "Utilities/GSL.h" - #include "memory_viewer_panel.h" #include "table_item_delegate.h" #include "gui_settings.h" From f76720ceb03a929126f54b3b6640e5fe7a7a9e8e Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 16:51:53 +0100 Subject: [PATCH 5/9] Remove extraneous ::narrow() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GSL’s gsl::span didn’t use the correct type for its index_type, which is why they were needed. --- rpcs3/Emu/RSX/Common/BufferUtils.cpp | 4 ++-- rpcs3/Emu/RSX/Common/TextureUtils.cpp | 6 +++--- rpcs3/Emu/RSX/Common/surface_store.h | 2 +- rpcs3/Emu/RSX/Common/texture_cache.h | 4 ++-- rpcs3/Emu/RSX/GL/GLGSRender.cpp | 2 +- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 2 +- rpcs3/Emu/RSX/VK/VKRenderTargets.h | 2 +- rpcs3/Emu/RSX/VK/VKTexture.cpp | 2 +- rpcs3/rpcs3qt/rsx_debugger.cpp | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index cb13b65de7..2ea98df02e 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -44,13 +44,13 @@ namespace template gsl::span as_span_workaround(gsl::span unformated_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_span.data(), 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)) }; + return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) }; } } diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 5400bd8c38..45de801efd 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -30,13 +30,13 @@ namespace template gsl::span as_span_workaround(gsl::span unformated_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_span.data(), 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)) }; + return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) }; } // TODO: Make this function part of GSL @@ -1042,4 +1042,4 @@ std::pair get_compatible_gcm_format(rsx::surface_depth_format format) default: ASSUME(0); } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 5e580dcd04..2d1ff4462c 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -14,7 +14,7 @@ namespace template gsl::span as_const_span(gsl::span unformated_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) }; } } diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index ce415ce367..744287b3d4 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -2405,7 +2405,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = image_height; subres.pitch_in_block = full_width; subres.depth = 1; - subres.data = { vm::_ptr(image_base), src.pitch * image_height }; + subres.data = { vm::_ptr(image_base), static_cast::index_type>(src.pitch * image_height) }; subresource_layout.push_back(subres); vram_texture = upload_image_from_cpu(cmd, rsx_range, image_width, image_height, 1, 1, src.pitch, gcm_format, texture_upload_context::blit_engine_src, @@ -2537,7 +2537,7 @@ namespace rsx subres.height_in_block = subres.height_in_texel = dst_dimensions.height; subres.pitch_in_block = pitch_in_block; subres.depth = 1; - subres.data = { vm::get_super_ptr(dst.rsx_address), dst.pitch * dst_dimensions.height }; + subres.data = { vm::get_super_ptr(dst.rsx_address), static_cast::index_type>(dst.pitch * dst_dimensions.height) }; subresource_layout.push_back(subres); cached_dest = upload_image_from_cpu(cmd, rsx_range, dst_dimensions.width, dst_dimensions.height, 1, 1, dst.pitch, diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 0317e72ea1..363fd75a0a 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1372,7 +1372,7 @@ void GLGSRender::load_program_env() auto mapping = m_fragment_constants_buffer->alloc_from_heap(fragment_constants_size, m_uniform_buffer_offset_align); auto buf = static_cast(mapping.first); - m_prog_buffer.fill_fragment_constants_buffer({ reinterpret_cast(buf), gsl::narrow(fragment_constants_size) }, + m_prog_buffer.fill_fragment_constants_buffer({ reinterpret_cast(buf), fragment_constants_size }, current_fragment_program, gl::get_driver_caps().vendor_NVIDIA); m_fragment_constants_buffer->bind_range(GL_FRAGMENT_CONSTANT_BUFFERS_BIND_SLOT, mapping.second, fragment_constants_size); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 148a1ce11a..8fe090ac3d 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2735,7 +2735,7 @@ void VKGSRender::load_program_env() auto mem = m_fragment_constants_ring_info.alloc<256>(fragment_constants_size); auto buf = m_fragment_constants_ring_info.map(mem, fragment_constants_size); - m_prog_buffer->fill_fragment_constants_buffer({ reinterpret_cast(buf), ::narrow(fragment_constants_size) }, + m_prog_buffer->fill_fragment_constants_buffer({ reinterpret_cast(buf), fragment_constants_size }, current_fragment_program, vk::sanitize_fp_values()); m_fragment_constants_ring_info.unmap(); diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.h b/rpcs3/Emu/RSX/VK/VKRenderTargets.h index 21fa553715..1f5aee67f1 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.h +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.h @@ -245,7 +245,7 @@ namespace vk subres.height_in_block = subres.height_in_texel = surface_height * samples_y; subres.pitch_in_block = rsx_pitch / get_bpp(); subres.depth = 1; - subres.data = { (const std::byte*)vm::get_super_ptr(base_addr), s32(rsx_pitch * surface_height * samples_y) }; + subres.data = { (const std::byte*)vm::get_super_ptr(base_addr), static_cast::index_type>(rsx_pitch * surface_height * samples_y) }; if (LIKELY(g_cfg.video.resolution_scale_percent == 100 && samples() == 1)) { diff --git a/rpcs3/Emu/RSX/VK/VKTexture.cpp b/rpcs3/Emu/RSX/VK/VKTexture.cpp index c5c4569997..602c83e112 100644 --- a/rpcs3/Emu/RSX/VK/VKTexture.cpp +++ b/rpcs3/Emu/RSX/VK/VKTexture.cpp @@ -722,7 +722,7 @@ namespace vk check_caps = false; } - gsl::span mapped{ (std::byte*)mapped_buffer, ::narrow(image_linear_size) }; + gsl::span mapped{ (std::byte*)mapped_buffer, image_linear_size }; opt = upload_texture_subresource(mapped, layout, format, is_swizzled, caps); upload_heap.unmap(); diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index c7b49d971e..e589837d1d 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -15,7 +15,7 @@ namespace template gsl::span as_const_span(gsl::span unformated_span) { - return{ (T*)unformated_span.data(), ::narrow(unformated_span.size_bytes() / sizeof(T)) }; + return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) }; } } From 7e4d1426824c79db465ee8286406479fd3486c5a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 16:13:20 +0100 Subject: [PATCH 6/9] =?UTF-8?q?Remove=20GSL=20as=20we=20don=E2=80=99t=20us?= =?UTF-8?q?e=20it=20anymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 4 ---- 3rdparty/CMakeLists.txt | 6 ------ 3rdparty/GSL | 1 - rpcs3/Emu/CMakeLists.txt | 3 +-- 4 files changed, 1 insertion(+), 13 deletions(-) delete mode 160000 3rdparty/GSL diff --git a/.gitmodules b/.gitmodules index 6508eebf8c..24f3fa4687 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,10 +11,6 @@ url = https://github.com/RPCS3/llvm branch = release_60 ignore = dirty -[submodule "GSL"] - path = 3rdparty/GSL - url = https://github.com/Microsoft/GSL.git - ignore = dirty [submodule "Vulkan/glslang"] path = Vulkan/glslang url = https://github.com/KhronosGroup/glslang.git diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 1203764c79..80698ac959 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -204,11 +204,6 @@ else() endif() -# GSL -add_library(3rdparty_gsl INTERFACE) -target_include_directories(3rdparty_gsl INTERFACE GSL/include) - - # span add_library(3rdparty_span INTERFACE) target_include_directories(3rdparty_span INTERFACE span/include) @@ -429,7 +424,6 @@ add_library(3rdparty::hidapi ALIAS 3rdparty_hidapi) add_library(3rdparty::libpng ALIAS ${LIBPNG_TARGET}) add_library(3rdparty::cereal ALIAS 3rdparty_cereal) add_library(3rdparty::opengl ALIAS 3rdparty_opengl) -add_library(3rdparty::gsl ALIAS 3rdparty_gsl) add_library(3rdparty::span ALIAS 3rdparty_span) add_library(3rdparty::stblib ALIAS 3rdparty_stblib) add_library(3rdparty::discord-rpc ALIAS 3rdparty_discord-rpc) diff --git a/3rdparty/GSL b/3rdparty/GSL deleted file mode 160000 index 1995e86d1a..0000000000 --- a/3rdparty/GSL +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1995e86d1ad70519465374fb4876c6ef7c9f8c61 diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt index c0b8857ddd..db4aa1af75 100644 --- a/rpcs3/Emu/CMakeLists.txt +++ b/rpcs3/Emu/CMakeLists.txt @@ -49,7 +49,6 @@ target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}") target_link_libraries(rpcs3_emu PUBLIC 3rdparty::pugixml - 3rdparty::gsl 3rdparty::span) if (MSVC) @@ -413,7 +412,7 @@ target_link_libraries(rpcs3_emu 3rdparty::vulkan 3rdparty::glew 3rdparty::libusb PRIVATE - 3rdparty::gsl 3rdparty::span 3rdparty::xxhash + 3rdparty::span 3rdparty::xxhash ) From 4401ad6747c4970e269a7fc18a462c3cf477ccaa Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 16:43:10 +0100 Subject: [PATCH 7/9] Fix CI --- .travis/build-linux.bash | 2 +- .travis/build-mac.bash | 2 +- appveyor.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis/build-linux.bash b/.travis/build-linux.bash index dd991b5f53..c07a4bfd30 100644 --- a/.travis/build-linux.bash +++ b/.travis/build-linux.bash @@ -8,7 +8,7 @@ export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib cd rpcs3 -git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang +git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/libusb 3rdparty/FAudio Vulkan/glslang # Download pre-compiled llvm libs curl -sLO https://github.com/RPCS3/llvm/releases/download/continuous-linux-master/llvmlibs-linux.tar.gz diff --git a/.travis/build-mac.bash b/.travis/build-mac.bash index 6b16765045..bc3b7d430b 100644 --- a/.travis/build-mac.bash +++ b/.travis/build-mac.bash @@ -15,7 +15,7 @@ cp target/release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib install_name_tool -id ${PWD}/vulkan-sdk/lib/libVulkan.dylib vulkan-sdk/lib/libVulkan.dylib export VULKAN_SDK=${PWD}/vulkan-sdk -git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/libusb 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/FAudio Vulkan/glslang +git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/span 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/libusb 3rdparty/xxHash 3rdparty/yaml-cpp 3rdparty/FAudio Vulkan/glslang mkdir build; cd build cmake .. -DWITH_LLVM=OFF -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja diff --git a/appveyor.yml b/appveyor.yml index fd65e62f02..3eee007874 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ install: git submodule -q update --init ` 3rdparty/cereal ` 3rdparty/ffmpeg ` - 3rdparty/GSL ` + 3rdparty/span ` 3rdparty/hidapi ` 3rdparty/libpng ` 3rdparty/libusb ` From f29fcc10cf75d905b5032a4122ec39041bbf078c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 18:20:20 +0100 Subject: [PATCH 8/9] s/GSL/span/ in XML files too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is completely untested, as I can’t run Visual Studio. --- rpcs3/emucore.vcxproj | 3 +-- rpcs3/emucore.vcxproj.filters | 5 +---- rpcs3/rpcs3.vcxproj | 10 +++++----- rpcs3_default.props | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index affda9bd70..cd800642ae 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -405,7 +405,6 @@ - @@ -651,4 +650,4 @@ - \ No newline at end of file + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index eb5d9219d9..497707f5d2 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -1378,9 +1378,6 @@ Emu - - Utilities - Utilities @@ -1586,4 +1583,4 @@ Emu\Cell\Modules - \ No newline at end of file + diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 32a80da9c4..5d8d03e534 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -104,20 +104,20 @@ true - ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\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;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) - ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\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;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib $(SolutionDir)lib\Debug-x64;$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) - ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\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;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib $(SolutionDir)lib\Release-x64;$(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) - ..\3rdparty\7z;..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\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;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib + ..\3rdparty\7z;..\3rdparty\hidapi\hidapi;.\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\Optional;..\3rdparty\discord-rpc\include;..\3rdparty\zlib @@ -2152,4 +2152,4 @@ - \ No newline at end of file + diff --git a/rpcs3_default.props b/rpcs3_default.props index 7d48d84cbd..93a0afae20 100644 --- a/rpcs3_default.props +++ b/rpcs3_default.props @@ -3,7 +3,7 @@ - .\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\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;..\3rdparty\hidapi\hidapi;..\3rdparty\Optional;..\3rdparty\xxhash + .\;..\;..\asmjit\src;..\3rdparty\yaml-cpp\include;..\3rdparty\ffmpeg\WindowsInclude;..\3rdparty\cereal\include;..\3rdparty\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);..\3rdparty\minidx12\Include;..\3rdparty\span\include;..\3rdparty\libpng;..\3rdparty\GL;..\3rdparty\stblib;..\3rdparty\OpenAL\include;..\3rdparty\pugixml\src;..\3rdparty\hidapi\hidapi;..\3rdparty\Optional;..\3rdparty\xxhash $(SolutionDir)lib\$(Configuration)-$(Platform)\ $(SolutionDir)lib\$(Configuration)-$(Platform)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath) $(SolutionDir)tmp\$(ProjectName)-$(Configuration)-$(Platform)\ @@ -30,4 +30,4 @@ - \ No newline at end of file + From 56f82d2701603672b81ea4b9b5dd97be414a6074 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 9 Nov 2019 20:00:31 +0100 Subject: [PATCH 9/9] rsx: Wrap gsl::span definition into Utilities/span.h --- Utilities/span.h | 2 ++ rpcs3/Emu/RSX/Common/BufferUtils.h | 4 +--- rpcs3/Emu/RSX/Common/ProgramStateCache.h | 4 +--- rpcs3/Emu/RSX/Common/TextureUtils.h | 4 +--- rpcs3/Emu/RSX/Common/surface_store.h | 4 +--- rpcs3/Emu/RSX/RSXThread.cpp | 4 +--- 6 files changed, 7 insertions(+), 15 deletions(-) create mode 100644 Utilities/span.h diff --git a/Utilities/span.h b/Utilities/span.h new file mode 100644 index 0000000000..6276c0b0b2 --- /dev/null +++ b/Utilities/span.h @@ -0,0 +1,2 @@ +#define TCB_SPAN_NAMESPACE_NAME gsl +#include diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.h b/rpcs3/Emu/RSX/Common/BufferUtils.h index 85ffd9df3b..5cf04e4134 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.h +++ b/rpcs3/Emu/RSX/Common/BufferUtils.h @@ -2,9 +2,7 @@ #include -#define TCB_SPAN_NAMESPACE_NAME gsl -#include - +#include "Utilities/span.h" #include "../gcm_enums.h" /** diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.h b/rpcs3/Emu/RSX/Common/ProgramStateCache.h index fc0b8a0809..03ebe4ac5e 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.h +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.h @@ -3,12 +3,10 @@ #include "Emu/RSX/RSXFragmentProgram.h" #include "Emu/RSX/RSXVertexProgram.h" -#define TCB_SPAN_NAMESPACE_NAME gsl -#include - #include "Utilities/hash.h" #include "Utilities/mutex.h" #include "Utilities/Log.h" +#include "Utilities/span.h" #include diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/Emu/RSX/Common/TextureUtils.h index e6b146b4a0..20bf3d77f9 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.h +++ b/rpcs3/Emu/RSX/Common/TextureUtils.h @@ -1,12 +1,10 @@ #pragma once #include "../RSXTexture.h" +#include "Utilities/span.h" #include -#define TCB_SPAN_NAMESPACE_NAME gsl -#include - namespace rsx { enum texture_upload_context : u32 diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 2d1ff4462c..93529931c9 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -1,12 +1,10 @@ #pragma once -#define TCB_SPAN_NAMESPACE_NAME gsl -#include - #include "Emu/Memory/vm.h" #include "surface_utils.h" #include "../GCM.h" #include "../rsx_utils.h" +#include "Utilities/span.h" #include namespace diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 52fa1fe41f..1c874145db 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -15,9 +15,7 @@ #include "Emu/Cell/lv2/sys_event.h" #include "Emu/Cell/Modules/cellGcmSys.h" -#define TCB_SPAN_NAMESPACE_NAME gsl -#include - +#include "Utilities/span.h" #include "Utilities/StrUtil.h" #include