14 // Initialize the library; in particular, will query the GPU for information
15 // that is needed by various components. For instance, it verifies that
16 // we have all the OpenGL extensions we need. Returns true if initialization
19 // The first parameter gives which directory to read .frag files from.
20 // This is a temporary hack until we add something more solid.
22 // The second parameter specifies whether debugging is on or off.
23 // If it is on, Movit will write intermediate graphs and the final
24 // generated shaders to the current directory.
26 // If you call init_movit() twice with different parameters,
27 // only the first will count, and the second will always return true.
28 bool init_movit(const std::string& data_directory, MovitDebugLevel debug_level) MUST_CHECK_RESULT;
30 // GPU features. These are not intended for end-user use.
32 // Whether init_movit() has been called.
33 extern bool movit_initialized;
35 // The current debug level.
36 extern MovitDebugLevel movit_debug_level;
38 // An estimate on the smallest values the linear texture interpolation
39 // of the GPU can distinguish between, i.e., for a GPU with N-bit
40 // texture subpixel precision, this value will be 2^-N.
42 // From reading the little specs that exist and through practical tests,
43 // the broad picture seems to be that Intel cards have 6-bit precision,
44 // nVidia cards have 8-bit, and Radeon cards have 6-bit before R6xx
45 // (at least when not using trilinear sampling), but can reach
46 // 8-bit precision on R6xx or newer in some (unspecified) cases.
48 // We currently don't bother to test for more than 1024 levels.
49 extern float movit_texel_subpixel_precision;
51 // Some GPUs use very inaccurate fixed-function circuits for rounding
52 // floating-point values to 8-bit outputs, leading to absurdities like
53 // the roundoff point between 128 and 129 being 128.62 instead of 128.5.
54 // We test, for every integer, x+0.48 and x+0.52 and check that they
55 // round the right way (giving some leeway, but not a lot); the number
56 // of errors are stored here.
58 // If this value is above 0, we will round off explicitly at the very end
59 // of the shader. Note the following limitations:
61 // - The measurement is done on linear 8-bit, not any sRGB format,
62 // 10-bit output, or the likes.
63 // - This only covers the final pass; intermediates are not covered
64 // (only relevant if you use e.g. GL_SRGB8 intermediates).
65 extern int movit_num_wrongly_rounded;
67 // Whether the OpenGL driver (or GPU) in use supports GL_ARB_timer_query.
68 extern bool movit_timer_queries_supported;
70 // What shader model we are compiling for. This only affects the choice
71 // of a few files (like header.frag); most of the shaders are the same.
72 enum MovitShaderModel {
73 MOVIT_GLSL_110, // No longer in use, but kept until next ABI break in order not to change the enums.
78 extern MovitShaderModel movit_shader_model;
82 #endif // !defined(_MOVIT_INIT_H)