Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 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 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 23 | // 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 | |
| 30 | namespace 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 Hetu | 8cb9c9a | 2017-06-07 13:47:08 -0400 | [diff] [blame] | 76 | OUTLINE_RESOLUTION = 8192, // Maximum vertical resolution of the render target |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 77 | MIPMAP_LEVELS = 14, |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 78 | TEXTURE_IMAGE_UNITS = 16, |
| 79 | VERTEX_TEXTURE_IMAGE_UNITS = 16, |
| 80 | TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS, |
Nicolas Capens | 0d8993c | 2018-07-16 11:13:49 -0400 | [diff] [blame] | 81 | FRAGMENT_UNIFORM_VECTORS = 264, |
Alexis Hetu | 0587821 | 2015-10-01 14:54:47 -0400 | [diff] [blame] | 82 | VERTEX_UNIFORM_VECTORS = 259, |
| 83 | MAX_VERTEX_INPUTS = 32, |
| 84 | MAX_VERTEX_OUTPUTS = 34, |
| 85 | MAX_FRAGMENT_INPUTS = 32, |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 86 | 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 Wu | 2337a19 | 2016-06-01 13:54:07 -0400 | [diff] [blame] | 93 | MIN_PROGRAM_TEXEL_OFFSET = -8, |
| 94 | MAX_PROGRAM_TEXEL_OFFSET = 7, |
Alexis Hetu | 0e22d3a | 2017-08-16 13:43:33 -0400 | [diff] [blame] | 95 | MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1 |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 96 | RENDERTARGETS = 8, |
Alexis Hetu | 329747c | 2018-04-09 13:47:34 -0400 | [diff] [blame] | 97 | NUM_TEMPORARY_REGISTERS = 4096, |
Nicolas Capens | f969488 | 2019-02-11 14:27:55 -0500 | [diff] [blame] | 98 | MAX_SHADER_CALL_STACK_SIZE = 64, |
Alexis Hetu | 48d47a4 | 2019-01-10 14:04:26 -0500 | [diff] [blame] | 99 | MAX_SHADER_ENABLE_STACK_SIZE = 1 + 24, |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 100 | }; |
| 101 | } |
| 102 | |
| 103 | #endif // sw_Config_hpp |