From 04b2e0b19baa50a133aa1a13fbe158440977a088 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 3 Apr 2009 10:36:38 +0200 Subject: [PATCH] wined3d: Remove the opcode field from struct wined3d_shader_instruction. --- dlls/wined3d/arb_program_shader.c | 19 ++++++++----------- dlls/wined3d/baseshader.c | 2 -- dlls/wined3d/glsl_shader.c | 18 +++++++----------- dlls/wined3d/wined3d_private.h | 1 - 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index bcf753acac2..f32213c27f1 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -1541,9 +1541,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) int i; int nComponents = 0; struct wined3d_shader_instruction tmp_ins; - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->shader; - const SHADER_OPCODE *opcode_table = shader->baseShader.shader_ins; - DWORD shader_version = ins->reg_maps->shader_version; memset(&tmp_ins, 0, sizeof(tmp_ins)); @@ -1554,36 +1551,36 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) tmp_ins.src_addr[0] = ins->src_addr[0]; tmp_ins.src_addr[1] = ins->src_addr[1]; tmp_ins.reg_maps = ins->reg_maps; + tmp_ins.dst_count = 1; + tmp_ins.src_count = 2; switch(ins->handler_idx) { case WINED3DSIH_M4x4: nComponents = 4; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4); + tmp_ins.handler_idx = WINED3DSIH_DP4; break; case WINED3DSIH_M4x3: nComponents = 3; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4); + tmp_ins.handler_idx = WINED3DSIH_DP4; break; case WINED3DSIH_M3x4: nComponents = 4; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; case WINED3DSIH_M3x3: nComponents = 3; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; case WINED3DSIH_M3x2: nComponents = 2; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; default: + FIXME("Unhandled opcode %#x\n", ins->handler_idx); break; } - tmp_ins.handler_idx = tmp_ins.opcode->handler_idx; - tmp_ins.dst_count = tmp_ins.opcode->dst_token ? 1 : 0; - tmp_ins.src_count = tmp_ins.opcode->num_params - tmp_ins.dst_count; for (i = 0; i < nComponents; i++) { tmp_ins.dst = ((ins->dst) & ~WINED3DSP_WRITEMASK_ALL)|(WINED3DSP_WRITEMASK_0<src[1]+i; diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 71c54205d28..04626a9b1a7 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -838,8 +838,6 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer, continue; } - ins.opcode = curOpcode; - ins.handler_idx = curOpcode->handler_idx; ins.flags = opcode_token & WINED3D_OPCODESPECIFICCONTROL_MASK; ins.coissue = opcode_token & WINED3DSI_COISSUE; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 72c07ea9b67..2fcd37f72c1 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2032,9 +2032,6 @@ static void shader_glsl_mad(const struct wined3d_shader_instruction *ins) Vertex shaders to GLSL codes */ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->shader; - const SHADER_OPCODE *opcode_table = shader->baseShader.shader_ins; - DWORD shader_version = ins->reg_maps->shader_version; int i; int nComponents = 0; struct wined3d_shader_instruction tmp_ins; @@ -2048,36 +2045,35 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins) tmp_ins.src_addr[0] = ins->src_addr[0]; tmp_ins.src_addr[1] = ins->src_addr[1]; tmp_ins.reg_maps = ins->reg_maps; + tmp_ins.dst_count = 1; + tmp_ins.src_count = 2; switch(ins->handler_idx) { case WINED3DSIH_M4x4: nComponents = 4; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4); + tmp_ins.handler_idx = WINED3DSIH_DP4; break; case WINED3DSIH_M4x3: nComponents = 3; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4); + tmp_ins.handler_idx = WINED3DSIH_DP4; break; case WINED3DSIH_M3x4: nComponents = 4; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; case WINED3DSIH_M3x3: nComponents = 3; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; case WINED3DSIH_M3x2: nComponents = 2; - tmp_ins.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3); + tmp_ins.handler_idx = WINED3DSIH_DP3; break; default: break; } - tmp_ins.handler_idx = tmp_ins.opcode->handler_idx; - tmp_ins.dst_count = tmp_ins.opcode->dst_token ? 1 : 0; - tmp_ins.src_count = tmp_ins.opcode->num_params - tmp_ins.dst_count; for (i = 0; i < nComponents; ++i) { tmp_ins.dst = ((ins->dst) & ~WINED3DSP_WRITEMASK_ALL) | (WINED3DSP_WRITEMASK_0 << i); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index fe7132798b1..425b049b049 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -454,7 +454,6 @@ struct wined3d_shader_instruction { IWineD3DBaseShader *shader; const shader_reg_maps *reg_maps; - CONST SHADER_OPCODE *opcode; enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; DWORD flags; BOOL coissue;