[Mesa-dev] [PATCH 09/13] i965: initialise the backend_reg members in the ctor
Emil Velikov
emil.l.velikov at gmail.com
Thu Nov 5 08:17:57 PST 2015
From: Emil Velikov <emil.velikov at collabora.co.uk>
Step one towards having a normal constructors for the *_reg primitives,
and removing a handful of somewhat ugly code.
Signed-off-by: Emil Velikov <emil.velikov at collabora.co.uk>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_shader.h | 11 +++++++++--
src/mesa/drivers/dri/i965/brw_vec4.cpp | 3 ---
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0ee6ffc..e54c48b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -376,10 +376,10 @@ fs_reg::fs_reg()
fs_reg::fs_reg(struct brw_reg reg) :
backend_reg(reg)
{
- this->reg_offset = 0;
this->subreg_offset = 0;
this->reladdr = NULL;
this->stride = 1;
+
if (this->file == IMM &&
(this->type != BRW_REGISTER_TYPE_V &&
this->type != BRW_REGISTER_TYPE_UV &&
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 31172a8..5908bf0 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -41,8 +41,15 @@
#ifdef __cplusplus
struct backend_reg : public brw_reg
{
- backend_reg() {}
- backend_reg(struct brw_reg reg) : brw_reg(reg) {}
+ backend_reg() {
+ v = 0;
+ d = 0;
+ file = BAD_FILE;
+ writemask = WRITEMASK_XYZW;
+
+ reg_offset = 0;
+ }
+ backend_reg(struct brw_reg reg) : brw_reg(reg), reg_offset(0) {}
bool is_zero() const;
bool is_one() const;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index db662d3..66ea15e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -74,14 +74,12 @@ src_reg::src_reg()
src_reg::src_reg(struct brw_reg reg) :
backend_reg(reg)
{
- this->reg_offset = 0;
this->reladdr = NULL;
}
src_reg::src_reg(const dst_reg ®) :
backend_reg(static_cast<struct brw_reg>(reg))
{
- this->reg_offset = reg.reg_offset;
this->reladdr = reg.reladdr;
this->swizzle = brw_swizzle_for_mask(reg.writemask);
}
@@ -113,7 +111,6 @@ dst_reg::dst_reg(enum brw_reg_file file, int nr, brw_reg_type type,
dst_reg::dst_reg(struct brw_reg reg) :
backend_reg(reg)
{
- this->reg_offset = 0;
this->reladdr = NULL;
}
--
2.6.2
More information about the mesa-dev
mailing list