wined3d: Store D3D shader opcode names in a separate table.

This commit is contained in:
Henri Verbeet 2009-04-27 09:37:14 +02:00 committed by Alexandre Julliard
parent 240ddb27c4
commit 2b07565d6e
4 changed files with 238 additions and 158 deletions

View File

@ -128,8 +128,7 @@ static const SHADER_OPCODE *shader_get_opcode(const SHADER_OPCODE *opcode_table,
{
DWORD i = 0;
/** TODO: use dichotomic search */
while (opcode_table[i].name)
while (opcode_table[i].handler_idx != WINED3DSIH_TABLE_SIZE)
{
if ((code & WINED3DSI_OPCODE_MASK) == opcode_table[i].opcode
&& shader_version >= opcode_table[i].min_version
@ -206,6 +205,93 @@ static void shader_sm1_read_opcode(const DWORD **ptr, struct wined3d_shader_inst
*param_size = shader_skip_opcode(opcode_info, opcode_token, shader_version);
}
static const char *shader_opcode_names[] =
{
/* WINED3DSIH_ABS */ "abs",
/* WINED3DSIH_ADD */ "add",
/* WINED3DSIH_BEM */ "bem",
/* WINED3DSIH_BREAK */ "break",
/* WINED3DSIH_BREAKC */ "breakc",
/* WINED3DSIH_BREAKP */ "breakp",
/* WINED3DSIH_CALL */ "call",
/* WINED3DSIH_CALLNZ */ "callnz",
/* WINED3DSIH_CMP */ "cmp",
/* WINED3DSIH_CND */ "cnd",
/* WINED3DSIH_CRS */ "crs",
/* WINED3DSIH_DCL */ "dcl",
/* WINED3DSIH_DEF */ "def",
/* WINED3DSIH_DEFB */ "defb",
/* WINED3DSIH_DEFI */ "defi",
/* WINED3DSIH_DP2ADD */ "dp2add",
/* WINED3DSIH_DP3 */ "dp3",
/* WINED3DSIH_DP4 */ "dp4",
/* WINED3DSIH_DST */ "dst",
/* WINED3DSIH_DSX */ "dsx",
/* WINED3DSIH_DSY */ "dsy",
/* WINED3DSIH_ELSE */ "else",
/* WINED3DSIH_ENDIF */ "endif",
/* WINED3DSIH_ENDLOOP */ "endloop",
/* WINED3DSIH_ENDREP */ "endrep",
/* WINED3DSIH_EXP */ "exp",
/* WINED3DSIH_EXPP */ "expp",
/* WINED3DSIH_FRC */ "frc",
/* WINED3DSIH_IF */ "if",
/* WINED3DSIH_IFC */ "ifc",
/* WINED3DSIH_LABEL */ "label",
/* WINED3DSIH_LIT */ "lit",
/* WINED3DSIH_LOG */ "log",
/* WINED3DSIH_LOGP */ "logp",
/* WINED3DSIH_LOOP */ "loop",
/* WINED3DSIH_LRP */ "lrp",
/* WINED3DSIH_M3x2 */ "m3x2",
/* WINED3DSIH_M3x3 */ "m3x3",
/* WINED3DSIH_M3x4 */ "m3x4",
/* WINED3DSIH_M4x3 */ "m4x3",
/* WINED3DSIH_M4x4 */ "m4x4",
/* WINED3DSIH_MAD */ "mad",
/* WINED3DSIH_MAX */ "max",
/* WINED3DSIH_MIN */ "min",
/* WINED3DSIH_MOV */ "mov",
/* WINED3DSIH_MOVA */ "mova",
/* WINED3DSIH_MUL */ "mul",
/* WINED3DSIH_NOP */ "nop",
/* WINED3DSIH_NRM */ "nrm",
/* WINED3DSIH_PHASE */ "phase",
/* WINED3DSIH_POW */ "pow",
/* WINED3DSIH_RCP */ "rcp",
/* WINED3DSIH_REP */ "rep",
/* WINED3DSIH_RET */ "ret",
/* WINED3DSIH_RSQ */ "rsq",
/* WINED3DSIH_SETP */ "setp",
/* WINED3DSIH_SGE */ "sge",
/* WINED3DSIH_SGN */ "sgn",
/* WINED3DSIH_SINCOS */ "sincos",
/* WINED3DSIH_SLT */ "slt",
/* WINED3DSIH_SUB */ "sub",
/* WINED3DSIH_TEX */ "texld",
/* WINED3DSIH_TEXBEM */ "texbem",
/* WINED3DSIH_TEXBEML */ "texbeml",
/* WINED3DSIH_TEXCOORD */ "texcrd",
/* WINED3DSIH_TEXDEPTH */ "texdepth",
/* WINED3DSIH_TEXDP3 */ "texdp3",
/* WINED3DSIH_TEXDP3TEX */ "texdp3tex",
/* WINED3DSIH_TEXKILL */ "texkill",
/* WINED3DSIH_TEXLDD */ "texldd",
/* WINED3DSIH_TEXLDL */ "texldl",
/* WINED3DSIH_TEXM3x2DEPTH */ "texm3x2depth",
/* WINED3DSIH_TEXM3x2PAD */ "texm3x2pad",
/* WINED3DSIH_TEXM3x2TEX */ "texm3x2tex",
/* WINED3DSIH_TEXM3x3 */ "texm3x3",
/* WINED3DSIH_TEXM3x3DIFF */ "texm3x3diff",
/* WINED3DSIH_TEXM3x3PAD */ "texm3x3pad",
/* WINED3DSIH_TEXM3x3SPEC */ "texm3x3spec",
/* WINED3DSIH_TEXM3x3TEX */ "texm3x3tex",
/* WINED3DSIH_TEXM3x3VSPEC */ "texm3x3vspec",
/* WINED3DSIH_TEXREG2AR */ "texreg2ar",
/* WINED3DSIH_TEXREG2GB */ "texreg2gb",
/* WINED3DSIH_TEXREG2RGB */ "texreg2rgb",
};
static inline BOOL shader_is_version_token(DWORD token) {
return shader_is_pshader_version(token) ||
shader_is_vshader_version(token);
@ -1180,7 +1266,7 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table
TRACE("+");
}
TRACE("%s", curOpcode->name);
TRACE("%s", shader_opcode_names[curOpcode->handler_idx]);
if (curOpcode->opcode == WINED3DSIO_IFC
|| curOpcode->opcode == WINED3DSIO_BREAKC)

View File

@ -120,98 +120,99 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader*
return WINED3D_OK;
}
CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
const SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] =
{
/* Arithmetic */
{WINED3DSIO_NOP, "nop", 0, 0, WINED3DSIH_NOP, 0, 0 },
{WINED3DSIO_MOV, "mov", 1, 2, WINED3DSIH_MOV, 0, 0 },
{WINED3DSIO_ADD, "add", 1, 3, WINED3DSIH_ADD, 0, 0 },
{WINED3DSIO_SUB, "sub", 1, 3, WINED3DSIH_SUB, 0, 0 },
{WINED3DSIO_MAD, "mad", 1, 4, WINED3DSIH_MAD, 0, 0 },
{WINED3DSIO_MUL, "mul", 1, 3, WINED3DSIH_MUL, 0, 0 },
{WINED3DSIO_RCP, "rcp", 1, 2, WINED3DSIH_RCP, 0, 0 },
{WINED3DSIO_RSQ, "rsq", 1, 2, WINED3DSIH_RSQ, 0, 0 },
{WINED3DSIO_DP3, "dp3", 1, 3, WINED3DSIH_DP3, 0, 0 },
{WINED3DSIO_DP4, "dp4", 1, 3, WINED3DSIH_DP4, 0, 0 },
{WINED3DSIO_MIN, "min", 1, 3, WINED3DSIH_MIN, 0, 0 },
{WINED3DSIO_MAX, "max", 1, 3, WINED3DSIH_MAX, 0, 0 },
{WINED3DSIO_SLT, "slt", 1, 3, WINED3DSIH_SLT, 0, 0 },
{WINED3DSIO_SGE, "sge", 1, 3, WINED3DSIH_SGE, 0, 0 },
{WINED3DSIO_ABS, "abs", 1, 2, WINED3DSIH_ABS, 0, 0 },
{WINED3DSIO_EXP, "exp", 1, 2, WINED3DSIH_EXP, 0, 0 },
{WINED3DSIO_LOG, "log", 1, 2, WINED3DSIH_LOG, 0, 0 },
{WINED3DSIO_EXPP, "expp", 1, 2, WINED3DSIH_EXPP, 0, 0 },
{WINED3DSIO_LOGP, "logp", 1, 2, WINED3DSIH_LOGP, 0, 0 },
{WINED3DSIO_DST, "dst", 1, 3, WINED3DSIH_DST, 0, 0 },
{WINED3DSIO_LRP, "lrp", 1, 4, WINED3DSIH_LRP, 0, 0 },
{WINED3DSIO_FRC, "frc", 1, 2, WINED3DSIH_FRC, 0, 0 },
{WINED3DSIO_CND, "cnd", 1, 4, WINED3DSIH_CND, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_CMP, "cmp", 1, 4, WINED3DSIH_CMP, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(3,0)},
{WINED3DSIO_POW, "pow", 1, 3, WINED3DSIH_POW, 0, 0 },
{WINED3DSIO_CRS, "crs", 1, 3, WINED3DSIH_CRS, 0, 0 },
{WINED3DSIO_NRM, "nrm", 1, 2, WINED3DSIH_NRM, 0, 0 },
{WINED3DSIO_SINCOS, "sincos", 1, 4, WINED3DSIH_SINCOS, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,1)},
{WINED3DSIO_SINCOS, "sincos", 1, 2, WINED3DSIH_SINCOS, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_DP2ADD, "dp2add", 1, 4, WINED3DSIH_DP2ADD, WINED3DPS_VERSION(2,0), -1 },
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
{WINED3DSIO_CND, 1, 4, WINED3DSIH_CND, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_CMP, 1, 4, WINED3DSIH_CMP, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(3,0)},
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,1)},
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_DP2ADD, 1, 4, WINED3DSIH_DP2ADD, WINED3DPS_VERSION(2,0), -1 },
/* Matrix */
{WINED3DSIO_M4x4, "m4x4", 1, 3, WINED3DSIH_M4x4, 0, 0 },
{WINED3DSIO_M4x3, "m4x3", 1, 3, WINED3DSIH_M4x3, 0, 0 },
{WINED3DSIO_M3x4, "m3x4", 1, 3, WINED3DSIH_M3x4, 0, 0 },
{WINED3DSIO_M3x3, "m3x3", 1, 3, WINED3DSIH_M3x3, 0, 0 },
{WINED3DSIO_M3x2, "m3x2", 1, 3, WINED3DSIH_M3x2, 0, 0 },
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
/* Register declarations */
{WINED3DSIO_DCL, "dcl", 0, 2, WINED3DSIH_DCL, 0, 0 },
/* Flow control - requires GLSL or software shaders */
{WINED3DSIO_REP , "rep", 0, 1, WINED3DSIH_REP, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDREP, "endrep", 0, 0, WINED3DSIH_ENDREP, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_IF, "if", 0, 1, WINED3DSIH_IF, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_IFC, "ifc", 0, 2, WINED3DSIH_IFC, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ELSE, "else", 0, 0, WINED3DSIH_ELSE, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDIF, "endif", 0, 0, WINED3DSIH_ENDIF, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAK, "break", 0, 0, WINED3DSIH_BREAK, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKC, "breakc", 0, 2, WINED3DSIH_BREAKC, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKP, "breakp", 0, 1, WINED3DSIH_BREAKP, 0, 0 },
{WINED3DSIO_CALL, "call", 0, 1, WINED3DSIH_CALL, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_CALLNZ, "callnz", 0, 2, WINED3DSIH_CALLNZ, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_LOOP, "loop", 0, 2, WINED3DSIH_LOOP, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_RET, "ret", 0, 0, WINED3DSIH_RET, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDLOOP, "endloop", 0, 0, WINED3DSIH_ENDLOOP, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_LABEL, "label", 0, 1, WINED3DSIH_LABEL, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
/* Flow control */
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3DPS_VERSION(2,1), -1 },
/* Constant definitions */
{WINED3DSIO_DEF, "def", 1, 5, WINED3DSIH_DEF, 0, 0 },
{WINED3DSIO_DEFB, "defb", 1, 2, WINED3DSIH_DEFB, 0, 0 },
{WINED3DSIO_DEFI, "defi", 1, 5, WINED3DSIH_DEFI, 0, 0 },
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
/* Texture */
{WINED3DSIO_TEXCOORD, "texcoord", 1, 1, WINED3DSIH_TEXCOORD, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXCOORD, "texcrd", 1, 2, WINED3DSIH_TEXCOORD, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_TEXKILL, "texkill", 1, 1, WINED3DSIH_TEXKILL, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(3,0)},
{WINED3DSIO_TEX, "tex", 1, 1, WINED3DSIH_TEX, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEX, "texld", 1, 2, WINED3DSIH_TEX, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_TEX, "texld", 1, 3, WINED3DSIH_TEX, WINED3DPS_VERSION(2,0), -1 },
{WINED3DSIO_TEXBEM, "texbem", 1, 2, WINED3DSIH_TEXBEM, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXBEML, "texbeml", 1, 2, WINED3DSIH_TEXBEML, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2AR, "texreg2ar", 1, 2, WINED3DSIH_TEXREG2AR, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2GB, "texreg2gb", 1, 2, WINED3DSIH_TEXREG2GB, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2RGB, "texreg2rgb", 1, 2, WINED3DSIH_TEXREG2RGB, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2PAD, "texm3x2pad", 1, 2, WINED3DSIH_TEXM3x2PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2TEX, "texm3x2tex", 1, 2, WINED3DSIH_TEXM3x2TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3PAD, "texm3x3pad", 1, 2, WINED3DSIH_TEXM3x3PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3DIFF, "texm3x3diff", 1, 2, WINED3DSIH_TEXM3x3DIFF, WINED3DPS_VERSION(0,0), WINED3DPS_VERSION(0,0)},
{WINED3DSIO_TEXM3x3SPEC, "texm3x3spec", 1, 3, WINED3DSIH_TEXM3x3SPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3VSPEC, "texm3x3vspec", 1, 2, WINED3DSIH_TEXM3x3VSPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3TEX, "texm3x3tex", 1, 2, WINED3DSIH_TEXM3x3TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDP3TEX, "texdp3tex", 1, 2, WINED3DSIH_TEXDP3TEX, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2DEPTH, "texm3x2depth", 1, 2, WINED3DSIH_TEXM3x2DEPTH, WINED3DPS_VERSION(1,3), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDP3, "texdp3", 1, 2, WINED3DSIH_TEXDP3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3, "texm3x3", 1, 2, WINED3DSIH_TEXM3x3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDEPTH, "texdepth", 1, 1, WINED3DSIH_TEXDEPTH, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_BEM, "bem", 1, 3, WINED3DSIH_BEM, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_DSX, "dsx", 1, 2, WINED3DSIH_DSX, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_DSY, "dsy", 1, 2, WINED3DSIH_DSY, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_TEXLDD, "texldd", 1, 5, WINED3DSIH_TEXLDD, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_SETP, "setp", 1, 3, WINED3DSIH_SETP, 0, 0 },
{WINED3DSIO_TEXLDL, "texldl", 1, 3, WINED3DSIH_TEXLDL, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_PHASE, "phase", 0, 0, WINED3DSIH_PHASE, 0, 0 },
{0, NULL, 0, 0, 0, 0, 0 }
{WINED3DSIO_TEXCOORD, 1, 1, WINED3DSIH_TEXCOORD, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXCOORD, 1, 2, WINED3DSIH_TEXCOORD, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_TEXKILL, 1, 1, WINED3DSIH_TEXKILL, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(3,0)},
{WINED3DSIO_TEX, 1, 1, WINED3DSIH_TEX, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEX, 1, 2, WINED3DSIH_TEX, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_TEX, 1, 3, WINED3DSIH_TEX, WINED3DPS_VERSION(2,0), -1 },
{WINED3DSIO_TEXBEM, 1, 2, WINED3DSIH_TEXBEM, 0, WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXBEML, 1, 2, WINED3DSIH_TEXBEML, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2AR, 1, 2, WINED3DSIH_TEXREG2AR, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2GB, 1, 2, WINED3DSIH_TEXREG2GB, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXREG2RGB, 1, 2, WINED3DSIH_TEXREG2RGB, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2PAD, 1, 2, WINED3DSIH_TEXM3x2PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2TEX, 1, 2, WINED3DSIH_TEXM3x2TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3PAD, 1, 2, WINED3DSIH_TEXM3x3PAD, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3DIFF, 1, 2, WINED3DSIH_TEXM3x3DIFF, WINED3DPS_VERSION(0,0), WINED3DPS_VERSION(0,0)},
{WINED3DSIO_TEXM3x3SPEC, 1, 3, WINED3DSIH_TEXM3x3SPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3VSPEC, 1, 2, WINED3DSIH_TEXM3x3VSPEC, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3TEX, 1, 2, WINED3DSIH_TEXM3x3TEX, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDP3TEX, 1, 2, WINED3DSIH_TEXDP3TEX, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x2DEPTH, 1, 2, WINED3DSIH_TEXM3x2DEPTH, WINED3DPS_VERSION(1,3), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDP3, 1, 2, WINED3DSIH_TEXDP3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXM3x3, 1, 2, WINED3DSIH_TEXM3x3, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)},
{WINED3DSIO_TEXDEPTH, 1, 1, WINED3DSIH_TEXDEPTH, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_BEM, 1, 3, WINED3DSIH_BEM, WINED3DPS_VERSION(1,4), WINED3DPS_VERSION(1,4)},
{WINED3DSIO_DSX, 1, 2, WINED3DSIH_DSX, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_DSY, 1, 2, WINED3DSIH_DSY, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_TEXLDD, 1, 5, WINED3DSIH_TEXLDD, WINED3DPS_VERSION(2,1), -1 },
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3DPS_VERSION(3,0), -1 },
{WINED3DSIO_PHASE, 0, 0, WINED3DSIH_PHASE, 0, 0 },
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
};
static void pshader_set_limits(

View File

@ -34,78 +34,72 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
#define GLINFO_LOCATION ((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info
/* TODO: Vertex and Pixel shaders are almost identical, the only exception being the way that some of the data is looked up or the availability of some of the data i.e. some instructions are only valid for pshaders and some for vshaders
because of this the bulk of the software pipeline can be shared between pixel and vertex shaders... and it wouldn't surprise me if the program can be cross compiled using a large body of shared code */
CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
/* This table is not order or position dependent. */
/* This table is not order or position dependent. */
const SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] =
{
/* Arithmetic */
{WINED3DSIO_NOP, "nop", 0, 0, WINED3DSIH_NOP, 0, 0 },
{WINED3DSIO_MOV, "mov", 1, 2, WINED3DSIH_MOV, 0, 0 },
{WINED3DSIO_MOVA, "mova", 1, 2, WINED3DSIH_MOVA, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ADD, "add", 1, 3, WINED3DSIH_ADD, 0, 0 },
{WINED3DSIO_SUB, "sub", 1, 3, WINED3DSIH_SUB, 0, 0 },
{WINED3DSIO_MAD, "mad", 1, 4, WINED3DSIH_MAD, 0, 0 },
{WINED3DSIO_MUL, "mul", 1, 3, WINED3DSIH_MUL, 0, 0 },
{WINED3DSIO_RCP, "rcp", 1, 2, WINED3DSIH_RCP, 0, 0 },
{WINED3DSIO_RSQ, "rsq", 1, 2, WINED3DSIH_RSQ, 0, 0 },
{WINED3DSIO_DP3, "dp3", 1, 3, WINED3DSIH_DP3, 0, 0 },
{WINED3DSIO_DP4, "dp4", 1, 3, WINED3DSIH_DP4, 0, 0 },
{WINED3DSIO_MIN, "min", 1, 3, WINED3DSIH_MIN, 0, 0 },
{WINED3DSIO_MAX, "max", 1, 3, WINED3DSIH_MAX, 0, 0 },
{WINED3DSIO_SLT, "slt", 1, 3, WINED3DSIH_SLT, 0, 0 },
{WINED3DSIO_SGE, "sge", 1, 3, WINED3DSIH_SGE, 0, 0 },
{WINED3DSIO_ABS, "abs", 1, 2, WINED3DSIH_ABS, 0, 0 },
{WINED3DSIO_EXP, "exp", 1, 2, WINED3DSIH_EXP, 0, 0 },
{WINED3DSIO_LOG, "log", 1, 2, WINED3DSIH_LOG, 0, 0 },
{WINED3DSIO_EXPP, "expp", 1, 2, WINED3DSIH_EXPP, 0, 0 },
{WINED3DSIO_LOGP, "logp", 1, 2, WINED3DSIH_LOGP, 0, 0 },
{WINED3DSIO_LIT, "lit", 1, 2, WINED3DSIH_LIT, 0, 0 },
{WINED3DSIO_DST, "dst", 1, 3, WINED3DSIH_DST, 0, 0 },
{WINED3DSIO_LRP, "lrp", 1, 4, WINED3DSIH_LRP, 0, 0 },
{WINED3DSIO_FRC, "frc", 1, 2, WINED3DSIH_FRC, 0, 0 },
{WINED3DSIO_POW, "pow", 1, 3, WINED3DSIH_POW, 0, 0 },
{WINED3DSIO_CRS, "crs", 1, 3, WINED3DSIH_CRS, 0, 0 },
/* TODO: sng can possibly be performed as
RCP tmp, vec
MUL out, tmp, vec*/
{WINED3DSIO_SGN, "sgn", 1, 2, WINED3DSIH_SGN, 0, 0 },
{WINED3DSIO_NRM, "nrm", 1, 2, WINED3DSIH_NRM, 0, 0 },
{WINED3DSIO_SINCOS, "sincos", 1, 4, WINED3DSIH_SINCOS, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,1)},
{WINED3DSIO_SINCOS, "sincos", 1, 2, WINED3DSIH_SINCOS, WINED3DVS_VERSION(3,0), -1 },
{WINED3DSIO_NOP, 0, 0, WINED3DSIH_NOP, 0, 0 },
{WINED3DSIO_MOV, 1, 2, WINED3DSIH_MOV, 0, 0 },
{WINED3DSIO_MOVA, 1, 2, WINED3DSIH_MOVA, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ADD, 1, 3, WINED3DSIH_ADD, 0, 0 },
{WINED3DSIO_SUB, 1, 3, WINED3DSIH_SUB, 0, 0 },
{WINED3DSIO_MAD, 1, 4, WINED3DSIH_MAD, 0, 0 },
{WINED3DSIO_MUL, 1, 3, WINED3DSIH_MUL, 0, 0 },
{WINED3DSIO_RCP, 1, 2, WINED3DSIH_RCP, 0, 0 },
{WINED3DSIO_RSQ, 1, 2, WINED3DSIH_RSQ, 0, 0 },
{WINED3DSIO_DP3, 1, 3, WINED3DSIH_DP3, 0, 0 },
{WINED3DSIO_DP4, 1, 3, WINED3DSIH_DP4, 0, 0 },
{WINED3DSIO_MIN, 1, 3, WINED3DSIH_MIN, 0, 0 },
{WINED3DSIO_MAX, 1, 3, WINED3DSIH_MAX, 0, 0 },
{WINED3DSIO_SLT, 1, 3, WINED3DSIH_SLT, 0, 0 },
{WINED3DSIO_SGE, 1, 3, WINED3DSIH_SGE, 0, 0 },
{WINED3DSIO_ABS, 1, 2, WINED3DSIH_ABS, 0, 0 },
{WINED3DSIO_EXP, 1, 2, WINED3DSIH_EXP, 0, 0 },
{WINED3DSIO_LOG, 1, 2, WINED3DSIH_LOG, 0, 0 },
{WINED3DSIO_EXPP, 1, 2, WINED3DSIH_EXPP, 0, 0 },
{WINED3DSIO_LOGP, 1, 2, WINED3DSIH_LOGP, 0, 0 },
{WINED3DSIO_LIT, 1, 2, WINED3DSIH_LIT, 0, 0 },
{WINED3DSIO_DST, 1, 3, WINED3DSIH_DST, 0, 0 },
{WINED3DSIO_LRP, 1, 4, WINED3DSIH_LRP, 0, 0 },
{WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 },
{WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 },
{WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 },
{WINED3DSIO_SGN, 1, 2, WINED3DSIH_SGN, 0, 0 },
{WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 },
{WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,1)},
{WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3DVS_VERSION(3,0), -1 },
/* Matrix */
{WINED3DSIO_M4x4, "m4x4", 1, 3, WINED3DSIH_M4x4, 0, 0 },
{WINED3DSIO_M4x3, "m4x3", 1, 3, WINED3DSIH_M4x3, 0, 0 },
{WINED3DSIO_M3x4, "m3x4", 1, 3, WINED3DSIH_M3x4, 0, 0 },
{WINED3DSIO_M3x3, "m3x3", 1, 3, WINED3DSIH_M3x3, 0, 0 },
{WINED3DSIO_M3x2, "m3x2", 1, 3, WINED3DSIH_M3x2, 0, 0 },
{WINED3DSIO_M4x4, 1, 3, WINED3DSIH_M4x4, 0, 0 },
{WINED3DSIO_M4x3, 1, 3, WINED3DSIH_M4x3, 0, 0 },
{WINED3DSIO_M3x4, 1, 3, WINED3DSIH_M3x4, 0, 0 },
{WINED3DSIO_M3x3, 1, 3, WINED3DSIH_M3x3, 0, 0 },
{WINED3DSIO_M3x2, 1, 3, WINED3DSIH_M3x2, 0, 0 },
/* Declare registers */
{WINED3DSIO_DCL, "dcl", 0, 2, WINED3DSIH_DCL, 0, 0 },
{WINED3DSIO_DCL, 0, 2, WINED3DSIH_DCL, 0, 0 },
/* Constant definitions */
{WINED3DSIO_DEF, "def", 1, 5, WINED3DSIH_DEF, 0, 0 },
{WINED3DSIO_DEFB, "defb", 1, 2, WINED3DSIH_DEFB, 0, 0 },
{WINED3DSIO_DEFI, "defi", 1, 5, WINED3DSIH_DEFI, 0, 0 },
/* Flow control - requires GLSL or software shaders */
{WINED3DSIO_REP , "rep", 0, 1, WINED3DSIH_REP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDREP, "endrep", 0, 0, WINED3DSIH_ENDREP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_IF, "if", 0, 1, WINED3DSIH_IF, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_IFC, "ifc", 0, 2, WINED3DSIH_IFC, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_ELSE, "else", 0, 0, WINED3DSIH_ELSE, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDIF, "endif", 0, 0, WINED3DSIH_ENDIF, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_BREAK, "break", 0, 0, WINED3DSIH_BREAK, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKC, "breakc", 0, 2, WINED3DSIH_BREAKC, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKP, "breakp", 0, 1, WINED3DSIH_BREAKP, 0, 0 },
{WINED3DSIO_CALL, "call", 0, 1, WINED3DSIH_CALL, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_CALLNZ, "callnz", 0, 2, WINED3DSIH_CALLNZ, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_LOOP, "loop", 0, 2, WINED3DSIH_LOOP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_RET, "ret", 0, 0, WINED3DSIH_RET, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDLOOP, "endloop", 0, 0, WINED3DSIH_ENDLOOP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_LABEL, "label", 0, 1, WINED3DSIH_LABEL, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_DEF, 1, 5, WINED3DSIH_DEF, 0, 0 },
{WINED3DSIO_DEFB, 1, 2, WINED3DSIH_DEFB, 0, 0 },
{WINED3DSIO_DEFI, 1, 5, WINED3DSIH_DEFI, 0, 0 },
/* Flow control */
{WINED3DSIO_REP, 0, 1, WINED3DSIH_REP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDREP, 0, 0, WINED3DSIH_ENDREP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_IF, 0, 1, WINED3DSIH_IF, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_IFC, 0, 2, WINED3DSIH_IFC, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_ELSE, 0, 0, WINED3DSIH_ELSE, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDIF, 0, 0, WINED3DSIH_ENDIF, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_BREAK, 0, 0, WINED3DSIH_BREAK, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKC, 0, 2, WINED3DSIH_BREAKC, WINED3DVS_VERSION(2,1), -1 },
{WINED3DSIO_BREAKP, 0, 1, WINED3DSIH_BREAKP, 0, 0 },
{WINED3DSIO_CALL, 0, 1, WINED3DSIH_CALL, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_CALLNZ, 0, 2, WINED3DSIH_CALLNZ, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_LOOP, 0, 2, WINED3DSIH_LOOP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_RET, 0, 0, WINED3DSIH_RET, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_ENDLOOP, 0, 0, WINED3DSIH_ENDLOOP, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_LABEL, 0, 1, WINED3DSIH_LABEL, WINED3DVS_VERSION(2,0), -1 },
{WINED3DSIO_SETP, "setp", 1, 3, WINED3DSIH_SETP, 0, 0 },
{WINED3DSIO_TEXLDL, "texldl", 1, 3, WINED3DSIH_TEXLDL, WINED3DVS_VERSION(3,0), -1 },
{0, NULL, 0, 0, 0, 0, 0 }
{WINED3DSIO_SETP, 1, 3, WINED3DSIH_SETP, 0, 0 },
{WINED3DSIO_TEXLDL, 1, 3, WINED3DSIH_TEXLDL, WINED3DVS_VERSION(3,0), -1 },
{0, 0, 0, WINED3DSIH_TABLE_SIZE, 0, 0 },
};
static void vshader_set_limits(

View File

@ -435,7 +435,6 @@ typedef struct shader_reg_maps
typedef struct SHADER_OPCODE
{
unsigned int opcode;
const char *name;
char dst_token;
CONST UINT num_params;
enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx;