Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinglplatform.h
Show All 36 Lines | 36 | { | |||
---|---|---|---|---|---|
37 | return ((major & 0xffff) << 32) | ((minor & 0xffff) << 16) | (patch & 0xffff); | 37 | return ((major & 0xffff) << 32) | ((minor & 0xffff) << 16) | (patch & 0xffff); | ||
38 | } | 38 | } | ||
39 | 39 | | |||
40 | enum GLFeature { | 40 | enum GLFeature { | ||
41 | /** | 41 | /** | ||
42 | * Set when a texture bound to a pixmap uses the same storage as the pixmap, | 42 | * Set when a texture bound to a pixmap uses the same storage as the pixmap, | ||
43 | * and thus doesn't need to be rebound when the contents of the pixmap | 43 | * and thus doesn't need to be rebound when the contents of the pixmap | ||
44 | * has changed. | 44 | * has changed. | ||
45 | */ | 45 | **/ | ||
46 | LooseBinding, | 46 | LooseBinding, | ||
47 | 47 | | |||
48 | /** | 48 | /** | ||
49 | * Set if the driver supports the following extensions: | 49 | * Set if the driver supports the following extensions: | ||
50 | * - GL_ARB_shader_objects | 50 | * - GL_ARB_shader_objects | ||
51 | * - GL_ARB_fragment_shader | 51 | * - GL_ARB_fragment_shader | ||
52 | * - GL_ARB_vertex_shader | 52 | * - GL_ARB_vertex_shader | ||
53 | * - GL_ARB_shading_language_100 | 53 | * - GL_ARB_shading_language_100 | ||
54 | */ | 54 | **/ | ||
55 | GLSL, | 55 | GLSL, | ||
56 | 56 | | |||
57 | /** | 57 | /** | ||
58 | * If set, assume the following: | 58 | * If set, assume the following: | ||
59 | * - No flow control or branches | 59 | * - No flow control or branches | ||
60 | * - No loops, unless the loops have a fixed iteration count and can be unrolled | 60 | * - No loops, unless the loops have a fixed iteration count and can be unrolled | ||
61 | * - No functions, unless they can be inlined | 61 | * - No functions, unless they can be inlined | ||
62 | * - No indirect indexing of arrays | 62 | * - No indirect indexing of arrays | ||
63 | * - No support for gl_ClipVertex or gl_FrontFacing | 63 | * - No support for gl_ClipVertex or gl_FrontFacing | ||
64 | * - No texture fetches in vertex shaders | 64 | * - No texture fetches in vertex shaders | ||
65 | * - Max 32 texture fetches in fragment shaders | 65 | * - Max 32 texture fetches in fragment shaders | ||
66 | * - Max 4 texture indirections | 66 | * - Max 4 texture indirections | ||
67 | */ | 67 | **/ | ||
68 | LimitedGLSL, | 68 | LimitedGLSL, | ||
69 | 69 | | |||
70 | /** | 70 | /** | ||
71 | * Set when the driver supports GL_ARB_texture_non_power_of_two. | 71 | * Set when the driver supports GL_ARB_texture_non_power_of_two. | ||
72 | */ | 72 | **/ | ||
73 | TextureNPOT, | 73 | TextureNPOT, | ||
74 | 74 | | |||
75 | /** | 75 | /** | ||
76 | * If set, the driver supports GL_ARB_texture_non_power_of_two with the | 76 | * If set, the driver supports GL_ARB_texture_non_power_of_two with the | ||
77 | * GL_ARB_texture_rectangle limitations. | 77 | * GL_ARB_texture_rectangle limitations. | ||
78 | * | 78 | * | ||
79 | * This means no support for mipmap filters, and that only the following | 79 | * This means no support for mipmap filters, and that only the following | ||
80 | * wrap modes are supported: | 80 | * wrap modes are supported: | ||
81 | * - GL_CLAMP | 81 | * - GL_CLAMP | ||
82 | * - GL_CLAMP_TO_EDGE | 82 | * - GL_CLAMP_TO_EDGE | ||
83 | * - GL_CLAMP_TO_BORDER | 83 | * - GL_CLAMP_TO_BORDER | ||
84 | */ | 84 | **/ | ||
85 | LimitedNPOT | 85 | LimitedNPOT | ||
86 | }; | 86 | }; | ||
87 | 87 | | |||
88 | enum Driver { | 88 | enum Driver { | ||
89 | Driver_R100, // Technically "Radeon" | 89 | Driver_R100, // Technically "Radeon" | ||
90 | Driver_R200, | 90 | Driver_R200, | ||
91 | Driver_R300C, | 91 | Driver_R300C, | ||
92 | Driver_R300G, | 92 | Driver_R300G, | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
157 | 157 | | |||
158 | class KWINGLUTILS_EXPORT GLPlatform | 158 | class KWINGLUTILS_EXPORT GLPlatform | ||
159 | { | 159 | { | ||
160 | public: | 160 | public: | ||
161 | ~GLPlatform(); | 161 | ~GLPlatform(); | ||
162 | 162 | | |||
163 | /** | 163 | /** | ||
164 | * Runs the detection code using the current OpenGL context. | 164 | * Runs the detection code using the current OpenGL context. | ||
165 | */ | 165 | **/ | ||
166 | void detect(OpenGLPlatformInterface platformInterface); | 166 | void detect(OpenGLPlatformInterface platformInterface); | ||
167 | 167 | | |||
168 | /** | 168 | /** | ||
169 | * Prints the results of the detection code. | 169 | * Prints the results of the detection code. | ||
170 | */ | 170 | **/ | ||
171 | void printResults() const; | 171 | void printResults() const; | ||
172 | 172 | | |||
173 | /** | 173 | /** | ||
174 | * Returns a pointer to the GLPlatform instance. | 174 | * Returns a pointer to the GLPlatform instance. | ||
175 | */ | 175 | **/ | ||
176 | static GLPlatform *instance(); | 176 | static GLPlatform *instance(); | ||
177 | 177 | | |||
178 | /** | 178 | /** | ||
179 | * Returns true if the driver support the given feature, and false otherwise. | 179 | * Returns true if the driver support the given feature, and false otherwise. | ||
180 | */ | 180 | **/ | ||
181 | bool supports(GLFeature feature) const; | 181 | bool supports(GLFeature feature) const; | ||
182 | 182 | | |||
183 | /** | 183 | /** | ||
184 | * Returns the OpenGL version. | 184 | * Returns the OpenGL version. | ||
185 | */ | 185 | **/ | ||
186 | qint64 glVersion() const; | 186 | qint64 glVersion() const; | ||
187 | 187 | | |||
188 | /** | 188 | /** | ||
189 | * Returns the GLSL version if the driver supports GLSL, and 0 otherwise. | 189 | * Returns the GLSL version if the driver supports GLSL, and 0 otherwise. | ||
190 | */ | 190 | **/ | ||
191 | qint64 glslVersion() const; | 191 | qint64 glslVersion() const; | ||
192 | 192 | | |||
193 | /** | 193 | /** | ||
194 | * Returns the Mesa version if the driver is a Mesa driver, and 0 otherwise. | 194 | * Returns the Mesa version if the driver is a Mesa driver, and 0 otherwise. | ||
195 | */ | 195 | **/ | ||
196 | qint64 mesaVersion() const; | 196 | qint64 mesaVersion() const; | ||
197 | 197 | | |||
198 | /** | 198 | /** | ||
199 | * Returns the Gallium version if the driver is a Gallium driver, and 0 otherwise. | 199 | * Returns the Gallium version if the driver is a Gallium driver, and 0 otherwise. | ||
200 | */ | 200 | **/ | ||
201 | qint64 galliumVersion() const; | 201 | qint64 galliumVersion() const; | ||
202 | 202 | | |||
203 | /** | 203 | /** | ||
204 | * Returns the X server version. | 204 | * Returns the X server version. | ||
205 | * | 205 | * | ||
206 | * Note that the version number changed from 7.2 to 1.3 in the first release | 206 | * Note that the version number changed from 7.2 to 1.3 in the first release | ||
207 | * following the doupling of the X server from the katamari. | 207 | * following the doupling of the X server from the katamari. | ||
208 | * | 208 | * | ||
209 | * For non X.org servers, this method returns 0. | 209 | * For non X.org servers, this method returns 0. | ||
210 | */ | 210 | **/ | ||
211 | qint64 serverVersion() const; | 211 | qint64 serverVersion() const; | ||
212 | 212 | | |||
213 | /** | 213 | /** | ||
214 | * Returns the Linux kernel version. | 214 | * Returns the Linux kernel version. | ||
215 | * | 215 | * | ||
216 | * If the kernel is not a Linux kernel, this method returns 0. | 216 | * If the kernel is not a Linux kernel, this method returns 0. | ||
217 | */ | 217 | **/ | ||
218 | qint64 kernelVersion() const; | 218 | qint64 kernelVersion() const; | ||
219 | 219 | | |||
220 | /** | 220 | /** | ||
221 | * Returns the driver version. | 221 | * Returns the driver version. | ||
222 | * | 222 | * | ||
223 | * For Mesa drivers, this is the same as the Mesa version number. | 223 | * For Mesa drivers, this is the same as the Mesa version number. | ||
224 | */ | 224 | **/ | ||
225 | qint64 driverVersion() const; | 225 | qint64 driverVersion() const; | ||
226 | 226 | | |||
227 | /** | 227 | /** | ||
228 | * Returns the driver. | 228 | * Returns the driver. | ||
229 | */ | 229 | **/ | ||
230 | Driver driver() const; | 230 | Driver driver() const; | ||
231 | 231 | | |||
232 | /** | 232 | /** | ||
233 | * Returns the chip class. | 233 | * Returns the chip class. | ||
234 | */ | 234 | **/ | ||
235 | ChipClass chipClass() const; | 235 | ChipClass chipClass() const; | ||
236 | 236 | | |||
237 | /** | 237 | /** | ||
238 | * Returns true if the driver is a Mesa driver, and false otherwise. | 238 | * Returns true if the driver is a Mesa driver, and false otherwise. | ||
239 | */ | 239 | **/ | ||
240 | bool isMesaDriver() const; | 240 | bool isMesaDriver() const; | ||
241 | 241 | | |||
242 | /** | 242 | /** | ||
243 | * Returns true if the driver is a Gallium driver, and false otherwise. | 243 | * Returns true if the driver is a Gallium driver, and false otherwise. | ||
244 | */ | 244 | **/ | ||
245 | bool isGalliumDriver() const; | 245 | bool isGalliumDriver() const; | ||
246 | 246 | | |||
247 | /** | 247 | /** | ||
248 | * Returns true if the GPU is a Radeon GPU, and false otherwise. | 248 | * Returns true if the GPU is a Radeon GPU, and false otherwise. | ||
249 | */ | 249 | **/ | ||
250 | bool isRadeon() const; | 250 | bool isRadeon() const; | ||
251 | 251 | | |||
252 | /** | 252 | /** | ||
253 | * Returns true if the GPU is an NVIDIA GPU, and false otherwise. | 253 | * Returns true if the GPU is an NVIDIA GPU, and false otherwise. | ||
254 | */ | 254 | **/ | ||
255 | bool isNvidia() const; | 255 | bool isNvidia() const; | ||
256 | 256 | | |||
257 | /** | 257 | /** | ||
258 | * Returns true if the GPU is an Intel GPU, and false otherwise. | 258 | * Returns true if the GPU is an Intel GPU, and false otherwise. | ||
259 | */ | 259 | **/ | ||
260 | bool isIntel() const; | 260 | bool isIntel() const; | ||
261 | 261 | | |||
262 | /** | 262 | /** | ||
263 | * @returns @c true if the "GPU" is a VirtualBox GPU, and @c false otherwise. | 263 | * @returns @c true if the "GPU" is a VirtualBox GPU, and @c false otherwise. | ||
264 | * @since 4.10 | 264 | * @since 4.10 | ||
265 | **/ | 265 | **/ | ||
266 | bool isVirtualBox() const; | 266 | bool isVirtualBox() const; | ||
267 | 267 | | |||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
312 | const QByteArray &glShadingLanguageVersionString() const; | 312 | const QByteArray &glShadingLanguageVersionString() const; | ||
313 | /** | 313 | /** | ||
314 | * @returns Whether the driver supports loose texture binding. | 314 | * @returns Whether the driver supports loose texture binding. | ||
315 | * @since 4.9 | 315 | * @since 4.9 | ||
316 | **/ | 316 | **/ | ||
317 | bool isLooseBinding() const; | 317 | bool isLooseBinding() const; | ||
318 | /** | 318 | /** | ||
319 | * @returns Whether OpenGL ES is used | 319 | * @returns Whether OpenGL ES is used | ||
320 | */ | 320 | **/ | ||
321 | bool isGLES() const; | 321 | bool isGLES() const; | ||
322 | 322 | | |||
323 | /** | 323 | /** | ||
324 | * @returns The CompositingType recommended by the driver. | 324 | * @returns The CompositingType recommended by the driver. | ||
325 | * @since 4.10 | 325 | * @since 4.10 | ||
326 | **/ | 326 | **/ | ||
327 | CompositingType recommendedCompositor() const; | 327 | CompositingType recommendedCompositor() const; | ||
328 | 328 | | |||
329 | /** | 329 | /** | ||
330 | * Returns true if glMapBufferRange() is likely to perform worse than glBufferSubData() | 330 | * Returns true if glMapBufferRange() is likely to perform worse than glBufferSubData() | ||
331 | * when updating an unused range of a buffer object, and false otherwise. | 331 | * when updating an unused range of a buffer object, and false otherwise. | ||
332 | * | 332 | * | ||
333 | * @since 4.11 | 333 | * @since 4.11 | ||
334 | */ | 334 | **/ | ||
335 | bool preferBufferSubData() const; | 335 | bool preferBufferSubData() const; | ||
336 | 336 | | |||
337 | /** | 337 | /** | ||
338 | * @returns The OpenGLPlatformInterface currently used | 338 | * @returns The OpenGLPlatformInterface currently used | ||
339 | * @since 5.0 | 339 | * @since 5.0 | ||
340 | **/ | 340 | **/ | ||
341 | OpenGLPlatformInterface platformInterface() const; | 341 | OpenGLPlatformInterface platformInterface() const; | ||
342 | 342 | | |||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |