[Mesa-dev] [PATCH 10/13] i965/fs: properly construct fs_reg
Emil Velikov
emil.l.velikov at gmail.com
Thu Nov 5 08:17:58 PST 2015
From: Emil Velikov <emil.velikov at collabora.co.uk>
Rather than doing memset(), implicitly use the backend_reg ctor(s) which
will initialise its variables. For the fs_reg ones, set them manually.
Signed-off-by: Emil Velikov <emil.velikov at collabora.co.uk>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 18 +++++++-----------
src/mesa/drivers/dri/i965/brw_ir_fs.h | 3 +--
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e54c48b..5973e15 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -359,18 +359,12 @@ fs_inst::has_side_effects() const
return this->eot || backend_instruction::has_side_effects();
}
-void
-fs_reg::init()
-{
- memset(this, 0, sizeof(*this));
- stride = 1;
-}
-
/** Generic unset register constructor. */
fs_reg::fs_reg()
{
- init();
- this->file = BAD_FILE;
+ this->subreg_offset = 0;
+ this->reladdr = NULL;
+ this->stride = 1;
}
fs_reg::fs_reg(struct brw_reg reg) :
@@ -895,11 +889,13 @@ fs_visitor::vgrf(const glsl_type *const type)
fs_reg::fs_reg(enum brw_reg_file file, int nr, enum brw_reg_type type)
{
- init();
+ this->subreg_offset = 0;
+ this->reladdr = NULL;
+ this->stride = (file == UNIFORM ? 0 : 1);
+
this->file = file;
this->nr = nr;
this->type = type;
- this->stride = (file == UNIFORM ? 0 : 1);
}
/* For SIMD16, we need to follow from the uniform setup of SIMD8 dispatch.
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 2e14917..4deb108 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -33,10 +33,9 @@ class fs_reg : public backend_reg {
public:
DECLARE_RALLOC_CXX_OPERATORS(fs_reg)
- void init();
-
fs_reg();
fs_reg(struct brw_reg reg);
+
fs_reg(enum brw_reg_file file, int nr,
enum brw_reg_type type = BRW_REGISTER_TYPE_F);
--
2.6.2
More information about the mesa-dev
mailing list