Re: [Mesa-dev] [PATCH 13/13] mesa: Drop unused NV_fragment_program opcodes.
Patches 12 and 13 are Reviewed-by: Ian Roamnick ian.d.roman...@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,
[Mesa-dev] [PATCH 13/13] mesa: Drop unused NV_fragment_program opcodes.
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 0x; -hy = raw 16; -result[0] = result[2] = _mesa_half_to_float(hx); -