mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-14 18:37:27 +00:00
GSL moved from stdafx.h (#1676)
Added GSL.h helper for correct including
This commit is contained in:
parent
efc8779275
commit
75fe95eeb1
14
Utilities/GSL.h
Normal file
14
Utilities/GSL.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#define GSL_THROW_ON_CONTRACT_VIOLATION
|
||||
|
||||
#pragma push_macro("new")
|
||||
#pragma push_macro("Expects")
|
||||
#pragma push_macro("Ensures")
|
||||
#undef new
|
||||
#undef Expects
|
||||
#undef Ensures
|
||||
#include <gsl.h>
|
||||
#pragma pop_macro("Ensures")
|
||||
#pragma pop_macro("Expects")
|
||||
#pragma pop_macro("new")
|
@ -28,6 +28,11 @@ using s16 = std::int16_t;
|
||||
using s32 = std::int32_t;
|
||||
using s64 = std::int64_t;
|
||||
|
||||
namespace gsl
|
||||
{
|
||||
enum class byte : std::uint8_t;
|
||||
}
|
||||
|
||||
// Specialization with static constexpr pair<T1, T2> map[] member expected
|
||||
template<typename T1, typename T2>
|
||||
struct bijective;
|
||||
|
@ -991,7 +991,7 @@ void spursSysServiceProcessRequests(SPUThread& spu, SpursKernelContext* ctxt)
|
||||
bool updateWorkload = false;
|
||||
bool terminate = false;
|
||||
|
||||
vm::reservation_op(vm::cast(ctxt->spurs.addr() + offsetof(CellSpurs, wklState1), HERE), 128, [&]()
|
||||
vm::reservation_op(vm::cast(ctxt->spurs.addr() + OFFSET_32(CellSpurs, wklState1), HERE), 128, [&]()
|
||||
{
|
||||
auto spurs = ctxt->spurs.get_ptr_priv();
|
||||
|
||||
|
@ -129,7 +129,7 @@ static const char* get_module_name(u16 id)
|
||||
|
||||
static const char* get_module_id(u16 id)
|
||||
{
|
||||
thread_local static char tls_id_name[8]; // for test
|
||||
static thread_local char tls_id_name[8]; // for test
|
||||
|
||||
switch (id)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ cfg::map_entry<s32> g_cfg_sys_language(cfg::root.sys, "Language",
|
||||
|
||||
static const char* get_systemparam_id_name(s32 id)
|
||||
{
|
||||
thread_local static char tls_id_name[16]; // for test
|
||||
static thread_local char tls_id_name[16]; // for test
|
||||
|
||||
switch (id)
|
||||
{
|
||||
|
@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Utilities/GSL.h"
|
||||
#include "Emu/Memory/vm.h"
|
||||
#include "../RSXThread.h"
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "Emu/RSX/RSXVertexProgram.h"
|
||||
#include "Emu/Memory/vm.h"
|
||||
|
||||
#include "Utilities/GSL.h"
|
||||
|
||||
enum class SHADER_TYPE
|
||||
{
|
||||
@ -15,6 +16,7 @@ namespace program_hash_util
|
||||
{
|
||||
// Based on
|
||||
// https://github.com/AlexAltea/nucleus/blob/master/nucleus/gpu/rsx_pgraph.cpp
|
||||
// TODO: eliminate it and implement independent hash utility
|
||||
union qword
|
||||
{
|
||||
u64 dword[2];
|
||||
|
@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "../RSXTexture.h"
|
||||
|
||||
#include <vector>
|
||||
#include "Utilities/GSL.h"
|
||||
|
||||
struct rsx_subresource_layout
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <gsl.h>
|
||||
#include "Utilities/GSL.h"
|
||||
#include "../GCM.h"
|
||||
#include <list>
|
||||
|
||||
|
@ -306,7 +306,7 @@ void GLFragmentProgram::Compile()
|
||||
id = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
const char* str = shader.c_str();
|
||||
const int strlen = gsl::narrow<int>(shader.length());
|
||||
const int strlen = ::narrow<int>(shader.length());
|
||||
|
||||
glShaderSource(id, 1, &str, &strlen);
|
||||
glCompileShader(id);
|
||||
|
@ -261,7 +261,7 @@ void GLVertexProgram::Compile()
|
||||
id = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
||||
const char* str = shader.c_str();
|
||||
const int strlen = gsl::narrow<int>(shader.length());
|
||||
const int strlen = ::narrow<int>(shader.length());
|
||||
|
||||
glShaderSource(id, 1, &str, &strlen);
|
||||
glCompileShader(id);
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "Common/BufferUtils.h"
|
||||
#include "rsx_methods.h"
|
||||
|
||||
#include "Utilities/GSL.h"
|
||||
|
||||
#define CMD_DEBUG 0
|
||||
|
||||
cfg::bool_entry g_cfg_rsx_write_color_buffers(cfg::root.video, "Write Color Buffers");
|
||||
|
@ -32,8 +32,8 @@ namespace rsx
|
||||
template<typename T>
|
||||
void convert_linear_swizzle(void* input_pixels, void* output_pixels, u16 width, u16 height, bool input_is_swizzled)
|
||||
{
|
||||
u16 log2width = gsl::narrow<u16>(ceil(log2(width)));
|
||||
u16 log2height = gsl::narrow<u16>(ceil(log2(height)));
|
||||
u16 log2width = ::narrow<u16>(ceil(log2(width)));
|
||||
u16 log2height = ::narrow<u16>(ceil(log2(height)));
|
||||
|
||||
// Max mask possible for square texture
|
||||
u32 x_mask = 0x55555555;
|
||||
|
@ -61,11 +61,6 @@
|
||||
<Import Project="..\rpcs3_llvm.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">
|
||||
<ClCompile>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="emucore.vcxproj">
|
||||
<Project>{c4a10229-4712-4bd2-b63e-50d93c67a038}</Project>
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "MemoryViewer.h"
|
||||
#include "RSXDebugger.h"
|
||||
|
||||
#include "Utilities/GSL.h"
|
||||
|
||||
enum GCMEnumTypes
|
||||
{
|
||||
CELL_GCM_ENUM,
|
||||
|
@ -55,7 +55,7 @@ namespace psf
|
||||
{
|
||||
case format::string:
|
||||
case format::array:
|
||||
return std::min(m_max_size, gsl::narrow<u32>(m_value_string.size() + (m_type == format::string)));
|
||||
return std::min(m_max_size, ::narrow<u32>(m_value_string.size() + (m_type == format::string)));
|
||||
|
||||
case format::integer:
|
||||
return SIZE_32(u32);
|
||||
@ -157,14 +157,14 @@ namespace psf
|
||||
for (const auto& entry : psf)
|
||||
{
|
||||
def_table_t index;
|
||||
index.key_off = gsl::narrow<u32>(key_offset);
|
||||
index.key_off = ::narrow<u32>(key_offset);
|
||||
index.param_fmt = entry.second.type();
|
||||
index.param_len = entry.second.size();
|
||||
index.param_max = entry.second.max();
|
||||
index.data_off = gsl::narrow<u32>(data_offset);
|
||||
index.data_off = ::narrow<u32>(data_offset);
|
||||
|
||||
// Update offsets:
|
||||
key_offset += gsl::narrow<u32>(entry.first.size() + 1); // key size
|
||||
key_offset += ::narrow<u32>(entry.first.size() + 1); // key size
|
||||
data_offset += index.param_max;
|
||||
|
||||
indices.push_back(index);
|
||||
@ -177,9 +177,9 @@ namespace psf
|
||||
header_t header;
|
||||
header.magic = "\0PSF"_u32;
|
||||
header.version = 0x101;
|
||||
header.off_key_table = gsl::narrow<u32>(sizeof(header_t) + sizeof(def_table_t) * psf.size());
|
||||
header.off_data_table = gsl::narrow<u32>(header.off_key_table + key_offset);
|
||||
header.entries_num = gsl::narrow<u32>(psf.size());
|
||||
header.off_key_table = ::narrow<u32>(sizeof(header_t) + sizeof(def_table_t) * psf.size());
|
||||
header.off_data_table = ::narrow<u32>(header.off_key_table + key_offset);
|
||||
header.entries_num = ::narrow<u32>(psf.size());
|
||||
|
||||
// Save header and indices
|
||||
std::vector<char> result; result.reserve(header.off_data_table + data_offset);
|
||||
|
@ -353,6 +353,7 @@
|
||||
<ClInclude Include="..\Utilities\BEType.h" />
|
||||
<ClInclude Include="..\Utilities\BitField.h" />
|
||||
<ClInclude Include="..\Utilities\event.h" />
|
||||
<ClInclude Include="..\Utilities\GSL.h" />
|
||||
<ClInclude Include="..\Utilities\Platform.h" />
|
||||
<ClInclude Include="..\Utilities\Log.h" />
|
||||
<ClInclude Include="..\Utilities\File.h" />
|
||||
|
@ -1588,5 +1588,8 @@
|
||||
<ClInclude Include="Emu\VFS.h">
|
||||
<Filter>Emu</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Utilities\GSL.h">
|
||||
<Filter>Utilities</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -39,16 +39,6 @@
|
||||
#include <unordered_map>
|
||||
#include <chrono>
|
||||
|
||||
#include "Utilities/types.h"
|
||||
|
||||
#include <restore_new.h>
|
||||
#define GSL_THROW_ON_CONTRACT_VIOLATION
|
||||
#include <gsl.h>
|
||||
#include <define_new_memleakdetect.h>
|
||||
|
||||
#undef Expects
|
||||
#undef Ensures
|
||||
|
||||
using namespace std::string_literals;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@ -58,6 +48,7 @@ using namespace std::chrono_literals;
|
||||
#define _PRGNAME_ "RPCS3"
|
||||
#define _PRGVER_ "0.0.0.9"
|
||||
|
||||
#include "Utilities/types.h"
|
||||
#include "Utilities/Macro.h"
|
||||
#include "Utilities/Platform.h"
|
||||
#include "Utilities/BEType.h"
|
||||
|
Loading…
Reference in New Issue
Block a user