i965/fs: Make null_reg_* const members of fs_visitor instead of globals
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 10 Sep 2014 18:28:27 +0000 (11:28 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 30 Sep 2014 17:29:13 +0000 (10:29 -0700)
We also set the register width equal to the dispatch width.  Right now,
this is effectively a no-op since we don't do anything with it.  However,
it will be important once we add an actual width field to fs_reg.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_reg.h

index 108e5b34d9fd05e80419c4667637cd92a88f7ea9..9c6b047d6ea059abb1044df8c19932a01349912f 100644 (file)
@@ -134,9 +134,6 @@ half(const fs_reg &reg, unsigned idx)
 }
 
 static const fs_reg reg_undef;
-static const fs_reg reg_null_f(retype(brw_null_reg(), BRW_REGISTER_TYPE_F));
-static const fs_reg reg_null_d(retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
-static const fs_reg reg_null_ud(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
 
 class ip_record : public exec_node {
 public:
@@ -206,6 +203,9 @@ public:
 class fs_visitor : public backend_visitor
 {
 public:
+   const fs_reg reg_null_f;
+   const fs_reg reg_null_d;
+   const fs_reg reg_null_ud;
 
    fs_visitor(struct brw_context *brw,
               void *mem_ctx,
index f25f439e1a4bc7343a524bcad340e9af76d061cf..ba9f6e1640df75275250dc00ba86e910f132579a 100644 (file)
@@ -3315,6 +3315,9 @@ fs_visitor::fs_visitor(struct brw_context *brw,
                        unsigned dispatch_width)
    : backend_visitor(brw, shader_prog, &fp->Base, &prog_data->base,
                      MESA_SHADER_FRAGMENT),
+     reg_null_f(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_F)),
+     reg_null_d(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_D)),
+     reg_null_ud(retype(brw_null_vec(dispatch_width), BRW_REGISTER_TYPE_UD)),
      key(key), prog_data(&prog_data->base),
      dispatch_width(dispatch_width)
 {
index 28d3d9433276fdaf5c2e374356b0087c34dee3a7..9638c779f91766f491819e1d94292d29b0bfcc35 100644 (file)
@@ -602,6 +602,12 @@ brw_null_reg(void)
    return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_NULL, 0);
 }
 
+static inline struct brw_reg
+brw_null_vec(unsigned width)
+{
+   return brw_vecn_reg(width, BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_NULL, 0);
+}
+
 static inline struct brw_reg
 brw_address_reg(unsigned subnr)
 {