wined3d: Get rid of the WINED3DTEXTUREOP typedef.

This commit is contained in:
Henri Verbeet 2012-01-10 20:37:01 +01:00 committed by Alexandre Julliard
parent bd3b0ba697
commit b6431d9493
10 changed files with 445 additions and 401 deletions

View File

@ -2550,21 +2550,18 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG1, &alphaarg1); wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG1, &alphaarg1);
wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG2, &alphaarg2); wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG2, &alphaarg2);
if (colorop == WINED3DTOP_SELECTARG1 && colorarg1 == WINED3DTA_TEXTURE && if (colorop == WINED3D_TOP_SELECT_ARG1 && colorarg1 == WINED3DTA_TEXTURE
alphaop == WINED3DTOP_SELECTARG1 && alphaarg1 == WINED3DTA_TEXTURE) && alphaop == WINED3D_TOP_SELECT_ARG1 && alphaarg1 == WINED3DTA_TEXTURE)
{
*lpdwRenderState = D3DTBLEND_DECAL; *lpdwRenderState = D3DTBLEND_DECAL;
} else if (colorop == WINED3D_TOP_SELECT_ARG1 && colorarg1 == WINED3DTA_TEXTURE
else if (colorop == WINED3DTOP_SELECTARG1 && colorarg1 == WINED3DTA_TEXTURE && && alphaop == WINED3D_TOP_MODULATE
alphaop == WINED3DTOP_MODULATE && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT) && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT)
{
*lpdwRenderState = D3DTBLEND_DECALALPHA; *lpdwRenderState = D3DTBLEND_DECALALPHA;
} else if (colorop == WINED3D_TOP_MODULATE
else if (colorop == WINED3DTOP_MODULATE && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT && && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT
alphaop == WINED3DTOP_MODULATE && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT) && alphaop == WINED3D_TOP_MODULATE
{ && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT)
*lpdwRenderState = D3DTBLEND_MODULATEALPHA; *lpdwRenderState = D3DTBLEND_MODULATEALPHA;
}
else else
{ {
struct wined3d_texture *tex = NULL; struct wined3d_texture *tex = NULL;
@ -2591,12 +2588,11 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
wined3d_texture_decref(tex); wined3d_texture_decref(tex);
} }
if (!(colorop == WINED3DTOP_MODULATE && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT && if (!(colorop == WINED3D_TOP_MODULATE
alphaop == (tex_alpha ? WINED3DTOP_SELECTARG1 : WINED3DTOP_SELECTARG2) && && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT
alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT)) && alphaop == (tex_alpha ? WINED3D_TOP_SELECT_ARG1 : WINED3D_TOP_SELECT_ARG2)
{ && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT))
ERR("Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous\n"); ERR("Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous.\n");
}
*lpdwRenderState = D3DTBLEND_MODULATE; *lpdwRenderState = D3DTBLEND_MODULATE;
} }
@ -2897,10 +2893,10 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
if (tex_alpha) if (tex_alpha)
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG1); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG1);
else else
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG2); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG2);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_ARG1, WINED3DTA_TEXTURE); 0, WINED3D_TSS_ALPHA_ARG1, WINED3DTA_TEXTURE);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
@ -2910,19 +2906,19 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_OP, WINED3DTOP_MODULATE); 0, WINED3D_TSS_COLOR_OP, WINED3D_TOP_MODULATE);
break; break;
} }
case D3DTBLEND_ADD: case D3DTBLEND_ADD:
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_OP, WINED3DTOP_ADD); 0, WINED3D_TSS_COLOR_OP, WINED3D_TOP_ADD);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_ARG1, WINED3DTA_TEXTURE); 0, WINED3D_TSS_COLOR_ARG1, WINED3DTA_TEXTURE);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG2); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG2);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT);
break; break;
@ -2937,9 +2933,9 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_OP, WINED3DTOP_MODULATE); 0, WINED3D_TSS_COLOR_OP, WINED3D_TOP_MODULATE);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_MODULATE); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_MODULATE);
break; break;
case D3DTBLEND_COPY: case D3DTBLEND_COPY:
@ -2949,20 +2945,20 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface,
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_ARG1, WINED3DTA_TEXTURE); 0, WINED3D_TSS_ALPHA_ARG1, WINED3DTA_TEXTURE);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_OP, WINED3DTOP_SELECTARG1); 0, WINED3D_TSS_COLOR_OP, WINED3D_TOP_SELECT_ARG1);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG1); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG1);
break; break;
case D3DTBLEND_DECALALPHA: case D3DTBLEND_DECALALPHA:
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_OP, WINED3DTOP_BLENDTEXTUREALPHA); 0, WINED3D_TSS_COLOR_OP, WINED3D_TOP_BLEND_TEXTURE_ALPHA);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_ARG1, WINED3DTA_TEXTURE); 0, WINED3D_TSS_COLOR_ARG1, WINED3DTA_TEXTURE);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_COLOR_ARG2, WINED3DTA_CURRENT);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG2); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG2);
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT); 0, WINED3D_TSS_ALPHA_ARG2, WINED3DTA_CURRENT);
break; break;
@ -4766,10 +4762,10 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface,
/* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */ /* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */
if (tex_alpha) if (tex_alpha)
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG1); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG1);
else else
wined3d_device_set_texture_stage_state(This->wined3d_device, wined3d_device_set_texture_stage_state(This->wined3d_device,
0, WINED3D_TSS_ALPHA_OP, WINED3DTOP_SELECTARG2); 0, WINED3D_TSS_ALPHA_OP, WINED3D_TOP_SELECT_ARG2);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();

View File

