/* Lower constant initializers. */
if (var->constant_value &&
var->type == var->constant_value->type) {
+ if (!options->LowerPrecisionConstants)
+ return visit_continue;
var->constant_value =
var->constant_value->clone(ralloc_parent(var), NULL);
lower_constant(var->constant_value);
if (var->constant_initializer &&
var->type == var->constant_initializer->type) {
+ if (!options->LowerPrecisionConstants)
+ return visit_continue;
var->constant_initializer =
var->constant_initializer->clone(ralloc_parent(var), NULL);
lower_constant(var->constant_initializer);
options->LowerPrecisionInt16 = true;
options->LowerPrecisionDerivatives = true;
options->LowerPrecisionTemporaries = true;
+ options->LowerPrecisionConstants = true;
}
}
GLboolean LowerPrecisionInt16;
GLboolean LowerPrecisionDerivatives;
+ /**
+ * This enables lowering of 16b constants. Some drivers may not
+ * to lower constants to 16b (ie. if the hw can do automatic
+ * narrowing on constant load)
+ */
+ GLboolean LowerPrecisionConstants;
+
/**
* This enables 16-bit phis in NIR, 16-bit loop counters, 16-bit indirect
* arrays, etc.
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_INT16);
options->LowerPrecisionTemporaries =
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_GLSL_16BIT_TEMPS);
+ options->LowerPrecisionConstants = options->LowerPrecisionTemporaries;
}
c->MaxUserAssignableUniformLocations =