From 062541c026bfa77d5d1bbd9819979a7736b7fa7f Mon Sep 17 00:00:00 2001 From: Ivan Gyurdiev Date: Mon, 9 Oct 2006 19:45:12 -0400 Subject: [PATCH] wined3d: Move D3DSIO structure into WINED3D namespace. --- dlls/wined3d/arb_program_shader.c | 24 ++-- dlls/wined3d/baseshader.c | 54 ++++----- dlls/wined3d/glsl_shader.c | 110 +++++++++--------- dlls/wined3d/pixelshader.c | 168 +++++++++++++-------------- dlls/wined3d/vertexshader.c | 112 +++++++++--------- dlls/wined3d/wined3d_private.h | 3 +- dlls/wined3d/wined3d_private_types.h | 119 +++++++++++++++++++ 7 files changed, 355 insertions(+), 235 deletions(-) create mode 100644 dlls/wined3d/wined3d_private_types.h diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index ed1bb865d3c..3412986f1e9 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -833,7 +833,7 @@ void pshader_hw_texm3x3spec(SHADER_OPCODE_ARG* arg) { current_state->current_row = 0; } -/** Handles transforming all D3DSIO_M?x? opcodes for +/** Handles transforming all WINED3DSIO_M?x? opcodes for Vertex shaders to ARB_vertex_program codes */ void vshader_hw_mnxn(SHADER_OPCODE_ARG* arg) { @@ -852,25 +852,25 @@ void vshader_hw_mnxn(SHADER_OPCODE_ARG* arg) { tmpArg.reg_maps = arg->reg_maps; switch(arg->opcode->opcode) { - case D3DSIO_M4x4: + case WINED3DSIO_M4x4: nComponents = 4; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP4]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP4]; break; - case D3DSIO_M4x3: + case WINED3DSIO_M4x3: nComponents = 3; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP4]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP4]; break; - case D3DSIO_M3x4: + case WINED3DSIO_M3x4: nComponents = 4; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; - case D3DSIO_M3x3: + case WINED3DSIO_M3x3: nComponents = 3; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; - case D3DSIO_M3x2: + case WINED3DSIO_M3x2: nComponents = 2; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; default: break; @@ -896,7 +896,7 @@ void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg) { char tmpLine[256]; unsigned int i; - if (curOpcode->opcode == D3DSIO_MOV && dst_regtype == D3DSPR_ADDR) + if (curOpcode->opcode == WINED3DSIO_MOV && dst_regtype == D3DSPR_ADDR) strcpy(tmpLine, "ARL"); else strcpy(tmpLine, curOpcode->glname); diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index eae76992c20..aa8d217b5fc 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -218,7 +218,7 @@ HRESULT shader_get_registers_used( ++pToken; /* Handle declarations */ - } else if (D3DSIO_DCL == curOpcode->opcode) { + } else if (WINED3DSIO_DCL == curOpcode->opcode) { DWORD usage = *pToken++; DWORD param = *pToken++; @@ -247,7 +247,7 @@ HRESULT shader_get_registers_used( } else if (D3DSPR_SAMPLER == regtype) reg_maps->samplers[regnum] = usage; - } else if (D3DSIO_DEF == curOpcode->opcode) { + } else if (WINED3DSIO_DEF == curOpcode->opcode) { local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant)); if (!lconst) return E_OUTOFMEMORY; @@ -256,7 +256,7 @@ HRESULT shader_get_registers_used( list_add_head(&This->baseShader.constantsF, &lconst->entry); pToken += curOpcode->num_params; - } else if (D3DSIO_DEFI == curOpcode->opcode) { + } else if (WINED3DSIO_DEFI == curOpcode->opcode) { local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant)); if (!lconst) return E_OUTOFMEMORY; @@ -265,7 +265,7 @@ HRESULT shader_get_registers_used( list_add_head(&This->baseShader.constantsI, &lconst->entry); pToken += curOpcode->num_params; - } else if (D3DSIO_DEFB == curOpcode->opcode) { + } else if (WINED3DSIO_DEFB == curOpcode->opcode) { local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant)); if (!lconst) return E_OUTOFMEMORY; @@ -275,13 +275,13 @@ HRESULT shader_get_registers_used( pToken += curOpcode->num_params; /* If there's a loop in the shader */ - } else if (D3DSIO_LOOP == curOpcode->opcode || - D3DSIO_REP == curOpcode->opcode) { + } else if (WINED3DSIO_LOOP == curOpcode->opcode || + WINED3DSIO_REP == curOpcode->opcode) { reg_maps->loop = 1; pToken += curOpcode->num_params; /* For subroutine prototypes */ - } else if (D3DSIO_LABEL == curOpcode->opcode) { + } else if (WINED3DSIO_LABEL == curOpcode->opcode) { DWORD snum = *pToken & D3DSP_REGNUM_MASK; reg_maps->labels[snum] = 1; @@ -293,10 +293,10 @@ HRESULT shader_get_registers_used( /* Declare 1.X samplers implicitly, based on the destination reg. number */ if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && - (D3DSIO_TEX == curOpcode->opcode || - D3DSIO_TEXBEM == curOpcode->opcode || - D3DSIO_TEXM3x2TEX == curOpcode->opcode || - D3DSIO_TEXM3x3TEX == curOpcode->opcode)) { + (WINED3DSIO_TEX == curOpcode->opcode || + WINED3DSIO_TEXBEM == curOpcode->opcode || + WINED3DSIO_TEXM3x2TEX == curOpcode->opcode || + WINED3DSIO_TEXM3x3TEX == curOpcode->opcode)) { /* Fake sampler usage, only set reserved bit and ttype */ DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK; @@ -330,8 +330,8 @@ HRESULT shader_get_registers_used( } } else if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && - (D3DSIO_TEXM3x3SPEC == curOpcode->opcode || - D3DSIO_TEXM3x3VSPEC == curOpcode->opcode)) { + (WINED3DSIO_TEXM3x3SPEC == curOpcode->opcode || + WINED3DSIO_TEXM3x3VSPEC == curOpcode->opcode)) { /* 3D sampler usage, only set reserved bit and ttype * FIXME: This could be either Cube or Volume, but we wouldn't know unless @@ -340,7 +340,7 @@ HRESULT shader_get_registers_used( DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK; reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_CUBE; } else if (D3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && - (D3DSIO_TEXDP3TEX == curOpcode->opcode)) { + (WINED3DSIO_TEXDP3TEX == curOpcode->opcode)) { /* 1D Sampler usage */ DWORD sampler_code = *pToken & D3DSP_REGNUM_MASK; @@ -724,13 +724,13 @@ void shader_generate_main( pToken += shader_skip_unrecognized(iface, pToken); /* Nothing to do */ - } else if (D3DSIO_DCL == curOpcode->opcode || - D3DSIO_NOP == curOpcode->opcode || - D3DSIO_DEF == curOpcode->opcode || - D3DSIO_DEFI == curOpcode->opcode || - D3DSIO_DEFB == curOpcode->opcode || - D3DSIO_PHASE == curOpcode->opcode || - D3DSIO_RET == curOpcode->opcode) { + } else if (WINED3DSIO_DCL == curOpcode->opcode || + WINED3DSIO_NOP == curOpcode->opcode || + WINED3DSIO_DEF == curOpcode->opcode || + WINED3DSIO_DEFI == curOpcode->opcode || + WINED3DSIO_DEFB == curOpcode->opcode || + WINED3DSIO_PHASE == curOpcode->opcode || + WINED3DSIO_RET == curOpcode->opcode) { pToken += shader_skip_opcode(This, curOpcode, hw_arg.opcode_token); @@ -851,7 +851,7 @@ void shader_trace_init( len += tokens_read; } else { - if (curOpcode->opcode == D3DSIO_DCL) { + if (curOpcode->opcode == WINED3DSIO_DCL) { DWORD usage = *pToken; DWORD param = *(pToken + 1); @@ -863,7 +863,7 @@ void shader_trace_init( pToken += 2; len += 2; - } else if (curOpcode->opcode == D3DSIO_DEF) { + } else if (curOpcode->opcode == WINED3DSIO_DEF) { unsigned int offset = shader_get_float_offset(*pToken); @@ -875,7 +875,7 @@ void shader_trace_init( pToken += 5; len += 5; - } else if (curOpcode->opcode == D3DSIO_DEFI) { + } else if (curOpcode->opcode == WINED3DSIO_DEFI) { TRACE("defi i%u = %d, %d, %d, %d", *pToken & D3DSP_REGNUM_MASK, *(pToken + 1), @@ -886,7 +886,7 @@ void shader_trace_init( pToken += 5; len += 5; - } else if (curOpcode->opcode == D3DSIO_DEFB) { + } else if (curOpcode->opcode == WINED3DSIO_DEFB) { TRACE("defb b%u = %s", *pToken & D3DSP_REGNUM_MASK, *(pToken + 1)? "true": "false"); @@ -909,8 +909,8 @@ void shader_trace_init( TRACE("%s", curOpcode->name); - if (curOpcode->opcode == D3DSIO_IFC || - curOpcode->opcode == D3DSIO_BREAKC) { + if (curOpcode->opcode == WINED3DSIO_IFC || + curOpcode->opcode == WINED3DSIO_BREAKC) { DWORD op = (opcode_token & INST_CONTROLS_MASK) >> INST_CONTROLS_SHIFT; switch (op) { diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0fe600517cd..a8226d63d73 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -534,7 +534,7 @@ static void shader_glsl_gen_modifier ( out_str[0] = 0; - if (instr == D3DSIO_TEXKILL) + if (instr == WINED3DSIO_TEXKILL) return; switch (instr & D3DSP_SRCMOD_MASK) { @@ -881,9 +881,9 @@ void shader_glsl_arith(SHADER_OPCODE_ARG* arg) { /* Determine the GLSL operator to use based on the opcode */ switch (curOpcode->opcode) { - case D3DSIO_MUL: strcat(tmpLine, " * "); break; - case D3DSIO_ADD: strcat(tmpLine, " + "); break; - case D3DSIO_SUB: strcat(tmpLine, " - "); break; + case WINED3DSIO_MUL: strcat(tmpLine, " * "); break; + case WINED3DSIO_ADD: strcat(tmpLine, " + "); break; + case WINED3DSIO_SUB: strcat(tmpLine, " - "); break; default: FIXME("Opcode %s not yet handled in GLSL\n", curOpcode->name); break; @@ -891,7 +891,7 @@ void shader_glsl_arith(SHADER_OPCODE_ARG* arg) { shader_addline(buffer, "%svec4(%s))%s;\n", tmpLine, src1_str, dst_mask); } -/* Process the D3DSIO_MOV opcode using GLSL (dst = src) */ +/* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ void shader_glsl_mov(SHADER_OPCODE_ARG* arg) { SHADER_BUFFER* buffer = arg->buffer; @@ -924,7 +924,7 @@ void shader_glsl_dot(SHADER_OPCODE_ARG* arg) { shader_glsl_add_dst(arg->dst, dst_reg, dst_mask, tmpDest); /* Need to cast the src vectors to vec3 for dp3, and vec4 for dp4 */ - if (curOpcode->opcode == D3DSIO_DP4) + if (curOpcode->opcode == WINED3DSIO_DP4) strcpy(cast, "vec4("); else strcpy(cast, "vec3("); @@ -951,20 +951,20 @@ void shader_glsl_map2gl(SHADER_OPCODE_ARG* arg) { /* Determine the GLSL function to use based on the opcode */ /* TODO: Possibly make this a table for faster lookups */ switch (curOpcode->opcode) { - case D3DSIO_MIN: strcat(tmpLine, "min"); break; - case D3DSIO_MAX: strcat(tmpLine, "max"); break; - case D3DSIO_RSQ: strcat(tmpLine, "inversesqrt"); break; - case D3DSIO_ABS: strcat(tmpLine, "abs"); break; - case D3DSIO_FRC: strcat(tmpLine, "fract"); break; - case D3DSIO_POW: strcat(tmpLine, "pow"); break; - case D3DSIO_CRS: strcat(tmpLine, "cross"); break; - case D3DSIO_NRM: strcat(tmpLine, "normalize"); break; - case D3DSIO_LOGP: - case D3DSIO_LOG: strcat(tmpLine, "log2"); break; - case D3DSIO_EXP: strcat(tmpLine, "exp2"); break; - case D3DSIO_SGE: strcat(tmpLine, "greaterThanEqual"); break; - case D3DSIO_SLT: strcat(tmpLine, "lessThan"); break; - case D3DSIO_SGN: strcat(tmpLine, "sign"); break; + case WINED3DSIO_MIN: strcat(tmpLine, "min"); break; + case WINED3DSIO_MAX: strcat(tmpLine, "max"); break; + case WINED3DSIO_RSQ: strcat(tmpLine, "inversesqrt"); break; + case WINED3DSIO_ABS: strcat(tmpLine, "abs"); break; + case WINED3DSIO_FRC: strcat(tmpLine, "fract"); break; + case WINED3DSIO_POW: strcat(tmpLine, "pow"); break; + case WINED3DSIO_CRS: strcat(tmpLine, "cross"); break; + case WINED3DSIO_NRM: strcat(tmpLine, "normalize"); break; + case WINED3DSIO_LOGP: + case WINED3DSIO_LOG: strcat(tmpLine, "log2"); break; + case WINED3DSIO_EXP: strcat(tmpLine, "exp2"); break; + case WINED3DSIO_SGE: strcat(tmpLine, "greaterThanEqual"); break; + case WINED3DSIO_SLT: strcat(tmpLine, "lessThan"); break; + case WINED3DSIO_SGN: strcat(tmpLine, "sign"); break; default: FIXME("Opcode %s not yet handled in GLSL\n", curOpcode->name); break; @@ -988,7 +988,7 @@ void shader_glsl_map2gl(SHADER_OPCODE_ARG* arg) { } -/** Process the D3DSIO_EXPP instruction in GLSL: +/** Process the WINED3DSIO_EXPP instruction in GLSL: * For shader model 1.x, do the following (and honor the writemask, so use a temporary variable): * dst.x = 2^(floor(src)) * dst.y = src - floor(src) @@ -1057,8 +1057,8 @@ void shader_glsl_compare(SHADER_OPCODE_ARG* arg) { shader_glsl_add_param(arg, arg->src[1], arg->src_addr[1], TRUE, src1_reg, src1_mask, src1_str); switch (arg->opcode->opcode) { - case D3DSIO_SLT: strcpy(compareStr, "<"); break; - case D3DSIO_SGE: strcpy(compareStr, ">="); break; + case WINED3DSIO_SLT: strcpy(compareStr, "<"); break; + case WINED3DSIO_SGE: strcpy(compareStr, ">="); break; default: FIXME("Can't handle opcode %s\n", arg->opcode->name); } @@ -1102,7 +1102,7 @@ void shader_glsl_cnd(SHADER_OPCODE_ARG* arg) { tmpLine, src0_str, src1_str, src2_str, dst_mask); } -/** GLSL code generation for D3DSIO_MAD: Multiply the first 2 opcodes, then add the last */ +/** GLSL code generation for WINED3DSIO_MAD: Multiply the first 2 opcodes, then add the last */ void shader_glsl_mad(SHADER_OPCODE_ARG* arg) { char tmpLine[256]; @@ -1120,7 +1120,7 @@ void shader_glsl_mad(SHADER_OPCODE_ARG* arg) { tmpLine, src0_str, src1_str, src2_str, dst_mask); } -/** Handles transforming all D3DSIO_M?x? opcodes for +/** Handles transforming all WINED3DSIO_M?x? opcodes for Vertex shaders to GLSL codes */ void shader_glsl_mnxn(SHADER_OPCODE_ARG* arg) { int i; @@ -1138,25 +1138,25 @@ void shader_glsl_mnxn(SHADER_OPCODE_ARG* arg) { tmpArg.reg_maps = arg->reg_maps; switch(arg->opcode->opcode) { - case D3DSIO_M4x4: + case WINED3DSIO_M4x4: nComponents = 4; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP4]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP4]; break; - case D3DSIO_M4x3: + case WINED3DSIO_M4x3: nComponents = 3; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP4]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP4]; break; - case D3DSIO_M3x4: + case WINED3DSIO_M3x4: nComponents = 4; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; - case D3DSIO_M3x3: + case WINED3DSIO_M3x3: nComponents = 3; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; - case D3DSIO_M3x2: + case WINED3DSIO_M3x2: nComponents = 2; - tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[D3DSIO_DP3]; + tmpArg.opcode = &IWineD3DVertexShaderImpl_shader_ins[WINED3DSIO_DP3]; break; default: break; @@ -1192,7 +1192,7 @@ void shader_glsl_lrp(SHADER_OPCODE_ARG* arg) { tmpLine, src2_str, src0_str, src1_str, src2_str, dst_mask); } -/** Process the D3DSIO_LIT instruction in GLSL: +/** Process the WINED3DSIO_LIT instruction in GLSL: * dst.x = dst.w = 1.0 * dst.y = (src0.x > 0) ? src0.x * dst.z = (src0.x > 0) ? ((src0.y > 0) ? pow(src0.y, src.w) : 0) : 0 @@ -1212,7 +1212,7 @@ void shader_glsl_lit(SHADER_OPCODE_ARG* arg) { dst_str, src0_reg, src0_reg, src0_reg, src0_reg, src0_reg, src0_reg, dst_mask); } -/** Process the D3DSIO_DST instruction in GLSL: +/** Process the WINED3DSIO_DST instruction in GLSL: * dst.x = 1.0 * dst.y = src0.x * src0.y * dst.z = src0.z @@ -1232,7 +1232,7 @@ void shader_glsl_dst(SHADER_OPCODE_ARG* arg) { dst_str, src0_reg, src1_reg, src0_reg, src1_reg, dst_mask); } -/** Process the D3DSIO_SINCOS instruction in GLSL: +/** Process the WINED3DSIO_SINCOS instruction in GLSL: * VS 2.0 requires that specific cosine and sine constants be passed to this instruction so the hardware * can handle it. But, these functions are built-in for GLSL, so we can just ignore the last 2 params. * @@ -1254,7 +1254,7 @@ void shader_glsl_sincos(SHADER_OPCODE_ARG* arg) { dst_str, src0_str, src0_str, dst_reg, dst_reg, dst_mask); } -/** Process the D3DSIO_LOOP instruction in GLSL: +/** Process the WINED3DSIO_LOOP instruction in GLSL: * Start a for() loop where src0.y is the initial value of aL, * increment aL by src0.z for a total of src0.x iterations. * Need to use a temporary variable for this operation. @@ -1454,7 +1454,7 @@ void pshader_glsl_texcoord(SHADER_OPCODE_ARG* arg) { } } -/** Process the D3DSIO_TEXDP3TEX instruction in GLSL: +/** Process the WINED3DSIO_TEXDP3TEX instruction in GLSL: * Take a 3-component dot product of the TexCoord[dstreg] and src, * then perform a 1D texture lookup from stage dstregnum, place into dst. */ void pshader_glsl_texdp3tex(SHADER_OPCODE_ARG* arg) { @@ -1471,7 +1471,7 @@ void pshader_glsl_texdp3tex(SHADER_OPCODE_ARG* arg) { shader_addline(arg->buffer, "%s = vec4(texture1D(Psampler%u, tmp0.x))%s;\n", dst_str, dstreg, dst_mask); } -/** Process the D3DSIO_TEXDP3 instruction in GLSL: +/** Process the WINED3DSIO_TEXDP3 instruction in GLSL: * Take a 3-component dot product of the TexCoord[dstreg] and src. */ void pshader_glsl_texdp3(SHADER_OPCODE_ARG* arg) { @@ -1487,7 +1487,7 @@ void pshader_glsl_texdp3(SHADER_OPCODE_ARG* arg) { dst_str, dstreg, src0_str, dst_mask); } -/** Process the D3DSIO_TEXDEPTH instruction in GLSL: +/** Process the WINED3DSIO_TEXDEPTH instruction in GLSL: * Calculate the depth as dst.x / dst.y */ void pshader_glsl_texdepth(SHADER_OPCODE_ARG* arg) { @@ -1500,7 +1500,7 @@ void pshader_glsl_texdepth(SHADER_OPCODE_ARG* arg) { shader_addline(arg->buffer, "gl_FragDepth = %s.x / %s.y;\n", dst_reg, dst_reg); } -/** Process the D3DSIO_TEXM3X2DEPTH instruction in GLSL: +/** Process the WINED3DSIO_TEXM3X2DEPTH instruction in GLSL: * Last row of a 3x2 matrix multiply, use the result to calculate the depth: * Calculate tmp0.y = TexCoord[dstreg] . src.xyz; (tmp0.x has already been calculated) * depth = (tmp0.y == 0.0) ? 1.0 : tmp0.x / tmp0.y @@ -1519,7 +1519,7 @@ void pshader_glsl_texm3x2depth(SHADER_OPCODE_ARG* arg) { shader_addline(arg->buffer, "gl_FragDepth = vec4((tmp0.y == 0.0) ? 1.0 : tmp0.x / tmp0.y)%s;\n", dst_str, dst_name); } -/** Process the D3DSIO_TEXM3X2PAD instruction in GLSL +/** Process the WINED3DSIO_TEXM3X2PAD instruction in GLSL * Calculate the 1st of a 2-row matrix multiplication. */ void pshader_glsl_texm3x2pad(SHADER_OPCODE_ARG* arg) { @@ -1533,7 +1533,7 @@ void pshader_glsl_texm3x2pad(SHADER_OPCODE_ARG* arg) { shader_addline(buffer, "tmp0.x = dot(vec3(T%u), vec3(%s));\n", reg, src0_str); } -/** Process the D3DSIO_TEXM3X3PAD instruction in GLSL +/** Process the WINED3DSIO_TEXM3X3PAD instruction in GLSL * Calculate the 1st or 2nd row of a 3-row matrix multiplication. */ void pshader_glsl_texm3x3pad(SHADER_OPCODE_ARG* arg) { @@ -1565,7 +1565,7 @@ void pshader_glsl_texm3x2tex(SHADER_OPCODE_ARG* arg) { shader_addline(buffer, "T%u = texture2D(Psampler%u, tmp0.st);\n", reg, reg); } -/** Process the D3DSIO_TEXM3X3TEX instruction in GLSL +/** Process the WINED3DSIO_TEXM3X3TEX instruction in GLSL * Perform the 3rd row of a 3x3 matrix multiply, then sample the texture using the calculate coordinates */ void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) { @@ -1596,7 +1596,7 @@ void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) { current_state->current_row = 0; } -/** Process the D3DSIO_TEXM3X3 instruction in GLSL +/** Process the WINED3DSIO_TEXM3X3 instruction in GLSL * Perform the 3rd row of a 3x3 matrix multiply */ void pshader_glsl_texm3x3(SHADER_OPCODE_ARG* arg) { @@ -1614,7 +1614,7 @@ void pshader_glsl_texm3x3(SHADER_OPCODE_ARG* arg) { current_state->current_row = 0; } -/** Process the D3DSIO_TEXM3X3SPEC instruction in GLSL +/** Process the WINED3DSIO_TEXM3X3SPEC instruction in GLSL * Peform the final texture lookup based on the previous 2 3x3 matrix multiplies */ void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) { @@ -1652,7 +1652,7 @@ void pshader_glsl_texm3x3spec(SHADER_OPCODE_ARG* arg) { current_state->current_row = 0; } -/** Process the D3DSIO_TEXM3X3VSPEC instruction in GLSL +/** Process the WINED3DSIO_TEXM3X3VSPEC instruction in GLSL * Peform the final texture lookup based on the previous 2 3x3 matrix multiplies */ void pshader_glsl_texm3x3vspec(SHADER_OPCODE_ARG* arg) { @@ -1688,7 +1688,7 @@ void pshader_glsl_texm3x3vspec(SHADER_OPCODE_ARG* arg) { current_state->current_row = 0; } -/** Process the D3DSIO_TEXBEM instruction in GLSL. +/** Process the WINED3DSIO_TEXBEM instruction in GLSL. * Apply a fake bump map transform. * FIXME: Should apply the BUMPMAPENV matrix. For now, just sample the texture */ void pshader_glsl_texbem(SHADER_OPCODE_ARG* arg) { @@ -1701,7 +1701,7 @@ void pshader_glsl_texbem(SHADER_OPCODE_ARG* arg) { reg1, reg1, reg1, reg2); } -/** Process the D3DSIO_TEXREG2AR instruction in GLSL +/** Process the WINED3DSIO_TEXREG2AR instruction in GLSL * Sample 2D texture at dst using the alpha & red (wx) components of src as texture coordinates */ void pshader_glsl_texreg2ar(SHADER_OPCODE_ARG* arg) { @@ -1719,7 +1719,7 @@ void pshader_glsl_texreg2ar(SHADER_OPCODE_ARG* arg) { tmpLine, src0_regnum, dst_reg, dst_mask); } -/** Process the D3DSIO_TEXREG2GB instruction in GLSL +/** Process the WINED3DSIO_TEXREG2GB instruction in GLSL * Sample 2D texture at dst using the green & blue (yz) components of src as texture coordinates */ void pshader_glsl_texreg2gb(SHADER_OPCODE_ARG* arg) { @@ -1737,7 +1737,7 @@ void pshader_glsl_texreg2gb(SHADER_OPCODE_ARG* arg) { tmpLine, src0_regnum, dst_reg, dst_mask); } -/** Process the D3DSIO_TEXREG2RGB instruction in GLSL +/** Process the WINED3DSIO_TEXREG2RGB instruction in GLSL * Sample texture at dst using the rgb (xyz) components of src as texture coordinates */ void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg) { @@ -1766,7 +1766,7 @@ void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg) { tmpLine, dimensions, src0_regnum, dst_reg, (stype == WINED3DSTT_2D) ? "xy" : "xyz", dst_mask); } -/** Process the D3DSIO_TEXKILL instruction in GLSL. +/** Process the WINED3DSIO_TEXKILL instruction in GLSL. * If any of the first 3 components are < 0, discard this pixel */ void pshader_glsl_texkill(SHADER_OPCODE_ARG* arg) { @@ -1776,7 +1776,7 @@ void pshader_glsl_texkill(SHADER_OPCODE_ARG* arg) { shader_addline(arg->buffer, "if (any(lessThan(%s.xyz, vec3(0.0)))) discard;\n", dst_name); } -/** Process the D3DSIO_DP2ADD instruction in GLSL. +/** Process the WINED3DSIO_DP2ADD instruction in GLSL. * dst = dot2(src0, src1) + src2 */ void pshader_glsl_dp2add(SHADER_OPCODE_ARG* arg) { diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index de4d9834b4a..27e1ce4f4f0 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -621,32 +621,32 @@ static void pshader_texldl(WINED3DSHADERVECTOR* d) { CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = { /* Arithmethic */ - {D3DSIO_NOP, "nop", "NOP", 0, 0, pshader_nop, pshader_hw_map2gl, NULL, 0, 0}, - {D3DSIO_MOV, "mov", "MOV", 1, 2, pshader_mov, pshader_hw_map2gl, shader_glsl_mov, 0, 0}, - {D3DSIO_ADD, "add", "ADD", 1, 3, pshader_add, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_SUB, "sub", "SUB", 1, 3, pshader_sub, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_MAD, "mad", "MAD", 1, 4, pshader_mad, pshader_hw_map2gl, shader_glsl_mad, 0, 0}, - {D3DSIO_MUL, "mul", "MUL", 1, 3, pshader_mul, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_RCP, "rcp", "RCP", 1, 2, pshader_rcp, pshader_hw_map2gl, shader_glsl_rcp, 0, 0}, - {D3DSIO_RSQ, "rsq", "RSQ", 1, 2, pshader_rsq, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_DP3, "dp3", "DP3", 1, 3, pshader_dp3, pshader_hw_map2gl, shader_glsl_dot, 0, 0}, - {D3DSIO_DP4, "dp4", "DP4", 1, 3, pshader_dp4, pshader_hw_map2gl, shader_glsl_dot, 0, 0}, - {D3DSIO_MIN, "min", "MIN", 1, 3, pshader_min, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_MAX, "max", "MAX", 1, 3, pshader_max, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_SLT, "slt", "SLT", 1, 3, pshader_slt, pshader_hw_map2gl, shader_glsl_compare, 0, 0}, - {D3DSIO_SGE, "sge", "SGE", 1, 3, pshader_sge, pshader_hw_map2gl, shader_glsl_compare, 0, 0}, - {D3DSIO_ABS, "abs", "ABS", 1, 2, pshader_abs, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_EXP, "exp", "EX2", 1, 2, pshader_exp, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_LOG, "log", "LG2", 1, 2, pshader_log, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_EXPP, "expp", "EXP", 1, 2, pshader_expp, pshader_hw_map2gl, shader_glsl_expp, 0, 0}, - {D3DSIO_LOGP, "logp", "LOG", 1, 2, pshader_logp, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_DST, "dst", "DST", 1, 3, pshader_dst, pshader_hw_map2gl, shader_glsl_dst, 0, 0}, - {D3DSIO_LRP, "lrp", "LRP", 1, 4, pshader_lrp, pshader_hw_map2gl, shader_glsl_lrp, 0, 0}, - {D3DSIO_FRC, "frc", "FRC", 1, 2, pshader_frc, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_CND, "cnd", NULL, 1, 4, pshader_cnd, pshader_hw_cnd, shader_glsl_cnd, D3DPS_VERSION(1,1), D3DPS_VERSION(1,4)}, - {D3DSIO_CMP, "cmp", NULL, 1, 4, pshader_cmp, pshader_hw_cmp, shader_glsl_cmp, D3DPS_VERSION(1,2), D3DPS_VERSION(3,0)}, - {D3DSIO_POW, "pow", "POW", 1, 3, pshader_pow, NULL, shader_glsl_map2gl, 0, 0}, - {D3DSIO_CRS, "crs", "XPS", 1, 3, pshader_crs, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_NOP, "nop", "NOP", 0, 0, pshader_nop, pshader_hw_map2gl, NULL, 0, 0}, + {WINED3DSIO_MOV, "mov", "MOV", 1, 2, pshader_mov, pshader_hw_map2gl, shader_glsl_mov, 0, 0}, + {WINED3DSIO_ADD, "add", "ADD", 1, 3, pshader_add, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_SUB, "sub", "SUB", 1, 3, pshader_sub, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_MAD, "mad", "MAD", 1, 4, pshader_mad, pshader_hw_map2gl, shader_glsl_mad, 0, 0}, + {WINED3DSIO_MUL, "mul", "MUL", 1, 3, pshader_mul, pshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_RCP, "rcp", "RCP", 1, 2, pshader_rcp, pshader_hw_map2gl, shader_glsl_rcp, 0, 0}, + {WINED3DSIO_RSQ, "rsq", "RSQ", 1, 2, pshader_rsq, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_DP3, "dp3", "DP3", 1, 3, pshader_dp3, pshader_hw_map2gl, shader_glsl_dot, 0, 0}, + {WINED3DSIO_DP4, "dp4", "DP4", 1, 3, pshader_dp4, pshader_hw_map2gl, shader_glsl_dot, 0, 0}, + {WINED3DSIO_MIN, "min", "MIN", 1, 3, pshader_min, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_MAX, "max", "MAX", 1, 3, pshader_max, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_SLT, "slt", "SLT", 1, 3, pshader_slt, pshader_hw_map2gl, shader_glsl_compare, 0, 0}, + {WINED3DSIO_SGE, "sge", "SGE", 1, 3, pshader_sge, pshader_hw_map2gl, shader_glsl_compare, 0, 0}, + {WINED3DSIO_ABS, "abs", "ABS", 1, 2, pshader_abs, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_EXP, "exp", "EX2", 1, 2, pshader_exp, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_LOG, "log", "LG2", 1, 2, pshader_log, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_EXPP, "expp", "EXP", 1, 2, pshader_expp, pshader_hw_map2gl, shader_glsl_expp, 0, 0}, + {WINED3DSIO_LOGP, "logp", "LOG", 1, 2, pshader_logp, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_DST, "dst", "DST", 1, 3, pshader_dst, pshader_hw_map2gl, shader_glsl_dst, 0, 0}, + {WINED3DSIO_LRP, "lrp", "LRP", 1, 4, pshader_lrp, pshader_hw_map2gl, shader_glsl_lrp, 0, 0}, + {WINED3DSIO_FRC, "frc", "FRC", 1, 2, pshader_frc, pshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_CND, "cnd", NULL, 1, 4, pshader_cnd, pshader_hw_cnd, shader_glsl_cnd, D3DPS_VERSION(1,1), D3DPS_VERSION(1,4)}, + {WINED3DSIO_CMP, "cmp", NULL, 1, 4, pshader_cmp, pshader_hw_cmp, shader_glsl_cmp, D3DPS_VERSION(1,2), D3DPS_VERSION(3,0)}, + {WINED3DSIO_POW, "pow", "POW", 1, 3, pshader_pow, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_CRS, "crs", "XPS", 1, 3, pshader_crs, NULL, shader_glsl_map2gl, 0, 0}, /* TODO: xyz normalise can be performed as VS_ARB using one temporary register, DP3 tmp , vec, vec; RSQ tmp, tmp.x; @@ -657,75 +657,75 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = { MUL vec, vec, tmp; */ - {D3DSIO_NRM, "nrm", NULL, 1, 2, pshader_nrm, NULL, shader_glsl_map2gl, 0, 0}, - {D3DSIO_SINCOS, "sincos", NULL, 1, 4, pshader_sincos2, NULL, shader_glsl_sincos, D3DPS_VERSION(2,0), D3DPS_VERSION(2,0)}, - {D3DSIO_SINCOS, "sincos", NULL, 1, 2, pshader_sincos3, NULL, shader_glsl_sincos, D3DPS_VERSION(3,0), -1}, + {WINED3DSIO_NRM, "nrm", NULL, 1, 2, pshader_nrm, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, pshader_sincos2, NULL, shader_glsl_sincos, D3DPS_VERSION(2,0), D3DPS_VERSION(2,0)}, + {WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, pshader_sincos3, NULL, shader_glsl_sincos, D3DPS_VERSION(3,0), -1}, /* TODO: dp2add can be made out of multiple instuctions */ - {D3DSIO_DP2ADD, "dp2add", GLNAME_REQUIRE_GLSL, 1, 4, pshader_dp2add, NULL, pshader_glsl_dp2add, D3DPS_VERSION(2,0), -1}, + {WINED3DSIO_DP2ADD, "dp2add", GLNAME_REQUIRE_GLSL, 1, 4, pshader_dp2add, NULL, pshader_glsl_dp2add, D3DPS_VERSION(2,0), -1}, /* Matrix */ - {D3DSIO_M4x4, "m4x4", "undefined", 1, 3, pshader_m4x4, NULL, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M4x3, "m4x3", "undefined", 1, 3, pshader_m4x3, NULL, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x4, "m3x4", "undefined", 1, 3, pshader_m3x4, NULL, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x3, "m3x3", "undefined", 1, 3, pshader_m3x3, NULL, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x2, "m3x2", "undefined", 1, 3, pshader_m3x2, NULL, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, pshader_m4x4, NULL, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M4x3, "m4x3", "undefined", 1, 3, pshader_m4x3, NULL, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x4, "m3x4", "undefined", 1, 3, pshader_m3x4, NULL, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x3, "m3x3", "undefined", 1, 3, pshader_m3x3, NULL, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x2, "m3x2", "undefined", 1, 3, pshader_m3x2, NULL, shader_glsl_mnxn, 0, 0}, /* Register declarations */ - {D3DSIO_DCL, "dcl", NULL, 0, 2, pshader_dcl, NULL, NULL, 0, 0}, + {WINED3DSIO_DCL, "dcl", NULL, 0, 2, pshader_dcl, NULL, NULL, 0, 0}, /* Flow control - requires GLSL or software shaders */ - {D3DSIO_REP , "rep", NULL, 0, 1, pshader_rep, NULL, shader_glsl_rep, D3DPS_VERSION(2,1), -1}, - {D3DSIO_ENDREP, "endrep", NULL, 0, 0, pshader_endrep, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1}, - {D3DSIO_IF, "if", NULL, 0, 1, pshader_if, NULL, shader_glsl_if, D3DPS_VERSION(2,1), -1}, - {D3DSIO_IFC, "ifc", NULL, 0, 2, pshader_ifc, NULL, shader_glsl_ifc, D3DPS_VERSION(2,1), -1}, - {D3DSIO_ELSE, "else", NULL, 0, 0, pshader_else, NULL, shader_glsl_else, D3DPS_VERSION(2,1), -1}, - {D3DSIO_ENDIF, "endif", NULL, 0, 0, pshader_endif, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1}, - {D3DSIO_BREAK, "break", NULL, 0, 0, pshader_break, NULL, shader_glsl_break, D3DPS_VERSION(2,1), -1}, - {D3DSIO_BREAKC, "breakc", NULL, 0, 2, pshader_breakc, NULL, shader_glsl_breakc, D3DPS_VERSION(2,1), -1}, - {D3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, pshader_breakp, NULL, NULL, 0, 0}, - {D3DSIO_CALL, "call", NULL, 0, 1, pshader_call, NULL, shader_glsl_call, D3DPS_VERSION(2,1), -1}, - {D3DSIO_CALLNZ, "callnz", NULL, 0, 2, pshader_callnz, NULL, shader_glsl_callnz, D3DPS_VERSION(2,1), -1}, - {D3DSIO_LOOP, "loop", NULL, 0, 2, pshader_loop, NULL, shader_glsl_loop, D3DPS_VERSION(3,0), -1}, - {D3DSIO_RET, "ret", NULL, 0, 0, pshader_ret, NULL, NULL, D3DPS_VERSION(2,1), -1}, - {D3DSIO_ENDLOOP, "endloop", NULL, 0, 0, pshader_endloop, NULL, shader_glsl_end, D3DPS_VERSION(3,0), -1}, - {D3DSIO_LABEL, "label", NULL, 0, 1, pshader_label, NULL, shader_glsl_label, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_REP , "rep", NULL, 0, 1, pshader_rep, NULL, shader_glsl_rep, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, pshader_endrep, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_IF, "if", NULL, 0, 1, pshader_if, NULL, shader_glsl_if, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_IFC, "ifc", NULL, 0, 2, pshader_ifc, NULL, shader_glsl_ifc, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_ELSE, "else", NULL, 0, 0, pshader_else, NULL, shader_glsl_else, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_ENDIF, "endif", NULL, 0, 0, pshader_endif, NULL, shader_glsl_end, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_BREAK, "break", NULL, 0, 0, pshader_break, NULL, shader_glsl_break, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, pshader_breakc, NULL, shader_glsl_breakc, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, pshader_breakp, NULL, NULL, 0, 0}, + {WINED3DSIO_CALL, "call", NULL, 0, 1, pshader_call, NULL, shader_glsl_call, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, pshader_callnz, NULL, shader_glsl_callnz, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_LOOP, "loop", NULL, 0, 2, pshader_loop, NULL, shader_glsl_loop, D3DPS_VERSION(3,0), -1}, + {WINED3DSIO_RET, "ret", NULL, 0, 0, pshader_ret, NULL, NULL, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, pshader_endloop, NULL, shader_glsl_end, D3DPS_VERSION(3,0), -1}, + {WINED3DSIO_LABEL, "label", NULL, 0, 1, pshader_label, NULL, shader_glsl_label, D3DPS_VERSION(2,1), -1}, /* Constant definitions */ - {D3DSIO_DEF, "def", "undefined", 1, 5, pshader_def, NULL, NULL, 0, 0}, - {D3DSIO_DEFB, "defb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_defb, NULL, NULL, 0, 0}, - {D3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, pshader_defi, NULL, NULL, 0, 0}, + {WINED3DSIO_DEF, "def", "undefined", 1, 5, pshader_def, NULL, NULL, 0, 0}, + {WINED3DSIO_DEFB, "defb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_defb, NULL, NULL, 0, 0}, + {WINED3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, pshader_defi, NULL, NULL, 0, 0}, /* Texture */ - {D3DSIO_TEXCOORD, "texcoord", "undefined", 1, 1, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, 0, D3DPS_VERSION(1,3)}, - {D3DSIO_TEXCOORD, "texcrd", "undefined", 1, 2, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, - {D3DSIO_TEXKILL, "texkill", "KIL", 1, 1, pshader_texkill, pshader_hw_map2gl, pshader_glsl_texkill, D3DPS_VERSION(1,0), D3DPS_VERSION(3,0)}, - {D3DSIO_TEX, "tex", "undefined", 1, 1, pshader_tex, pshader_hw_tex, pshader_glsl_tex, 0, D3DPS_VERSION(1,3)}, - {D3DSIO_TEX, "texld", "undefined", 1, 2, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, - {D3DSIO_TEX, "texld", "undefined", 1, 3, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(2,0), -1}, - {D3DSIO_TEXBEM, "texbem", "undefined", 1, 2, pshader_texbem, pshader_hw_texbem, pshader_glsl_texbem, 0, D3DPS_VERSION(1,3)}, - {D3DSIO_TEXBEML, "texbeml", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texbeml, NULL, NULL, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXREG2AR,"texreg2ar","undefined", 1, 2, pshader_texreg2ar, pshader_hw_texreg2ar, pshader_glsl_texreg2ar, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXREG2GB,"texreg2gb","undefined", 1, 2, pshader_texreg2gb, pshader_hw_texreg2gb, pshader_glsl_texreg2gb, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXREG2RGB, "texreg2rgb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texreg2rgb, NULL, pshader_glsl_texreg2rgb, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x2PAD, "texm3x2pad", "undefined", 1, 2, pshader_texm3x2pad, pshader_hw_texm3x2pad, pshader_glsl_texm3x2pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x2TEX, "texm3x2tex", "undefined", 1, 2, pshader_texm3x2tex, pshader_hw_texm3x2tex, pshader_glsl_texm3x2tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x3PAD, "texm3x3pad", "undefined", 1, 2, pshader_texm3x3pad, pshader_hw_texm3x3pad, pshader_glsl_texm3x3pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x3DIFF, "texm3x3diff", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3diff, NULL, NULL, D3DPS_VERSION(0,0), D3DPS_VERSION(0,0)}, - {D3DSIO_TEXM3x3SPEC, "texm3x3spec", "undefined", 1, 3, pshader_texm3x3spec, pshader_hw_texm3x3spec, pshader_glsl_texm3x3spec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x3VSPEC, "texm3x3vspec", "undefined", 1, 2, pshader_texm3x3vspec, pshader_hw_texm3x3vspec, pshader_glsl_texm3x3vspec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x3TEX, "texm3x3tex", "undefined", 1, 2, pshader_texm3x3tex, pshader_hw_texm3x3tex, pshader_glsl_texm3x3tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXDP3TEX, "texdp3tex", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3tex, NULL, pshader_glsl_texdp3tex, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x2DEPTH, "texm3x2depth", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x2depth, NULL, pshader_glsl_texm3x2depth, D3DPS_VERSION(1,3), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXDP3, "texdp3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3, NULL, pshader_glsl_texdp3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXM3x3, "texm3x3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3, NULL, pshader_glsl_texm3x3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, - {D3DSIO_TEXDEPTH, "texdepth", GLNAME_REQUIRE_GLSL, 1, 1, pshader_texdepth, NULL, pshader_glsl_texdepth, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, - {D3DSIO_BEM, "bem", GLNAME_REQUIRE_GLSL, 1, 3, pshader_bem, NULL, NULL, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, - {D3DSIO_DSX, "dsx", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsx, NULL, NULL, 0, 0}, - {D3DSIO_DSY, "dsy", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsy, NULL, NULL, 0, 0}, - {D3DSIO_TEXLDD, "texldd", GLNAME_REQUIRE_GLSL, 1, 5, pshader_texldd, NULL, NULL, D3DPS_VERSION(2,1), -1}, - {D3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, pshader_setp, NULL, NULL, 0, 0}, - {D3DSIO_TEXLDL, "texdl", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texldl, NULL, NULL, 0, 0}, - {D3DSIO_PHASE, "phase", GLNAME_REQUIRE_GLSL, 0, 0, pshader_nop, NULL, NULL, 0, 0}, + {WINED3DSIO_TEXCOORD, "texcoord", "undefined", 1, 1, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, 0, D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXCOORD, "texcrd", "undefined", 1, 2, pshader_texcoord, pshader_hw_texcoord, pshader_glsl_texcoord, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, + {WINED3DSIO_TEXKILL, "texkill", "KIL", 1, 1, pshader_texkill, pshader_hw_map2gl, pshader_glsl_texkill, D3DPS_VERSION(1,0), D3DPS_VERSION(3,0)}, + {WINED3DSIO_TEX, "tex", "undefined", 1, 1, pshader_tex, pshader_hw_tex, pshader_glsl_tex, 0, D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEX, "texld", "undefined", 1, 2, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, + {WINED3DSIO_TEX, "texld", "undefined", 1, 3, pshader_texld, pshader_hw_tex, pshader_glsl_tex, D3DPS_VERSION(2,0), -1}, + {WINED3DSIO_TEXBEM, "texbem", "undefined", 1, 2, pshader_texbem, pshader_hw_texbem, pshader_glsl_texbem, 0, D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXBEML, "texbeml", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texbeml, NULL, NULL, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXREG2AR,"texreg2ar","undefined", 1, 2, pshader_texreg2ar, pshader_hw_texreg2ar, pshader_glsl_texreg2ar, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXREG2GB,"texreg2gb","undefined", 1, 2, pshader_texreg2gb, pshader_hw_texreg2gb, pshader_glsl_texreg2gb, D3DPS_VERSION(1,1), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXREG2RGB, "texreg2rgb", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texreg2rgb, NULL, pshader_glsl_texreg2rgb, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x2PAD, "texm3x2pad", "undefined", 1, 2, pshader_texm3x2pad, pshader_hw_texm3x2pad, pshader_glsl_texm3x2pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x2TEX, "texm3x2tex", "undefined", 1, 2, pshader_texm3x2tex, pshader_hw_texm3x2tex, pshader_glsl_texm3x2tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x3PAD, "texm3x3pad", "undefined", 1, 2, pshader_texm3x3pad, pshader_hw_texm3x3pad, pshader_glsl_texm3x3pad, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x3DIFF, "texm3x3diff", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3diff, NULL, NULL, D3DPS_VERSION(0,0), D3DPS_VERSION(0,0)}, + {WINED3DSIO_TEXM3x3SPEC, "texm3x3spec", "undefined", 1, 3, pshader_texm3x3spec, pshader_hw_texm3x3spec, pshader_glsl_texm3x3spec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x3VSPEC, "texm3x3vspec", "undefined", 1, 2, pshader_texm3x3vspec, pshader_hw_texm3x3vspec, pshader_glsl_texm3x3vspec, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x3TEX, "texm3x3tex", "undefined", 1, 2, pshader_texm3x3tex, pshader_hw_texm3x3tex, pshader_glsl_texm3x3tex, D3DPS_VERSION(1,0), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXDP3TEX, "texdp3tex", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3tex, NULL, pshader_glsl_texdp3tex, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x2DEPTH, "texm3x2depth", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x2depth, NULL, pshader_glsl_texm3x2depth, D3DPS_VERSION(1,3), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXDP3, "texdp3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texdp3, NULL, pshader_glsl_texdp3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXM3x3, "texm3x3", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texm3x3, NULL, pshader_glsl_texm3x3, D3DPS_VERSION(1,2), D3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXDEPTH, "texdepth", GLNAME_REQUIRE_GLSL, 1, 1, pshader_texdepth, NULL, pshader_glsl_texdepth, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, + {WINED3DSIO_BEM, "bem", GLNAME_REQUIRE_GLSL, 1, 3, pshader_bem, NULL, NULL, D3DPS_VERSION(1,4), D3DPS_VERSION(1,4)}, + {WINED3DSIO_DSX, "dsx", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsx, NULL, NULL, 0, 0}, + {WINED3DSIO_DSY, "dsy", GLNAME_REQUIRE_GLSL, 1, 2, pshader_dsy, NULL, NULL, 0, 0}, + {WINED3DSIO_TEXLDD, "texldd", GLNAME_REQUIRE_GLSL, 1, 5, pshader_texldd, NULL, NULL, D3DPS_VERSION(2,1), -1}, + {WINED3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, pshader_setp, NULL, NULL, 0, 0}, + {WINED3DSIO_TEXLDL, "texldl", GLNAME_REQUIRE_GLSL, 1, 2, pshader_texldl, NULL, NULL, 0, 0}, + {WINED3DSIO_PHASE, "phase", GLNAME_REQUIRE_GLSL, 0, 0, pshader_nop, NULL, NULL, 0, 0}, {0, NULL, NULL, 0, 0, NULL, NULL, 0, 0} }; diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index 0ba8d47af87..7faf3c3f041 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -475,35 +475,35 @@ static void vshader_texldl(WINED3DSHADERVECTOR* d) { CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = { /* Arithmetic */ - {D3DSIO_NOP, "nop", "NOP", 0, 0, vshader_nop, vshader_hw_map2gl, NULL, 0, 0}, - {D3DSIO_MOV, "mov", "MOV", 1, 2, vshader_mov, vshader_hw_map2gl, shader_glsl_mov, 0, 0}, - {D3DSIO_ADD, "add", "ADD", 1, 3, vshader_add, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_SUB, "sub", "SUB", 1, 3, vshader_sub, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_MAD, "mad", "MAD", 1, 4, vshader_mad, vshader_hw_map2gl, shader_glsl_mad, 0, 0}, - {D3DSIO_MUL, "mul", "MUL", 1, 3, vshader_mul, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, - {D3DSIO_RCP, "rcp", "RCP", 1, 2, vshader_rcp, vshader_hw_map2gl, shader_glsl_rcp, 0, 0}, - {D3DSIO_RSQ, "rsq", "RSQ", 1, 2, vshader_rsq, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_DP3, "dp3", "DP3", 1, 3, vshader_dp3, vshader_hw_map2gl, shader_glsl_dot, 0, 0}, - {D3DSIO_DP4, "dp4", "DP4", 1, 3, vshader_dp4, vshader_hw_map2gl, shader_glsl_dot, 0, 0}, - {D3DSIO_MIN, "min", "MIN", 1, 3, vshader_min, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_MAX, "max", "MAX", 1, 3, vshader_max, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_SLT, "slt", "SLT", 1, 3, vshader_slt, vshader_hw_map2gl, shader_glsl_compare, 0, 0}, - {D3DSIO_SGE, "sge", "SGE", 1, 3, vshader_sge, vshader_hw_map2gl, shader_glsl_compare, 0, 0}, - {D3DSIO_ABS, "abs", "ABS", 1, 2, vshader_abs, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_EXP, "exp", "EX2", 1, 2, vshader_exp, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_LOG, "log", "LG2", 1, 2, vshader_log, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_EXPP, "expp", "EXP", 1, 2, vshader_expp, vshader_hw_map2gl, shader_glsl_expp, 0, 0}, - {D3DSIO_LOGP, "logp", "LOG", 1, 2, vshader_logp, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_LIT, "lit", "LIT", 1, 2, vshader_lit, vshader_hw_map2gl, shader_glsl_lit, 0, 0}, - {D3DSIO_DST, "dst", "DST", 1, 3, vshader_dst, vshader_hw_map2gl, shader_glsl_dst, 0, 0}, - {D3DSIO_LRP, "lrp", "LRP", 1, 4, vshader_lrp, NULL, shader_glsl_lrp, 0, 0}, - {D3DSIO_FRC, "frc", "FRC", 1, 2, vshader_frc, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, - {D3DSIO_POW, "pow", "POW", 1, 3, vshader_pow, NULL, shader_glsl_map2gl, 0, 0}, - {D3DSIO_CRS, "crs", "XPS", 1, 3, vshader_crs, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_NOP, "nop", "NOP", 0, 0, vshader_nop, vshader_hw_map2gl, NULL, 0, 0}, + {WINED3DSIO_MOV, "mov", "MOV", 1, 2, vshader_mov, vshader_hw_map2gl, shader_glsl_mov, 0, 0}, + {WINED3DSIO_ADD, "add", "ADD", 1, 3, vshader_add, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_SUB, "sub", "SUB", 1, 3, vshader_sub, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_MAD, "mad", "MAD", 1, 4, vshader_mad, vshader_hw_map2gl, shader_glsl_mad, 0, 0}, + {WINED3DSIO_MUL, "mul", "MUL", 1, 3, vshader_mul, vshader_hw_map2gl, shader_glsl_arith, 0, 0}, + {WINED3DSIO_RCP, "rcp", "RCP", 1, 2, vshader_rcp, vshader_hw_map2gl, shader_glsl_rcp, 0, 0}, + {WINED3DSIO_RSQ, "rsq", "RSQ", 1, 2, vshader_rsq, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_DP3, "dp3", "DP3", 1, 3, vshader_dp3, vshader_hw_map2gl, shader_glsl_dot, 0, 0}, + {WINED3DSIO_DP4, "dp4", "DP4", 1, 3, vshader_dp4, vshader_hw_map2gl, shader_glsl_dot, 0, 0}, + {WINED3DSIO_MIN, "min", "MIN", 1, 3, vshader_min, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_MAX, "max", "MAX", 1, 3, vshader_max, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_SLT, "slt", "SLT", 1, 3, vshader_slt, vshader_hw_map2gl, shader_glsl_compare, 0, 0}, + {WINED3DSIO_SGE, "sge", "SGE", 1, 3, vshader_sge, vshader_hw_map2gl, shader_glsl_compare, 0, 0}, + {WINED3DSIO_ABS, "abs", "ABS", 1, 2, vshader_abs, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_EXP, "exp", "EX2", 1, 2, vshader_exp, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_LOG, "log", "LG2", 1, 2, vshader_log, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_EXPP, "expp", "EXP", 1, 2, vshader_expp, vshader_hw_map2gl, shader_glsl_expp, 0, 0}, + {WINED3DSIO_LOGP, "logp", "LOG", 1, 2, vshader_logp, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_LIT, "lit", "LIT", 1, 2, vshader_lit, vshader_hw_map2gl, shader_glsl_lit, 0, 0}, + {WINED3DSIO_DST, "dst", "DST", 1, 3, vshader_dst, vshader_hw_map2gl, shader_glsl_dst, 0, 0}, + {WINED3DSIO_LRP, "lrp", "LRP", 1, 4, vshader_lrp, NULL, shader_glsl_lrp, 0, 0}, + {WINED3DSIO_FRC, "frc", "FRC", 1, 2, vshader_frc, vshader_hw_map2gl, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_POW, "pow", "POW", 1, 3, vshader_pow, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_CRS, "crs", "XPS", 1, 3, vshader_crs, NULL, shader_glsl_map2gl, 0, 0}, /* TODO: sng can possibly be performed a s RCP tmp, vec MUL out, tmp, vec*/ - {D3DSIO_SGN, "sgn", NULL, 1, 2, vshader_sgn, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_SGN, "sgn", NULL, 1, 2, vshader_sgn, NULL, shader_glsl_map2gl, 0, 0}, /* TODO: xyz normalise can be performed as VS_ARB using one temporary register, DP3 tmp , vec, vec; RSQ tmp, tmp.x; @@ -514,45 +514,45 @@ CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = { MUL vec, vec, tmp; */ - {D3DSIO_NRM, "nrm", NULL, 1, 2, vshader_nrm, NULL, shader_glsl_map2gl, 0, 0}, - {D3DSIO_SINCOS, "sincos", NULL, 1, 4, vshader_sincos2, NULL, shader_glsl_sincos, D3DVS_VERSION(2,0), D3DVS_VERSION(2,0)}, - {D3DSIO_SINCOS, "sincos", NULL, 1, 2, vshader_sincos3, NULL, shader_glsl_sincos, D3DVS_VERSION(3,0), -1}, + {WINED3DSIO_NRM, "nrm", NULL, 1, 2, vshader_nrm, NULL, shader_glsl_map2gl, 0, 0}, + {WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, vshader_sincos2, NULL, shader_glsl_sincos, D3DVS_VERSION(2,0), D3DVS_VERSION(2,0)}, + {WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, vshader_sincos3, NULL, shader_glsl_sincos, D3DVS_VERSION(3,0), -1}, /* Matrix */ - {D3DSIO_M4x4, "m4x4", "undefined", 1, 3, vshader_m4x4, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M4x3, "m4x3", "undefined", 1, 3, vshader_m4x3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x4, "m3x4", "undefined", 1, 3, vshader_m3x4, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x3, "m3x3", "undefined", 1, 3, vshader_m3x3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, - {D3DSIO_M3x2, "m3x2", "undefined", 1, 3, vshader_m3x2, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, vshader_m4x4, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M4x3, "m4x3", "undefined", 1, 3, vshader_m4x3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x4, "m3x4", "undefined", 1, 3, vshader_m3x4, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x3, "m3x3", "undefined", 1, 3, vshader_m3x3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, + {WINED3DSIO_M3x2, "m3x2", "undefined", 1, 3, vshader_m3x2, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0}, /* Declare registers */ - {D3DSIO_DCL, "dcl", NULL, 0, 2, vshader_dcl, NULL, NULL, 0, 0}, + {WINED3DSIO_DCL, "dcl", NULL, 0, 2, vshader_dcl, NULL, NULL, 0, 0}, /* Constant definitions */ - {D3DSIO_DEF, "def", NULL, 1, 5, vshader_def, NULL, NULL, 0, 0}, - {D3DSIO_DEFB, "defb", GLNAME_REQUIRE_GLSL, 1, 2, vshader_defb, NULL, NULL, 0, 0}, - {D3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, vshader_defi, NULL, NULL, 0, 0}, + {WINED3DSIO_DEF, "def", NULL, 1, 5, vshader_def, NULL, NULL, 0, 0}, + {WINED3DSIO_DEFB, "defb", GLNAME_REQUIRE_GLSL, 1, 2, vshader_defb, NULL, NULL, 0, 0}, + {WINED3DSIO_DEFI, "defi", GLNAME_REQUIRE_GLSL, 1, 5, vshader_defi, NULL, NULL, 0, 0}, /* Flow control - requires GLSL or software shaders */ - {D3DSIO_REP , "rep", NULL, 0, 1, vshader_rep, NULL, shader_glsl_rep, D3DVS_VERSION(2,0), -1}, - {D3DSIO_ENDREP, "endrep", NULL, 0, 0, vshader_endrep, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, - {D3DSIO_IF, "if", NULL, 0, 1, vshader_if, NULL, shader_glsl_if, D3DVS_VERSION(2,0), -1}, - {D3DSIO_IFC, "ifc", NULL, 0, 2, vshader_ifc, NULL, shader_glsl_ifc, D3DVS_VERSION(2,1), -1}, - {D3DSIO_ELSE, "else", NULL, 0, 0, vshader_else, NULL, shader_glsl_else, D3DVS_VERSION(2,0), -1}, - {D3DSIO_ENDIF, "endif", NULL, 0, 0, vshader_endif, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, - {D3DSIO_BREAK, "break", NULL, 0, 0, vshader_break, NULL, shader_glsl_break, D3DVS_VERSION(2,1), -1}, - {D3DSIO_BREAKC, "breakc", NULL, 0, 2, vshader_breakc, NULL, shader_glsl_breakc, D3DVS_VERSION(2,1), -1}, - {D3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, vshader_breakp, NULL, NULL, 0, 0}, - {D3DSIO_CALL, "call", NULL, 0, 1, vshader_call, NULL, shader_glsl_call, D3DVS_VERSION(2,0), -1}, - {D3DSIO_CALLNZ, "callnz", NULL, 0, 2, vshader_callnz, NULL, shader_glsl_callnz, D3DVS_VERSION(2,0), -1}, - {D3DSIO_LOOP, "loop", NULL, 0, 2, vshader_loop, NULL, shader_glsl_loop, D3DVS_VERSION(2,0), -1}, - {D3DSIO_RET, "ret", NULL, 0, 0, vshader_ret, NULL, NULL, D3DVS_VERSION(2,0), -1}, - {D3DSIO_ENDLOOP, "endloop", NULL, 0, 0, vshader_endloop, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, - {D3DSIO_LABEL, "label", NULL, 0, 1, vshader_label, NULL, shader_glsl_label, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_REP , "rep", NULL, 0, 1, vshader_rep, NULL, shader_glsl_rep, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_ENDREP, "endrep", NULL, 0, 0, vshader_endrep, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_IF, "if", NULL, 0, 1, vshader_if, NULL, shader_glsl_if, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_IFC, "ifc", NULL, 0, 2, vshader_ifc, NULL, shader_glsl_ifc, D3DVS_VERSION(2,1), -1}, + {WINED3DSIO_ELSE, "else", NULL, 0, 0, vshader_else, NULL, shader_glsl_else, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_ENDIF, "endif", NULL, 0, 0, vshader_endif, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_BREAK, "break", NULL, 0, 0, vshader_break, NULL, shader_glsl_break, D3DVS_VERSION(2,1), -1}, + {WINED3DSIO_BREAKC, "breakc", NULL, 0, 2, vshader_breakc, NULL, shader_glsl_breakc, D3DVS_VERSION(2,1), -1}, + {WINED3DSIO_BREAKP, "breakp", GLNAME_REQUIRE_GLSL, 0, 1, vshader_breakp, NULL, NULL, 0, 0}, + {WINED3DSIO_CALL, "call", NULL, 0, 1, vshader_call, NULL, shader_glsl_call, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_CALLNZ, "callnz", NULL, 0, 2, vshader_callnz, NULL, shader_glsl_callnz, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_LOOP, "loop", NULL, 0, 2, vshader_loop, NULL, shader_glsl_loop, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_RET, "ret", NULL, 0, 0, vshader_ret, NULL, NULL, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_ENDLOOP, "endloop", NULL, 0, 0, vshader_endloop, NULL, shader_glsl_end, D3DVS_VERSION(2,0), -1}, + {WINED3DSIO_LABEL, "label", NULL, 0, 1, vshader_label, NULL, shader_glsl_label, D3DVS_VERSION(2,0), -1}, - {D3DSIO_MOVA, "mova", GLNAME_REQUIRE_GLSL, 1, 2, vshader_mova, NULL, shader_glsl_mov, 0, 0}, - {D3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, vshader_setp, NULL, NULL, 0, 0}, - {D3DSIO_TEXLDL, "texdl", GLNAME_REQUIRE_GLSL, 1, 2, vshader_texldl, NULL, NULL, 0, 0}, + {WINED3DSIO_MOVA, "mova", GLNAME_REQUIRE_GLSL, 1, 2, vshader_mova, NULL, shader_glsl_mov, 0, 0}, + {WINED3DSIO_SETP, "setp", GLNAME_REQUIRE_GLSL, 1, 3, vshader_setp, NULL, NULL, 0, 0}, + {WINED3DSIO_TEXLDL, "texdl", GLNAME_REQUIRE_GLSL, 1, 2, vshader_texldl, NULL, NULL, 0, 0}, {0, NULL, NULL, 0, 0, NULL, NULL, 0, 0} }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 796c01c2ee0..0de4a312bd0 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -39,6 +39,7 @@ #include "d3d9.h" #include "d3d9types.h" +#include "wined3d_private_types.h" #include "ddraw.h" #include "wine/wined3d_interface.h" #include "wine/wined3d_gl.h" @@ -1682,7 +1683,7 @@ inline static BOOL shader_is_vshader_version(DWORD token) { } inline static BOOL shader_is_comment(DWORD token) { - return D3DSIO_COMMENT == (token & D3DSI_OPCODE_MASK); + return WINED3DSIO_COMMENT == (token & D3DSI_OPCODE_MASK); } /* Internally used shader constants. Applications can use constants 0 to GL_LIMITS(vshader_constantsF) - 1, diff --git a/dlls/wined3d/wined3d_private_types.h b/dlls/wined3d/wined3d_private_types.h new file mode 100644 index 00000000000..f3fea9a89ca --- /dev/null +++ b/dlls/wined3d/wined3d_private_types.h @@ -0,0 +1,119 @@ +/* + * Direct3D wine internal header: D3D equivalent types + * + * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2003 Raphael Junqueira + * Copyright 2005 Oliver Stieber + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINED3D_TYPES_INTERNAL_H +#define __WINE_WINED3D_TYPES_INTERNAL_H + +/** opcodes types for PS and VS */ +typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE { + WINED3DSIO_NOP = 0, + WINED3DSIO_MOV = 1, + WINED3DSIO_ADD = 2, + WINED3DSIO_SUB = 3, + WINED3DSIO_MAD = 4, + WINED3DSIO_MUL = 5, + WINED3DSIO_RCP = 6, + WINED3DSIO_RSQ = 7, + WINED3DSIO_DP3 = 8, + WINED3DSIO_DP4 = 9, + WINED3DSIO_MIN = 10, + WINED3DSIO_MAX = 11, + WINED3DSIO_SLT = 12, + WINED3DSIO_SGE = 13, + WINED3DSIO_EXP = 14, + WINED3DSIO_LOG = 15, + WINED3DSIO_LIT = 16, + WINED3DSIO_DST = 17, + WINED3DSIO_LRP = 18, + WINED3DSIO_FRC = 19, + WINED3DSIO_M4x4 = 20, + WINED3DSIO_M4x3 = 21, + WINED3DSIO_M3x4 = 22, + WINED3DSIO_M3x3 = 23, + WINED3DSIO_M3x2 = 24, + WINED3DSIO_CALL = 25, + WINED3DSIO_CALLNZ = 26, + WINED3DSIO_LOOP = 27, + WINED3DSIO_RET = 28, + WINED3DSIO_ENDLOOP = 29, + WINED3DSIO_LABEL = 30, + WINED3DSIO_DCL = 31, + WINED3DSIO_POW = 32, + WINED3DSIO_CRS = 33, + WINED3DSIO_SGN = 34, + WINED3DSIO_ABS = 35, + WINED3DSIO_NRM = 36, + WINED3DSIO_SINCOS = 37, + WINED3DSIO_REP = 38, + WINED3DSIO_ENDREP = 39, + WINED3DSIO_IF = 40, + WINED3DSIO_IFC = 41, + WINED3DSIO_ELSE = 42, + WINED3DSIO_ENDIF = 43, + WINED3DSIO_BREAK = 44, + WINED3DSIO_BREAKC = 45, + WINED3DSIO_MOVA = 46, + WINED3DSIO_DEFB = 47, + WINED3DSIO_DEFI = 48, + + WINED3DSIO_TEXCOORD = 64, + WINED3DSIO_TEXKILL = 65, + WINED3DSIO_TEX = 66, + WINED3DSIO_TEXBEM = 67, + WINED3DSIO_TEXBEML = 68, + WINED3DSIO_TEXREG2AR = 69, + WINED3DSIO_TEXREG2GB = 70, + WINED3DSIO_TEXM3x2PAD = 71, + WINED3DSIO_TEXM3x2TEX = 72, + WINED3DSIO_TEXM3x3PAD = 73, + WINED3DSIO_TEXM3x3TEX = 74, + WINED3DSIO_TEXM3x3DIFF = 75, + WINED3DSIO_TEXM3x3SPEC = 76, + WINED3DSIO_TEXM3x3VSPEC = 77, + WINED3DSIO_EXPP = 78, + WINED3DSIO_LOGP = 79, + WINED3DSIO_CND = 80, + WINED3DSIO_DEF = 81, + WINED3DSIO_TEXREG2RGB = 82, + WINED3DSIO_TEXDP3TEX = 83, + WINED3DSIO_TEXM3x2DEPTH = 84, + WINED3DSIO_TEXDP3 = 85, + WINED3DSIO_TEXM3x3 = 86, + WINED3DSIO_TEXDEPTH = 87, + WINED3DSIO_CMP = 88, + WINED3DSIO_BEM = 89, + WINED3DSIO_DP2ADD = 90, + WINED3DSIO_DSX = 91, + WINED3DSIO_DSY = 92, + WINED3DSIO_TEXLDD = 93, + WINED3DSIO_SETP = 94, + WINED3DSIO_TEXLDL = 95, + WINED3DSIO_BREAKP = 96, + + WINED3DSIO_PHASE = 0xFFFD, + WINED3DSIO_COMMENT = 0xFFFE, + WINED3DSIO_END = 0XFFFF, + + WINED3DSIO_FORCE_DWORD = 0X7FFFFFFF /** for 32-bit alignment */ +} WINED3DSHADER_INSTRUCTION_OPCODE_TYPE; + +#endif