d3dx9: Use separate opcodes for TEXLDP and TEXLDB.

There is no reason we have to strictly follow D3D bytecode format in our
intermediate representation.
This commit is contained in:
Matteo Bruni 2010-05-21 14:56:43 +02:00 committed by Alexandre Julliard
parent 1d3f462fef
commit a9118ba171
4 changed files with 10 additions and 11 deletions

View File

@ -724,12 +724,12 @@ instruction: INSTR_ADD omods dreg ',' sregs
| INSTR_TEXLDP omods dreg ',' sregs
{
TRACE("TEXLDP\n");
asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEX | ( BWRITERSI_TEXLD_PROJECT << BWRITER_OPCODESPECIFICCONTROL_SHIFT ), $2.mod, $2.shift, 0, &$3, &$5, 2);
asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDP, $2.mod, $2.shift, 0, &$3, &$5, 2);
}
| INSTR_TEXLDB omods dreg ',' sregs
{
TRACE("TEXLDB\n");
asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEX | ( BWRITERSI_TEXLD_BIAS << BWRITER_OPCODESPECIFICCONTROL_SHIFT ), $2.mod, $2.shift, 0, &$3, &$5, 2);
asm_ctx.funcs->instr(&asm_ctx, BWRITERSIO_TEXLDB, $2.mod, $2.shift, 0, &$3, &$5, 2);
}
| INSTR_DSX omods dreg ',' sregs
{

View File

@ -209,8 +209,8 @@ DWORD d3d9_opcode(DWORD bwriter_opcode) {
case BWRITERSIO_COMMENT: return D3DSIO_COMMENT;
case BWRITERSIO_END: return D3DSIO_END;
case BWRITERSIO_TEX | ( BWRITERSI_TEXLD_PROJECT << BWRITER_OPCODESPECIFICCONTROL_SHIFT ): return D3DSIO_TEX | D3DSI_TEXLD_PROJECT;
case BWRITERSIO_TEX | ( BWRITERSI_TEXLD_BIAS << BWRITER_OPCODESPECIFICCONTROL_SHIFT ): return D3DSIO_TEX | D3DSI_TEXLD_BIAS;
case BWRITERSIO_TEXLDP: return D3DSIO_TEX | D3DSI_TEXLD_PROJECT;
case BWRITERSIO_TEXLDB: return D3DSIO_TEX | D3DSI_TEXLD_BIAS;
default:
FIXME("Unhandled BWRITERSIO token %u\n", bwriter_opcode);
@ -484,8 +484,8 @@ const char *debug_print_opcode(DWORD opcode) {
case BWRITERSIO_TEXLDL: return "texldl";
case BWRITERSIO_BREAKP: return "breakp";
case BWRITERSIO_TEX | ( BWRITERSI_TEXLD_PROJECT << BWRITER_OPCODESPECIFICCONTROL_SHIFT ): return "texldp";
case BWRITERSIO_TEX | ( BWRITERSI_TEXLD_BIAS << BWRITER_OPCODESPECIFICCONTROL_SHIFT ): return "texldb";
case BWRITERSIO_TEXLDP: return "texldp";
case BWRITERSIO_TEXLDB: return "texldb";
default: return "unknown";
}

View File

@ -693,8 +693,8 @@ static const struct instr_handler_table ps_3_handlers[] = {
{BWRITERSIO_TEXLDL, instr_handler},
{BWRITERSIO_TEX, instr_handler},
{BWRITERSIO_TEX | ( BWRITERSI_TEXLD_PROJECT << BWRITER_OPCODESPECIFICCONTROL_SHIFT ), instr_handler},
{BWRITERSIO_TEX | ( BWRITERSI_TEXLD_BIAS << BWRITER_OPCODESPECIFICCONTROL_SHIFT ), instr_handler},
{BWRITERSIO_TEXLDP, instr_handler},
{BWRITERSIO_TEXLDB, instr_handler},
{BWRITERSIO_TEXKILL, instr_handler},
{BWRITERSIO_DSX, instr_handler},
{BWRITERSIO_DSY, instr_handler},

View File

@ -462,6 +462,8 @@ typedef enum _BWRITERSHADER_INSTRUCTION_OPCODE_TYPE {
BWRITERSIO_SETP,
BWRITERSIO_TEXLDL,
BWRITERSIO_BREAKP,
BWRITERSIO_TEXLDP,
BWRITERSIO_TEXLDB,
BWRITERSIO_COMMENT,
BWRITERSIO_END,
@ -589,9 +591,6 @@ typedef enum _BWRITERDECLUSAGE {
BWRITERDECLUSAGE_SAMPLE
} BWRITERDECLUSAGE;
#define BWRITER_OPCODESPECIFICCONTROL_SHIFT 16
#define BWRITER_OPCODESPECIFICCONTROL_MASK (0xff << BWRITER_OPCODESPECIFICCONTROL_SHIFT)
struct bwriter_shader *SlAssembleShader(const char *text, char **messages);
DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result);
void SlDeleteShader(struct bwriter_shader *shader);