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.6.
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, the extension GL_EXT_gpu_shader4 is available
59 // (giving round()) and you have enabled dithering, we will round off
60 // explicitly at the very end of the shader.
62 // Note: I don't know of any cards that round off wrong (well, outside
63 // our tolerance) and do not have this extension.
64 extern int movit_num_wrongly_rounded;
65 extern bool movit_shader_rounding_supported;
67 // Whether the GPU in use supports GL_EXT_texture_sRGB.
68 extern bool movit_srgb_textures_supported;
72 #endif // !defined(_MOVIT_INIT_H)