Skip to content

Commit

Permalink
More span changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bevanweiss authored and AniLeo committed Sep 25, 2020
1 parent e733002 commit d9a71d5
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions rpcs3/Crypto/utils.cpp
Expand Up @@ -7,11 +7,11 @@
#include <stdio.h>
#include <time.h>
#include "Utilities/StrUtil.h"
#include "Utilities/span.h"

#include <memory>
#include <string>
#include <string_view>
#include <span>

// Auxiliary functions (endian swap, xor).

Expand Down Expand Up @@ -129,7 +129,7 @@ char* extract_file_name(const char* file_path, char real_file_name[MAX_PATH])
v.remove_prefix(pos + 1);
}

gsl::span r(real_file_name, MAX_PATH);
std::span r(real_file_name, MAX_PATH);
strcpy_trunc(r, v);
return real_file_name;
}
4 changes: 2 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellGame.cpp
Expand Up @@ -10,10 +10,10 @@

#include "Loader/PSF.h"
#include "Utilities/StrUtil.h"
#include "Utilities/span.h"
#include "util/init_mutex.hpp"

#include <thread>
#include <span>

LOG_CHANNEL(cellGame);

Expand Down Expand Up @@ -884,7 +884,7 @@ error_code cellGameGetParamString(s32 id, vm::ptr<char> buf, u32 bufsize)
cellGame.warning("cellGameGetParamString(): id=%d was not found", id);
}

gsl::span dst(buf.get_ptr(), bufsize);
std::span dst(buf.get_ptr(), bufsize);
strcpy_trunc(dst, value);
return CELL_OK;
}
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/Modules/cellSaveData.cpp
Expand Up @@ -12,11 +12,11 @@

#include "Loader/PSF.h"
#include "Utilities/StrUtil.h"
#include "Utilities/span.h"

#include <thread>
#include <mutex>
#include <algorithm>
#include <span>

LOG_CHANNEL(cellSaveData);

Expand Down Expand Up @@ -1601,7 +1601,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
if (dotpos)
{
// Copy file name
gsl::span dst(name, dotpos + 1);
std::span dst(name, dotpos + 1);
strcpy_trunc(dst, file_path);

// Allow multiple '.' even though sysutil_check_name_string does not
Expand Down Expand Up @@ -1638,7 +1638,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
if (file_path.size() > dotpos + 1)
{
// Copy file extension
gsl::span dst(name, file_path.size() - dotpos);
std::span dst(name, file_path.size() - dotpos);
strcpy_trunc(dst, file_path.operator std::string_view().substr(dotpos + 1));

// Allow '_' at start even though sysutil_check_name_string does not
Expand Down
5 changes: 3 additions & 2 deletions rpcs3/Emu/Cell/Modules/cellSysutil.cpp
Expand Up @@ -10,7 +10,8 @@

#include "Utilities/StrUtil.h"
#include "Utilities/lockless.h"
#include "Utilities/span.h"

#include <span>

LOG_CHANNEL(cellSysutil);

Expand Down Expand Up @@ -349,7 +350,7 @@ error_code cellSysutilGetSystemParamString(CellSysutilParamId id, vm::ptr<char>
cellSysutil.error("cellSysutilGetSystemParamString: Unknown ParamId 0x%x", id);
}

gsl::span dst(buf.get_ptr(), copy_size);
std::span dst(buf.get_ptr(), copy_size);
strcpy_trunc(dst, param_str);
return CELL_OK;
}
Expand Down
5 changes: 3 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_prx.cpp
Expand Up @@ -10,11 +10,12 @@
#include "Emu/Cell/ErrorCodes.h"
#include "Crypto/unedat.h"
#include "Utilities/StrUtil.h"
#include "Utilities/span.h"
#include "sys_fs.h"
#include "sys_process.h"
#include "sys_memory.h"

#include <span>

extern std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object&, const std::string&);
extern void ppu_unload_prx(const lv2_prx& prx);
extern void ppu_initialize(const ppu_module&);
Expand Down Expand Up @@ -606,7 +607,7 @@ error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr<sys_prx_module_in
pOpt->info->all_segments_num = ::size32(prx->segs);
if (pOpt->info->filename)
{
gsl::span dst(pOpt->info->filename.get_ptr(), pOpt->info->filename_size);
std::span dst(pOpt->info->filename.get_ptr(), pOpt->info->filename_size);
strcpy_trunc(dst, prx->name);
}

Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/Common/BufferUtils.cpp
Expand Up @@ -5,6 +5,7 @@
#include "../RSXThread.h"

