1 /*
2  * Copyright © Microsoft Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #include "u_driconf.h"
25 
26 void
u_driconf_fill_st_options(struct st_config_options * options,const struct driOptionCache * optionCache)27 u_driconf_fill_st_options(struct st_config_options *options,
28                           const struct driOptionCache *optionCache)
29 {
30 #define query_option_impl(option, type) \
31    options->option = driQueryOption##type(optionCache, #option)
32 #define query_bool_option(option) query_option_impl(option, b)
33 #define query_int_option(option) query_option_impl(option, i)
34 #define query_string_option(option) \
35    do { \
36       char *option = driQueryOptionstr(optionCache, #option); \
37       if (*option) \
38          options->option = strdup(option); \
39    } while (0)
40 
41    query_bool_option(disable_blend_func_extended);
42    query_bool_option(disable_arb_gpu_shader5);
43    query_bool_option(disable_glsl_line_continuations);
44    query_bool_option(force_glsl_extensions_warn);
45    query_int_option(force_glsl_version);
46    query_bool_option(allow_extra_pp_tokens);
47    query_bool_option(allow_glsl_extension_directive_midshader);
48    query_bool_option(allow_glsl_120_subset_in_110);
49    query_bool_option(allow_glsl_builtin_const_expression);
50    query_bool_option(allow_glsl_relaxed_es);
51    query_bool_option(allow_glsl_builtin_variable_redeclaration);
52    query_bool_option(allow_higher_compat_version);
53    query_bool_option(glsl_ignore_write_to_readonly_var);
54    query_bool_option(glsl_zero_init);
55    query_bool_option(force_integer_tex_nearest);
56    query_bool_option(vs_position_always_invariant);
57    query_bool_option(vs_position_always_precise);
58    query_bool_option(force_glsl_abs_sqrt);
59    query_bool_option(allow_glsl_cross_stage_interpolation_mismatch);
60    query_bool_option(allow_draw_out_of_order);
61    query_bool_option(ignore_map_unsynchronized);
62    query_bool_option(force_gl_names_reuse);
63    query_bool_option(transcode_etc);
64    query_bool_option(transcode_astc);
65    query_string_option(force_gl_vendor);
66    query_string_option(force_gl_renderer);
67 
68    driComputeOptionsSha1(optionCache, options->config_options_sha1);
69 }
70