From patchwork Mon Oct 19 19:48:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 7439461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4FE71BF90C for ; Mon, 19 Oct 2015 19:48:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83D34207F8 for ; Mon, 19 Oct 2015 19:48:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4DBBB207F9 for ; Mon, 19 Oct 2015 19:48:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF5D272115; Mon, 19 Oct 2015 12:48:20 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f49.google.com (mail-qg0-f49.google.com [209.85.192.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2A5F720F2 for ; Mon, 19 Oct 2015 12:48:17 -0700 (PDT) Received: by qgeo38 with SMTP id o38so123903244qge.0 for ; Mon, 19 Oct 2015 12:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P+onEMGcO2Wx6u4h5gtvhU9ffqwiGAW47wXglzf5h7U=; b=kgiW8+Q3jEFAC63JNIK4282+ySuIxGgof4qJaXq4IVPcxNlkE1f0qm49f0xDAGGKXP 7JULI/XDhpxfOKyvVmg6Lw4f6riIbwYqch1UAwuXuBZZ2RhlL+KRhQ3DahOOaAGL9xe+ uB5hYW3jlRde5DYdjRJS1u1nCFu4tz7Rfho5I/OgMYTc/kqelV8PT6LzgMAdzBAd92rh eEfJrqjqTJgsoCZPdFd6Aai7TcJ/W186WlP1Rv3zXfmtrt3Xhx4jDmxqkm0oC3SDaNd6 6EPxJnIDMq4tmK65WD2gQAtmZZklg2t1PML4jA4E35oI5f30TddbD4CIx7ZezIepmmM+ lFcg== X-Received: by 10.140.17.41 with SMTP id 38mr38901100qgc.55.1445284097259; Mon, 19 Oct 2015 12:48:17 -0700 (PDT) Received: from localhost ([2601:184:4000:26d7:6af7:28ff:fe77:e429]) by smtp.gmail.com with ESMTPSA id d66sm14994771qgd.36.2015.10.19.12.48.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 12:48:16 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RFCv0 7/8] freedreno/ir3: fix const_index handling for uniforms Date: Mon, 19 Oct 2015 15:48:00 -0400 Message-Id: <1445284081-29532-8-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1445284081-29532-1-git-send-email-robdclark@gmail.com> References: <1445284081-29532-1-git-send-email-robdclark@gmail.com> Cc: Jason Ekstrand X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When coming directly from glsl_to_nir (rather than via TGSI where information about, for example, mat4's is lost), both const_index fields will be used (vs. tgsi_to_nir where the 2nd is always zero). For example: decl_var uniform INTERP_QUALIFIER_NONE mat4 ModelViewProjectionMatrix (0, 0) decl_var uniform INTERP_QUALIFIER_NONE mat4 NormalMatrix (4, 4) ... vec4 ssa_54 = intrinsic load_uniform () () (4, 0) /* NormalMatrix */ vec4 ssa_56 = intrinsic load_uniform () () (4, 1) /* NormalMatrix */ vs: decl_var uniform INTERP_QUALIFIER_NONE vec4[8] uniform_0 (0, 0) ... vec4 ssa_54 = intrinsic load_uniform () () (4, 0) vec4 ssa_56 = intrinsic load_uniform () () (5, 0) --- src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 5a53e32..2b9a841 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -1377,7 +1377,10 @@ emit_intrinisic(struct ir3_compile *ctx, nir_intrinsic_instr *intr) const nir_intrinsic_info *info = &nir_intrinsic_infos[intr->intrinsic]; struct ir3_instruction **dst, **src; struct ir3_block *b = ctx->block; - unsigned idx = intr->const_index[0]; + unsigned idx = 0; + + for (unsigned i = 0; i < nir_intrinsic_infos[intr->intrinsic].num_indices; i++) + idx += intr->const_index[i]; if (info->has_dest) { dst = get_dst(ctx, &intr->dest, intr->num_components);