Mesa (master): r600/sfn: make number of source components a local variable
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 21 17:21:54 UTC 2020
Module: Mesa
Branch: master
Commit: eb3199db3e558672a332f9fcf26f90b9c3c04498
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb3199db3e558672a332f9fcf26f90b9c3c04498
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Sat Sep 19 15:24:15 2020 +0200
r600/sfn: make number of source components a local variable
There is no need to keep that value as a member and it irritates
Coverity.
Fixes: 688680decce9
r600/nir: fetch sources and split uniforms before emittting alu instructions
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6787>
---
src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp | 10 +++++-----
src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.h | 3 +--
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
index 76d4993e61a..b2da81f2104 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.cpp
@@ -189,10 +189,10 @@ void EmitAluInstruction::preload_src(const nir_alu_instr& instr)
const nir_op_info *op_info = &nir_op_infos[instr.op];
assert(op_info->num_inputs <= 4);
- m_num_src_comp = num_src_comp(instr);
+ unsigned nsrc_comp = num_src_comp(instr);
sfn_log << SfnLog::reg << "Preload:\n";
for (unsigned i = 0; i < op_info->num_inputs; ++i) {
- for (unsigned c = 0; c < m_num_src_comp; ++c) {
+ for (unsigned c = 0; c < nsrc_comp; ++c) {
m_src[i][c] = from_nir(instr.src[i], c);
sfn_log << SfnLog::reg << " " << *m_src[i][c];
}
@@ -203,7 +203,7 @@ void EmitAluInstruction::preload_src(const nir_alu_instr& instr)
sfn_log << SfnLog::reg << " extra:" << *m_src[1][3] << "\n";
}
- split_constants(instr);
+ split_constants(instr, nsrc_comp);
}
unsigned EmitAluInstruction::num_src_comp(const nir_alu_instr& instr)
@@ -244,7 +244,7 @@ unsigned EmitAluInstruction::num_src_comp(const nir_alu_instr& instr)
-void EmitAluInstruction::split_constants(const nir_alu_instr& instr)
+void EmitAluInstruction::split_constants(const nir_alu_instr& instr, unsigned nsrc_comp)
{
const nir_op_info *op_info = &nir_op_infos[instr.op];
if (op_info->num_inputs < 2)
@@ -278,7 +278,7 @@ void EmitAluInstruction::split_constants(const nir_alu_instr& instr)
if (c[i]->sel() != sel || c[i]->kcache_bank() != kcache) {
AluInstruction *ir = nullptr;
auto v = get_temp_vec4();
- for (unsigned k = 0; k < m_num_src_comp; ++k) {
+ for (unsigned k = 0; k < nsrc_comp; ++k) {
ir = new AluInstruction(op1_mov, v[k], m_src[idx[i]][k], {write});
emit_instruction(ir);
m_src[idx[i]][k] = v[k];
diff --git a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.h b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.h
index 7cbdcfd5d5c..5c31b94dfd5 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.h
+++ b/src/gallium/drivers/r600/sfn/sfn_emitaluinstruction.h
@@ -51,7 +51,7 @@ private:
bool do_emit(nir_instr* instr) override;
- void split_constants(const nir_alu_instr& instr);
+ void split_constants(const nir_alu_instr& instr, unsigned nsrc_comp);
bool emit_mov(const nir_alu_instr& instr);
bool emit_alu_op1(const nir_alu_instr& instr, EAluOp opcode, const AluOpFlags &flags = 0);
@@ -108,7 +108,6 @@ private:
using vreg = std::array<PValue, 4>;
- unsigned m_num_src_comp;
std::array<PValue, 4> m_src[4];
};
More information about the mesa-commit
mailing list