OSDN Git Service

b0839b52bc3ccfb5b12ddc1ffb517c1cf65c0d34
[android-x86/external-swiftshader.git] / src / Main / Config.hpp
1 // 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
23 #if defined(_WIN32)
24 #define S3TC_SUPPORT 1
25 #else
26 #define S3TC_SUPPORT 0
27 #endif
28
29 // Worker thread count when not set by SwiftConfig
30 // 0 = process affinity count (recommended)
31 // 1 = rendering on main thread (no worker threads), useful for debugging
32 #ifndef DEFAULT_THREAD_COUNT
33 #define DEFAULT_THREAD_COUNT 0
34 #endif
35
36 namespace sw
37 {
38         enum
39         {
40                 PERF_PIXEL,
41                 PERF_PIPE,
42                 PERF_INTERP,
43                 PERF_SHADER,
44                 PERF_TEX,
45                 PERF_ROP,
46
47                 PERF_TIMERS
48         };
49
50         struct Profiler
51         {
52                 Profiler();
53
54                 void reset();
55                 void nextFrame();
56
57                 int framesSec;
58                 int framesTotal;
59                 double FPS;
60
61                 #if PERF_PROFILE
62                 double cycles[PERF_TIMERS];
63
64                 int64_t ropOperations;
65                 int64_t ropOperationsTotal;
66                 int64_t ropOperationsFrame;
67
68                 int64_t texOperations;
69                 int64_t texOperationsTotal;
70                 int64_t texOperationsFrame;
71
72                 int64_t compressedTex;
73                 int64_t compressedTexTotal;
74                 int64_t compressedTexFrame;
75                 #endif
76         };
77
78         extern Profiler profiler;
79
80         enum
81         {
82                 OUTLINE_RESOLUTION = 4096,   // Maximum vertical resolution of the render target
83                 MIPMAP_LEVELS = 14,
84                 VERTEX_ATTRIBUTES = 16,
85                 TEXTURE_IMAGE_UNITS = 16,
86                 VERTEX_TEXTURE_IMAGE_UNITS = 16,
87                 TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS,
88                 FRAGMENT_UNIFORM_VECTORS = 224,
89                 VERTEX_UNIFORM_VECTORS = 256,
90                 MAX_VERTEX_OUTPUTS = 12,
91                 MAX_FRAGMENT_INPUTS = 10,
92                 MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
93                 MAX_VERTEX_UNIFORM_BLOCKS = 12,
94                 MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS,   // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
95                 MAX_UNIFORM_BLOCK_SIZE = 16384,
96                 MAX_CLIP_PLANES = 6,
97                 MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 64,
98                 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 64,
99                 RENDERTARGETS = 8,
100         };
101 }
102
103 #endif   // sw_Config_hpp