Fix geometry pipeline; attempt to fix motion controls

This commit is contained in:
Hamish Milne 2020-01-17 07:58:40 +00:00 committed by zhupengfei
parent 35c3ca995c
commit 0effb229cd
2 changed files with 17 additions and 7 deletions

View file

@ -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)

View file

@ -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<float24>* buffer_end;
unsigned int vs_output_num;
GeometryPipeline_Point() : regs(g_state.regs), unit(g_state.gs_unit) {}
template <typename Class, class Archive>
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
ar& boost::serialization::base_object<GeometryPipelineBackend>(*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<float24>* buffer_cur;
unsigned int vs_output_num;
GeometryPipeline_VariablePrimitive() : regs(g_state.regs), setup(g_state.gs) {}
template <typename Class, class Archive>
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
ar& boost::serialization::base_object<GeometryPipelineBackend>(*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<float24>* buffer_end;
unsigned int vs_output_num;
GeometryPipeline_FixedPrimitive() : regs(g_state.regs), setup(g_state.gs) {}
template <typename Class, class Archive>
static void serialize_common(Class* self, Archive& ar, const unsigned int version) {
ar& boost::serialization::base_object<GeometryPipelineBackend>(*self);
@ -329,13 +337,13 @@ void GeometryPipeline::Reconfigure() {
switch (state.regs.pipeline.gs_config.mode) {
case PipelineRegs::GSMode::Point:
backend = std::make_unique<GeometryPipeline_Point>();
backend = std::make_unique<GeometryPipeline_Point>(state.regs, state.gs_unit);
break;
case PipelineRegs::GSMode::VariablePrimitive:
backend = std::make_unique<GeometryPipeline_VariablePrimitive>();
backend = std::make_unique<GeometryPipeline_VariablePrimitive>(state.regs, state.gs);
break;
case PipelineRegs::GSMode::FixedPrimitive:
backend = std::make_unique<GeometryPipeline_FixedPrimitive>();
backend = std::make_unique<GeometryPipeline_FixedPrimitive>(state.regs, state.gs);
break;
default:
UNREACHABLE();