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++)