Commit a9118ba1 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Use separate opcodes for TEXLDP and TEXLDB.

There is no reason we have to strictly follow D3D bytecode format in our intermediate representation.
parent 1d3f462f
......@@ -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
{
......
......@@ -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";
}
......
......@@ -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},
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment