2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2009-02-15 06:45:03 -07:00
|
|
|
// Top vertex loaders
|
|
|
|
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
|
|
|
|
|
2010-03-05 05:04:09 -07:00
|
|
|
#include <algorithm>
|
2008-12-07 21:46:09 -07:00
|
|
|
#include <string>
|
|
|
|
|
2014-09-07 19:06:58 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
2009-02-28 09:33:59 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
|
|
|
#include "VideoCommon/DataReader.h"
|
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-12-12 17:51:14 -07:00
|
|
|
#include "VideoCommon/VertexLoaderBase.h"
|
2014-11-28 19:39:24 -07:00
|
|
|
#include "VideoCommon/VertexLoaderUtils.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-12-12 17:51:14 -07:00
|
|
|
#ifdef WIN32
|
|
|
|
#define LOADERDECL __cdecl
|
|
|
|
#else
|
|
|
|
#define LOADERDECL
|
|
|
|
#endif
|
|
|
|
|
2014-12-13 02:57:46 -07:00
|
|
|
class VertexLoader;
|
|
|
|
typedef void (LOADERDECL *TPipelineFunction)(VertexLoader* loader);
|
2014-07-08 07:58:25 -06:00
|
|
|
|
2014-12-12 17:51:14 -07:00
|
|
|
class VertexLoader : public VertexLoaderBase
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
|
|
|
|
|
2015-02-12 17:50:10 -07:00
|
|
|
int RunVertices(DataReader src, DataReader dst, int count, int primitive) override;
|
2014-12-12 17:51:14 -07:00
|
|
|
std::string GetName() const override { return "OldLoader"; }
|
|
|
|
bool IsInitialized() override { return true; } // This vertex loader supports all formats
|
2014-08-24 21:53:28 -06:00
|
|
|
|
2014-12-13 02:57:46 -07:00
|
|
|
// They are used for the communication with the loader functions
|
2015-01-19 10:33:08 -07:00
|
|
|
float m_posScale;
|
|
|
|
float m_tcScale[8];
|
2014-12-13 02:57:46 -07:00
|
|
|
int m_tcIndex;
|
|
|
|
int m_colIndex;
|
|
|
|
|
|
|
|
// Matrix components are first in GC format but later in PC format - we need to store it temporarily
|
|
|
|
// when decoding each vertex.
|
|
|
|
u8 m_curtexmtx[8];
|
|
|
|
int m_texmtxwrite;
|
|
|
|
int m_texmtxread;
|
2014-12-21 06:29:44 -07:00
|
|
|
bool m_vertexSkip;
|
|
|
|
int m_skippedVertices;
|
2014-12-13 02:57:46 -07:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
private:
|
2014-02-23 07:14:27 -07:00
|
|
|
// Pipeline.
|
2008-12-07 21:46:09 -07:00
|
|
|
TPipelineFunction m_PipelineStages[64]; // TODO - figure out real max. it's lower.
|
|
|
|
int m_numPipelineStages;
|
|
|
|
|
|
|
|
void CompileVertexTranslator();
|
|
|
|
|
|
|
|
void WriteCall(TPipelineFunction);
|
2013-03-19 19:51:12 -06:00
|
|
|
};
|