Fix for gcc/clang build

This commit is contained in:
DH 2015-10-07 19:02:10 +03:00
parent cc0c3fc98d
commit 6cb036d35f
9 changed files with 108 additions and 86 deletions

View File

@ -56,45 +56,47 @@ struct size2_base
{
T width, height;
/*
size2_base() : width{}, height{}
constexpr size2_base() : width{}, height{}
{
}
size2_base(T width, T height) : width{ width }, height{ height }
constexpr size2_base(T width, T height) : width{ width }, height{ height }
{
}
constexpr size2_base(const size2_base& rhs) : width{ rhs.width }, height{ rhs.height }
{
}
*/
size2_base operator -(const size2_base& rhs) const
constexpr size2_base operator -(const size2_base& rhs) const
{
return{ width - rhs.width, height - rhs.height };
}
size2_base operator -(T rhs) const
constexpr size2_base operator -(T rhs) const
{
return{ width - rhs, height - rhs };
}
size2_base operator +(const size2_base& rhs) const
constexpr size2_base operator +(const size2_base& rhs) const
{
return{ width + rhs.width, height + rhs.height };
}
size2_base operator +(T rhs) const
constexpr size2_base operator +(T rhs) const
{
return{ width + rhs, height + rhs };
}
size2_base operator /(const size2_base& rhs) const
constexpr size2_base operator /(const size2_base& rhs) const
{
return{ width / rhs.width, height / rhs.height };
}
size2_base operator /(T rhs) const
constexpr size2_base operator /(T rhs) const
{
return{ width / rhs, height / rhs };
}
size2_base operator *(const size2_base& rhs) const
constexpr size2_base operator *(const size2_base& rhs) const
{
return{ width * rhs.width, height * rhs.height };
}
size2_base operator *(T rhs) const
constexpr size2_base operator *(T rhs) const
{
return{ width * rhs, height * rhs };
}
@ -148,18 +150,18 @@ struct size2_base
return *this;
}
bool operator == (const size2_base& rhs) const
constexpr bool operator == (const size2_base& rhs) const
{
return width == rhs.width && height == rhs.height;
}
bool operator != (const size2_base& rhs) const
constexpr bool operator != (const size2_base& rhs) const
{
return width != rhs.width || height != rhs.height;
}
template<typename NT>
operator size2_base<NT>() const
constexpr operator size2_base<NT>() const
{
return{ (NT)width, (NT)height };
}
@ -285,84 +287,87 @@ template<typename T>
struct position2_base
{
T x, y;
/*
position2_base() : x{}, y{}
constexpr position2_base() : x{}, y{}
{
}
position2_base(T x, T y) : x{ x }, y{ y }
constexpr position2_base(T x, T y) : x{ x }, y{ y }
{
}
*/
bool operator >(const position2_base& rhs) const
constexpr position2_base(const position2_base& rhs) : x{ rhs.x }, y{ rhs.y }
{
}
constexpr bool operator >(const position2_base& rhs) const
{
return x > rhs.x && y > rhs.y;
}
bool operator >(T rhs) const
constexpr bool operator >(T rhs) const
{
return x > rhs && y > rhs;
}
bool operator <(const position2_base& rhs) const
constexpr bool operator <(const position2_base& rhs) const
{
return x < rhs.x && y < rhs.y;
}
bool operator <(T rhs) const
constexpr bool operator <(T rhs) const
{
return x < rhs && y < rhs;
}
bool operator >=(const position2_base& rhs) const
constexpr bool operator >=(const position2_base& rhs) const
{
return x >= rhs.x && y >= rhs.y;
}
bool operator >=(T rhs) const
constexpr bool operator >=(T rhs) const
{
return x >= rhs && y >= rhs;
}
bool operator <=(const position2_base& rhs) const
constexpr bool operator <=(const position2_base& rhs) const
{
return x <= rhs.x && y <= rhs.y;
}
bool operator <=(T rhs) const
constexpr bool operator <=(T rhs) const
{
return x <= rhs && y <= rhs;
}
position2_base operator -(const position2_base& rhs) const
constexpr position2_base operator -(const position2_base& rhs) const
{
return{ x - rhs.x, y - rhs.y };
}
position2_base operator -(T rhs) const
constexpr position2_base operator -(T rhs) const
{
return{ x - rhs, y - rhs };
}
position2_base operator +(const position2_base& rhs) const
constexpr position2_base operator +(const position2_base& rhs) const
{
return{ x + rhs.x, y + rhs.y };
}
position2_base operator +(T rhs) const
constexpr position2_base operator +(T rhs) const
{
return{ x + rhs, y + rhs };
}
template<typename RhsT>
position2_base operator *(RhsT rhs) const
constexpr position2_base operator *(RhsT rhs) const
{
return{ T(x * rhs), T(y * rhs) };
}
position2_base operator *(const position2_base& rhs) const
constexpr position2_base operator *(const position2_base& rhs) const
{
return{ T(x * rhs.x), T(y * rhs.y) };
}
template<typename RhsT>
position2_base operator /(RhsT rhs) const
constexpr position2_base operator /(RhsT rhs) const
{
return{ x / rhs, y / rhs };
}
position2_base operator /(const position2_base& rhs) const
constexpr position2_base operator /(const position2_base& rhs) const
{
return{ x / rhs.x, y / rhs.y };
}
position2_base operator /(const size2_base<T>& rhs) const
constexpr position2_base operator /(const size2_base<T>& rhs) const
{
return{ x / rhs.width, y / rhs.height };
}
@ -393,59 +398,59 @@ struct position2_base
}
template<typename RhsT>
position2_base& operator *=(RhsT rhs) const
position2_base& operator *=(RhsT rhs)
{
x *= rhs;
y *= rhs;
return *this;
}
position2_base& operator *=(const position2_base& rhs) const
position2_base& operator *=(const position2_base& rhs)
{
x *= rhs.x;
y *= rhs.y;
return *this;
}
template<typename RhsT>
position2_base& operator /=(RhsT rhs) const
position2_base& operator /=(RhsT rhs)
{
x /= rhs;
y /= rhs;
return *this;
}
position2_base& operator /=(const position2_base& rhs) const
position2_base& operator /=(const position2_base& rhs)
{
x /= rhs.x;
y /= rhs.y;
return *this;
}
bool operator ==(const position2_base& rhs) const
constexpr bool operator ==(const position2_base& rhs) const
{
return x == rhs.x && y == rhs.y;
}
bool operator ==(T rhs) const
constexpr bool operator ==(T rhs) const
{
return x == rhs && y == rhs;
}
bool operator !=(const position2_base& rhs) const
constexpr bool operator !=(const position2_base& rhs) const
{
return !(*this == rhs);
}
bool operator !=(T rhs) const
constexpr bool operator !=(T rhs) const
{
return !(*this == rhs);
}
template<typename NT>
operator position2_base<NT>() const
constexpr operator position2_base<NT>() const
{
return{ (NT)x, (NT)y };
}
double distance(const position2_base& to)
double distance(const position2_base& to) const
{
return std::sqrt(double((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y)));
}
@ -646,12 +651,19 @@ struct coord_base
struct { T width, height; };
};
constexpr coord_base() : x{}, y{}, position{}, width{}, height{}, size{}
constexpr coord_base() : position{}, size{}
#ifdef _MSC_VER
//compiler error
, x{}, y{}, width{}, height{}
#endif
{
}
constexpr coord_base(const position_base<T>& position, const size2_base<T>& size)
: x{ position.x }, y{ position.y }, position{ position }, width{ size.width }, height{ size.height }, size{ size }
: position{ position }, size{ size }
#ifdef _MSC_VER
, x{ position.x }, y{ position.y }, width{ size.width }, height{ size.height }
#endif
{
}

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#ifdef DX12_SUPPORT
#include "BufferUtils.h"
@ -243,4 +244,5 @@ void uploadIndexData(unsigned m_draw_mode, unsigned index_type, void* indexBuffe
return;
}
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef DX12_SUPPORT
#pragma once
#include <vector>
#include "Emu/Memory/vm.h"
@ -37,4 +38,5 @@ size_t getIndexCount(unsigned m_draw_mode, unsigned initial_index_count);
/*
* Write index information to bufferMap
*/
void uploadIndexData(unsigned m_draw_mode, unsigned index_type, void* indexBuffer, void* bufferMap, unsigned element_count);
void uploadIndexData(unsigned m_draw_mode, unsigned index_type, void* indexBuffer, void* bufferMap, unsigned element_count);
#endif

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#ifdef DX12_SUPPORT
#include "Emu/Memory/vm.h"
#include "TextureUtils.h"
#include "../RSXThread.h"
@ -541,4 +542,5 @@ std::vector<MipmapLevelInfo> uploadPlacedTexture(const RSXTexture &texture, size
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, blockSizeInByte, texture.GetMipmap());
}
}
}
#endif

View File

@ -1,4 +1,5 @@
#pragma once
#ifdef DX12_SUPPORT
#include "../RSXTexture.h"
#include <vector>
@ -21,4 +22,5 @@ size_t getPlacedTextureStorageSpace(const rsx::texture &texture, size_t rowPitch
* Data are not packed, they are stored per rows using rowPitchAlignement.
* Similarly, offset for every mipmaplevel is aligned to rowPitchAlignement boundary.
*/
std::vector<MipmapLevelInfo> uploadPlacedTexture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData);
std::vector<MipmapLevelInfo> uploadPlacedTexture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData);
#endif

View File

@ -903,9 +903,9 @@ enum Method
namespace rsx
{
template<typename ...T>
static std::array<u32, sizeof...(T) + 1> make_command(u32 start_register, T... values)
static auto make_command(u32 start_register, T... values) -> std::array<u32, sizeof...(values) + 1>
{
return{ (start_register << 2) | (sizeof...(values) << 18), values... };
return{ (start_register << 2) | u32(sizeof...(values) << 18), u32(values)... };
}
static u32 make_jump(u32 offset)
@ -916,14 +916,12 @@ namespace rsx
template<typename AT, typename ...T>
static size_t make_command(vm::ps3::ptr<u32, AT> &dst, u32 start_register, T... values)
{
auto commands = make_command(start_register, values...);
for (u32 command : commands)
for (u32 command : { (start_register << 2) | u32(sizeof...(values) << 18), u32(values)... })
{
*dst++ = command;
}
return commands.size();
return sizeof...(values) + 1;
}
template<typename AT>

View File

@ -796,7 +796,7 @@ namespace gl
clamp_to_edge = GL_CLAMP_TO_EDGE,
clamp_to_border = GL_CLAMP_TO_BORDER,
mirror_clamp = GL_MIRROR_CLAMP_EXT,
mirror_clamp_to_edge = GL_MIRROR_CLAMP_TO_EDGE,
//mirror_clamp_to_edge = GL_MIRROR_CLAMP_TO_EDGE,
mirror_clamp_to_border = GL_MIRROR_CLAMP_TO_BORDER_EXT
};

