aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/prog_execute.c156
-rw-r--r--mesalib/src/mesa/program/prog_instruction.c12
-rw-r--r--mesalib/src/mesa/program/prog_instruction.h12
-rw-r--r--mesalib/src/mesa/program/program_lexer.l14
4 files changed, 1 insertions, 193 deletions
diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c
index fcc9ed518..650c40f2a 100644
--- a/mesalib/src/mesa/program/prog_execute.c
+++ b/mesalib/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];
@@ -1279,12 +1194,6 @@ _mesa_execute_program(struct gl_context * ctx,
}
}
break;
- case OPCODE_SFL: /* set false, operands ignored */
- {
- static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
- store_vector4(inst, machine, result);
- }
- break;
case OPCODE_SGE: /* set on greater or equal */
{
GLfloat a[4], b[4], result[4];
@@ -1395,12 +1304,6 @@ _mesa_execute_program(struct gl_context * ctx,
store_vector4(inst, machine, result);
}
break;
- case OPCODE_STR: /* set true, operands ignored */
- {
- static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F };
- store_vector4(inst, machine, result);
- }
- break;
case OPCODE_SUB:
{
GLfloat a[4], b[4], result[4];
@@ -1574,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];
@@ -1637,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/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c
index e2eadc36c..976024e3c 100644
--- a/mesalib/src/mesa/program/prog_instruction.c
+++ b/mesalib/src/mesa/program/prog_instruction.c
@@ -191,18 +191,12 @@ 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 },
- { OPCODE_SFL, "SFL", 0, 1 },
{ OPCODE_SGE, "SGE", 2, 1 },
{ OPCODE_SGT, "SGT", 2, 1 },
{ OPCODE_SIN, "SIN", 1, 1 },
@@ -210,7 +204,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
{ OPCODE_SLT, "SLT", 2, 1 },
{ OPCODE_SNE, "SNE", 2, 1 },
{ OPCODE_SSG, "SSG", 1, 1 },
- { OPCODE_STR, "STR", 0, 1 },
{ OPCODE_SUB, "SUB", 2, 1 },
{ OPCODE_SWZ, "SWZ", 1, 1 },
{ OPCODE_TEX, "TEX", 1, 1 },
@@ -220,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/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h
index b9604e50d..de7880499 100644
--- a/mesalib/src/mesa/program/prog_instruction.h
+++ b/mesalib/src/mesa/program/prog_instruction.h
@@ -187,18 +187,12 @@ 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 */
- OPCODE_SFL, /* 2 X */
OPCODE_SGE, /* X X X X X */
OPCODE_SGT, /* 2 X X */
OPCODE_SIN, /* X 2 X X */
@@ -206,7 +200,6 @@ typedef enum prog_opcode {
OPCODE_SLT, /* X X X X X */
OPCODE_SNE, /* 2 X X */
OPCODE_SSG, /* 2 X */
- OPCODE_STR, /* 2 X */
OPCODE_SUB, /* X X 1.1 X X */
OPCODE_SWZ, /* X X X */
OPCODE_TEX, /* X 3 X X */
@@ -216,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/mesalib/src/mesa/program/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l
index d5dbcf347..2fcd71f22 100644
--- a/mesalib/src/mesa/program/program_lexer.l
+++ b/mesalib/src/mesa/program/program_lexer.l
@@ -28,6 +28,7 @@
#include "program/symbol_table.h"
#include "program/program_parser.h"
#include "program/program_parse.tab.h"
+#include "util/strtod.h"
#define require_ARB_vp (yyextra->mode == ARB_vertex)
#define require_ARB_fp (yyextra->mode == ARB_fragment)
@@ -216,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); }
@@ -244,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); }