diff options
author | Dave Airlie <[email protected]> | 2017-09-14 05:03:19 +0100 |
---|---|---|
committer | Juan A. Suarez Romero <[email protected]> | 2017-09-20 22:54:11 +0200 |
commit | 136c3c79b3fe27d2b9959aa8bcf92b70332c2b19 (patch) | |
tree | c940f47db9d767d82fbf60cea4640879b0df4128 /src/mesa | |
parent | ea5b52b100151766c678b50a07c401eab9bc36ec (diff) |
st/glsl->tgsi: fix u64 to bool comparisons.
Otherwise we end up using a 32-bit comparison which didn't end well.
Timothy caught this while playing around with some opt passes.
Fixes: 278580729a (st/glsl_to_tgsi: add support for 64-bit integers)
Reviewed-by: Timothy Arceri <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
(cherry picked from commit a7a7bf21bdf0cf8e59f8c8e17c2580a363be7055)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index bed8ec390cf..ffd84b70453 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -445,6 +445,7 @@ public: st_src_reg st_src_reg_for_double(double val); st_src_reg st_src_reg_for_float(float val); st_src_reg st_src_reg_for_int(int val); + st_src_reg st_src_reg_for_int64(int64_t val); st_src_reg st_src_reg_for_type(enum glsl_base_type type, int val); /** @@ -1212,6 +1213,19 @@ glsl_to_tgsi_visitor::st_src_reg_for_int(int val) } st_src_reg +glsl_to_tgsi_visitor::st_src_reg_for_int64(int64_t val) +{ + st_src_reg src(PROGRAM_IMMEDIATE, -1, GLSL_TYPE_INT64); + union gl_constant_value uval[2]; + + memcpy(uval, &val, sizeof(uval)); + src.index = add_constant(src.file, uval, 1, GL_DOUBLE, &src.swizzle); + src.swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_X, SWIZZLE_Y); + + return src; +} + +st_src_reg glsl_to_tgsi_visitor::st_src_reg_for_type(enum glsl_base_type type, int val) { if (native_integers) @@ -2459,7 +2473,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op) break; } case ir_unop_i642b: - emit_asm(ir, TGSI_OPCODE_U64SNE, result_dst, op[0], st_src_reg_for_int(0)); + emit_asm(ir, TGSI_OPCODE_U64SNE, result_dst, op[0], st_src_reg_for_int64(0)); break; case ir_unop_i642f: emit_asm(ir, TGSI_OPCODE_I642F, result_dst, op[0]); |