View File

@ -39,12 +39,12 @@ namespace rsx
namespace nv406e
{
__forceinline void set_reference(thread* rsx, u32 arg)
force_inline void set_reference(thread* rsx, u32 arg)
{
rsx->ctrl->ref.exchange(arg);
}
__forceinline void semaphore_acquire(thread* rsx, u32 arg)
force_inline void semaphore_acquire(thread* rsx, u32 arg)
{
//TODO: dma
while (vm::read32(rsx->label_addr + method_registers[NV406E_SEMAPHORE_OFFSET]) != arg)
@ -56,7 +56,7 @@ namespace rsx
}
}
__forceinline void semaphore_release(thread* rsx, u32 arg)
force_inline void semaphore_release(thread* rsx, u32 arg)
{
//TODO: dma
vm::write32(rsx->label_addr + method_registers[NV406E_SEMAPHORE_OFFSET], arg);
@ -65,13 +65,13 @@ namespace rsx
namespace nv4097
{
__forceinline void texture_read_semaphore_release(thread* rsx, u32 arg)
force_inline void texture_read_semaphore_release(thread* rsx, u32 arg)
{
//TODO: dma
vm::write32(rsx->label_addr + method_registers[NV4097_SET_SEMAPHORE_OFFSET], arg);
}
__forceinline void back_end_write_semaphore_release(thread* rsx, u32 arg)
force_inline void back_end_write_semaphore_release(thread* rsx, u32 arg)
{
//TODO: dma
vm::write32(rsx->label_addr + method_registers[NV4097_SET_SEMAPHORE_OFFSET],
@ -80,7 +80,7 @@ namespace rsx
//fire only when all data passed to rsx cmd buffer
template<u32 id, u32 index, int count, typename type>
__forceinline void set_vertex_data_impl(thread* rsx, u32 arg)
force_inline void set_vertex_data_impl(thread* rsx, u32 arg)
{
static const size_t element_size = (count * sizeof(type));
static const size_t element_size_in_words = element_size / sizeof(u32);
@ -105,56 +105,56 @@ namespace rsx
}
template<u32 index>
__forceinline void set_vertex_data4ub_m(thread* rsx, u32 arg)
force_inline void set_vertex_data4ub_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA4UB_M, index, 4, u8>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data1f_m(thread* rsx, u32 arg)
force_inline void set_vertex_data1f_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA1F_M, index, 1, f32>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data2f_m(thread* rsx, u32 arg)
force_inline void set_vertex_data2f_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA1F_M, index, 2, f32>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data3f_m(thread* rsx, u32 arg)
force_inline void set_vertex_data3f_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA1F_M, index, 3, f32>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data4f_m(thread* rsx, u32 arg)
force_inline void set_vertex_data4f_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA1F_M, index, 4, f32>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data2s_m(thread* rsx, u32 arg)
force_inline void set_vertex_data2s_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA2S_M, index, 2, u16>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data4s_m(thread* rsx, u32 arg)
force_inline void set_vertex_data4s_m(thread* rsx, u32 arg)
{
set_vertex_data_impl<NV4097_SET_VERTEX_DATA4S_M, index, 4, u16>(rsx, arg);
}
template<u32 index>
__forceinline void set_vertex_data_array_format(thread* rsx, u32 arg)
force_inline void set_vertex_data_array_format(thread* rsx, u32 arg)
{
auto& info = rsx->vertex_arrays_info[index];
info.unpack(arg);
info.array = info.size > 0;
}
__forceinline void draw_arrays(thread* rsx, u32 arg)
force_inline void draw_arrays(thread* rsx, u32 arg)
{
u32 first = arg & 0xffffff;
u32 count = (arg >> 24) + 1;
@ -162,7 +162,7 @@ namespace rsx
rsx->load_vertex_data(first, count);
}
__forceinline void draw_index_array(thread* rsx, u32 arg)
force_inline void draw_index_array(thread* rsx, u32 arg)
{
u32 first = arg & 0xffffff;
u32 count = (arg >> 24) + 1;
@ -172,7 +172,7 @@ namespace rsx
}
template<u32 index>
__forceinline void set_transform_constant(thread* rsxthr, u32 arg)
force_inline void set_transform_constant(thread* rsxthr, u32 arg)
{
u32& load = method_registers[NV4097_SET_TRANSFORM_CONSTANT_LOAD];
@ -183,7 +183,7 @@ namespace rsx
}
template<u32 index>
__forceinline void set_transform_program(thread* rsx, u32 arg)
force_inline void set_transform_program(thread* rsx, u32 arg)
{
u32& load = method_registers[NV4097_SET_TRANSFORM_PROGRAM_LOAD];
@ -193,7 +193,7 @@ namespace rsx
memcpy(rsx->transform_program + load++ * count, method_registers + NV4097_SET_TRANSFORM_PROGRAM + index * count, size);
}
__forceinline void set_begin_end(thread* rsx, u32 arg)
force_inline void set_begin_end(thread* rsx, u32 arg)
{
if (arg)
{
@ -241,7 +241,7 @@ namespace rsx
rsx->vertex_draw_count = 0;
}
__forceinline void get_report(thread* rsx, u32 arg)
force_inline void get_report(thread* rsx, u32 arg)
{
u8 type = arg >> 24;
u32 offset = arg & 0xffffff;
@ -271,7 +271,7 @@ namespace rsx
//result->padding = 0;
}
__forceinline void clear_report_value(thread* rsx, u32 arg)
force_inline void clear_report_value(thread* rsx, u32 arg)
{
switch (arg)
{
@ -291,7 +291,7 @@ namespace rsx
namespace nv308a
{
template<u32 index>
__forceinline void color(u32 arg)
force_inline void color(u32 arg)
{
u32 point = method_registers[NV308A_POINT];
u16 x = point;
@ -309,7 +309,7 @@ namespace rsx
namespace nv3089
{
__forceinline void image_in(u32 arg)
force_inline void image_in(u32 arg)
{
const u16 width = method_registers[NV3089_IMAGE_IN_SIZE];
const u16 height = method_registers[NV3089_IMAGE_IN_SIZE] >> 16;
@ -487,7 +487,7 @@ namespace rsx
namespace nv0039
{
__forceinline void buffer_notify(u32 arg)
force_inline void buffer_notify(u32 arg)
{
const u32 inPitch = method_registers[NV0039_PITCH_IN];
const u32 outPitch = method_registers[NV0039_PITCH_OUT];
@ -561,13 +561,13 @@ namespace rsx
using rsx_impl_method_t = void(*)(u32);
template<rsx_method_t impl_func>
__forceinline static void call_impl_func(thread *rsx, u32 arg)
force_inline static void call_impl_func(thread *rsx, u32 arg)
{
impl_func(rsx, arg);
}
template<rsx_impl_method_t impl_func>
__forceinline static void call_impl_func(thread *rsx, u32 arg)
force_inline static void call_impl_func(thread *rsx, u32 arg)
{
impl_func(arg);
}

View File

@ -3,6 +3,10 @@
#include "Loader/Loader.h"
#include "DbgCommand.h"
//just for frame_type
//TODO: provide better way
#include "Emu/RSX/GSRender.h"
struct EmuCallbacks
{
std::function<void(std::function<void()>)> call_after;
@ -11,7 +15,7 @@ struct EmuCallbacks
std::function<std::unique_ptr<class KeyboardHandlerBase>()> get_kb_handler;
std::function<std::unique_ptr<class MouseHandlerBase>()> get_mouse_handler;
std::function<std::unique_ptr<class PadHandlerBase>()> get_pad_handler;
std::function<std::unique_ptr<class GSFrameBase>(enum class frame_type)> get_gs_frame;
std::function<std::unique_ptr<class GSFrameBase>(frame_type)> get_gs_frame;
std::function<std::unique_ptr<class MsgDialogBase>()> get_msg_dialog;
std::function<std::unique_ptr<class SaveDialogBase>()> get_save_dialog;
};