VertexLoader.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. // Top vertex loaders
  6. // Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
  7. #include <algorithm>
  8. #include <string>
  9. #include "Common/CommonTypes.h"
  10. #include "VideoCommon/CPMemory.h"
  11. #include "VideoCommon/DataReader.h"
  12. #include "VideoCommon/NativeVertexFormat.h"
  13. #include "VideoCommon/VertexLoaderBase.h"
  14. #include "VideoCommon/VertexLoaderUtils.h"
  15. #ifdef WIN32
  16. #define LOADERDECL __cdecl
  17. #else
  18. #define LOADERDECL
  19. #endif
  20. class VertexLoader;
  21. typedef void (LOADERDECL *TPipelineFunction)(VertexLoader* loader);
  22. class VertexLoader : public VertexLoaderBase
  23. {
  24. public:
  25. VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
  26. int RunVertices(DataReader src, DataReader dst, int count) override;
  27. std::string GetName() const override { return "OldLoader"; }
  28. bool IsInitialized() override { return true; } // This vertex loader supports all formats
  29. // They are used for the communication with the loader functions
  30. float m_posScale;
  31. float m_tcScale[8];
  32. int m_tcIndex;
  33. int m_colIndex;
  34. // Matrix components are first in GC format but later in PC format - we need to store it temporarily
  35. // when decoding each vertex.
  36. u8 m_curtexmtx[8];
  37. int m_texmtxwrite;
  38. int m_texmtxread;
  39. bool m_vertexSkip;
  40. int m_skippedVertices;
  41. int m_counter;
  42. private:
  43. // Pipeline.
  44. TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower.
  45. int m_numPipelineStages;
  46. void CompileVertexTranslator();
  47. void WriteCall(TPipelineFunction);
  48. };