Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/GPU/Common/DepthRaster.h
3186 views
1
#pragma once
2
3
#include "Common/CommonTypes.h"
4
#include "GPU/ge_constants.h"
5
6
struct DepthScreenVertex {
7
int x;
8
int y;
9
int z;
10
};
11
12
// X11.h, sigh.
13
#ifdef Always
14
#undef Always
15
#endif
16
17
// We only need to support these three modes.
18
enum class ZCompareMode : u8 {
19
Greater, // Most common
20
Less, // Less common
21
Always, // Mostly used for clears
22
};
23
24
struct DepthScissor {
25
u16 x1;
26
u16 y1;
27
u16 x2;
28
u16 y2;
29
30
DepthScissor Tile(int tile, int numTiles) const;
31
};
32
33
struct DepthDraw {
34
u32 depthAddr;
35
u16 depthStride;
36
u8 cullMode;
37
GEPrimitiveType prim;
38
ZCompareMode compareMode;
39
bool cullEnabled;
40
DepthScissor scissor;
41
int vertexOffset;
42
int indexOffset;
43
int vertexCount;
44
};
45
46
// Specialized, very limited depth-only rasterizer.
47
// Meant to run in parallel with hardware rendering, in games that read back the depth buffer
48
// for effects like lens flare.
49
// So, we can be quite inaccurate without any issues, and skip a lot of functionality.
50
51
class VertexDecoder;
52
struct TransformedVertex;
53
54
int DepthRasterClipIndexedTriangles(int *tx, int *ty, float *tz, const float *transformed, const uint16_t *indexBuffer, const DepthDraw &draw, const DepthScissor scissor);
55
int DepthRasterClipIndexedRectangles(int *tx, int *ty, float *tz, const float *transformed, const uint16_t *indexBuffer, const DepthDraw &draw, const DepthScissor scissor);
56
void DecodeAndTransformForDepthRaster(float *dest, const float *worldviewproj, const void *vertexData, int indexLowerBound, int indexUpperBound, const VertexDecoder *dec, u32 vertTypeID);
57
void TransformPredecodedForDepthRaster(float *dest, const float *worldviewproj, const void *decodedVertexData, const VertexDecoder *dec, int count);
58
void ConvertPredecodedThroughForDepthRaster(float *dest, const void *decodedVertexData, const VertexDecoder *dec, int count);
59
void DepthRasterScreenVerts(uint16_t *depth, int depthStride, const int *tx, const int *ty, const float *tz, int count, const DepthDraw &draw, const DepthScissor scissor, bool lowQ);
60
61