blob: 9eb7e11287e2ebb9aac5911a161535e0ba8b79d7 [file] [log] [blame]
Nicolas Capens0bac2852016-05-07 06:09:58 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef sw_Config_hpp
16#define sw_Config_hpp
17
18#include "Common/Types.hpp"
19
20#define PERF_HUD 0 // Display time spent on vertex, setup and pixel processing for each thread
21#define PERF_PROFILE 0 // Profile various pipeline stages and display the timing in SwiftConfig
22
Nicolas Capens0bac2852016-05-07 06:09:58 -040023// Worker thread count when not set by SwiftConfig
24// 0 = process affinity count (recommended)
25// 1 = rendering on main thread (no worker threads), useful for debugging
26#ifndef DEFAULT_THREAD_COUNT
27#define DEFAULT_THREAD_COUNT 0
28#endif
29
30namespace sw
31{
32 enum
33 {
34 PERF_PIXEL,
35 PERF_PIPE,
36 PERF_INTERP,
37 PERF_SHADER,
38 PERF_TEX,
39 PERF_ROP,
40
41 PERF_TIMERS
42 };
43
44 struct Profiler
45 {
46 Profiler();
47
48 void reset();
49 void nextFrame();
50
51 int framesSec;
52 int framesTotal;
53 double FPS;
54
55 #if PERF_PROFILE
56 double cycles[PERF_TIMERS];
57
58 int64_t ropOperations;
59 int64_t ropOperationsTotal;
60 int64_t ropOperationsFrame;
61
62 int64_t texOperations;
63 int64_t texOperationsTotal;
64 int64_t texOperationsFrame;
65
66 int64_t compressedTex;
67 int64_t compressedTexTotal;
68 int64_t compressedTexFrame;
69 #endif
70 };
71
72 extern Profiler profiler;
73
74 enum
75 {
Alexis Hetu8cb9c9a2017-06-07 13:47:08 -040076 OUTLINE_RESOLUTION = 8192, // Maximum vertical resolution of the render target
Nicolas Capens0bac2852016-05-07 06:09:58 -040077 MIPMAP_LEVELS = 14,
Nicolas Capens0bac2852016-05-07 06:09:58 -040078 TEXTURE_IMAGE_UNITS = 16,
79 VERTEX_TEXTURE_IMAGE_UNITS = 16,
80 TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS,
Nicolas Capens0d8993c2018-07-16 11:13:49 -040081 FRAGMENT_UNIFORM_VECTORS = 264,
Alexis Hetu05878212015-10-01 14:54:47 -040082 VERTEX_UNIFORM_VECTORS = 259,
83 MAX_VERTEX_INPUTS = 32,
84 MAX_VERTEX_OUTPUTS = 34,
85 MAX_FRAGMENT_INPUTS = 32,
Nicolas Capens0bac2852016-05-07 06:09:58 -040086 MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
87 MAX_VERTEX_UNIFORM_BLOCKS = 12,
88 MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS, // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
89 MAX_UNIFORM_BLOCK_SIZE = 16384,
90 MAX_CLIP_PLANES = 6,
91 MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 64,
92 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 64,
Meng-Lin Wu2337a192016-06-01 13:54:07 -040093 MIN_PROGRAM_TEXEL_OFFSET = -8,
94 MAX_PROGRAM_TEXEL_OFFSET = 7,
Alexis Hetu0e22d3a2017-08-16 13:43:33 -040095 MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1
Nicolas Capens0bac2852016-05-07 06:09:58 -040096 RENDERTARGETS = 8,
Alexis Hetu329747c2018-04-09 13:47:34 -040097 NUM_TEMPORARY_REGISTERS = 4096,
Nicolas Capensf9694882019-02-11 14:27:55 -050098 MAX_SHADER_CALL_STACK_SIZE = 64,
Alexis Hetu48d47a42019-01-10 14:04:26 -050099 MAX_SHADER_ENABLE_STACK_SIZE = 1 + 24,
Nicolas Capens0bac2852016-05-07 06:09:58 -0400100 };
101}
102
103#endif // sw_Config_hpp