#include <limits>
#include <span>

#define DEBUG_VERTEX_STREAMING 0

Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/RSX/Common/TextureUtils.cpp
Expand Up @@ -4,6 +4,8 @@
#include "../RSXThread.h"
#include "../rsx_utils.h"

#include <span>

namespace rsx
{
void typeless_xfer::analyse()
Expand Down
5 changes: 3 additions & 2 deletions rpcs3/Emu/RSX/Common/texture_cache.h
Expand Up @@ -4,6 +4,7 @@
#include "texture_cache_helpers.h"

#include <atomic>
#include <span>

extern u64 get_system_time();

Expand Down Expand Up @@ -2559,7 +2560,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<const std::byte>(image_base), static_cast<std::span<const std::byte>::index_type>(src.pitch * image_height) };
subres.data = { vm::_ptr<const std::byte>(image_base), static_cast<std::span<const std::byte>::size_type>(src.pitch * image_height) };
subresource_layout.push_back(subres);

const u32 gcm_format = helpers::get_sized_blit_format(src_is_argb8, dst_is_depth_surface);
Expand Down Expand Up @@ -2696,7 +2697,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<const std::byte>(dst_base_address), static_cast<std::span<const std::byte>::index_type>(dst.pitch * dst_dimensions.height) };
subres.data = { vm::get_super_ptr<const std::byte>(dst_base_address), static_cast<std::span<const std::byte>::size_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,
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/GL/GLRenderTargets.cpp
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "GLGSRender.h"

#include <span>

color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_format color_format)
{
//color format
Expand Down Expand Up @@ -460,7 +462,7 @@ void gl::render_target::load_memory(gl::command_context& cmd)
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 = { vm::get_super_ptr<const std::byte>(base_addr), static_cast<std::span<const std::byte>::index_type>(rsx_pitch * surface_height * samples_y) };
subres.data = { vm::get_super_ptr<const std::byte>(base_addr), static_cast<std::span<const std::byte>::size_type>(rsx_pitch * surface_height * samples_y) };

// TODO: MSAA support
if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/RSX/RSXThread.h
Expand Up @@ -5,6 +5,7 @@
#include <variant>
#include <stack>
#include <atomic>
#include <span>

#include "GCM.h"
#include "rsx_cache.h"
Expand Down
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/VK/VKRenderTargets.h
Expand Up @@ -8,6 +8,8 @@
#include "../Common/TextureUtils.h"
#include "../Common/texture_cache_utils.h"

#include <span>

namespace vk
{
void resolve_image(vk::command_buffer& cmd, vk::viewable_image* dst, vk::viewable_image* src);
Expand Down Expand Up @@ -248,7 +250,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 = { vm::get_super_ptr<const std::byte>(base_addr), static_cast<std::span<const std::byte>::index_type>(rsx_pitch * surface_height * samples_y) };
subres.data = {vm::get_super_ptr<const std::byte>(base_addr), static_cast<std::span<const std::byte>::size_type>(rsx_pitch * surface_height * samples_y)};

if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
{
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/RSX/VK/VKTexture.cpp
Expand Up @@ -8,6 +8,8 @@
#include "VKCompute.h"
#include "VKRenderPass.h"

#include <span>

namespace vk
{
VkComponentMapping default_component_map()
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/RSX/VK/VKVertexBuffers.cpp
Expand Up @@ -3,6 +3,8 @@
#include "../rsx_methods.h"
#include "../Common/BufferUtils.h"

#include <span>

namespace vk
{
VkPrimitiveTopology get_appropriate_topology(rsx::primitive_type mode, bool &requires_modification)
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3qt/rsx_debugger.cpp
Expand Up @@ -13,6 +13,8 @@
#include <QPushButton>
#include <QKeyEvent>

#include <span>

enum GCMEnumTypes
{
CELL_GCM_ENUM,
Expand Down

0 comments on commit d9a71d5

Please sign in to comment.