prog_data->total_scratch = brw_get_scratch_size(last_scratch);
}
-static bool
-env_var_as_boolean(const char *var_name, bool default_value)
-{
- const char *str = getenv(var_name);
- if (str == NULL)
- return default_value;
-
- if (strcmp(str, "1") == 0 ||
- strcasecmp(str, "true") == 0 ||
- strcasecmp(str, "yes") == 0) {
- return true;
- } else if (strcmp(str, "0") == 0 ||
- strcasecmp(str, "false") == 0 ||
- strcasecmp(str, "no") == 0) {
- return false;
- } else {
- return default_value;
- }
-}
-
bool
fs_visitor::run_vs()
{
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
emit_shader_time_begin();
- if (env_var_as_boolean("INTEL_USE_NIR", false)) {
+ if (brw_env_var_as_boolean("INTEL_USE_NIR", false)) {
emit_nir_code();
} else {
foreach_in_list(ir_instruction, ir, shader->base.ir) {
/* Generate FS IR for main(). (the visitor only descends into
* functions called "main").
*/
- if (env_var_as_boolean("INTEL_USE_NIR", false)) {
+ if (brw_env_var_as_boolean("INTEL_USE_NIR", false)) {
emit_nir_code();
} else if (shader) {
foreach_in_list(ir_instruction, ir, shader->base.ir) {
if (INTEL_DEBUG & DEBUG_AUB)
drm_intel_bufmgr_gem_set_aub_dump(brw->bufmgr, true);
}
+
+/**
+ * Reads an environment variable and interprets its value as a boolean.
+ *
+ * Recognizes 0/false/no and 1/true/yes. Other values result in the default value.
+ */
+bool
+brw_env_var_as_boolean(const char *var_name, bool default_value)
+{
+ const char *str = getenv(var_name);
+ if (str == NULL)
+ return default_value;
+
+ if (strcmp(str, "1") == 0 ||
+ strcasecmp(str, "true") == 0 ||
+ strcasecmp(str, "yes") == 0) {
+ return true;
+ } else if (strcmp(str, "0") == 0 ||
+ strcasecmp(str, "false") == 0 ||
+ strcasecmp(str, "no") == 0) {
+ return false;
+ } else {
+ return default_value;
+ }
+}