1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef sw_SwiftConfig_hpp
16 #define sw_SwiftConfig_hpp
18 #include "Reactor/Nucleus.hpp"
20 #include "Common/Thread.hpp"
21 #include "Common/MutexLock.hpp"
22 #include "Common/Socket.hpp"
33 int pixelShaderVersion;
34 int vertexShaderVersion;
37 int vertexRoutineCacheSize;
38 int pixelRoutineCacheSize;
39 int setupRoutineCacheSize;
41 int textureSampleQuality;
43 bool perspectiveCorrection;
44 int transcendentalPrecision;
51 rr::Optimization optimization[10];
53 bool keepSystemCursor;
55 bool complementaryDepthBuffer;
57 bool exactColorRounding;
58 bool disableAlphaMode;
59 bool disable10BitMode;
60 int transparencyAntialiasing;
64 bool forceClearRegisters;
66 unsigned int minPrimitives;
67 unsigned int maxPrimitives;
71 SwiftConfig(bool disableServerOverride);
75 bool hasNewConfiguration(bool reset = true);
76 void getConfiguration(Configuration &configuration);
88 static void serverRoutine(void *parameters);
91 void respond(Socket *clientSocket, const char *request);
93 std::string profile();
94 void send(Socket *clientSocket, Status code, std::string body = "");
95 void parsePost(const char *post);
97 void readConfiguration(bool disableServerOverride = false);
98 void writeConfiguration();
100 Configuration config;
102 Thread *serverThread;
103 volatile bool terminate;
104 MutexLock criticalSection; // Protects reading and writing the configuration settings
108 Socket *listenSocket;
115 #endif // sw_SwiftConfig_hpp