I don't have any issue with simply adding PROGRAM_BUFFER to the enum type. prog_src_register::File is a 4-bit field and we currently have 13 enum values so we're safe there (not sure if that even matters).

I know I've used gdb to debug/trace something in st_glsl_to_tgsi.cpp at least twice last year and seeing enum values in gdb makes life a lot easier.

-Brian


On 01/19/2016 07:24 AM, Ilia Mirkin wrote:
Because I got a ton of errors about how PROGRAM_BUFFER was out of
bounds for the enum. I could add them to the enum, of course, but I
think that enum was about ARB_vp/fp things?

   -ilia

On Tue, Jan 19, 2016 at 9:23 AM, Brian Paul <bri...@vmware.com> wrote:
Can you say why you're removing gl_register_file?  Enums are so much nicer
when debugging.

-Brian


On 01/18/2016 07:30 PM, Ilia Mirkin wrote:

Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>
---
   src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 21 +++++++++++----------
   1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index d424e3b..055d187 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -53,6 +53,7 @@


   #define PROGRAM_IMMEDIATE PROGRAM_FILE_MAX
+#define PROGRAM_BUFFER    (PROGRAM_FILE_MAX + 1)
   #define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) |    \
                              (1 << PROGRAM_CONSTANT) |     \
                              (1 << PROGRAM_UNIFORM))
@@ -69,7 +70,7 @@ static int swizzle_for_size(int size);
    */
   class st_src_reg {
   public:
-   st_src_reg(gl_register_file file, int index, const glsl_type *type)
+   st_src_reg(int file, int index, const glsl_type *type)
      {
         this->file = file;
         this->index = index;
@@ -88,7 +89,7 @@ public:
         this->is_double_vertex_input = false;
      }

-   st_src_reg(gl_register_file file, int index, int type)
+   st_src_reg(int file, int index, int type)
      {
         this->type = type;
         this->file = file;
@@ -104,7 +105,7 @@ public:
         this->is_double_vertex_input = false;
      }

-   st_src_reg(gl_register_file file, int index, int type, int index2D)
+   st_src_reg(int file, int index, int type, int index2D)
      {
         this->type = type;
         this->file = file;
@@ -138,7 +139,7 @@ public:

      explicit st_src_reg(st_dst_reg reg);

-   gl_register_file file; /**< PROGRAM_* from Mesa */
+   int file; /**< PROGRAM_* from Mesa */
      int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc.
*/
      int index2D;
      GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */
@@ -203,7 +204,7 @@ public:

      explicit st_dst_reg(st_src_reg reg);

-   gl_register_file file; /**< PROGRAM_* from Mesa */
+   int file; /**< PROGRAM_* from Mesa */
      int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc.
*/
      int index2D;
      int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
@@ -273,14 +274,14 @@ public:

   class variable_storage : public exec_node {
   public:
-   variable_storage(ir_variable *var, gl_register_file file, int index,
+   variable_storage(ir_variable *var, int file, int index,
                       unsigned array_id = 0)
         : file(file), index(index), var(var), array_id(array_id)
      {
         /* empty */
      }

-   gl_register_file file;
+   int file;
      int index;
      ir_variable *var; /* variable that maps to this, if any */
      unsigned array_id;
@@ -401,7 +402,7 @@ public:

      variable_storage *find_variable_storage(ir_variable *var);

-   int add_constant(gl_register_file file, gl_constant_value values[8],
+   int add_constant(int file, gl_constant_value values[8],
                       int size, int datatype, GLuint *swizzle_out);

      function_entry *get_function_signature(ir_function_signature *sig);
@@ -990,7 +991,7 @@ glsl_to_tgsi_visitor::emit_arl(ir_instruction *ir,
   }

   int
-glsl_to_tgsi_visitor::add_constant(gl_register_file file,
+glsl_to_tgsi_visitor::add_constant(int file,
                                      gl_constant_value values[8], int
size, int datatype,
                                      GLuint *swizzle_out)
   {
@@ -4550,7 +4551,7 @@ emit_immediate(struct st_translate *t,
    * Map a glsl_to_tgsi dst register to a TGSI ureg_dst register.
    */
   static struct ureg_dst
-dst_register(struct st_translate *t, gl_register_file file, unsigned
index,
+dst_register(struct st_translate *t, int file, unsigned index,
                unsigned array_id)
   {
      unsigned array;



_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to