[Mesa-dev] [PATCH 13/13] mesa: Drop unused NV_fragment_program opcodes.

Ian Romanick idr at freedesktop.org
Tue Nov 18 11:07:14 PST 2014


Patches 12 and 13 are

Reviewed-by: Ian Roamnick <ian.d.romanick at intel.com>

The other require_NV_fp opcodes can also be removed from
program_lexer.l.  ir_to_mesa can generate those opcodes, but we can't
get them from an assembly source shader.

On 11/12/2014 05:18 PM, Eric Anholt wrote:
> The extension itself was deleted 2 years ago.  There are still some
> prog_instruction opcodes from NV_fp that exist because they're used by
> ir_to_mesa.cpp, though.
> ---
>  src/mesa/program/prog_execute.c     | 144 ------------------------------------
>  src/mesa/program/prog_instruction.c |  10 ---
>  src/mesa/program/prog_instruction.h |  10 ---
>  src/mesa/program/program_lexer.l    |  13 ----
>  4 files changed, 177 deletions(-)
> 
> diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
> index e59ae70..650c40f 100644
> --- a/src/mesa/program/prog_execute.c
> +++ b/src/mesa/program/prog_execute.c
> @@ -1119,77 +1119,6 @@ _mesa_execute_program(struct gl_context * ctx,
>           break;
>        case OPCODE_NOP:
>           break;
> -      case OPCODE_PK2H:        /* pack two 16-bit floats in one 32-bit float */
> -         {
> -            GLfloat a[4];
> -            GLuint result[4];
> -            GLhalfNV hx, hy;
> -            fetch_vector4(&inst->SrcReg[0], machine, a);
> -            hx = _mesa_float_to_half(a[0]);
> -            hy = _mesa_float_to_half(a[1]);
> -            result[0] =
> -            result[1] =
> -            result[2] =
> -            result[3] = hx | (hy << 16);
> -            store_vector4ui(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_PK2US:       /* pack two GLushorts into one 32-bit float */
> -         {
> -            GLfloat a[4];
> -            GLuint result[4], usx, usy;
> -            fetch_vector4(&inst->SrcReg[0], machine, a);
> -            a[0] = CLAMP(a[0], 0.0F, 1.0F);
> -            a[1] = CLAMP(a[1], 0.0F, 1.0F);
> -            usx = F_TO_I(a[0] * 65535.0F);
> -            usy = F_TO_I(a[1] * 65535.0F);
> -            result[0] =
> -            result[1] =
> -            result[2] =
> -            result[3] = usx | (usy << 16);
> -            store_vector4ui(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_PK4B:        /* pack four GLbytes into one 32-bit float */
> -         {
> -            GLfloat a[4];
> -            GLuint result[4], ubx, uby, ubz, ubw;
> -            fetch_vector4(&inst->SrcReg[0], machine, a);
> -            a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F);
> -            a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F);
> -            a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F);
> -            a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F);
> -            ubx = F_TO_I(127.0F * a[0] + 128.0F);
> -            uby = F_TO_I(127.0F * a[1] + 128.0F);
> -            ubz = F_TO_I(127.0F * a[2] + 128.0F);
> -            ubw = F_TO_I(127.0F * a[3] + 128.0F);
> -            result[0] =
> -            result[1] =
> -            result[2] =
> -            result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
> -            store_vector4ui(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_PK4UB:       /* pack four GLubytes into one 32-bit float */
> -         {
> -            GLfloat a[4];
> -            GLuint result[4], ubx, uby, ubz, ubw;
> -            fetch_vector4(&inst->SrcReg[0], machine, a);
> -            a[0] = CLAMP(a[0], 0.0F, 1.0F);
> -            a[1] = CLAMP(a[1], 0.0F, 1.0F);
> -            a[2] = CLAMP(a[2], 0.0F, 1.0F);
> -            a[3] = CLAMP(a[3], 0.0F, 1.0F);
> -            ubx = F_TO_I(255.0F * a[0]);
> -            uby = F_TO_I(255.0F * a[1]);
> -            ubz = F_TO_I(255.0F * a[2]);
> -            ubw = F_TO_I(255.0F * a[3]);
> -            result[0] =
> -            result[1] =
> -            result[2] =
> -            result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24);
> -            store_vector4ui(inst, machine, result);
> -         }
> -         break;
>        case OPCODE_POW:
>           {
>              GLfloat a[4], b[4], result[4];
> @@ -1224,20 +1153,6 @@ _mesa_execute_program(struct gl_context * ctx,
>              pc = machine->CallStack[--machine->StackDepth] - 1;
>           }
>           break;
> -      case OPCODE_RFL:         /* reflection vector */
> -         {
> -            GLfloat axis[4], dir[4], result[4], tmpX, tmpW;
> -            fetch_vector4(&inst->SrcReg[0], machine, axis);
> -            fetch_vector4(&inst->SrcReg[1], machine, dir);
> -            tmpW = DOT3(axis, axis);
> -            tmpX = (2.0F * DOT3(axis, dir)) / tmpW;
> -            result[0] = tmpX * axis[0] - dir[0];
> -            result[1] = tmpX * axis[1] - dir[1];
> -            result[2] = tmpX * axis[2] - dir[2];
> -            /* result[3] is never written! XXX enforce in parser! */
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
>        case OPCODE_RSQ:         /* 1 / sqrt() */
>           {
>              GLfloat a[4], result[4];
> @@ -1562,52 +1477,6 @@ _mesa_execute_program(struct gl_context * ctx,
>              store_vector4(inst, machine, result);
>           }
>           break;
> -      case OPCODE_UP2H:        /* unpack two 16-bit floats */
> -         {
> -            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
> -            GLfloat result[4];
> -            GLushort hx, hy;
> -            hx = raw & 0xffff;
> -            hy = raw >> 16;
> -            result[0] = result[2] = _mesa_half_to_float(hx);
> -            result[1] = result[3] = _mesa_half_to_float(hy);
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_UP2US:       /* unpack two GLushorts */
> -         {
> -            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
> -            GLfloat result[4];
> -            GLushort usx, usy;
> -            usx = raw & 0xffff;
> -            usy = raw >> 16;
> -            result[0] = result[2] = usx * (1.0f / 65535.0f);
> -            result[1] = result[3] = usy * (1.0f / 65535.0f);
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_UP4B:        /* unpack four GLbytes */
> -         {
> -            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
> -            GLfloat result[4];
> -            result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F;
> -            result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F;
> -            result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F;
> -            result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F;
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
> -      case OPCODE_UP4UB:       /* unpack four GLubytes */
> -         {
> -            const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
> -            GLfloat result[4];
> -            result[0] = ((raw >> 0) & 0xff) / 255.0F;
> -            result[1] = ((raw >> 8) & 0xff) / 255.0F;
> -            result[2] = ((raw >> 16) & 0xff) / 255.0F;
> -            result[3] = ((raw >> 24) & 0xff) / 255.0F;
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
>        case OPCODE_XPD:         /* cross product */
>           {
>              GLfloat a[4], b[4], result[4];
> @@ -1625,19 +1494,6 @@ _mesa_execute_program(struct gl_context * ctx,
>              }
>           }
>           break;
> -      case OPCODE_X2D:         /* 2-D matrix transform */
> -         {
> -            GLfloat a[4], b[4], c[4], result[4];
> -            fetch_vector4(&inst->SrcReg[0], machine, a);
> -            fetch_vector4(&inst->SrcReg[1], machine, b);
> -            fetch_vector4(&inst->SrcReg[2], machine, c);
> -            result[0] = a[0] + b[0] * c[0] + b[1] * c[1];
> -            result[1] = a[1] + b[0] * c[2] + b[1] * c[3];
> -            result[2] = a[2] + b[0] * c[0] + b[1] * c[1];
> -            result[3] = a[3] + b[0] * c[2] + b[1] * c[3];
> -            store_vector4(inst, machine, result);
> -         }
> -         break;
>        case OPCODE_END:
>           return GL_TRUE;
>        default:
> diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c
> index abe663d..976024e 100644
> --- a/src/mesa/program/prog_instruction.c
> +++ b/src/mesa/program/prog_instruction.c
> @@ -191,14 +191,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
>     { OPCODE_NOISE2, "NOISE2",  1, 1 },
>     { OPCODE_NOISE3, "NOISE3",  1, 1 },
>     { OPCODE_NOISE4, "NOISE4",  1, 1 },
> -   { OPCODE_PK2H,   "PK2H",    1, 1 },
> -   { OPCODE_PK2US,  "PK2US",   1, 1 },
> -   { OPCODE_PK4B,   "PK4B",    1, 1 },
> -   { OPCODE_PK4UB,  "PK4UB",   1, 1 },
>     { OPCODE_POW,    "POW",     2, 1 },
>     { OPCODE_RCP,    "RCP",     1, 1 },
>     { OPCODE_RET,    "RET",     0, 0 },
> -   { OPCODE_RFL,    "RFL",     1, 1 },
>     { OPCODE_RSQ,    "RSQ",     1, 1 },
>     { OPCODE_SCS,    "SCS",     1, 1 },
>     { OPCODE_SEQ,    "SEQ",     2, 1 },
> @@ -218,11 +213,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
>     { OPCODE_TXP,    "TXP",     1, 1 },
>     { OPCODE_TXP_NV, "TXP_NV",  1, 1 },
>     { OPCODE_TRUNC,  "TRUNC",   1, 1 },
> -   { OPCODE_UP2H,   "UP2H",    1, 1 },
> -   { OPCODE_UP2US,  "UP2US",   1, 1 },
> -   { OPCODE_UP4B,   "UP4B",    1, 1 },
> -   { OPCODE_UP4UB,  "UP4UB",   1, 1 },
> -   { OPCODE_X2D,    "X2D",     3, 1 },
>     { OPCODE_XPD,    "XPD",     2, 1 }
>  };
>  
> diff --git a/src/mesa/program/prog_instruction.h b/src/mesa/program/prog_instruction.h
> index 4cca975..de78804 100644
> --- a/src/mesa/program/prog_instruction.h
> +++ b/src/mesa/program/prog_instruction.h
> @@ -187,14 +187,9 @@ typedef enum prog_opcode {
>     OPCODE_NOISE2,    /*                                      X   */
>     OPCODE_NOISE3,    /*                                      X   */
>     OPCODE_NOISE4,    /*                                      X   */
> -   OPCODE_PK2H,      /*                            X             */
> -   OPCODE_PK2US,     /*                            X             */
> -   OPCODE_PK4B,      /*                            X             */
> -   OPCODE_PK4UB,     /*                            X             */
>     OPCODE_POW,       /*   X        X               X         X   */
>     OPCODE_RCP,       /*   X        X       X       X         X   */
>     OPCODE_RET,       /*                    2       2        opt  */
> -   OPCODE_RFL,       /*                            X             */
>     OPCODE_RSQ,       /*   X        X       X       X         X   */
>     OPCODE_SCS,       /*            X                         X   */
>     OPCODE_SEQ,       /*                    2       X         X   */
> @@ -214,11 +209,6 @@ typedef enum prog_opcode {
>     OPCODE_TXP,       /*            X                         X   */
>     OPCODE_TXP_NV,    /*                    3       X             */
>     OPCODE_TRUNC,     /*                                      X   */
> -   OPCODE_UP2H,      /*                            X             */
> -   OPCODE_UP2US,     /*                            X             */
> -   OPCODE_UP4B,      /*                            X             */
> -   OPCODE_UP4UB,     /*                            X             */
> -   OPCODE_X2D,       /*                            X             */
>     OPCODE_XPD,       /*   X        X                             */
>     MAX_OPCODE
>  } gl_inst_opcode;
> diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
> index e363912..2fcd71f 100644
> --- a/src/mesa/program/program_lexer.l
> +++ b/src/mesa/program/program_lexer.l
> @@ -217,26 +217,19 @@ MIN{sz}{cc}{sat}   { return_opcode(             1, BIN_OP, MIN, 3); }
>  MOV{sz}{cc}{sat}   { return_opcode(             1, VECTOR_OP, MOV, 3); }
>  MUL{sz}{cc}{sat}   { return_opcode(             1, BIN_OP, MUL, 3); }
>  
> -PK2H               { return_opcode(require_NV_fp,  VECTOR_OP, PK2H, 4); }
> -PK2US              { return_opcode(require_NV_fp,  VECTOR_OP, PK2US, 5); }
> -PK4B               { return_opcode(require_NV_fp,  VECTOR_OP, PK4B, 4); }
> -PK4UB              { return_opcode(require_NV_fp,  VECTOR_OP, PK4UB, 5); }
>  POW{szf}{cc}{sat}  { return_opcode(             1, BINSC_OP, POW, 3); }
>  
>  RCP{szf}{cc}{sat}  { return_opcode(             1, SCALAR_OP, RCP, 3); }
> -RFL{szf}{cc}{sat}  { return_opcode(require_NV_fp,  BIN_OP,    RFL, 3); }
>  RSQ{szf}{cc}{sat}  { return_opcode(             1, SCALAR_OP, RSQ, 3); }
>  
>  SCS{sat}           { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); }
>  SEQ{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, SEQ, 3); }
> -SFL{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, SFL, 3); }
>  SGE{sz}{cc}{sat}   { return_opcode(             1, BIN_OP, SGE, 3); }
>  SGT{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, SGT, 3); }
>  SIN{szf}{cc}{sat}  { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); }
>  SLE{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, SLE, 3); }
>  SLT{sz}{cc}{sat}   { return_opcode(             1, BIN_OP, SLT, 3); }
>  SNE{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, SNE, 3); }
> -STR{sz}{cc}{sat}   { return_opcode(require_NV_fp,  BIN_OP, STR, 3); }
>  SUB{sz}{cc}{sat}   { return_opcode(             1, BIN_OP, SUB, 3); }
>  SWZ{sat}           { return_opcode(             1, SWZ, SWZ, 3); }
>  
> @@ -245,12 +238,6 @@ TXB{cc}{sat}       { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); }
>  TXD{cc}{sat}       { return_opcode(require_NV_fp,  TXD_OP, TXD, 3); }
>  TXP{cc}{sat}       { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); }
>  
> -UP2H{cc}{sat}      { return_opcode(require_NV_fp,  SCALAR_OP, UP2H, 4); }
> -UP2US{cc}{sat}     { return_opcode(require_NV_fp,  SCALAR_OP, UP2US, 5); }
> -UP4B{cc}{sat}      { return_opcode(require_NV_fp,  SCALAR_OP, UP4B, 4); }
> -UP4UB{cc}{sat}     { return_opcode(require_NV_fp,  SCALAR_OP, UP4UB, 5); }
> -
> -X2D{szf}{cc}{sat}  { return_opcode(require_NV_fp,  TRI_OP, X2D, 3); }
>  XPD{sat}           { return_opcode(             1, BIN_OP, XPD, 3); }
>  
>  vertex                    { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); }
> 



More information about the mesa-dev mailing list