From: Kenneth Graunke Date: Mon, 8 Sep 2014 21:28:39 +0000 (-0700) Subject: ir_to_mesa: Stop converting uniform booleans. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e36bbff0e6d6d2baeaeab153b93e201674be2056;p=mesa.git ir_to_mesa: Stop converting uniform booleans. Excess conversions considered harmful. Recently Matt reworked the boolean uniform handling to use the value of UniformBooleanTrue, rather than integer 1, when uploading uniforms: mesa: Upload boolean uniforms using UniformBooleanTrue. glsl: Use UniformBooleanTrue value for uniform initializers. Marek then set the default to 1.0f for drivers without native integer support: mesa: set UniformBooleanTrue = 1.0f by default However, ir_to_mesa was assuming a value of integer 1, and arranging for it to be converted to 1.0f on upload. Since Marek's commit, we were uploading 1.0f = 0x3f800000 which was being interpreted as the integer value 1065353216 and converted to float as 1.06535322E9, which broke assumptions in ir_to_mesa that "true" was exactly 1.0f. +13 Piglits on classic swrast (fs-bool-less-compare-true, {vs,fs}-op-not-bool-using-if, glsl-1.20/execution/uniform-initializer). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83573 Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 49e4a7a40eb..293fe34b9e4 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2505,12 +2505,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, columns = storage->type->matrix_columns; break; case GLSL_TYPE_BOOL: - if (ctx->Const.NativeIntegers) { - format = (ctx->Const.UniformBooleanTrue == 1) - ? uniform_bool_int_0_1 : uniform_bool_int_0_not0; - } else { - format = uniform_bool_float; - } + format = uniform_native; columns = 1; break; case GLSL_TYPE_SAMPLER: