[Mesa-dev] [PATCH 3/3] program: Replace gl_inst_opcode with enum prog_opcode.

Brian Paul brianp at vmware.com
Tue Jun 2 12:28:59 PDT 2015


Series LGTM.

Reviewed-by: Brian Paul <brianp at vmware.com>


On 06/02/2015 01:23 PM, Matt Turner wrote:
> Both were introduced at the same time. I'm not sure why we needed two.
> ---
>   src/mesa/program/ir_to_mesa.cpp     |  2 +-
>   src/mesa/program/prog_instruction.c | 10 +++++-----
>   src/mesa/program/prog_instruction.h | 14 +++++++-------
>   src/mesa/program/program_parse.y    |  6 +++---
>   4 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 02a0568..3759724 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -405,7 +405,7 @@ ir_to_mesa_visitor::emit_dp(ir_instruction *ir,
>   			    dst_reg dst, src_reg src0, src_reg src1,
>   			    unsigned elements)
>   {
> -   static const gl_inst_opcode dot_opcodes[] = {
> +   static const enum prog_opcode dot_opcodes[] = {
>         OPCODE_DP2, OPCODE_DP3, OPCODE_DP4
>      };
>
> diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
> index a8fb9d9..21ef353 100644
> --- a/src/mesa/program/prog_instruction.c
> +++ b/src/mesa/program/prog_instruction.c
> @@ -114,7 +114,7 @@ _mesa_free_instructions(struct prog_instruction *inst, GLuint count)
>    */
>   struct instruction_info
>   {
> -   gl_inst_opcode Opcode;
> +   enum prog_opcode Opcode;
>      const char *Name;
>      GLuint NumSrcRegs;
>      GLuint NumDstRegs;
> @@ -198,7 +198,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
>    * Return the number of src registers for the given instruction/opcode.
>    */
>   GLuint
> -_mesa_num_inst_src_regs(gl_inst_opcode opcode)
> +_mesa_num_inst_src_regs(enum prog_opcode opcode)
>   {
>      assert(opcode < MAX_OPCODE);
>      assert(opcode == InstInfo[opcode].Opcode);
> @@ -211,7 +211,7 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode)
>    * Return the number of dst registers for the given instruction/opcode.
>    */
>   GLuint
> -_mesa_num_inst_dst_regs(gl_inst_opcode opcode)
> +_mesa_num_inst_dst_regs(enum prog_opcode opcode)
>   {
>      assert(opcode < MAX_OPCODE);
>      assert(opcode == InstInfo[opcode].Opcode);
> @@ -221,7 +221,7 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode)
>
>
>   GLboolean
> -_mesa_is_tex_instruction(gl_inst_opcode opcode)
> +_mesa_is_tex_instruction(enum prog_opcode opcode)
>   {
>      return (opcode == OPCODE_TEX ||
>              opcode == OPCODE_TXB ||
> @@ -285,7 +285,7 @@ _mesa_check_soa_dependencies(const struct prog_instruction *inst)
>    * Return string name for given program opcode.
>    */
>   const char *
> -_mesa_opcode_string(gl_inst_opcode opcode)
> +_mesa_opcode_string(enum prog_opcode opcode)
>   {
>      if (opcode < MAX_OPCODE)
>         return InstInfo[opcode].Name;
> diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h
> index 3518f6c..d56f96c 100644
> --- a/src/mesa/program/prog_instruction.h
> +++ b/src/mesa/program/prog_instruction.h
> @@ -134,7 +134,7 @@
>   /**
>    * Program instruction opcodes for vertex, fragment and geometry programs.
>    */
> -typedef enum prog_opcode {
> +enum prog_opcode {
>                        /* ARB_vp   ARB_fp   NV_vp   NV_fp     GLSL */
>                        /*------------------------------------------*/
>      OPCODE_NOP = 0,   /*                                      X   */
> @@ -204,7 +204,7 @@ typedef enum prog_opcode {
>      OPCODE_TRUNC,     /*                                      X   */
>      OPCODE_XPD,       /*   X        X                             */
>      MAX_OPCODE
> -} gl_inst_opcode;
> +};
>
>
>   /**
> @@ -291,7 +291,7 @@ struct prog_dst_register
>    */
>   struct prog_instruction
>   {
> -   gl_inst_opcode Opcode;
> +   enum prog_opcode Opcode;
>      struct prog_src_register SrcReg[3];
>      struct prog_dst_register DstReg;
>
> @@ -379,19 +379,19 @@ extern void
>   _mesa_free_instructions(struct prog_instruction *inst, GLuint count);
>
>   extern GLuint
> -_mesa_num_inst_src_regs(gl_inst_opcode opcode);
> +_mesa_num_inst_src_regs(enum prog_opcode opcode);
>
>   extern GLuint
> -_mesa_num_inst_dst_regs(gl_inst_opcode opcode);
> +_mesa_num_inst_dst_regs(enum prog_opcode opcode);
>
>   extern GLboolean
> -_mesa_is_tex_instruction(gl_inst_opcode opcode);
> +_mesa_is_tex_instruction(enum prog_opcode opcode);
>
>   extern GLboolean
>   _mesa_check_soa_dependencies(const struct prog_instruction *inst);
>
>   extern const char *
> -_mesa_opcode_string(gl_inst_opcode opcode);
> +_mesa_opcode_string(enum prog_opcode opcode);
>
>
>   #ifdef __cplusplus
> diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
> index 1319f29..635f5d0 100644
> --- a/src/mesa/program/program_parse.y
> +++ b/src/mesa/program/program_parse.y
> @@ -84,7 +84,7 @@ static void asm_instruction_set_operands(struct asm_instruction *inst,
>       const struct prog_dst_register *dst, const struct asm_src_register *src0,
>       const struct asm_src_register *src1, const struct asm_src_register *src2);
>
> -static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
> +static struct asm_instruction *asm_instruction_ctor(enum prog_opcode op,
>       const struct prog_dst_register *dst, const struct asm_src_register *src0,
>       const struct asm_src_register *src1, const struct asm_src_register *src2);
>
> @@ -139,7 +139,7 @@ static struct asm_instruction *asm_instruction_copy_ctor(
>      gl_state_index state[STATE_LENGTH];
>      int negate;
>      struct asm_vector vector;
> -   gl_inst_opcode opcode;
> +   enum prog_opcode opcode;
>
>      struct {
>         unsigned swz;
> @@ -2275,7 +2275,7 @@ asm_instruction_set_operands(struct asm_instruction *inst,
>
>
>   struct asm_instruction *
> -asm_instruction_ctor(gl_inst_opcode op,
> +asm_instruction_ctor(enum prog_opcode op,
>   		     const struct prog_dst_register *dst,
>   		     const struct asm_src_register *src0,
>   		     const struct asm_src_register *src1,
>



More information about the mesa-dev mailing list