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