Mesa (master): i965/fs: Make fs_reg's type an enum for better debugging.

Matt Turner mattst88 at kemper.freedesktop.org
Sat Feb 22 06:50:00 UTC 2014


Module: Mesa
Branch: master
Commit: 5ceadd29b0af835d741bcf09b9622c628e549ae6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ceadd29b0af835d741bcf09b9622c628e549ae6

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Feb 19 18:38:40 2014 -0800

i965/fs: Make fs_reg's type an enum for better debugging.

Since the enum is marked as packed, it'll still take only one byte.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp     |    4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h       |    4 ++--
 src/mesa/drivers/dri/i965/brw_shader.cpp |    2 +-
 src/mesa/drivers/dri/i965/brw_shader.h   |    3 ++-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ce8a515..2ffeffa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -423,7 +423,7 @@ fs_reg::fs_reg(struct brw_reg fixed_hw_reg)
    init();
    this->file = HW_REG;
    this->fixed_hw_reg = fixed_hw_reg;
-   this->type = fixed_hw_reg.type;
+   this->type = (enum brw_reg_type)fixed_hw_reg.type;
 }
 
 bool
@@ -836,7 +836,7 @@ fs_reg::fs_reg(enum register_file file, int reg)
 }
 
 /** Fixed HW reg constructor. */
-fs_reg::fs_reg(enum register_file file, int reg, uint32_t type)
+fs_reg::fs_reg(enum register_file file, int reg, enum brw_reg_type type)
 {
    init();
    this->file = file;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 1981eef..5d1908a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -74,7 +74,7 @@ public:
    fs_reg(uint32_t u);
    fs_reg(struct brw_reg fixed_hw_reg);
    fs_reg(enum register_file file, int reg);
-   fs_reg(enum register_file file, int reg, uint32_t type);
+   fs_reg(enum register_file file, int reg, enum brw_reg_type type);
    fs_reg(class fs_visitor *v, const struct glsl_type *type);
 
    bool equals(const fs_reg &r) const;
@@ -102,7 +102,7 @@ public:
     */
    int reg_offset;
    /** Register type.  BRW_REGISTER_TYPE_* */
-   uint8_t type;
+   enum brw_reg_type type;
    bool negate;
    bool abs;
    struct brw_reg fixed_hw_reg;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 08ceca1..a436ee9 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -282,7 +282,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
 }
 
 
-int
+enum brw_reg_type
 brw_type_for_base_type(const struct glsl_type *type)
 {
    switch (type->base_type) {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 4d98cbc..bbbeb32 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -23,6 +23,7 @@
 
 #include <stdint.h>
 #include "brw_defines.h"
+#include "brw_reg.h"
 #include "main/compiler.h"
 #include "glsl/ir.h"
 
@@ -99,7 +100,7 @@ uint32_t brw_texture_offset(struct gl_context *ctx, ir_constant *offset);
 
 #endif /* __cplusplus */
 
-int brw_type_for_base_type(const struct glsl_type *type);
+enum brw_reg_type brw_type_for_base_type(const struct glsl_type *type);
 uint32_t brw_conditional_for_comparison(unsigned int op);
 uint32_t brw_math_function(enum opcode op);
 const char *brw_instruction_name(enum opcode op);




More information about the mesa-commit mailing list