-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommon.h
104 lines (86 loc) · 1.89 KB
/
Common.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#define INSTANCE_BUFFER_SRV 0
#define MESH_BUFFER_SRV 1
#define CLUSTER_BUFFER_SRV 2
#define POSITION_DATA_BUFFER_SRV 3
#define NORMAL_DATA_BUFFER_SRV 4
#define TANGENT_DATA_BUFFER_SRV 5
#define TEXCOORD_DATA_BUFFER_SRV 6
#define INDEX_DATA_BUFFER_SRV 7
#define MATERIAL_BUFFER_SRV 8
#define VISIBLE_INSTANCES_SRV 10
#define VISIBLE_INSTANCES_UAV 11
#define VISIBLE_CLUSTERS_SRV 12
#define VISIBLE_CLUSTERS_UAV 13
#define VISIBLE_INSTANCES_COUNTER_UAV 14
#define VISIBLE_CLUSTERS_COUNTER_UAV 15
#define VBUFFER_UAV 16
#define COLORBUFFER_UAV 17
#define DEPTHBUFFER_SRV 18
#define IMGUI_FONT_SRV 19
#define WORK_GRAPH_UAV 20
// HACKS TO REMOVE
#define VBUFFER_SRV 16
#define MAX_ELEMENTS 65535
// Debug Mode
#define DEBUG_MODE_NONE 0
#define DEBUG_MODE_SHOW_TRIANGLES 1
#define DEBUG_MODE_SHOW_CLUSTERS 2
#define DEBUG_MODE_SHOW_INSTANCES 3
#define DEBUG_MODE_SHOW_MATERIALS 4
#define DEBUG_MODE_SHOW_DEPTH_BUFFER 5
struct MinMaxAABB
{
float3 Min;
float3 Max;
};
struct CenterExtentsAABB
{
float3 Center;
float3 Extents; // half extents
};
struct Camera
{
float4x4 ViewMatrix;
float4x4 ViewProjectionMatrix;
float4x4 InverseProjectionMatrix;
float4x4 InverseViewProjectionMatrix;
float4 FrustumPlanes[6];
};
CB_ALIGN struct Constants
{
Camera CullingCamera;
Camera DrawingCamera;
uint4 Counts;
uint DebugMode;
uint Padding0;
uint Padding1;
uint Padding2;
};
struct Instance
{
float4x4 ModelMatrix;
uint MeshIndex;
uint MaterialIndex;
CenterExtentsAABB Box;
};
struct Mesh
{
uint ClusterStart;
uint ClusterCount;
// TODO: these do not need to be uploaded to GPU
CenterExtentsAABB Box;
};
struct Cluster
{
uint PrimitiveStart;
uint PrimitiveCount;
uint VertexStart;
uint VertexCount;
CenterExtentsAABB Box; // TODO: OOBB?
};
struct Material
{
float4 Color;
float Metallic;
float Roughness;
};