r600: Lower int64 ops from TGSI-to-NIR shaders too
authorGert Wollny <gert.wollny@collabora.com>
Wed, 6 May 2020 21:25:03 +0000 (23:25 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 May 2020 07:52:13 +0000 (07:52 +0000)
r600 uses a TGSI shaders with 64 bit ints for a query compute shader.

v2: Use screen version of tgsi_to_nir and fix compile error

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>

src/gallium/drivers/r600/r600_shader.c

index 7784f35c31749dde6e6681f33c1ead520f049c9f..346498cd98aaca08fb7cebff8480203cbb540290 100644 (file)
@@ -194,9 +194,18 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
                        goto error;
                }
        } else {
-               if (sel->ir_type == PIPE_SHADER_IR_TGSI)
-                       sel->nir = tgsi_to_nir_noscreen(sel->tokens, &r600_nir_options);
+               if (sel->ir_type == PIPE_SHADER_IR_TGSI) {
+                       sel->nir = tgsi_to_nir(sel->tokens, ctx->screen, true);
+                       /* Lower int64 ops because we have some r600 build-in shaders that use it */
+                       if (!ctx->screen->get_param(ctx->screen, PIPE_CAP_DOUBLES)) {
+                               NIR_PASS_V(sel->nir, nir_lower_regs_to_ssa);
+                               NIR_PASS_V(sel->nir, nir_lower_alu_to_scalar, NULL, NULL);
+                               NIR_PASS_V(sel->nir, nir_lower_int64, ~0);
+                               NIR_PASS_V(sel->nir, nir_opt_vectorize);
+                       }
+               }
                nir_tgsi_scan_shader(sel->nir, &sel->info, true);
+
                r = r600_shader_from_nir(rctx, shader, &key);
                if (r) {
                        fprintf(stderr, "--Failed shader--------------------------------------------------\n");