@ -5881,22 +5881,24 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
arg1 = get_argreg(buffer, 1, stage, dw_arg1); arg1 = get_argreg(buffer, 1, stage, dw_arg1);
arg2 = get_argreg(buffer, 2, stage, dw_arg2); arg2 = get_argreg(buffer, 2, stage, dw_arg2);
switch(op) { switch (op)
case WINED3DTOP_DISABLE: {
if (!stage) shader_addline(buffer, "MOV %s%s, fragment.color.primary;\n", dstreg, dstmask); case WINED3D_TOP_DISABLE:
if (!stage)
shader_addline(buffer, "MOV %s%s, fragment.color.primary;\n", dstreg, dstmask);
break; break;
case WINED3DTOP_SELECTARG2: case WINED3D_TOP_SELECT_ARG2:
arg1 = arg2; arg1 = arg2;
/* FALLTHROUGH */ /* FALLTHROUGH */
case WINED3DTOP_SELECTARG1: case WINED3D_TOP_SELECT_ARG1:
shader_addline(buffer, "MOV %s%s, %s;\n", dstreg, dstmask, arg1); shader_addline(buffer, "MOV %s%s, %s;\n", dstreg, dstmask, arg1);
break; break;
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
mul = 2; mul = 2;
/* FALLTHROUGH */ /* FALLTHROUGH */
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
mul *= 2; mul *= 2;
if (!strcmp(dstreg, "result.color")) if (!strcmp(dstreg, "result.color"))
{ {
@ -5904,11 +5906,11 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
mul_final_dest = TRUE; mul_final_dest = TRUE;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
shader_addline(buffer, "MUL %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); shader_addline(buffer, "MUL %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2);
break; break;
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
mul = 2; mul = 2;
if (!strcmp(dstreg, "result.color")) if (!strcmp(dstreg, "result.color"))
{ {
@ -5916,41 +5918,41 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
mul_final_dest = TRUE; mul_final_dest = TRUE;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
shader_addline(buffer, "SUB arg2, %s, const.w;\n", arg2); shader_addline(buffer, "SUB arg2, %s, const.w;\n", arg2);
arg2 = "arg2"; arg2 = "arg2";
/* FALLTHROUGH */ /* FALLTHROUGH */
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
shader_addline(buffer, "ADD_SAT %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); shader_addline(buffer, "ADD_SAT %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2);
break; break;
case WINED3DTOP_SUBTRACT: case WINED3D_TOP_SUBTRACT:
shader_addline(buffer, "SUB_SAT %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); shader_addline(buffer, "SUB_SAT %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2);
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
shader_addline(buffer, "SUB arg1, const.x, %s;\n", arg1); shader_addline(buffer, "SUB arg1, const.x, %s;\n", arg1);
shader_addline(buffer, "MAD_SAT %s%s, arg1, %s, %s;\n", dstreg, dstmask, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, arg1, %s, %s;\n", dstreg, dstmask, arg2, arg1);
break; break;
case WINED3DTOP_BLENDCURRENTALPHA: case WINED3D_TOP_BLEND_CURRENT_ALPHA:
arg0 = get_argreg(buffer, 0, stage, WINED3DTA_CURRENT); arg0 = get_argreg(buffer, 0, stage, WINED3DTA_CURRENT);
shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2);
break; break;
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TFACTOR); arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TFACTOR);
shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2);
break; break;
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE); arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE);
shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2);
break; break;
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
arg0 = get_argreg(buffer, 0, stage, WINED3DTA_DIFFUSE); arg0 = get_argreg(buffer, 0, stage, WINED3DTA_DIFFUSE);
shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2);
break; break;
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE); arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE);
shader_addline(buffer, "SUB arg0.w, const.x, %s.w;\n", arg0); shader_addline(buffer, "SUB arg0.w, const.x, %s.w;\n", arg0);
shader_addline(buffer, "MAD_SAT %s%s, %s, arg0.w, %s;\n", dstreg, dstmask, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, %s, arg0.w, %s;\n", dstreg, dstmask, arg2, arg1);
@ -5958,22 +5960,22 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
/* D3DTOP_PREMODULATE ???? */ /* D3DTOP_PREMODULATE ???? */
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
shader_addline(buffer, "SUB arg0.w, const.x, %s;\n", arg1); shader_addline(buffer, "SUB arg0.w, const.x, %s;\n", arg1);
shader_addline(buffer, "MAD_SAT %s%s, arg0.w, %s, %s;\n", dstreg, dstmask, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, arg0.w, %s, %s;\n", dstreg, dstmask, arg2, arg1);
break; break;
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
shader_addline(buffer, "MAD_SAT %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg1);
break; break;
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
shader_addline(buffer, "SUB arg0, const.x, %s;\n", arg1); shader_addline(buffer, "SUB arg0, const.x, %s;\n", arg1);
shader_addline(buffer, "MAD_SAT %s%s, arg0, %s, %s.w;\n", dstreg, dstmask, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, arg0, %s, %s.w;\n", dstreg, dstmask, arg2, arg1);
break; break;
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s.w;\n", dstreg, dstmask, arg1, arg2, arg1); shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s.w;\n", dstreg, dstmask, arg1, arg2, arg1);
break; break;
case WINED3DTOP_DOTPRODUCT3: case WINED3D_TOP_DOTPRODUCT3:
mul = 4; mul = 4;
if (!strcmp(dstreg, "result.color")) if (!strcmp(dstreg, "result.color"))
{ {
@ -5985,17 +5987,17 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
shader_addline(buffer, "DP3_SAT %s%s, arg1, arg2;\n", dstreg, dstmask); shader_addline(buffer, "DP3_SAT %s%s, arg1, arg2;\n", dstreg, dstmask);
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg0); shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg0);
break; break;
case WINED3DTOP_LERP: case WINED3D_TOP_LERP:
/* The msdn is not quite right here */ /* The msdn is not quite right here */
shader_addline(buffer, "LRP %s%s, %s, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); shader_addline(buffer, "LRP %s%s, %s, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2);
break; break;
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
/* Those are handled in the first pass of the shader(generation pass 1 and 2) already */ /* Those are handled in the first pass of the shader(generation pass 1 and 2) already */
break; break;
@ -6029,8 +6031,10 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
GLint pos; GLint pos;
/* Find out which textures are read */ /* Find out which textures are read */
for(stage = 0; stage < MAX_TEXTURES; stage++) { for (stage = 0; stage < MAX_TEXTURES; ++stage)
if(settings->op[stage].cop == WINED3DTOP_DISABLE) break; {
if (settings->op[stage].cop == WINED3D_TOP_DISABLE)
break;
arg0 = settings->op[stage].carg0 & WINED3DTA_SELECTMASK; arg0 = settings->op[stage].carg0 & WINED3DTA_SELECTMASK;
arg1 = settings->op[stage].carg1 & WINED3DTA_SELECTMASK; arg1 = settings->op[stage].carg1 & WINED3DTA_SELECTMASK;
arg2 = settings->op[stage].carg2 & WINED3DTA_SELECTMASK; arg2 = settings->op[stage].carg2 & WINED3DTA_SELECTMASK;
@ -6038,17 +6042,23 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
if(arg1 == WINED3DTA_TEXTURE) tex_read[stage] = TRUE; if(arg1 == WINED3DTA_TEXTURE) tex_read[stage] = TRUE;
if(arg2 == WINED3DTA_TEXTURE) tex_read[stage] = TRUE; if(arg2 == WINED3DTA_TEXTURE) tex_read[stage] = TRUE;
if(settings->op[stage].cop == WINED3DTOP_BLENDTEXTUREALPHA) tex_read[stage] = TRUE; if (settings->op[stage].cop == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
if(settings->op[stage].cop == WINED3DTOP_BLENDTEXTUREALPHAPM) tex_read[stage] = TRUE; tex_read[stage] = TRUE;
if(settings->op[stage].cop == WINED3DTOP_BUMPENVMAP) { if (settings->op[stage].cop == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
tex_read[stage] = TRUE;
if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP)
{
bump_used[stage] = TRUE; bump_used[stage] = TRUE;
tex_read[stage] = TRUE; tex_read[stage] = TRUE;
} }
if(settings->op[stage].cop == WINED3DTOP_BUMPENVMAPLUMINANCE) { if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
{
bump_used[stage] = TRUE; bump_used[stage] = TRUE;
tex_read[stage] = TRUE; tex_read[stage] = TRUE;
luminance_used[stage] = TRUE; luminance_used[stage] = TRUE;
} else if(settings->op[stage].cop == WINED3DTOP_BLENDFACTORALPHA) { }
else if (settings->op[stage].cop == WINED3D_TOP_BLEND_FACTOR_ALPHA)
{
tfactor_used = TRUE; tfactor_used = TRUE;
} }
@ -6061,7 +6071,8 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
tempreg_used = TRUE; tempreg_used = TRUE;
} }
if(settings->op[stage].aop == WINED3DTOP_DISABLE) continue; if (settings->op[stage].aop == WINED3D_TOP_DISABLE)
continue;
arg0 = settings->op[stage].aarg0 & WINED3DTA_SELECTMASK; arg0 = settings->op[stage].aarg0 & WINED3DTA_SELECTMASK;
arg1 = settings->op[stage].aarg1 & WINED3DTA_SELECTMASK; arg1 = settings->op[stage].aarg1 & WINED3DTA_SELECTMASK;
arg2 = settings->op[stage].aarg2 & WINED3DTA_SELECTMASK; arg2 = settings->op[stage].aarg2 & WINED3DTA_SELECTMASK;
@ -6126,8 +6137,10 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
shader_addline(&buffer, "KIL fragment.texcoord[7];\n"); shader_addline(&buffer, "KIL fragment.texcoord[7];\n");
/* Generate texture sampling instructions) */ /* Generate texture sampling instructions) */
for(stage = 0; stage < MAX_TEXTURES && settings->op[stage].cop != WINED3DTOP_DISABLE; stage++) { for (stage = 0; stage < MAX_TEXTURES && settings->op[stage].cop != WINED3D_TOP_DISABLE; ++stage)
if(!tex_read[stage]) continue; {
if (!tex_read[stage])
continue;
switch(settings->op[stage].tex_type) { switch(settings->op[stage].tex_type) {
case tex_1d: textype = "1D"; break; case tex_1d: textype = "1D"; break;
@ -6138,12 +6151,11 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
default: textype = "unexpected_textype"; break; default: textype = "unexpected_textype"; break;
} }
if(settings->op[stage].cop == WINED3DTOP_BUMPENVMAP || if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP
settings->op[stage].cop == WINED3DTOP_BUMPENVMAPLUMINANCE) { || settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
sat = ""; sat = "";
} else { else
sat = "_SAT"; sat = "_SAT";
}
if(settings->op[stage].projected == proj_none) { if(settings->op[stage].projected == proj_none) {
instr = "TEX"; instr = "TEX";
@ -6155,9 +6167,10 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
instr = "TXP"; instr = "TXP";
} }
if(stage > 0 && if (stage > 0
(settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAP || && (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP
settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAPLUMINANCE)) { || settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE))
{
shader_addline(&buffer, "SWZ arg1, bumpmat%u, x, z, 0, 0;\n", stage - 1); shader_addline(&buffer, "SWZ arg1, bumpmat%u, x, z, 0, 0;\n", stage - 1);
shader_addline(&buffer, "DP3 ret.x, arg1, tex%u;\n", stage - 1); shader_addline(&buffer, "DP3 ret.x, arg1, tex%u;\n", stage - 1);
shader_addline(&buffer, "SWZ arg1, bumpmat%u, y, w, 0, 0;\n", stage - 1); shader_addline(&buffer, "SWZ arg1, bumpmat%u, y, w, 0, 0;\n", stage - 1);
@ -6179,8 +6192,9 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
} }
shader_addline(&buffer, "%s%s tex%u, ret, texture[%u], %s;\n", shader_addline(&buffer, "%s%s tex%u, ret, texture[%u], %s;\n",
instr, sat, stage, stage, textype); instr, sat, stage, stage, textype);
if(settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAPLUMINANCE) { if (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
{
shader_addline(&buffer, "MAD_SAT ret.x, tex%u.z, luminance%u.x, luminance%u.y;\n", shader_addline(&buffer, "MAD_SAT ret.x, tex%u.z, luminance%u.x, luminance%u.y;\n",
stage - 1, stage - 1, stage - 1); stage - 1, stage - 1, stage - 1);
shader_addline(&buffer, "MUL tex%u, tex%u, ret.x;\n", stage, stage); shader_addline(&buffer, "MUL tex%u, tex%u, ret.x;\n", stage, stage);
@ -6203,32 +6217,33 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
/* Generate the main shader */ /* Generate the main shader */
for (stage = 0; stage < MAX_TEXTURES; ++stage) for (stage = 0; stage < MAX_TEXTURES; ++stage)
{ {
if (settings->op[stage].cop == WINED3DTOP_DISABLE) if (settings->op[stage].cop == WINED3D_TOP_DISABLE)
{ {
if (!stage) final_combiner_src = "fragment.color.primary"; if (!stage)
final_combiner_src = "fragment.color.primary";
break; break;
} }
if(settings->op[stage].cop == WINED3DTOP_SELECTARG1 && if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG1
settings->op[stage].aop == WINED3DTOP_SELECTARG1) { && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG1)
op_equal = settings->op[stage].carg1 == settings->op[stage].aarg1; op_equal = settings->op[stage].carg1 == settings->op[stage].aarg1;
} else if(settings->op[stage].cop == WINED3DTOP_SELECTARG1 && else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG1
settings->op[stage].aop == WINED3DTOP_SELECTARG2) { && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG2)
op_equal = settings->op[stage].carg1 == settings->op[stage].aarg2; op_equal = settings->op[stage].carg1 == settings->op[stage].aarg2;
} else if(settings->op[stage].cop == WINED3DTOP_SELECTARG2 && else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG2
settings->op[stage].aop == WINED3DTOP_SELECTARG1) { && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG1)
op_equal = settings->op[stage].carg2 == settings->op[stage].aarg1; op_equal = settings->op[stage].carg2 == settings->op[stage].aarg1;
} else if(settings->op[stage].cop == WINED3DTOP_SELECTARG2 && else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG2
settings->op[stage].aop == WINED3DTOP_SELECTARG2) { && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG2)
op_equal = settings->op[stage].carg2 == settings->op[stage].aarg2; op_equal = settings->op[stage].carg2 == settings->op[stage].aarg2;
} else { else
op_equal = settings->op[stage].aop == settings->op[stage].cop && op_equal = settings->op[stage].aop == settings->op[stage].cop
settings->op[stage].carg0 == settings->op[stage].aarg0 && && settings->op[stage].carg0 == settings->op[stage].aarg0
settings->op[stage].carg1 == settings->op[stage].aarg1 && && settings->op[stage].carg1 == settings->op[stage].aarg1
settings->op[stage].carg2 == settings->op[stage].aarg2; && settings->op[stage].carg2 == settings->op[stage].aarg2;
}
if(settings->op[stage].aop == WINED3DTOP_DISABLE) { if (settings->op[stage].aop == WINED3D_TOP_DISABLE)
{
gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].dst, gen_ffp_instr(&buffer, stage, TRUE, FALSE, settings->op[stage].dst,
settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].cop, settings->op[stage].carg0,
settings->op[stage].carg1, settings->op[stage].carg2); settings->op[stage].carg1, settings->op[stage].carg2);
@ -6337,7 +6352,8 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi
new_desc->num_textures_used = 0; new_desc->num_textures_used = 0;
for (i = 0; i < gl_info->limits.texture_stages; ++i) for (i = 0; i < gl_info->limits.texture_stages; ++i)
{ {
if(settings.op[i].cop == WINED3DTOP_DISABLE) break; if (settings.op[i].cop == WINED3D_TOP_DISABLE)
break;
new_desc->num_textures_used = i; new_desc->num_textures_used = i;
} }

View File

@ -321,10 +321,10 @@ static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES])
BOOL tex_used[MAX_TEXTURES]; BOOL tex_used[MAX_TEXTURES];
memset(tex_used, 0, sizeof(tex_used)); memset(tex_used, 0, sizeof(tex_used));
for(i = 0; i < MAX_TEXTURES; i++) { for (i = 0; i < MAX_TEXTURES; ++i)
if(op[i].cop == WINED3DTOP_DISABLE) { {
if (op[i].cop == WINED3D_TOP_DISABLE)
break; break;
}
if(lowest_read == -1 && if(lowest_read == -1 &&
(op[i].carg1 == WINED3DTA_TEMP || op[i].carg2 == WINED3DTA_TEMP || op[i].carg0 == WINED3DTA_TEMP || (op[i].carg1 == WINED3DTA_TEMP || op[i].carg2 == WINED3DTA_TEMP || op[i].carg0 == WINED3DTA_TEMP ||
@ -399,9 +399,11 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
/* Pass 1: Generate sampling instructions for perturbation maps */ /* Pass 1: Generate sampling instructions for perturbation maps */
for (stage = 0; stage < gl_info->limits.textures; ++stage) for (stage = 0; stage < gl_info->limits.textures; ++stage)
{ {
if(op[stage].cop == WINED3DTOP_DISABLE) break; if (op[stage].cop == WINED3D_TOP_DISABLE)
if(op[stage].cop != WINED3DTOP_BUMPENVMAP && break;
op[stage].cop != WINED3DTOP_BUMPENVMAPLUMINANCE) continue; if (op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE)
continue;
TRACE("glSampleMapATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, GL_SWIZZLE_STR_ATI)\n", TRACE("glSampleMapATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, GL_SWIZZLE_STR_ATI)\n",
stage, stage); stage, stage);
@ -428,9 +430,11 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
GLuint argmodextra_x, argmodextra_y; GLuint argmodextra_x, argmodextra_y;
struct color_fixup_desc fixup; struct color_fixup_desc fixup;
if(op[stage].cop == WINED3DTOP_DISABLE) break; if (op[stage].cop == WINED3D_TOP_DISABLE)
if(op[stage].cop != WINED3DTOP_BUMPENVMAP && break;
op[stage].cop != WINED3DTOP_BUMPENVMAPLUMINANCE) continue; if (op[stage].cop != WINED3D_TOP_BUMPENVMAP
&& op[stage].cop != WINED3D_TOP_BUMPENVMAP_LUMINANCE)
continue;
fixup = op[stage].color_fixup; fixup = op[stage].color_fixup;
if (fixup.x_source != CHANNEL_SOURCE_X || fixup.y_source != CHANNEL_SOURCE_Y) if (fixup.x_source != CHANNEL_SOURCE_X || fixup.y_source != CHANNEL_SOURCE_Y)
@ -474,9 +478,8 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
/* Pass 3: Generate sampling instructions for regular textures */ /* Pass 3: Generate sampling instructions for regular textures */
for (stage = 0; stage < gl_info->limits.textures; ++stage) for (stage = 0; stage < gl_info->limits.textures; ++stage)
{ {
if(op[stage].cop == WINED3DTOP_DISABLE) { if (op[stage].cop == WINED3D_TOP_DISABLE)
break; break;
}
if(op[stage].projected == proj_none) { if(op[stage].projected == proj_none) {
swizzle = GL_SWIZZLE_STR_ATI; swizzle = GL_SWIZZLE_STR_ATI;
@ -486,17 +489,18 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
swizzle = GL_SWIZZLE_STQ_DQ_ATI; swizzle = GL_SWIZZLE_STQ_DQ_ATI;
} }
if((op[stage].carg0 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || if ((op[stage].carg0 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
(op[stage].carg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || || (op[stage].carg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
(op[stage].carg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || || (op[stage].carg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
(op[stage].aarg0 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || || (op[stage].aarg0 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
(op[stage].aarg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || || (op[stage].aarg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
(op[stage].aarg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE || || (op[stage].aarg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
op[stage].cop == WINED3DTOP_BLENDTEXTUREALPHA) { || op[stage].cop == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
{
if(stage > 0 && if (stage > 0
(op[stage - 1].cop == WINED3DTOP_BUMPENVMAP || && (op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP
op[stage - 1].cop == WINED3DTOP_BUMPENVMAPLUMINANCE)) { || op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE))
{
TRACE("glSampleMapATI(GL_REG_%d_ATI, GL_REG_%d_ATI, GL_SWIZZLE_STR_ATI)\n", TRACE("glSampleMapATI(GL_REG_%d_ATI, GL_REG_%d_ATI, GL_SWIZZLE_STR_ATI)\n",
stage, stage); stage, stage);
GL_EXTCALL(glSampleMapATI(GL_REG_0_ATI + stage, GL_EXTCALL(glSampleMapATI(GL_REG_0_ATI + stage,
@ -515,7 +519,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
/* Pass 4: Generate the arithmetic instructions */ /* Pass 4: Generate the arithmetic instructions */
for (stage = 0; stage < MAX_TEXTURES; ++stage) for (stage = 0; stage < MAX_TEXTURES; ++stage)
{ {
if (op[stage].cop == WINED3DTOP_DISABLE) if (op[stage].cop == WINED3D_TOP_DISABLE)
{ {
if (!stage) if (!stage)
{ {
@ -546,51 +550,52 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
argmodextra = GL_NONE; argmodextra = GL_NONE;
extrarg = GL_NONE; extrarg = GL_NONE;
switch(op[stage].cop) { switch (op[stage].cop)
case WINED3DTOP_SELECTARG2: {
case WINED3D_TOP_SELECT_ARG2:
arg1 = arg2; arg1 = arg2;
argmod1 = argmod2; argmod1 = argmod2;
rep1 = rep2; rep1 = rep2;
/* fall through */ /* fall through */
case WINED3DTOP_SELECTARG1: case WINED3D_TOP_SELECT_ARG1:
wrap_op1(gl_info, GL_MOV_ATI, dstreg, GL_NONE, GL_NONE, wrap_op1(gl_info, GL_MOV_ATI, dstreg, GL_NONE, GL_NONE,
arg1, rep1, argmod1); arg1, rep1, argmod1);
break; break;
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
if(dstmod == GL_NONE) dstmod = GL_4X_BIT_ATI; if(dstmod == GL_NONE) dstmod = GL_4X_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
if(dstmod == GL_NONE) dstmod = GL_2X_BIT_ATI; if(dstmod == GL_NONE) dstmod = GL_2X_BIT_ATI;
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
wrap_op2(gl_info, GL_MUL_ATI, dstreg, GL_NONE, dstmod, wrap_op2(gl_info, GL_MUL_ATI, dstreg, GL_NONE, dstmod,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmod2); arg2, rep2, argmod2);
break; break;
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
dstmod = GL_2X_BIT_ATI; dstmod = GL_2X_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
argmodextra = GL_BIAS_BIT_ATI; argmodextra = GL_BIAS_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
wrap_op2(gl_info, GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, dstmod, wrap_op2(gl_info, GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, dstmod,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmodextra | argmod2); arg2, rep2, argmodextra | argmod2);
break; break;
case WINED3DTOP_SUBTRACT: case WINED3D_TOP_SUBTRACT:
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
wrap_op2(gl_info, GL_SUB_ATI, dstreg, GL_NONE, dstmod, wrap_op2(gl_info, GL_SUB_ATI, dstreg, GL_NONE, dstmod,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmod2); arg2, rep2, argmod2);
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI; argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
/* Dst = arg1 + * arg2(1 -arg 1) /* Dst = arg1 + * arg2(1 -arg 1)
* = arg2 * (1 - arg1) + arg1 * = arg2 * (1 - arg1) + arg1
@ -601,24 +606,28 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
arg1, rep1, argmod1); arg1, rep1, argmod1);
break; break;
case WINED3DTOP_BLENDCURRENTALPHA: case WINED3D_TOP_BLEND_CURRENT_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_CURRENT, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_CURRENT, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_TFACTOR, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_TFACTOR, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_DIFFUSE, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_DIFFUSE, gl_info, stage, NULL, NULL, -1);
wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_NONE, GL_NONE, wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_NONE, GL_NONE,
extrarg, GL_ALPHA, GL_NONE, extrarg, GL_ALPHA, GL_NONE,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmod2); arg2, rep2, argmod2);
break; break;
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
arg0 = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1); arg0 = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1);
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_NONE, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_NONE,
arg2, rep2, argmod2, arg2, rep2, argmod2,
@ -628,50 +637,52 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
/* D3DTOP_PREMODULATE ???? */ /* D3DTOP_PREMODULATE ???? */
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI; argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
if(!argmodextra) argmodextra = argmod1; if (!argmodextra)
argmodextra = argmod1;
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
arg2, rep2, argmod2, arg2, rep2, argmod2,
arg1, GL_ALPHA, argmodextra, arg1, GL_ALPHA, argmodextra,
arg1, rep1, argmod1); arg1, rep1, argmod1);
break; break;
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI; argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
if(!argmodextra) argmodextra = argmod1; if (!argmodextra)
argmodextra = argmod1;
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
arg2, rep2, argmod2, arg2, rep2, argmod2,
arg1, rep1, argmodextra, arg1, rep1, argmodextra,
arg1, GL_ALPHA, argmod1); arg1, GL_ALPHA, argmod1);
break; break;
case WINED3DTOP_DOTPRODUCT3: case WINED3D_TOP_DOTPRODUCT3:
wrap_op2(gl_info, GL_DOT3_ATI, dstreg, GL_NONE, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI, wrap_op2(gl_info, GL_DOT3_ATI, dstreg, GL_NONE, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI,
arg1, rep1, argmod1 | GL_BIAS_BIT_ATI, arg1, rep1, argmod1 | GL_BIAS_BIT_ATI,
arg2, rep2, argmod2 | GL_BIAS_BIT_ATI); arg2, rep2, argmod2 | GL_BIAS_BIT_ATI);
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmod2, arg2, rep2, argmod2,
arg0, rep0, argmod0); arg0, rep0, argmod0);
break; break;
case WINED3DTOP_LERP: case WINED3D_TOP_LERP:
wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_NONE, GL_NONE, wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_NONE, GL_NONE,
arg0, rep0, argmod0, arg0, rep0, argmod0,
arg1, rep1, argmod1, arg1, rep1, argmod1,
arg2, rep2, argmod2); arg2, rep2, argmod2);
break; break;
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
/* Those are handled in the first pass of the shader(generation pass 1 and 2) already */ /* Those are handled in the first pass of the shader(generation pass 1 and 2) already */
break; break;
@ -685,8 +696,9 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
argmodextra = GL_NONE; argmodextra = GL_NONE;
extrarg = GL_NONE; extrarg = GL_NONE;
switch(op[stage].aop) { switch (op[stage].aop)
case WINED3DTOP_DISABLE: {
case WINED3D_TOP_DISABLE:
/* Get the primary color to the output if on stage 0, otherwise leave register 0 untouched */ /* Get the primary color to the output if on stage 0, otherwise leave register 0 untouched */
if (!stage) if (!stage)
{ {
@ -695,49 +707,51 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
} }
break; break;
case WINED3DTOP_SELECTARG2: case WINED3D_TOP_SELECT_ARG2:
arg1 = arg2; arg1 = arg2;
argmod1 = argmod2; argmod1 = argmod2;
/* fall through */ /* fall through */
case WINED3DTOP_SELECTARG1: case WINED3D_TOP_SELECT_ARG1:
wrap_op1(gl_info, GL_MOV_ATI, dstreg, GL_ALPHA, GL_NONE, wrap_op1(gl_info, GL_MOV_ATI, dstreg, GL_ALPHA, GL_NONE,
arg1, GL_NONE, argmod1); arg1, GL_NONE, argmod1);
break; break;
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
if(dstmod == GL_NONE) dstmod = GL_4X_BIT_ATI; if (dstmod == GL_NONE)
dstmod = GL_4X_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
if(dstmod == GL_NONE) dstmod = GL_2X_BIT_ATI; if (dstmod == GL_NONE)
dstmod = GL_2X_BIT_ATI;
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
wrap_op2(gl_info, GL_MUL_ATI, dstreg, GL_ALPHA, dstmod, wrap_op2(gl_info, GL_MUL_ATI, dstreg, GL_ALPHA, dstmod,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmod2); arg2, GL_NONE, argmod2);
break; break;
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
dstmod = GL_2X_BIT_ATI; dstmod = GL_2X_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
argmodextra = GL_BIAS_BIT_ATI; argmodextra = GL_BIAS_BIT_ATI;
/* fall through */ /* fall through */
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
wrap_op2(gl_info, GL_ADD_ATI, dstreg, GL_ALPHA, dstmod, wrap_op2(gl_info, GL_ADD_ATI, dstreg, GL_ALPHA, dstmod,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmodextra | argmod2); arg2, GL_NONE, argmodextra | argmod2);
break; break;
case WINED3DTOP_SUBTRACT: case WINED3D_TOP_SUBTRACT:
dstmod |= GL_SATURATE_BIT_ATI; dstmod |= GL_SATURATE_BIT_ATI;
wrap_op2(gl_info, GL_SUB_ATI, dstreg, GL_ALPHA, dstmod, wrap_op2(gl_info, GL_SUB_ATI, dstreg, GL_ALPHA, dstmod,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmod2); arg2, GL_NONE, argmod2);
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI; argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
/* Dst = arg1 + * arg2(1 -arg 1) /* Dst = arg1 + * arg2(1 -arg 1)
* = arg2 * (1 - arg1) + arg1 * = arg2 * (1 - arg1) + arg1
@ -748,24 +762,28 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
arg1, GL_NONE, argmod1); arg1, GL_NONE, argmod1);
break; break;
case WINED3DTOP_BLENDCURRENTALPHA: case WINED3D_TOP_BLEND_CURRENT_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_CURRENT, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_CURRENT, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_TFACTOR, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_TFACTOR, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1);
/* fall through */ /* fall through */
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
if(extrarg == GL_NONE) extrarg = register_for_arg(WINED3DTA_DIFFUSE, gl_info, stage, NULL, NULL, -1); if (extrarg == GL_NONE)
extrarg = register_for_arg(WINED3DTA_DIFFUSE, gl_info, stage, NULL, NULL, -1);
wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_ALPHA, GL_NONE, wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_ALPHA, GL_NONE,
extrarg, GL_ALPHA, GL_NONE, extrarg, GL_ALPHA, GL_NONE,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmod2); arg2, GL_NONE, argmod2);
break; break;
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
arg0 = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1); arg0 = register_for_arg(WINED3DTA_TEXTURE, gl_info, stage, NULL, NULL, -1);
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_ALPHA, GL_NONE, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_ALPHA, GL_NONE,
arg2, GL_NONE, argmod2, arg2, GL_NONE, argmod2,
@ -775,32 +793,32 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
/* D3DTOP_PREMODULATE ???? */ /* D3DTOP_PREMODULATE ???? */
case WINED3DTOP_DOTPRODUCT3: case WINED3D_TOP_DOTPRODUCT3:
wrap_op2(gl_info, GL_DOT3_ATI, dstreg, GL_ALPHA, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI, wrap_op2(gl_info, GL_DOT3_ATI, dstreg, GL_ALPHA, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI,
arg1, GL_NONE, argmod1 | GL_BIAS_BIT_ATI, arg1, GL_NONE, argmod1 | GL_BIAS_BIT_ATI,
arg2, GL_NONE, argmod2 | GL_BIAS_BIT_ATI); arg2, GL_NONE, argmod2 | GL_BIAS_BIT_ATI);
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_ALPHA, GL_SATURATE_BIT_ATI, wrap_op3(gl_info, GL_MAD_ATI, dstreg, GL_ALPHA, GL_SATURATE_BIT_ATI,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmod2, arg2, GL_NONE, argmod2,
arg0, GL_NONE, argmod0); arg0, GL_NONE, argmod0);
break; break;
case WINED3DTOP_LERP: case WINED3D_TOP_LERP:
wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_ALPHA, GL_SATURATE_BIT_ATI, wrap_op3(gl_info, GL_LERP_ATI, dstreg, GL_ALPHA, GL_SATURATE_BIT_ATI,
arg1, GL_NONE, argmod1, arg1, GL_NONE, argmod1,
arg2, GL_NONE, argmod2, arg2, GL_NONE, argmod2,
arg0, GL_NONE, argmod0); arg0, GL_NONE, argmod0);
break; break;
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
ERR("Application uses an invalid alpha operation\n"); ERR("Application uses an invalid alpha operation\n");
break; break;
@ -836,7 +854,8 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
new_desc->num_textures_used = 0; new_desc->num_textures_used = 0;
for (i = 0; i < gl_info->limits.texture_stages; ++i) for (i = 0; i < gl_info->limits.texture_stages; ++i)
{ {
if(settings.op[i].cop == WINED3DTOP_DISABLE) break; if (settings.op[i].cop == WINED3D_TOP_DISABLE)
break;
new_desc->num_textures_used = i; new_desc->num_textures_used = i;
} }

View File

@ -2812,8 +2812,8 @@ static void device_update_fixed_function_usage_map(struct wined3d_device *device
for (i = 0; i < MAX_TEXTURES; ++i) for (i = 0; i < MAX_TEXTURES; ++i)
{ {
const struct wined3d_state *state = &device->stateBlock->state; const struct wined3d_state *state = &device->stateBlock->state;
WINED3DTEXTUREOP color_op = state->texture_states[i][WINED3D_TSS_COLOR_OP]; enum wined3d_texture_op color_op = state->texture_states[i][WINED3D_TSS_COLOR_OP];
WINED3DTEXTUREOP alpha_op = state->texture_states[i][WINED3D_TSS_ALPHA_OP]; enum wined3d_texture_op alpha_op = state->texture_states[i][WINED3D_TSS_ALPHA_OP];
DWORD color_arg1 = state->texture_states[i][WINED3D_TSS_COLOR_ARG1] & WINED3DTA_SELECTMASK; DWORD color_arg1 = state->texture_states[i][WINED3D_TSS_COLOR_ARG1] & WINED3DTA_SELECTMASK;
DWORD color_arg2 = state->texture_states[i][WINED3D_TSS_COLOR_ARG2] & WINED3DTA_SELECTMASK; DWORD color_arg2 = state->texture_states[i][WINED3D_TSS_COLOR_ARG2] & WINED3DTA_SELECTMASK;
DWORD color_arg3 = state->texture_states[i][WINED3D_TSS_COLOR_ARG0] & WINED3DTA_SELECTMASK; DWORD color_arg3 = state->texture_states[i][WINED3D_TSS_COLOR_ARG0] & WINED3DTA_SELECTMASK;
@ -2821,22 +2821,22 @@ static void device_update_fixed_function_usage_map(struct wined3d_device *device
DWORD alpha_arg2 = state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] & WINED3DTA_SELECTMASK; DWORD alpha_arg2 = state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] & WINED3DTA_SELECTMASK;
DWORD alpha_arg3 = state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] & WINED3DTA_SELECTMASK; DWORD alpha_arg3 = state->texture_states[i][WINED3D_TSS_ALPHA_ARG0] & WINED3DTA_SELECTMASK;
if (color_op == WINED3DTOP_DISABLE) { /* Not used, and disable higher stages. */
/* Not used, and disable higher stages */ if (color_op == WINED3D_TOP_DISABLE)
break; break;
}
if (((color_arg1 == WINED3DTA_TEXTURE) && color_op != WINED3DTOP_SELECTARG2) if (((color_arg1 == WINED3DTA_TEXTURE) && color_op != WINED3D_TOP_SELECT_ARG2)
|| ((color_arg2 == WINED3DTA_TEXTURE) && color_op != WINED3DTOP_SELECTARG1) || ((color_arg2 == WINED3DTA_TEXTURE) && color_op != WINED3D_TOP_SELECT_ARG1)
|| ((color_arg3 == WINED3DTA_TEXTURE) || ((color_arg3 == WINED3DTA_TEXTURE)
&& (color_op == WINED3DTOP_MULTIPLYADD || color_op == WINED3DTOP_LERP)) && (color_op == WINED3D_TOP_MULTIPLY_ADD || color_op == WINED3D_TOP_LERP))
|| ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG2) || ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3D_TOP_SELECT_ARG2)
|| ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG1) || ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3D_TOP_SELECT_ARG1)
|| ((alpha_arg3 == WINED3DTA_TEXTURE) || ((alpha_arg3 == WINED3DTA_TEXTURE)
&& (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) && (alpha_op == WINED3D_TOP_MULTIPLY_ADD || alpha_op == WINED3D_TOP_LERP)))
device->fixed_function_usage_map |= (1 << i); device->fixed_function_usage_map |= (1 << i);
if ((color_op == WINED3DTOP_BUMPENVMAP || color_op == WINED3DTOP_BUMPENVMAPLUMINANCE) && i < MAX_TEXTURES - 1) if ((color_op == WINED3D_TOP_BUMPENVMAP || color_op == WINED3D_TOP_BUMPENVMAP_LUMINANCE)
&& i < MAX_TEXTURES - 1)
device->fixed_function_usage_map |= (1 << (i + 1)); device->fixed_function_usage_map |= (1 << (i + 1));
} }
} }
@ -3644,7 +3644,7 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi
{ {
unsigned int i; unsigned int i;
if (value == WINED3DTOP_DISABLE && old_value != WINED3DTOP_DISABLE) if (value == WINED3D_TOP_DISABLE && old_value != WINED3D_TOP_DISABLE)
{ {
/* Previously enabled stage disabled now. Make sure to dirtify /* Previously enabled stage disabled now. Make sure to dirtify
* all enabled stages above stage, they have to be disabled. * all enabled stages above stage, they have to be disabled.
@ -3658,7 +3658,7 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi
device->stateBlock->state.lowest_disabled_stage = stage; device->stateBlock->state.lowest_disabled_stage = stage;
TRACE("New lowest disabled: %u.\n", stage); TRACE("New lowest disabled: %u.\n", stage);
} }
else if (value != WINED3DTOP_DISABLE && old_value == WINED3DTOP_DISABLE) else if (value != WINED3D_TOP_DISABLE && old_value == WINED3D_TOP_DISABLE)
{ {
/* Previously disabled stage enabled. Stages above it may need /* Previously disabled stage enabled. Stages above it may need
* enabling. Stage must be lowest_disabled_stage here, if it's * enabling. Stage must be lowest_disabled_stage here, if it's
@ -3670,7 +3670,7 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi
* handled below. */ * handled below. */
for (i = stage + 1; i < gl_info->limits.texture_stages; ++i) for (i = stage + 1; i < gl_info->limits.texture_stages; ++i)
{ {
if (device->updateStateBlock->state.texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3DTOP_DISABLE) if (device->updateStateBlock->state.texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
break; break;
TRACE("Additionally dirtifying stage %u due to enable.\n", i); TRACE("Additionally dirtifying stage %u due to enable.\n", i);
device_invalidate_state(device, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP)); device_invalidate_state(device, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP));

View File

@ -34,8 +34,9 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st
{ {
BOOL bumpmap = FALSE; BOOL bumpmap = FALSE;
if (stage > 0 && (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3DTOP_BUMPENVMAPLUMINANCE if (stage > 0
|| state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3DTOP_BUMPENVMAP)) && (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
|| state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP))
{ {
bumpmap = TRUE; bumpmap = TRUE;
context->texShaderBumpMap |= (1 << stage); context->texShaderBumpMap |= (1 << stage);
@ -133,7 +134,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum*
} }
void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha, void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst) int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst)
{ {
struct tex_op_args tex_op_args = {{0}, {0}, {0}}; struct tex_op_args tex_op_args = {{0}, {0}, {0}};
GLenum portion = is_alpha ? GL_ALPHA : GL_RGB; GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
@ -148,7 +149,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
if (is_invalid_op(state, stage, op, arg1, arg2, arg3)) if (is_invalid_op(state, stage, op, arg1, arg2, arg3))
{ {
arg1 = WINED3DTA_CURRENT; arg1 = WINED3DTA_CURRENT;
op = WINED3DTOP_SELECTARG1; op = WINED3D_TOP_SELECT_ARG1;
} }
get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0], get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
@ -166,9 +167,9 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
} }
/* This is called by a state handler which has the gl lock held and a context for the thread */ /* This is called by a state handler which has the gl lock held and a context for the thread */
switch(op) switch (op)
{ {
case WINED3DTOP_DISABLE: case WINED3D_TOP_DISABLE:
/* Only for alpha */ /* Only for alpha */
if (!is_alpha) if (!is_alpha)
ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n"); ERR("Shouldn't be called for WINED3D_TSS_COLOR_OP (WINED3DTOP_DISABLE).\n");
@ -183,16 +184,15 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_SELECTARG1: case WINED3D_TOP_SELECT_ARG1:
case WINED3DTOP_SELECTARG2: case WINED3D_TOP_SELECT_ARG2:
/* Input, arg*1 */ /* Input, arg*1 */
if (op == WINED3DTOP_SELECTARG1) { if (op == WINED3D_TOP_SELECT_ARG1)
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
} else { else
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1])); tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
}
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion)); GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
@ -201,9 +201,9 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
/* Input, arg1*arg2 */ /* Input, arg1*arg2 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
@ -211,21 +211,20 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1])); tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
/* Output */ /* Output */
if (op == WINED3DTOP_MODULATE) { if (op == WINED3D_TOP_MODULATE)
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
} else if (op == WINED3DTOP_MODULATE2X) { else if (op == WINED3D_TOP_MODULATE_2X)
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
} else if (op == WINED3DTOP_MODULATE4X) { else if (op == WINED3D_TOP_MODULATE_4X)
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
}
break; break;
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
/* Input, arg1*1+arg2*1 */ /* Input, arg1*1+arg2*1 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
@ -237,19 +236,18 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion)); GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
/* Output */ /* Output */
if (op == WINED3DTOP_ADD) { if (op == WINED3D_TOP_ADD)
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
} else if (op == WINED3DTOP_ADDSIGNED) { else if (op == WINED3D_TOP_ADD_SIGNED)
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
} else if (op == WINED3DTOP_ADDSIGNED2X) { else if (op == WINED3D_TOP_ADD_SIGNED_2X)
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV, GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
}
break; break;
case WINED3DTOP_SUBTRACT: case WINED3D_TOP_SUBTRACT:
/* Input, arg1*1+-arg2*1 */ /* Input, arg1*1+-arg2*1 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
@ -265,7 +263,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
/* Input, arg1*1+(1-arg1)*arg2 */ /* Input, arg1*1+(1-arg1)*arg2 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
@ -281,24 +279,30 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
case WINED3DTOP_BLENDCURRENTALPHA: case WINED3D_TOP_BLEND_CURRENT_ALPHA:
{ {
GLenum alpha_src = GL_PRIMARY_COLOR_NV; GLenum alpha_src = GL_PRIMARY_COLOR_NV;
if (op == WINED3DTOP_BLENDDIFFUSEALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx); if (op == WINED3D_TOP_BLEND_DIFFUSE_ALPHA)
else if (op == WINED3DTOP_BLENDTEXTUREALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx); alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
else if (op == WINED3DTOP_BLENDFACTORALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx); else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA)
else if (op == WINED3DTOP_BLENDTEXTUREALPHAPM) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx); alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
else if (op == WINED3DTOP_BLENDCURRENTALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx); else if (op == WINED3D_TOP_BLEND_FACTOR_ALPHA)
else FIXME("Unhandled WINED3DTOP %s, shouldn't happen\n", debug_d3dtop(op)); alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
else if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
else if (op == WINED3D_TOP_BLEND_CURRENT_ALPHA)
alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
else
FIXME("Unhandled texture op %s, shouldn't happen.\n", debug_d3dtop(op));
/* Input, arg1*alpha_src+arg2*(1-alpha_src) */ /* Input, arg1*alpha_src+arg2*(1-alpha_src) */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0])); tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
if (op == WINED3DTOP_BLENDTEXTUREALPHAPM) if (op == WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM)
{ {
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion)); GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
@ -317,7 +321,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
break; break;
} }
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
/* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */ /* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
if (is_alpha) if (is_alpha)
ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n"); ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEALPHA_ADDCOLOR).\n");
@ -335,7 +339,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
/* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */ /* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
if (is_alpha) if (is_alpha)
ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n"); ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATECOLOR_ADDALPHA).\n");
@ -353,7 +357,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
/* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */ /* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
if (is_alpha) if (is_alpha)
ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n"); ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR).\n");
@ -371,7 +375,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
/* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */ /* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
if (is_alpha) if (is_alpha)
ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n"); ERR("Only supported for WINED3D_TSS_COLOR_OP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA).\n");
@ -389,7 +393,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_DOTPRODUCT3: case WINED3D_TOP_DOTPRODUCT3:
/* Input, arg1 . arg2 */ /* Input, arg1 . arg2 */
/* FIXME: DX7 uses a different calculation? */ /* FIXME: DX7 uses a different calculation? */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
@ -402,7 +406,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE)); GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
/* Input, arg3*1+arg1*arg2 */ /* Input, arg3*1+arg1*arg2 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2])); tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
@ -418,7 +422,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_LERP: case WINED3D_TOP_LERP:
/* Input, arg3*arg1+(1-arg3)*arg2 */ /* Input, arg3*arg1+(1-arg3)*arg2 */
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2])); tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
@ -434,8 +438,8 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
break; break;
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
if (gl_info->supported[NV_TEXTURE_SHADER]) if (gl_info->supported[NV_TEXTURE_SHADER])
{ {
/* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
@ -454,7 +458,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
} }
default: default:
FIXME("Unhandled WINED3DTOP: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n", FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n",
stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx); stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
} }
@ -557,8 +561,8 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
*/ */
if (gl_info->supported[NV_TEXTURE_SHADER2]) if (gl_info->supported[NV_TEXTURE_SHADER2])
{ {
BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3DTOP_BUMPENVMAPLUMINANCE BOOL usesBump = (state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUMINANCE
|| state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3DTOP_BUMPENVMAP); || state->texture_states[stage][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP);
BOOL usedBump = !!(context->texShaderBumpMap & 1 << (stage + 1)); BOOL usedBump = !!(context->texShaderBumpMap & 1 << (stage + 1));
if (usesBump != usedBump) if (usesBump != usedBump)
{ {

View File

@ -2038,7 +2038,7 @@ static void get_src_and_opr(DWORD arg, BOOL is_alpha, GLenum* source, GLenum* op
/* Setup the texture operations texture stage states */ /* Setup the texture operations texture stage states */
static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) BOOL isAlpha, int Stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
{ {
GLenum src1, src2, src3; GLenum src1, src2, src3;
GLenum opr1, opr2, opr3; GLenum opr1, opr2, opr3;
@ -2092,7 +2092,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
if (is_invalid_op(state, Stage, op, arg1, arg2, arg3)) if (is_invalid_op(state, Stage, op, arg1, arg2, arg3))
{ {
arg1 = WINED3DTA_CURRENT; arg1 = WINED3DTA_CURRENT;
op = WINED3DTOP_SELECTARG1; op = WINED3D_TOP_SELECT_ARG1;
} }
if (isAlpha && !state->textures[Stage] && arg1 == WINED3DTA_TEXTURE) if (isAlpha && !state->textures[Stage] && arg1 == WINED3DTA_TEXTURE)
@ -2122,8 +2122,9 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
src3_target = GL_SOURCE3_RGB_NV; src3_target = GL_SOURCE3_RGB_NV;
opr3_target = GL_OPERAND3_RGB_NV; opr3_target = GL_OPERAND3_RGB_NV;
} }
switch (op) { switch (op)
case WINED3DTOP_DISABLE: /* Only for alpha */ {
case WINED3D_TOP_DISABLE: /* Only for alpha */
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
@ -2143,11 +2144,12 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr); glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr"); checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
break; break;
case WINED3DTOP_SELECTARG1: /* = a1 * 1 + 0 * 0 */ case WINED3D_TOP_SELECT_ARG1: /* = a1 * 1 + 0 * 0 */
case WINED3DTOP_SELECTARG2: /* = a2 * 1 + 0 * 0 */ case WINED3D_TOP_SELECT_ARG2: /* = a2 * 1 + 0 * 0 */
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
if (op == WINED3DTOP_SELECTARG1) { if (op == WINED3D_TOP_SELECT_ARG1)
{
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1"); checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1); glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
@ -2172,7 +2174,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr"); checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
break; break;
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */ checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2194,7 +2196,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */ checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2216,7 +2218,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2); glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
checkGLcall("GL_TEXTURE_ENV, scal_target, 2"); checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
break; break;
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */ checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2239,7 +2241,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 4"); checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
break; break;
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2262,7 +2264,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2285,7 +2287,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2308,7 +2310,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 2"); checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2337,7 +2339,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2359,7 +2361,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2381,7 +2383,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2403,7 +2405,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2425,7 +2427,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */ checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); /* a0 = src1/opr1 */ glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); /* a0 = src1/opr1 */
@ -2451,7 +2453,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2477,7 +2479,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2505,7 +2507,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2537,7 +2539,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src3); glTexEnvi(GL_TEXTURE_ENV, src0_target, src3);
@ -2560,11 +2562,8 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
{ case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
}
case WINED3DTOP_BUMPENVMAPLUMINANCE:
FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n"); FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n");
default: default:
@ -2580,7 +2579,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
Handled = TRUE; /* Again, assume handled */ Handled = TRUE; /* Again, assume handled */
switch (op) { switch (op) {
case WINED3DTOP_DISABLE: /* Only for alpha */ case WINED3D_TOP_DISABLE: /* Only for alpha */
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT); glTexEnvi(GL_TEXTURE_ENV, src0_target, GL_PREVIOUS_EXT);
@ -2590,7 +2589,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_SELECTARG1: case WINED3D_TOP_SELECT_ARG1:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2600,7 +2599,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_SELECTARG2: case WINED3D_TOP_SELECT_ARG2:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_REPLACE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_REPLACE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src2); glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
@ -2610,7 +2609,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATE: case WINED3D_TOP_MODULATE:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2624,7 +2623,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_MODULATE2X: case WINED3D_TOP_MODULATE_2X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2638,7 +2637,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2); glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
checkGLcall("GL_TEXTURE_ENV, scal_target, 2"); checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
break; break;
case WINED3DTOP_MODULATE4X: case WINED3D_TOP_MODULATE_4X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_MODULATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2652,7 +2651,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 4); glTexEnvi(GL_TEXTURE_ENV, scal_target, 4);
checkGLcall("GL_TEXTURE_ENV, scal_target, 4"); checkGLcall("GL_TEXTURE_ENV, scal_target, 4");
break; break;
case WINED3DTOP_ADD: case WINED3D_TOP_ADD:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2666,7 +2665,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_ADDSIGNED: case WINED3D_TOP_ADD_SIGNED:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2680,7 +2679,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_ADDSIGNED2X: case WINED3D_TOP_ADD_SIGNED_2X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD_SIGNED");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2694,7 +2693,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 2); glTexEnvi(GL_TEXTURE_ENV, scal_target, 2);
checkGLcall("GL_TEXTURE_ENV, scal_target, 2"); checkGLcall("GL_TEXTURE_ENV, scal_target, 2");
break; break;
case WINED3DTOP_SUBTRACT: case WINED3D_TOP_SUBTRACT:
if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE]) if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_SUBTRACT); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_SUBTRACT);
@ -2714,7 +2713,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} }
break; break;
case WINED3DTOP_BLENDDIFFUSEALPHA: case WINED3D_TOP_BLEND_DIFFUSE_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2732,7 +2731,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDTEXTUREALPHA: case WINED3D_TOP_BLEND_TEXTURE_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2750,7 +2749,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDFACTORALPHA: case WINED3D_TOP_BLEND_FACTOR_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2768,7 +2767,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_BLENDCURRENTALPHA: case WINED3D_TOP_BLEND_CURRENT_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2786,7 +2785,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_DOTPRODUCT3: case WINED3D_TOP_DOTPRODUCT3:
if (gl_info->supported[ARB_TEXTURE_ENV_DOT3]) if (gl_info->supported[ARB_TEXTURE_ENV_DOT3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
@ -2810,7 +2809,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_LERP: case WINED3D_TOP_LERP:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE"); checkGLcall("GL_TEXTURE_ENV, comb_target, GL_INTERPOLATE");
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1); glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
@ -2828,7 +2827,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1); glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1"); checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break; break;
case WINED3DTOP_ADDSMOOTH: case WINED3D_TOP_ADD_SMOOTH:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2856,7 +2855,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2878,7 +2877,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2906,7 +2905,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2934,7 +2933,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2962,7 +2961,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -2996,7 +2995,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MULTIPLY_ADD:
if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3]) if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3])
{ {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI); glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_MODULATE_ADD_ATI);
@ -3018,8 +3017,8 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
} else } else
Handled = FALSE; Handled = FALSE;
break; break;
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3D_TOP_BUMPENVMAP_LUMINANCE:
case WINED3DTOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP:
if (gl_info->supported[NV_TEXTURE_SHADER2]) if (gl_info->supported[NV_TEXTURE_SHADER2])
{ {
/* Technically texture shader support without register combiners is possible, but not expected to occur /* Technically texture shader support without register combiners is possible, but not expected to occur
@ -3043,18 +3042,20 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
op2 = state->texture_states[Stage][WINED3D_TSS_ALPHA_OP]; op2 = state->texture_states[Stage][WINED3D_TSS_ALPHA_OP];
/* Note: If COMBINE4 in effect can't go back to combine! */ /* Note: If COMBINE4 in effect can't go back to combine! */
switch (op2) { switch (op2)
case WINED3DTOP_ADDSMOOTH: {
case WINED3DTOP_BLENDTEXTUREALPHAPM: case WINED3D_TOP_ADD_SMOOTH:
case WINED3DTOP_MODULATEALPHA_ADDCOLOR: case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM:
case WINED3DTOP_MODULATECOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR:
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA:
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR:
case WINED3DTOP_MULTIPLYADD: case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA:
case WINED3D_TOP_MULTIPLY_ADD:
/* Ignore those implemented in both cases */ /* Ignore those implemented in both cases */
switch (op) { switch (op)
case WINED3DTOP_SELECTARG1: {
case WINED3DTOP_SELECTARG2: case WINED3D_TOP_SELECT_ARG1:
case WINED3D_TOP_SELECT_ARG2:
combineOK = FALSE; combineOK = FALSE;
Handled = FALSE; Handled = FALSE;
break; break;
@ -3200,26 +3201,26 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
* *
* What to do with multitexturing? So far no app has been found that uses color keying with * What to do with multitexturing? So far no app has been found that uses color keying with
* multitexturing */ * multitexturing */
if (op == WINED3DTOP_DISABLE) if (op == WINED3D_TOP_DISABLE)
{ {
arg1 = WINED3DTA_TEXTURE; arg1 = WINED3DTA_TEXTURE;
op = WINED3DTOP_SELECTARG1; op = WINED3D_TOP_SELECT_ARG1;
} }
else if(op == WINED3DTOP_SELECTARG1 && arg1 != WINED3DTA_TEXTURE) else if (op == WINED3D_TOP_SELECT_ARG1 && arg1 != WINED3DTA_TEXTURE)
{ {
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]) if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
{ {
arg2 = WINED3DTA_TEXTURE; arg2 = WINED3DTA_TEXTURE;
op = WINED3DTOP_MODULATE; op = WINED3D_TOP_MODULATE;
} }
else arg1 = WINED3DTA_TEXTURE; else arg1 = WINED3DTA_TEXTURE;
} }
else if(op == WINED3DTOP_SELECTARG2 && arg2 != WINED3DTA_TEXTURE) else if (op == WINED3D_TOP_SELECT_ARG2 && arg2 != WINED3DTA_TEXTURE)
{ {
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]) if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
{ {
arg1 = WINED3DTA_TEXTURE; arg1 = WINED3DTA_TEXTURE;
op = WINED3DTOP_MODULATE; op = WINED3D_TOP_MODULATE;
} }
else arg2 = WINED3DTA_TEXTURE; else arg2 = WINED3DTA_TEXTURE;
} }

View File

@ -1072,7 +1072,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1; stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1;
for (i = 0; i < MAX_TEXTURES - 1; ++i) for (i = 0; i < MAX_TEXTURES - 1; ++i)
{ {
if (stateblock->device->stateBlock->state.texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3DTOP_DISABLE) if (stateblock->device->stateBlock->state.texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
{ {
stateblock->device->stateBlock->state.lowest_disabled_stage = i; stateblock->device->stateBlock->state.lowest_disabled_stage = i;
break; break;
@ -1254,10 +1254,10 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
{ {
TRACE("Setting up default texture states for texture Stage %u.\n", i); TRACE("Setting up default texture states for texture Stage %u.\n", i);
memcpy(&state->transforms[WINED3DTS_TEXTURE0 + i], identity, sizeof(identity)); memcpy(&state->transforms[WINED3DTS_TEXTURE0 + i], identity, sizeof(identity));
state->texture_states[i][WINED3D_TSS_COLOR_OP] = i ? WINED3DTOP_DISABLE : WINED3DTOP_MODULATE; state->texture_states[i][WINED3D_TSS_COLOR_OP] = i ? WINED3D_TOP_DISABLE : WINED3D_TOP_MODULATE;
state->texture_states[i][WINED3D_TSS_COLOR_ARG1] = WINED3DTA_TEXTURE; state->texture_states[i][WINED3D_TSS_COLOR_ARG1] = WINED3DTA_TEXTURE;
state->texture_states[i][WINED3D_TSS_COLOR_ARG2] = WINED3DTA_CURRENT; state->texture_states[i][WINED3D_TSS_COLOR_ARG2] = WINED3DTA_CURRENT;
state->texture_states[i][WINED3D_TSS_ALPHA_OP] = i ? WINED3DTOP_DISABLE : WINED3DTOP_SELECTARG1; state->texture_states[i][WINED3D_TSS_ALPHA_OP] = i ? WINED3D_TOP_DISABLE : WINED3D_TOP_SELECT_ARG1;
state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] = WINED3DTA_TEXTURE; state->texture_states[i][WINED3D_TSS_ALPHA_ARG1] = WINED3DTA_TEXTURE;
state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] = WINED3DTA_CURRENT; state->texture_states[i][WINED3D_TSS_ALPHA_ARG2] = WINED3DTA_CURRENT;
state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00] = 0; state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00] = 0;

View File

@ -2227,38 +2227,40 @@ const char *debug_d3dtexturestate(enum wined3d_texture_stage_state state)
} }
} }
const char* debug_d3dtop(WINED3DTEXTUREOP d3dtop) { const char *debug_d3dtop(enum wined3d_texture_op d3dtop)
switch (d3dtop) { {
switch (d3dtop)
{
#define D3DTOP_TO_STR(u) case u: return #u #define D3DTOP_TO_STR(u) case u: return #u
D3DTOP_TO_STR(WINED3DTOP_DISABLE); D3DTOP_TO_STR(WINED3D_TOP_DISABLE);
D3DTOP_TO_STR(WINED3DTOP_SELECTARG1); D3DTOP_TO_STR(WINED3D_TOP_SELECT_ARG1);
D3DTOP_TO_STR(WINED3DTOP_SELECTARG2); D3DTOP_TO_STR(WINED3D_TOP_SELECT_ARG2);
D3DTOP_TO_STR(WINED3DTOP_MODULATE); D3DTOP_TO_STR(WINED3D_TOP_MODULATE);
D3DTOP_TO_STR(WINED3DTOP_MODULATE2X); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_2X);
D3DTOP_TO_STR(WINED3DTOP_MODULATE4X); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_4X);
D3DTOP_TO_STR(WINED3DTOP_ADD); D3DTOP_TO_STR(WINED3D_TOP_ADD);
D3DTOP_TO_STR(WINED3DTOP_ADDSIGNED); D3DTOP_TO_STR(WINED3D_TOP_ADD_SIGNED);
D3DTOP_TO_STR(WINED3DTOP_ADDSIGNED2X); D3DTOP_TO_STR(WINED3D_TOP_ADD_SIGNED_2X);
D3DTOP_TO_STR(WINED3DTOP_SUBTRACT); D3DTOP_TO_STR(WINED3D_TOP_SUBTRACT);
D3DTOP_TO_STR(WINED3DTOP_ADDSMOOTH); D3DTOP_TO_STR(WINED3D_TOP_ADD_SMOOTH);
D3DTOP_TO_STR(WINED3DTOP_BLENDDIFFUSEALPHA); D3DTOP_TO_STR(WINED3D_TOP_BLEND_DIFFUSE_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_BLENDTEXTUREALPHA); D3DTOP_TO_STR(WINED3D_TOP_BLEND_TEXTURE_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_BLENDFACTORALPHA); D3DTOP_TO_STR(WINED3D_TOP_BLEND_FACTOR_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_BLENDTEXTUREALPHAPM); D3DTOP_TO_STR(WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM);
D3DTOP_TO_STR(WINED3DTOP_BLENDCURRENTALPHA); D3DTOP_TO_STR(WINED3D_TOP_BLEND_CURRENT_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_PREMODULATE); D3DTOP_TO_STR(WINED3D_TOP_PREMODULATE);
D3DTOP_TO_STR(WINED3DTOP_MODULATEALPHA_ADDCOLOR); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR);
D3DTOP_TO_STR(WINED3DTOP_MODULATECOLOR_ADDALPHA); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_MODULATEINVALPHA_ADDCOLOR); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR);
D3DTOP_TO_STR(WINED3DTOP_MODULATEINVCOLOR_ADDALPHA); D3DTOP_TO_STR(WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA);
D3DTOP_TO_STR(WINED3DTOP_BUMPENVMAP); D3DTOP_TO_STR(WINED3D_TOP_BUMPENVMAP);
D3DTOP_TO_STR(WINED3DTOP_BUMPENVMAPLUMINANCE); D3DTOP_TO_STR(WINED3D_TOP_BUMPENVMAP_LUMINANCE);
D3DTOP_TO_STR(WINED3DTOP_DOTPRODUCT3); D3DTOP_TO_STR(WINED3D_TOP_DOTPRODUCT3);
D3DTOP_TO_STR(WINED3DTOP_MULTIPLYADD); D3DTOP_TO_STR(WINED3D_TOP_MULTIPLY_ADD);
D3DTOP_TO_STR(WINED3DTOP_LERP); D3DTOP_TO_STR(WINED3D_TOP_LERP);
#undef D3DTOP_TO_STR #undef D3DTOP_TO_STR
default: default:
FIXME("Unrecognized %u WINED3DTOP\n", d3dtop); FIXME("Unrecognized texture op %#x.\n", d3dtop);
return "unrecognized"; return "unrecognized";
} }
} }
@ -2478,17 +2480,22 @@ const char *debug_surflocation(DWORD flag) {
} }
BOOL is_invalid_op(const struct wined3d_state *state, int stage, BOOL is_invalid_op(const struct wined3d_state *state, int stage,
WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3)
{ {
if (op == WINED3DTOP_DISABLE) return FALSE; if (op == WINED3D_TOP_DISABLE)
if (state->textures[stage]) return FALSE; return FALSE;
if (state->textures[stage])
return FALSE;
if ((arg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE if ((arg1 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
&& op != WINED3DTOP_SELECTARG2) return TRUE; && op != WINED3D_TOP_SELECT_ARG2)
return TRUE;
if ((arg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE if ((arg2 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
&& op != WINED3DTOP_SELECTARG1) return TRUE; && op != WINED3D_TOP_SELECT_ARG1)
return TRUE;
if ((arg3 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE if ((arg3 & WINED3DTA_SELECTMASK) == WINED3DTA_TEXTURE
&& (op == WINED3DTOP_MULTIPLYADD || op == WINED3DTOP_LERP)) return TRUE; && (op == WINED3D_TOP_MULTIPLY_ADD || op == WINED3D_TOP_LERP))
return TRUE;
return FALSE; return FALSE;
} }
@ -2859,7 +2866,8 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s
#define ARG1 0x01 #define ARG1 0x01
#define ARG2 0x02 #define ARG2 0x02
#define ARG0 0x04 #define ARG0 0x04
static const unsigned char args[WINED3DTOP_LERP + 1] = { static const unsigned char args[WINED3D_TOP_LERP + 1] =
{
/* undefined */ 0, /* undefined */ 0,
/* D3DTOP_DISABLE */ 0, /* D3DTOP_DISABLE */ 0,
/* D3DTOP_SELECTARG1 */ ARG1, /* D3DTOP_SELECTARG1 */ ARG1,
@ -2899,10 +2907,10 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s
const struct wined3d_texture *texture; const struct wined3d_texture *texture;
settings->op[i].padding = 0; settings->op[i].padding = 0;
if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3DTOP_DISABLE) if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
{ {
settings->op[i].cop = WINED3DTOP_DISABLE; settings->op[i].cop = WINED3D_TOP_DISABLE;
settings->op[i].aop = WINED3DTOP_DISABLE; settings->op[i].aop = WINED3D_TOP_DISABLE;
settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED; settings->op[i].carg0 = settings->op[i].carg1 = settings->op[i].carg2 = ARG_UNUSED;
settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED; settings->op[i].aarg0 = settings->op[i].aarg1 = settings->op[i].aarg2 = ARG_UNUSED;
settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY; settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY;
@ -2958,10 +2966,11 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s
carg0 = ARG_UNUSED; carg0 = ARG_UNUSED;
carg2 = ARG_UNUSED; carg2 = ARG_UNUSED;
carg1 = WINED3DTA_CURRENT; carg1 = WINED3DTA_CURRENT;
cop = WINED3DTOP_SELECTARG1; cop = WINED3D_TOP_SELECT_ARG1;
} }
if(cop == WINED3DTOP_DOTPRODUCT3) { if (cop == WINED3D_TOP_DOTPRODUCT3)
{
/* A dotproduct3 on the colorop overwrites the alphaop operation and replicates /* A dotproduct3 on the colorop overwrites the alphaop operation and replicates
* the color result to the alpha component of the destination * the color result to the alpha component of the destination
*/ */
@ -2990,26 +2999,26 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask) if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
{ {
if (aop == WINED3DTOP_DISABLE) if (aop == WINED3D_TOP_DISABLE)
{ {
aarg1 = WINED3DTA_TEXTURE; aarg1 = WINED3DTA_TEXTURE;
aop = WINED3DTOP_SELECTARG1; aop = WINED3D_TOP_SELECT_ARG1;
} }
else if (aop == WINED3DTOP_SELECTARG1 && aarg1 != WINED3DTA_TEXTURE) else if (aop == WINED3D_TOP_SELECT_ARG1 && aarg1 != WINED3DTA_TEXTURE)
{ {
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]) if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
{ {
aarg2 = WINED3DTA_TEXTURE; aarg2 = WINED3DTA_TEXTURE;
aop = WINED3DTOP_MODULATE; aop = WINED3D_TOP_MODULATE;
} }
else aarg1 = WINED3DTA_TEXTURE; else aarg1 = WINED3DTA_TEXTURE;
} }
else if (aop == WINED3DTOP_SELECTARG2 && aarg2 != WINED3DTA_TEXTURE) else if (aop == WINED3D_TOP_SELECT_ARG2 && aarg2 != WINED3DTA_TEXTURE)
{ {
if (state->render_states[WINED3D_RS_ALPHABLENDENABLE]) if (state->render_states[WINED3D_RS_ALPHABLENDENABLE])
{ {
aarg1 = WINED3DTA_TEXTURE; aarg1 = WINED3DTA_TEXTURE;
aop = WINED3DTOP_MODULATE; aop = WINED3D_TOP_MODULATE;
} }
else aarg2 = WINED3DTA_TEXTURE; else aarg2 = WINED3DTA_TEXTURE;
} }
@ -3022,7 +3031,7 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s
aarg0 = ARG_UNUSED; aarg0 = ARG_UNUSED;
aarg2 = ARG_UNUSED; aarg2 = ARG_UNUSED;
aarg1 = WINED3DTA_CURRENT; aarg1 = WINED3DTA_CURRENT;
aop = WINED3DTOP_SELECTARG1; aop = WINED3D_TOP_SELECT_ARG1;
} }
if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE

View File

@ -2510,14 +2510,14 @@ const char *debug_fbostatus(GLenum status) DECLSPEC_HIDDEN;
const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN; const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN;
const char *debug_d3dbasis(WINED3DBASISTYPE basis) DECLSPEC_HIDDEN; const char *debug_d3dbasis(WINED3DBASISTYPE basis) DECLSPEC_HIDDEN;
const char *debug_d3ddegree(enum wined3d_degree_type order) DECLSPEC_HIDDEN; const char *debug_d3ddegree(enum wined3d_degree_type order) DECLSPEC_HIDDEN;
const char *debug_d3dtop(WINED3DTEXTUREOP d3dtop) DECLSPEC_HIDDEN; const char *debug_d3dtop(enum wined3d_texture_op d3dtop) DECLSPEC_HIDDEN;
void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN; void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
const char *debug_surflocation(DWORD flag) DECLSPEC_HIDDEN; const char *debug_surflocation(DWORD flag) DECLSPEC_HIDDEN;
BOOL is_invalid_op(const struct wined3d_state *state, int stage, BOOL is_invalid_op(const struct wined3d_state *state, int stage,
WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) DECLSPEC_HIDDEN; enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3) DECLSPEC_HIDDEN;
void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, BOOL is_alpha, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3,
INT texture_idx, DWORD dst) DECLSPEC_HIDDEN; INT texture_idx, DWORD dst) DECLSPEC_HIDDEN;
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords,
BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN; BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;

View File

@ -582,36 +582,35 @@ enum wined3d_texture_transform_flags
WINED3D_TTFF_PROJECTED = 256, WINED3D_TTFF_PROJECTED = 256,
}; };
typedef enum _WINED3DTEXTUREOP enum wined3d_texture_op
{ {
WINED3DTOP_DISABLE = 1, WINED3D_TOP_DISABLE = 1,
WINED3DTOP_SELECTARG1 = 2, WINED3D_TOP_SELECT_ARG1 = 2,
WINED3DTOP_SELECTARG2 = 3, WINED3D_TOP_SELECT_ARG2 = 3,
WINED3DTOP_MODULATE = 4, WINED3D_TOP_MODULATE = 4,
WINED3DTOP_MODULATE2X = 5, WINED3D_TOP_MODULATE_2X = 5,
WINED3DTOP_MODULATE4X = 6, WINED3D_TOP_MODULATE_4X = 6,
WINED3DTOP_ADD = 7, WINED3D_TOP_ADD = 7,
WINED3DTOP_ADDSIGNED = 8, WINED3D_TOP_ADD_SIGNED = 8,
WINED3DTOP_ADDSIGNED2X = 9, WINED3D_TOP_ADD_SIGNED_2X = 9,
WINED3DTOP_SUBTRACT = 10, WINED3D_TOP_SUBTRACT = 10,
WINED3DTOP_ADDSMOOTH = 11, WINED3D_TOP_ADD_SMOOTH = 11,
WINED3DTOP_BLENDDIFFUSEALPHA = 12, WINED3D_TOP_BLEND_DIFFUSE_ALPHA = 12,
WINED3DTOP_BLENDTEXTUREALPHA = 13, WINED3D_TOP_BLEND_TEXTURE_ALPHA = 13,
WINED3DTOP_BLENDFACTORALPHA = 14, WINED3D_TOP_BLEND_FACTOR_ALPHA = 14,
WINED3DTOP_BLENDTEXTUREALPHAPM = 15, WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM = 15,
WINED3DTOP_BLENDCURRENTALPHA = 16, WINED3D_TOP_BLEND_CURRENT_ALPHA = 16,
WINED3DTOP_PREMODULATE = 17, WINED3D_TOP_PREMODULATE = 17,
WINED3DTOP_MODULATEALPHA_ADDCOLOR = 18, WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR = 18,
WINED3DTOP_MODULATECOLOR_ADDALPHA = 19, WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA = 19,
WINED3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR = 20,
WINED3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA = 21,
WINED3DTOP_BUMPENVMAP = 22, WINED3D_TOP_BUMPENVMAP = 22,
WINED3DTOP_BUMPENVMAPLUMINANCE = 23, WINED3D_TOP_BUMPENVMAP_LUMINANCE = 23,
WINED3DTOP_DOTPRODUCT3 = 24, WINED3D_TOP_DOTPRODUCT3 = 24,
WINED3DTOP_MULTIPLYADD = 25, WINED3D_TOP_MULTIPLY_ADD = 25,
WINED3DTOP_LERP = 26, WINED3D_TOP_LERP = 26,
WINED3DTOP_FORCE_DWORD = 0x7fffffff, };
} WINED3DTEXTUREOP;
typedef enum _WINED3DTEXTUREADDRESS typedef enum _WINED3DTEXTUREADDRESS
{ {