File: VertexLoader.h

package info (click to toggle)
dolphin-emu 2512%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 76,328 kB
  • sloc: cpp: 499,023; ansic: 119,674; python: 6,547; sh: 2,338; makefile: 1,093; asm: 726; pascal: 257; javascript: 183; perl: 97; objc: 75; xml: 30
file content (51 lines) | stat: -rw-r--r-- 1,452 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

// Top vertex loaders
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt

#include <string>

#include "Common/CommonTypes.h"
#include "Common/SmallVector.h"
#include "VideoCommon/VertexLoaderBase.h"

class VertexLoader;
typedef void (*TPipelineFunction)(VertexLoader* loader);

class VertexLoader : public VertexLoaderBase
{
public:
  VertexLoader(const TVtxDesc& vtx_desc, const VAT& vtx_attr);

  int RunVertices(const u8* src, u8* dst, int count) override;
  // They are used for the communication with the loader functions
  float m_posScale;
  float m_tcScale[8];
  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;
  bool m_vertexSkip;
  int m_skippedVertices;
  int m_remaining;

private:
  // Pipeline.
  // 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;

  void CompileVertexTranslator();

  void WriteCall(TPipelineFunction);
};