This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Constants.h
144 lines (113 loc) · 4.16 KB
/
Constants.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
////////////////////////////////////////////////////////////////////////////////
// Copyright 2017 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
////////////////////////////////////////////////////////////////////////////////
#ifndef CONSTANTS_H
#define CONSTANTS_H
#include "CPUTMath.h"
#include "TaskMgrTBB.h"
// Choose which depth buffer size to use
// If you change depth buffer size please do a rebuilt all
//#define DP_VERY_VERY_LARGE
#define DP_VERY_LARGE
//#define DP_LARGE
//#define DP_MEDIUM
//#define DP_SMALL
enum SOC_TYPE
{
SCALAR_TYPE,
SSE_TYPE,
AVX_TYPE,
MASK_AVX_TYPE,
};
extern SOC_TYPE gSOCType;
extern float gOccluderSizeThreshold;
extern float gOccludeeSizeThreshold;
extern UINT gDepthTestTasks;
extern TASKSETHANDLE gInsideViewFrustum[2];
extern TASKSETHANDLE gTooSmall[2];
extern TASKSETHANDLE gActiveModels[2];
extern TASKSETHANDLE gXformMesh[2];
extern TASKSETHANDLE gBinMesh[2];
extern TASKSETHANDLE gSortBins[2];
extern TASKSETHANDLE gRasterize[2];
extern TASKSETHANDLE gAABBoxDepthTest[2];
extern LARGE_INTEGER glFrequency;
#define PI 3.1415926535f
#if defined(DP_VERY_VERY_LARGE)
const int SCREENW = 2432;
const int SCREENH = 1440;
const int TILE_WIDTH_IN_PIXELS = 304;
const int TILE_HEIGHT_IN_PIXELS = 360;
#elif defined(DP_VERY_LARGE)
const int SCREENW = 1920;
const int SCREENH = 1080;
const int TILE_WIDTH_IN_PIXELS = 240;
const int TILE_HEIGHT_IN_PIXELS = 288;
#elif defined(DP_LARGE)
const int SCREENW = 1280;
const int SCREENH = 720;
const int TILE_WIDTH_IN_PIXELS = 160;
const int TILE_HEIGHT_IN_PIXELS = 192;
#elif defined(DP_MEDIUM)
const int SCREENW = 640;
const int SCREENH = 360;
const int TILE_WIDTH_IN_PIXELS = 80;
const int TILE_HEIGHT_IN_PIXELS = 96;
#elif defined(DP_SMALL)
const int SCREENW = 320;
const int SCREENH = 192;
const int TILE_WIDTH_IN_PIXELS = 40;
const int TILE_HEIGHT_IN_PIXELS = 48;
#endif
const int SCREENW_IN_TILES = (SCREENW + TILE_WIDTH_IN_PIXELS-1)/TILE_WIDTH_IN_PIXELS;
const int SCREENH_IN_TILES = (SCREENH + TILE_HEIGHT_IN_PIXELS-1)/TILE_HEIGHT_IN_PIXELS;
const int NUM_XFORMVERTS_TASKS = 16;
const int NUM_TILES = SCREENW_IN_TILES * SCREENH_IN_TILES;
// depending upon the scene the max #of tris in the bin should be changed.
const int MAX_TRIS_IN_BIN_MT = 1024 * 16;
const int MAX_TRIS_IN_BIN_ST = 1024 * 16;
const int YOFFSET1_ST = SCREENW_IN_TILES;
const int XOFFSET1_ST = 1;
const int YOFFSET2_ST = SCREENW_IN_TILES * MAX_TRIS_IN_BIN_ST;
const int XOFFSET2_ST = MAX_TRIS_IN_BIN_ST;
const int YOFFSET1_MT = SCREENW_IN_TILES;
const int XOFFSET1_MT = 1;
const int TOFFSET1_MT = SCREENW_IN_TILES * SCREENH_IN_TILES;
const int YOFFSET2_MT = SCREENW_IN_TILES * NUM_XFORMVERTS_TASKS * MAX_TRIS_IN_BIN_MT;
const int XOFFSET2_MT = NUM_XFORMVERTS_TASKS * MAX_TRIS_IN_BIN_MT;
const int SSE = 4;
const int AVX = 8;
const int AABB_VERTICES = 8;
const int AABB_INDICES = 36;
const int AABB_TRIANGLES = 12;
const float4x4 viewportMatrix(
0.5f*(float)SCREENW, 0.0f, 0.0f, 0.0f,
0.0f, -0.5f*(float)SCREENH, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.5f*(float)SCREENW, 0.5f*(float)SCREENH, 0.0f, 1.0f
);
// This needs to be checked for correctness
const float4x4 viewportMatrixMaskedOcclusionCulling(
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
);
const int OCCLUDER_SETS = 2;
const int OCCLUDEE_SETS = 4;
const int AVG_COUNTER = 10;
const int NUM_DT_TASKS = 50;
const int BLOCK_SIZE = 8;
#endif