d3d9: Test for fixed function value clamping.
This commit is contained in:
parent
bab367e1a0
commit
bbf313e76a
|
@ -9298,6 +9298,116 @@ static void yuv_color_test(IDirect3DDevice9 *device) {
|
|||
IDirect3D9_Release(d3d);
|
||||
}
|
||||
|
||||
static void texop_range_test(IDirect3DDevice9 *device)
|
||||
{
|
||||
static const struct {
|
||||
float x, y, z;
|
||||
D3DCOLOR diffuse;
|
||||
} quad[] = {
|
||||
{-1.0f, -1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)},
|
||||
{-1.0f, 1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)},
|
||||
{ 1.0f, -1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)},
|
||||
{ 1.0f, 1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)}
|
||||
};
|
||||
HRESULT hr;
|
||||
IDirect3DTexture9 *texture;
|
||||
D3DLOCKED_RECT locked_rect;
|
||||
D3DCAPS9 caps;
|
||||
DWORD color;
|
||||
|
||||
/* We need ADD and SUBTRACT operations */
|
||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "GetDeviceCaps failed with 0x%08x\n", hr);
|
||||
if (!(caps.TextureOpCaps & D3DTEXOPCAPS_ADD)) {
|
||||
skip("D3DTOP_ADD is not supported, skipping value range test\n");
|
||||
}
|
||||
if (!(caps.TextureOpCaps & D3DTEXOPCAPS_SUBTRACT)) {
|
||||
skip("D3DTEXOPCAPS_SUBTRACT is not supported, skipping value range test\n");
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "SetFVF failed with 0x%08x\n", hr);
|
||||
/* Stage 1: result = diffuse(=1.0) + diffuse
|
||||
* stage 2: result = result - tfactor(= 0.5)
|
||||
*/
|
||||
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x80808080);
|
||||
ok(SUCCEEDED(hr), "SetRenderState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLORARG1, D3DTA_CURRENT);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLORARG2, D3DTA_TFACTOR);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_SUBTRACT);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "BeginScene failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "EndScene failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Present failed with 0x%08x\n", hr);
|
||||
|
||||
color = getPixelColor(device, 320, 240);
|
||||
ok(color_match(color, 0x00808080, 1), "texop Range > 1.0 returned 0x%08x, expected 0x00808080\n",
|
||||
color);
|
||||
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 1, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, NULL);
|
||||
ok(SUCCEEDED(hr), "IDirect3DDevice9_CreateTexture failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DTexture9_LockRect(texture, 0, &locked_rect, NULL, 0);
|
||||
ok(SUCCEEDED(hr), "LockRect failed with 0x%08x\n", hr);
|
||||
*((DWORD *)locked_rect.pBits) = D3DCOLOR_ARGB(0x00, 0x00, 0x00, 0x00);
|
||||
hr = IDirect3DTexture9_UnlockRect(texture, 0);
|
||||
ok(SUCCEEDED(hr), "LockRect failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
|
||||
ok(SUCCEEDED(hr), "SetTexture failed with 0x%08x\n", hr);
|
||||
|
||||
/* Stage 1: result = texture(=0.0) - tfactor(= 0.5)
|
||||
* stage 2: result = result + diffuse(1.0)
|
||||
*/
|
||||
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x80808080);
|
||||
ok(SUCCEEDED(hr), "SetRenderState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SUBTRACT);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLORARG1, D3DTA_CURRENT);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "BeginScene failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "EndScene failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Present failed with 0x%08x\n", hr);
|
||||
|
||||
color = getPixelColor(device, 320, 240);
|
||||
ok(color_match(color, 0x00ffffff, 1), "texop Range < 0.0 returned 0x%08x, expected 0x00ffffff\n",
|
||||
color);
|
||||
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr);
|
||||
hr = IDirect3DDevice9_SetTexture(device, 1, (IDirect3DBaseTexture9 *)NULL);
|
||||
ok(SUCCEEDED(hr), "SetTexture failed with 0x%08x\n", hr);
|
||||
IDirect3DTexture9_Release(texture);
|
||||
}
|
||||
|
||||
START_TEST(visual)
|
||||
{
|
||||
IDirect3DDevice9 *device_ptr;
|
||||
|
@ -9455,6 +9565,7 @@ START_TEST(visual)
|
|||
}
|
||||
else skip("No ps_1_1 support\n");
|
||||
texop_test(device_ptr);
|
||||
texop_range_test(device_ptr);
|
||||
|
||||
cleanup:
|
||||
if(device_ptr) {
|
||||
|
|
|
@ -2561,9 +2561,9 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color,
|
|||
}
|
||||
|
||||
if(mul == 2) {
|
||||
shader_addline(buffer, "MUL %s%s, %s, const.y;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg);
|
||||
shader_addline(buffer, "MUL_SAT %s%s, %s, const.y;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg);
|
||||
} else if(mul == 4) {
|
||||
shader_addline(buffer, "MUL %s%s, %s, const.z;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg);
|
||||
shader_addline(buffer, "MUL_SAT %s%s, %s, const.z;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -451,6 +451,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
if(dstmod == GL_NONE) dstmod = GL_4X_BIT_ATI;
|
||||
case WINED3DTOP_MODULATE2X:
|
||||
if(dstmod == GL_NONE) dstmod = GL_2X_BIT_ATI;
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
case WINED3DTOP_MODULATE:
|
||||
TRACE("glColorFragmentOp2ATI(GL_MUL_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
|
@ -466,6 +467,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
case WINED3DTOP_ADDSIGNED:
|
||||
argmodextra = GL_BIAS_BIT_ATI;
|
||||
case WINED3DTOP_ADD:
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
TRACE("glColorFragmentOp2ATI(GL_ADD_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
|
@ -476,6 +478,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
break;
|
||||
|
||||
case WINED3DTOP_SUBTRACT:
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
TRACE("glColorFragmentOp2ATI(GL_SUB_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
|
@ -487,7 +490,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
|
||||
case WINED3DTOP_ADDSMOOTH:
|
||||
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg1), debug_argmod(argmodextra),
|
||||
|
@ -495,7 +498,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
/* Dst = arg1 + * arg2(1 -arg 1)
|
||||
* = arg2 * (1 - arg1) + arg1
|
||||
*/
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_NONE,
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg1, GL_NONE, argmodextra,
|
||||
arg1, GL_NONE, argmod1));
|
||||
|
@ -539,11 +542,11 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
|
||||
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
||||
if(!argmodextra) argmodextra = argmod1;
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_NONE, %s, GL_NONE, %s, %s, GL_ALPHA, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_ALPHA, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg1), debug_argmod(argmodextra), debug_register(arg1), debug_argmod(arg1));
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_NONE,
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg1, GL_ALPHA, argmodextra,
|
||||
arg1, GL_NONE, argmod1));
|
||||
|
@ -553,34 +556,34 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
|
||||
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
||||
if(!argmodextra) argmodextra = argmod1;
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_ALPHA, %s)\n",
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_ALPHA, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg1), debug_argmod(argmodextra),
|
||||
debug_register(arg1), debug_argmod(argmod1));
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_NONE,
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg1, GL_NONE, argmodextra,
|
||||
arg1, GL_ALPHA, argmod1));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_DOTPRODUCT3:
|
||||
TRACE("glColorFragmentOp2ATI(GL_DOT3_ATI, %s, GL_NONE, GL_4X_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glColorFragmentOp2ATI(GL_DOT3_ATI, %s, GL_NONE, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg1), debug_argmod(argmod1 | GL_BIAS_BIT_ATI),
|
||||
debug_register(arg2), debug_argmod(argmod2 | GL_BIAS_BIT_ATI));
|
||||
GL_EXTCALL(glColorFragmentOp2ATI(GL_DOT3_ATI, dstreg, GL_NONE, GL_4X_BIT_ATI,
|
||||
GL_EXTCALL(glColorFragmentOp2ATI(GL_DOT3_ATI, dstreg, GL_NONE, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI,
|
||||
arg1, GL_NONE, argmod1 | GL_BIAS_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2 | GL_BIAS_BIT_ATI));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MULTIPLYADD:
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glColorFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg0), debug_argmod(argmod0));
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_NONE,
|
||||
GL_EXTCALL(glColorFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE, GL_SATURATE_BIT_ATI,
|
||||
arg1, GL_NONE, argmod1,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg0, GL_NONE, argmod0));
|
||||
|
@ -638,6 +641,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
if(dstmod == GL_NONE) dstmod = GL_4X_BIT_ATI;
|
||||
case WINED3DTOP_MODULATE2X:
|
||||
if(dstmod == GL_NONE) dstmod = GL_2X_BIT_ATI;
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
case WINED3DTOP_MODULATE:
|
||||
TRACE("glAlphaFragmentOp2ATI(GL_MUL_ATI, %s, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
|
@ -653,6 +657,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
case WINED3DTOP_ADDSIGNED:
|
||||
argmodextra = GL_BIAS_BIT_ATI;
|
||||
case WINED3DTOP_ADD:
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
TRACE("glAlphaFragmentOp2ATI(GL_ADD_ATI, %s, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
|
@ -663,6 +668,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
break;
|
||||
|
||||
case WINED3DTOP_SUBTRACT:
|
||||
dstmod |= GL_SATURATE_BIT_ATI;
|
||||
TRACE("glAlphaFragmentOp2ATI(GL_SUB_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg), debug_dstmod(dstmod),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
|
@ -674,7 +680,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
|
||||
case WINED3DTOP_ADDSMOOTH:
|
||||
argmodextra = argmod1 & GL_COMP_BIT_ATI ? argmod1 & ~GL_COMP_BIT_ATI : argmod1 | GL_COMP_BIT_ATI;
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_MAD_ATI, %s, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg1), debug_argmod(argmodextra),
|
||||
|
@ -682,7 +688,7 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
/* Dst = arg1 + * arg2(1 -arg 1)
|
||||
* = arg2 * (1 - arg1) + arg1
|
||||
*/
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE,
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_SATURATE_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg1, GL_NONE, argmodextra,
|
||||
arg1, GL_NONE, argmod1));
|
||||
|
@ -723,34 +729,34 @@ static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_G
|
|||
/* D3DTOP_PREMODULATE ???? */
|
||||
|
||||
case WINED3DTOP_DOTPRODUCT3:
|
||||
TRACE("glAlphaFragmentOp2ATI(GL_DOT3_ATI, %s, GL_NONE, GL_4X_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glAlphaFragmentOp2ATI(GL_DOT3_ATI, %s, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg1), debug_argmod(argmod1 | GL_BIAS_BIT_ATI),
|
||||
debug_register(arg2), debug_argmod(argmod2 | GL_BIAS_BIT_ATI));
|
||||
GL_EXTCALL(glAlphaFragmentOp2ATI(GL_DOT3_ATI, dstreg, GL_4X_BIT_ATI,
|
||||
GL_EXTCALL(glAlphaFragmentOp2ATI(GL_DOT3_ATI, dstreg, GL_4X_BIT_ATI | GL_SATURATE_BIT_ATI,
|
||||
arg1, GL_NONE, argmod1 | GL_BIAS_BIT_ATI,
|
||||
arg2, GL_NONE, argmod2 | GL_BIAS_BIT_ATI));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MULTIPLYADD:
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_MAD_ATI, %s, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_MAD_ATI, %s, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg0), debug_argmod(argmod0));
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_NONE,
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_MAD_ATI, dstreg, GL_SATURATE_BIT_ATI,
|
||||
arg1, GL_NONE, argmod1,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg0, GL_NONE, argmod0));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_LERP:
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_LERP_ATI, %s, GL_NONE, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
TRACE("glAlphaFragmentOp3ATI(GL_LERP_ATI, %s, GL_SATURATE_BIT_ATI, %s, GL_NONE, %s, %s, GL_NONE, %s, %s, GL_NONE, %s)\n",
|
||||
debug_register(dstreg),
|
||||
debug_register(arg1), debug_argmod(argmod1),
|
||||
debug_register(arg2), debug_argmod(argmod2),
|
||||
debug_register(arg0), debug_argmod(argmod0));
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_LERP_ATI, dstreg, GL_NONE,
|
||||
GL_EXTCALL(glAlphaFragmentOp3ATI(GL_LERP_ATI, dstreg, GL_SATURATE_BIT_ATI,
|
||||
arg1, GL_NONE, argmod1,
|
||||
arg2, GL_NONE, argmod2,
|
||||
arg0, GL_NONE, argmod0));
|
||||
|
|
|
@ -105,8 +105,8 @@ static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx)
|
|||
}
|
||||
|
||||
static GLenum invert_mapping(GLenum mapping) {
|
||||
if (mapping == GL_UNSIGNED_INVERT_NV) return GL_SIGNED_IDENTITY_NV;
|
||||
else if (mapping == GL_SIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
|
||||
if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
|
||||
else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
|
||||
|
||||
FIXME("Unhandled mapping %#x\n", mapping);
|
||||
return mapping;
|
||||
|
@ -116,7 +116,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum*
|
|||
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
|
||||
* be used. */
|
||||
if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
|
||||
else *mapping = GL_SIGNED_IDENTITY_NV;
|
||||
else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
|
||||
|
||||
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
|
||||
* should be used for all input components. */
|
||||
|
|
Loading…
Reference in New Issue