2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-02-15 13:45:03 +00:00
|
|
|
// Top vertex loaders
|
|
|
|
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
|
|
|
|
|
2008-11-25 21:15:31 +00:00
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2023-11-26 01:33:44 +00:00
|
|
|
#include "Common/SmallVector.h"
|
2014-12-13 00:51:14 +00:00
|
|
|
#include "VideoCommon/VertexLoaderBase.h"
|
|
|
|
|
2014-12-13 09:57:46 +00:00
|
|
|
class VertexLoader;
|
2015-06-19 19:18:16 +00:00
|
|
|
typedef void (*TPipelineFunction)(VertexLoader* loader);
|
2014-07-08 13:58:25 +00:00
|
|
|
|
2014-12-13 00:51:14 +00:00
|
|
|
class VertexLoader : public VertexLoaderBase
|
2008-10-25 15:53:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr);
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2022-11-23 00:54:05 +00:00
|
|
|
int RunVertices(const u8* src, u8* dst, int count) override;
|
2014-12-13 09:57:46 +00:00
|
|
|
// They are used for the communication with the loader functions
|
2015-01-19 17:33:08 +00:00
|
|
|
float m_posScale;
|
|
|
|
float m_tcScale[8];
|
2014-12-13 09:57:46 +00:00
|
|
|
int m_tcIndex;
|
|
|
|
int m_colIndex;
|
2016-06-24 08:43:46 +00:00
|
|
|
|
2014-12-13 09:57:46 +00:00
|
|
|
// 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 13:29:44 +00:00
|
|
|
bool m_vertexSkip;
|
|
|
|
int m_skippedVertices;
|
2022-04-14 19:01:57 +00:00
|
|
|
int m_remaining;
|
2014-12-13 09:57:46 +00:00
|
|
|
|
2008-10-25 15:53:43 +00:00
|
|
|
private:
|
2014-02-23 14:14:27 +00:00
|
|
|
// Pipeline.
|
2023-11-26 01:33:44 +00:00
|
|
|
// 1 pos matrix + 8 texture matrices + 1 position + 1 normal or normal/binormal/tangent
|
|
|
|
// + 2 colors + 8 texture coordinates or dummy texture coordinates + 8 texture matrices
|
|
|
|
// merged into texture coordinates + 1 skip gives a maximum of 30
|
|
|
|
// (Tested by VertexLoaderTest.LargeFloatVertexSpeed)
|
|
|
|
Common::SmallVector<TPipelineFunction, 30> m_PipelineStages;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-10-25 15:53:43 +00:00
|
|
|
void CompileVertexTranslator();
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-10-25 15:53:43 +00:00
|
|
|
void WriteCall(TPipelineFunction);
|
2008-07-12 17:40:22 +00:00
|
|
|
};
|