| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include "VideoCommon/BPMemory.h" |
| 7 |
#include "VideoCommon/DataReader.h" |
| 8 |
#include "VideoCommon/OpcodeDecoding.h" |
| 9 |
|
| 10 |
class CPUCull |
| 11 |
{ |
| 12 |
public: |
| 13 |
~CPUCull(); |
| 14 |
void Init(); |
| 15 |
bool AreAllVerticesCulled(VertexLoaderBase* loader, OpcodeDecoder::Primitive primitive, |
| 16 |
const u8* src, u32 count); |
| 17 |
|
| 18 |
struct alignas(16) TransformedVertex |
| 19 |
{ |
| 20 |
float x, y, z, w; |
| 21 |
}; |
| 22 |
|
| 23 |
using TransformFunction = void (*)(void*, const void*, u32, int); |
| 24 |
using CullFunction = bool (*)(const CPUCull::TransformedVertex*, int); |
| 25 |
|
| 26 |
private: |
| 27 |
template <typename T> |
| 28 |
struct BufferDeleter |
| 29 |
{ |
| 30 |
void operator()(T* ptr); |
| 31 |
}; |
| 32 |
std::unique_ptr<TransformedVertex[], BufferDeleter<TransformedVertex>> m_transform_buffer{}; |
| 33 |
u32 m_transform_buffer_size = 0; |
| 34 |
std::array<std::array<TransformFunction, 2>, 2> m_transform_table{}; |
| 35 |
Common::EnumMap<Common::EnumMap<CullFunction, CullMode::All>, |
| 36 |
OpcodeDecoder::Primitive::GX_DRAW_TRIANGLE_FAN> |
| 37 |
m_cull_table{}; |
| 38 |
}; |