clang-format fixes
This commit is contained in:
parent
d482fb359c
commit
7b846ffa98
117 changed files with 797 additions and 925 deletions
|
@ -645,8 +645,7 @@ void ProcessCommandList(PAddr list, u32 size) {
|
|||
u32* buffer = (u32*)VideoCore::g_memory->GetPhysicalPointer(list);
|
||||
|
||||
if (Pica::g_debug_context && Pica::g_debug_context->recorder) {
|
||||
Pica::g_debug_context->recorder->MemoryAccessed((u8*)buffer, size,
|
||||
list);
|
||||
Pica::g_debug_context->recorder->MemoryAccessed((u8*)buffer, size, list);
|
||||
}
|
||||
|
||||
g_state.cmd_list.addr = list;
|
||||
|
|
|
@ -37,9 +37,7 @@ public:
|
|||
|
||||
private:
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
}
|
||||
void serialize(Archive& ar, const unsigned int file_version) {}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
||||
|
@ -92,16 +90,14 @@ private:
|
|||
unsigned int vs_output_num;
|
||||
|
||||
template <typename Class, class Archive>
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version)
|
||||
{
|
||||
ar & boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
|
||||
ar& boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
ar & self->attribute_buffer;
|
||||
ar & self->vs_output_num;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive & ar, const unsigned int version) const
|
||||
{
|
||||
template <class Archive>
|
||||
void save(Archive& ar, const unsigned int version) const {
|
||||
serialize_common(this, ar, version);
|
||||
auto buffer_idx = static_cast<u32>(buffer_cur - attribute_buffer.attr);
|
||||
auto buffer_size = static_cast<u32>(buffer_end - attribute_buffer.attr);
|
||||
|
@ -109,9 +105,8 @@ private:
|
|||
ar << buffer_size;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void load(Archive & ar, const unsigned int version)
|
||||
{
|
||||
template <class Archive>
|
||||
void load(Archive& ar, const unsigned int version) {
|
||||
serialize_common(this, ar, version);
|
||||
u32 buffer_idx, buffer_size;
|
||||
ar >> buffer_idx;
|
||||
|
@ -130,8 +125,7 @@ private:
|
|||
// value in the batch. This mode is usually used for subdivision.
|
||||
class GeometryPipeline_VariablePrimitive : public GeometryPipelineBackend {
|
||||
public:
|
||||
GeometryPipeline_VariablePrimitive()
|
||||
: regs(g_state.regs), setup(g_state.gs) {
|
||||
GeometryPipeline_VariablePrimitive() : regs(g_state.regs), setup(g_state.gs) {
|
||||
ASSERT(regs.pipeline.variable_primitive == 1);
|
||||
ASSERT(regs.gs.input_to_uniform == 1);
|
||||
vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1;
|
||||
|
@ -190,26 +184,23 @@ private:
|
|||
unsigned int vs_output_num;
|
||||
|
||||
template <typename Class, class Archive>
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version)
|
||||
{
|
||||
ar & boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
|
||||
ar& boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
ar & self->need_index;
|
||||
ar & self->main_vertex_num;
|
||||
ar & self->total_vertex_num;
|
||||
ar & self->vs_output_num;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive & ar, const unsigned int version) const
|
||||
{
|
||||
template <class Archive>
|
||||
void save(Archive& ar, const unsigned int version) const {
|
||||
serialize_common(this, ar, version);
|
||||
auto buffer_idx = static_cast<u32>(buffer_cur - setup.uniforms.f);
|
||||
ar << buffer_idx;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void load(Archive & ar, const unsigned int version)
|
||||
{
|
||||
template <class Archive>
|
||||
void load(Archive& ar, const unsigned int version) {
|
||||
serialize_common(this, ar, version);
|
||||
u32 buffer_idx;
|
||||
ar >> buffer_idx;
|
||||
|
@ -226,8 +217,7 @@ private:
|
|||
// particle system.
|
||||
class GeometryPipeline_FixedPrimitive : public GeometryPipelineBackend {
|
||||
public:
|
||||
GeometryPipeline_FixedPrimitive()
|
||||
: regs(g_state.regs), setup(g_state.gs) {
|
||||
GeometryPipeline_FixedPrimitive() : regs(g_state.regs), setup(g_state.gs) {
|
||||
ASSERT(regs.pipeline.variable_primitive == 0);
|
||||
ASSERT(regs.gs.input_to_uniform == 1);
|
||||
vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1;
|
||||
|
@ -267,15 +257,13 @@ private:
|
|||
unsigned int vs_output_num;
|
||||
|
||||
template <typename Class, class Archive>
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version)
|
||||
{
|
||||
ar & boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
|
||||
ar& boost::serialization::base_object<GeometryPipelineBackend>(*self);
|
||||
ar & self->vs_output_num;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive & ar, const unsigned int version) const
|
||||
{
|
||||
template <class Archive>
|
||||
void save(Archive& ar, const unsigned int version) const {
|
||||
serialize_common(this, ar, version);
|
||||
auto buffer_offset = static_cast<u32>(buffer_begin - setup.uniforms.f);
|
||||
auto buffer_idx = static_cast<u32>(buffer_cur - setup.uniforms.f);
|
||||
|
@ -285,9 +273,8 @@ private:
|
|||
ar << buffer_size;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void load(Archive & ar, const unsigned int version)
|
||||
{
|
||||
template <class Archive>
|
||||
void load(Archive& ar, const unsigned int version) {
|
||||
serialize_common(this, ar, version);
|
||||
u32 buffer_offset, buffer_idx, buffer_size;
|
||||
ar >> buffer_offset;
|
||||
|
@ -385,7 +372,7 @@ void GeometryPipeline::SubmitVertex(const Shader::AttributeBuffer& input) {
|
|||
template <class Archive>
|
||||
void GeometryPipeline::serialize(Archive& ar, const unsigned int version) {
|
||||
// vertex_handler and shader_engine are always set to the same value
|
||||
ar & backend;
|
||||
ar& backend;
|
||||
}
|
||||
|
||||
} // namespace Pica
|
||||
|
|
|
@ -3,17 +3,19 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cstring>
|
||||
#include "core/global.h"
|
||||
#include "video_core/geometry_pipeline.h"
|
||||
#include "video_core/pica.h"
|
||||
#include "video_core/pica_state.h"
|
||||
#include "video_core/renderer_base.h"
|
||||
#include "video_core/video_core.h"
|
||||
#include "core/global.h"
|
||||
|
||||
namespace Core {
|
||||
template <>
|
||||
Pica::State& Global() { return Pica::g_state; }
|
||||
template <>
|
||||
Pica::State& Global() {
|
||||
return Pica::g_state;
|
||||
}
|
||||
} // namespace Core
|
||||
|
||||
namespace Pica {
|
||||
|
||||
|
|
|
@ -9,23 +9,21 @@
|
|||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "video_core/video_core.h"
|
||||
#include "video_core/geometry_pipeline.h"
|
||||
#include "video_core/primitive_assembly.h"
|
||||
#include "video_core/regs.h"
|
||||
#include "video_core/shader/shader.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
// Boost::serialization doesn't like union types for some reason,
|
||||
// so we need to mark arrays of union values with a special serialization method
|
||||
template<typename Value, size_t Size>
|
||||
struct UnionArray : public std::array<Value, Size>
|
||||
{
|
||||
template <typename Value, size_t Size>
|
||||
struct UnionArray : public std::array<Value, Size> {
|
||||
private:
|
||||
template<class Archive>
|
||||
void serialize(Archive& ar, const unsigned int)
|
||||
{
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int) {
|
||||
static_assert(sizeof(Value) == sizeof(u32));
|
||||
ar & *static_cast<u32 (*)[Size]>(static_cast<void *>(this->data()));
|
||||
ar&* static_cast<u32(*)[Size]>(static_cast<void*>(this->data()));
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
@ -99,14 +97,13 @@ struct State {
|
|||
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & noise_table;
|
||||
ar & color_map_table;
|
||||
ar & alpha_map_table;
|
||||
ar & color_table;
|
||||
ar & color_diff_table;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& noise_table;
|
||||
ar& color_map_table;
|
||||
ar& alpha_map_table;
|
||||
ar& color_table;
|
||||
ar& color_diff_table;
|
||||
}
|
||||
} proctex;
|
||||
|
||||
|
@ -131,10 +128,9 @@ struct State {
|
|||
return neg_difference ? -diff : diff;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & raw;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& raw;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -180,12 +176,11 @@ struct State {
|
|||
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & input_vertex;
|
||||
ar & current_attribute;
|
||||
ar & reset_geometry_pipeline;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& input_vertex;
|
||||
ar& current_attribute;
|
||||
ar& reset_geometry_pipeline;
|
||||
}
|
||||
|
||||
} immediate;
|
||||
|
@ -210,42 +205,38 @@ struct State {
|
|||
u32 default_attr_write_buffer[3]{};
|
||||
|
||||
private:
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & regs.reg_array;
|
||||
ar & vs;
|
||||
ar & gs;
|
||||
ar & input_default_attributes;
|
||||
ar & proctex;
|
||||
ar & lighting.luts;
|
||||
ar & fog.lut;
|
||||
ar & cmd_list.addr;
|
||||
ar & cmd_list.length;
|
||||
ar & immediate;
|
||||
ar & gs_unit;
|
||||
ar & geometry_pipeline;
|
||||
ar & primitive_assembler;
|
||||
ar & vs_float_regs_counter;
|
||||
ar & vs_uniform_write_buffer;
|
||||
ar & gs_float_regs_counter;
|
||||
ar & gs_uniform_write_buffer;
|
||||
ar & default_attr_counter;
|
||||
ar & default_attr_write_buffer;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& regs.reg_array;
|
||||
ar& vs;
|
||||
ar& gs;
|
||||
ar& input_default_attributes;
|
||||
ar& proctex;
|
||||
ar& lighting.luts;
|
||||
ar& fog.lut;
|
||||
ar& cmd_list.addr;
|
||||
ar& cmd_list.length;
|
||||
ar& immediate;
|
||||
ar& gs_unit;
|
||||
ar& geometry_pipeline;
|
||||
ar& primitive_assembler;
|
||||
ar& vs_float_regs_counter;
|
||||
ar& vs_uniform_write_buffer;
|
||||
ar& gs_float_regs_counter;
|
||||
ar& gs_uniform_write_buffer;
|
||||
ar& default_attr_counter;
|
||||
ar& default_attr_write_buffer;
|
||||
boost::serialization::split_member(ar, *this, file_version);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive & ar, const unsigned int file_version) const
|
||||
{
|
||||
template <class Archive>
|
||||
void save(Archive& ar, const unsigned int file_version) const {
|
||||
ar << static_cast<u32>(cmd_list.current_ptr - cmd_list.head_ptr);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void load(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
template <class Archive>
|
||||
void load(Archive& ar, const unsigned int file_version) {
|
||||
u32 offset{};
|
||||
ar >> offset;
|
||||
cmd_list.head_ptr = (u32*)VideoCore::g_memory->GetPhysicalPointer(cmd_list.addr);
|
||||
|
|
|
@ -143,10 +143,9 @@ private:
|
|||
float value;
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & value;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& value;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
#include <functional>
|
||||
#include "video_core/regs_pipeline.h"
|
||||
namespace boost::serialization { class access; }
|
||||
namespace boost::serialization {
|
||||
class access;
|
||||
}
|
||||
|
||||
namespace Pica {
|
||||
|
||||
|
@ -65,13 +67,12 @@ private:
|
|||
bool winding = false;
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int version)
|
||||
{
|
||||
ar & topology;
|
||||
ar & buffer_index;
|
||||
ar & buffer;
|
||||
ar & strip_ready;
|
||||
ar & winding;
|
||||
void serialize(Archive& ar, const unsigned int version) {
|
||||
ar& topology;
|
||||
ar& buffer_index;
|
||||
ar& buffer;
|
||||
ar& strip_ready;
|
||||
ar& winding;
|
||||
}
|
||||
friend class boost::serialization::access;
|
||||
};
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <nihstro/shader_bytecode.h>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <nihstro/shader_bytecode.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/common_funcs.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "common/pod.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "video_core/pica_types.h"
|
||||
#include "video_core/regs_rasterizer.h"
|
||||
#include "video_core/regs_shader.h"
|
||||
|
@ -38,9 +38,8 @@ struct AttributeBuffer {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
ar & attr;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& attr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -107,13 +106,12 @@ struct GSEmitter {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
ar & buffer;
|
||||
ar & vertex_id;
|
||||
ar & prim_emit;
|
||||
ar & winding;
|
||||
ar & output_mask;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& buffer;
|
||||
ar& vertex_id;
|
||||
ar& prim_emit;
|
||||
ar& winding;
|
||||
ar& output_mask;
|
||||
// Handlers are ignored because they're constant
|
||||
}
|
||||
};
|
||||
|
@ -137,11 +135,10 @@ struct UnitState {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
ar & input;
|
||||
ar & temporary;
|
||||
ar & output;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& input;
|
||||
ar& temporary;
|
||||
ar& output;
|
||||
}
|
||||
} registers;
|
||||
static_assert(std::is_pod<Registers>::value, "Structure is not POD");
|
||||
|
@ -199,11 +196,10 @@ struct UnitState {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
ar & registers;
|
||||
ar & conditional_code;
|
||||
ar & address_registers;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& registers;
|
||||
ar& conditional_code;
|
||||
ar& address_registers;
|
||||
// emitter_ptr is only set by GSUnitState and is serialized there
|
||||
}
|
||||
};
|
||||
|
@ -223,10 +219,9 @@ struct GSUnitState : public UnitState {
|
|||
private:
|
||||
friend class boost::serialization::access;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version)
|
||||
{
|
||||
ar & boost::serialization::base_object<UnitState>(*this);
|
||||
ar & emitter;
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& boost::serialization::base_object<UnitState>(*this);
|
||||
ar& emitter;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -252,12 +247,11 @@ struct Uniforms {
|
|||
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & f;
|
||||
ar & b;
|
||||
ar & i;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& f;
|
||||
ar& b;
|
||||
ar& i;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -305,16 +299,15 @@ private:
|
|||
u64 swizzle_data_hash = 0xDEADC0DE;
|
||||
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int file_version)
|
||||
{
|
||||
ar & uniforms;
|
||||
ar & program_code;
|
||||
ar & swizzle_data;
|
||||
ar & program_code_hash_dirty;
|
||||
ar & swizzle_data_hash_dirty;
|
||||
ar & program_code_hash;
|
||||
ar & swizzle_data_hash;
|
||||
template <class Archive>
|
||||
void serialize(Archive& ar, const unsigned int file_version) {
|
||||
ar& uniforms;
|
||||
ar& program_code;
|
||||
ar& swizzle_data;
|
||||
ar& program_code_hash_dirty;
|
||||
ar& swizzle_data_hash_dirty;
|
||||
ar& program_code_hash;
|
||||
ar& swizzle_data_hash;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -87,18 +87,15 @@ u16 GetResolutionScaleFactor() {
|
|||
}
|
||||
}
|
||||
|
||||
void Save(std::ostream &stream)
|
||||
{
|
||||
void Save(std::ostream& stream) {
|
||||
oarchive oa{stream};
|
||||
oa & Pica::g_state;
|
||||
oa& Pica::g_state;
|
||||
}
|
||||
|
||||
void Load(std::istream &stream)
|
||||
{
|
||||
void Load(std::istream& stream) {
|
||||
iarchive ia{stream};
|
||||
ia & Pica::g_state;
|
||||
ia& Pica::g_state;
|
||||
// TODO: Flush/reset things
|
||||
|
||||
}
|
||||
|
||||
} // namespace VideoCore
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include "core/frontend/emu_window.h"
|
||||
|
||||
|
@ -62,7 +62,7 @@ void RequestScreenshot(void* data, std::function<void()> callback,
|
|||
|
||||
u16 GetResolutionScaleFactor();
|
||||
|
||||
void Save(std::ostream &stream);
|
||||
void Load(std::istream &stream);
|
||||
void Save(std::ostream& stream);
|
||||
void Load(std::istream& stream);
|
||||
|
||||
} // namespace VideoCore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue