From 0effb229cd754640def04b7d9f9dd3187137aa43 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Fri, 17 Jan 2020 07:58:40 +0000 Subject: [PATCH] Fix geometry pipeline; attempt to fix motion controls --- src/core/hle/service/hid/hid.cpp | 4 +++- src/video_core/geometry_pipeline.cpp | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index f20cebca7..012a37e6b 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -40,7 +40,9 @@ void Module::serialize(Archive& ar, const unsigned int) { ar& next_gyroscope_index; ar& enable_accelerometer_count; ar& enable_gyroscope_count; - ReloadInputDevices(); + if (Archive::is_loading::value) { + LoadInputDevices(); + } // Pad state not needed as it's always updated // Update events are set in the constructor // Devices are set from the implementation (and are stateless afaik) diff --git a/src/video_core/geometry_pipeline.cpp b/src/video_core/geometry_pipeline.cpp index 159f1df0b..7e002d55d 100644 --- a/src/video_core/geometry_pipeline.cpp +++ b/src/video_core/geometry_pipeline.cpp @@ -49,7 +49,7 @@ private: // TODO: what happens when the input size is not divisible by the output size? class GeometryPipeline_Point : public GeometryPipelineBackend { public: - GeometryPipeline_Point() : regs(g_state.regs), unit(g_state.gs_unit) { + GeometryPipeline_Point(const Regs& regs, Shader::GSUnitState& unit) : regs(regs), unit(unit) { ASSERT(regs.pipeline.variable_primitive == 0); ASSERT(regs.gs.input_to_uniform == 0); vs_output_num = regs.pipeline.vs_outmap_total_minus_1_a + 1; @@ -89,6 +89,8 @@ private: Common::Vec4* buffer_end; unsigned int vs_output_num; + GeometryPipeline_Point() : regs(g_state.regs), unit(g_state.gs_unit) {} + template static void serialize_common(Class* self, Archive& ar, const unsigned int version) { ar& boost::serialization::base_object(*self); @@ -125,7 +127,8 @@ 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(const Regs& regs, Shader::ShaderSetup& setup) + : regs(regs), setup(setup) { 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; @@ -183,6 +186,8 @@ private: Common::Vec4* buffer_cur; unsigned int vs_output_num; + GeometryPipeline_VariablePrimitive() : regs(g_state.regs), setup(g_state.gs) {} + template static void serialize_common(Class* self, Archive& ar, const unsigned int version) { ar& boost::serialization::base_object(*self); @@ -217,7 +222,8 @@ private: // particle system. class GeometryPipeline_FixedPrimitive : public GeometryPipelineBackend { public: - GeometryPipeline_FixedPrimitive() : regs(g_state.regs), setup(g_state.gs) { + GeometryPipeline_FixedPrimitive(const Regs& regs, Shader::ShaderSetup& setup) + : regs(regs), setup(setup) { 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; @@ -256,6 +262,8 @@ private: Common::Vec4* buffer_end; unsigned int vs_output_num; + GeometryPipeline_FixedPrimitive() : regs(g_state.regs), setup(g_state.gs) {} + template static void serialize_common(Class* self, Archive& ar, const unsigned int version) { ar& boost::serialization::base_object(*self); @@ -329,13 +337,13 @@ void GeometryPipeline::Reconfigure() { switch (state.regs.pipeline.gs_config.mode) { case PipelineRegs::GSMode::Point: - backend = std::make_unique(); + backend = std::make_unique(state.regs, state.gs_unit); break; case PipelineRegs::GSMode::VariablePrimitive: - backend = std::make_unique(); + backend = std::make_unique(state.regs, state.gs); break; case PipelineRegs::GSMode::FixedPrimitive: - backend = std::make_unique(); + backend = std::make_unique(state.regs, state.gs); break; default: UNREACHABLE();