Module: wine
Branch: master
Commit: 3e5899b38dee014756e55d9bb7c35257bae7611e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e5899b38dee014756e55d9bb…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Mon Apr 7 14:36:53 2008 +0200
d3d9: Some Windows drivers set undefined attributes to 0.0.
---
dlls/d3d9/tests/visual.c | 15 +++++++++------
dlls/wined3d/state.c | 8 ++++++++
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 969f79b..e8866c0 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -6078,11 +6078,13 @@ void test_vshader_input(IDirect3DDevice9 *device)
ok(color == 0x00FFFF80 || color == 0x00FFFF7f || color == 0x00FFFF81,
"Input test: Quad 1(2crd) returned color 0x%08x, expected 0x00FFFF80\n", color);
- /* The last value of the read but undefined stream is used */
+ /* The last value of the read but undefined stream is used, it is 0x00. The defined input is vec4(1, 0, 0, 0) */
color = getPixelColor(device, 480, 360);
- ok(color == 0x00FFFF00, "Input test: Quad 2(1crd) returned color 0x%08x, expected 0x00FFFF00\n", color);
+ ok(color == 0x00FFFF00 || color ==0x00FF0000,
+ "Input test: Quad 2(1crd) returned color 0x%08x, expected 0x00FFFF00\n", color);
color = getPixelColor(device, 160, 120);
- ok(color == 0x00FF0080 || color == 0x00FF007f || color == 0x00FF0081,
+ /* Same as above, accept both the last used value and 0.0 for the undefined streams */
+ ok(color == 0x00FF0080 || color == 0x00FF007f || color == 0x00FF0081 || color == 0x00FF0000,
"Input test: Quad 3(2crd-wrongidx) returned color 0x%08x, expected 0x00FF0080\n", color);
color = getPixelColor(device, 480, 160);
@@ -6149,7 +6151,8 @@ void test_vshader_input(IDirect3DDevice9 *device)
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %s\n", DXGetErrorString9(hr));
color = getPixelColor(device, 480, 350);
- /* vs_1_1 may fail, accept the clear color
+ /* vs_1_1 may fail, accept the clear color. Some drivers also set the undefined streams to 0, accept that
+ * as well.
*
* NOTE: This test fails on the reference rasterizer. In the refrast, the 4 vertices have different colors,
* i.e., the whole old stream is read, and not just the last used attribute. Some games require that this
@@ -6158,8 +6161,8 @@ void test_vshader_input(IDirect3DDevice9 *device)
*
* A test app for this behavior is Half Life 2 Episode 2 in dxlevel 95, and related games(Portal, TF2).
*/
- ok(color == 0x000000FF || color == 0x00808080,
- "Input test: Quad 2(different colors) returned color 0x%08x, expected 0x000000FF\n", color);
+ ok(color == 0x000000FF || color == 0x00808080 || color == 0x00000000,
+ "Input test: Quad 2(different colors) returned color 0x%08x, expected 0x000000FF, 0x00808080 or 0x00000000\n", color);
color = getPixelColor(device, 160, 120);
IDirect3DDevice9_SetVertexShader(device, NULL);
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 7ec4051..55d37a7 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3017,6 +3017,14 @@ static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock) {
for (i = 0; i < maxAttribs; ++i) {
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
checkGLcall("glDisableVertexAttribArrayARB(reg)");
+ /* Some Windows drivers(NV GF 7) use the latest value that was used when drawing with the now
+ * deactivated stream disabled, some other drivers(ATI, NV GF 8) set the undefined values to 0x00.
+ * Let's set them to 0x00 to avoid hitting some undefined aspects of OpenGL. All that is really
+ * important here is the glDisableVertexAttribArrayARB call above. The test shows that the refrast
+ * keeps dereferencing the pointers, which would cause crashes in some games like Half Life 2 Eposide 2
+ */
+ GL_EXTCALL(glVertexAttrib4NubARB(i, 0, 0, 0, 0));
+ checkGLcall("glVertexAttrib4NubARB(i, 0, 0, 0, 0)");
}
}
Module: wine
Branch: master
Commit: 1c3e725d6363c34837f76d03e40d3cabd69110ba
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1c3e725d6363c34837f76d03e…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Mon Apr 7 14:07:22 2008 +0200
d3d9: Accept erros in the fvp->3.0 pixel shader varying test.
Some cards/drivers like ATI and the Geforce 8 driver return an error in
this case, make the test accept that. This lifts some constraints we
have to care for in WineD3D and removes one of the requirement for the
packing shader. We still need the packing shader for vs_1_1 -> ps_3_0
mapping and for indirect pixel shader varying addressing though.
---
dlls/d3d9/tests/visual.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 879e2c4..969f79b 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -5181,6 +5181,7 @@ static void fixed_function_varying_test(IDirect3DDevice9 *device) {
HRESULT hr;
unsigned int i;
DWORD color, r, g, b, r_e, g_e, b_e;
+ BOOL drawok;
memcpy(data2, data, sizeof(data2));
data2[0].pos_x = 0; data2[0].pos_y = 0;
@@ -5212,16 +5213,25 @@ static void fixed_function_varying_test(IDirect3DDevice9 *device) {
hr = IDirect3DDevice9_BeginScene(device);
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %s\n", DXGetErrorString9(hr));
+ drawok = FALSE;
if(SUCCEEDED(hr))
{
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, data, sizeof(data[0]));
- ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr);
+ ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "DrawPrimitiveUP failed (%08x)\n", hr);
+ drawok = SUCCEEDED(hr);
hr = IDirect3DDevice9_EndScene(device);
ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %s\n", DXGetErrorString9(hr));
}
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %s\n", DXGetErrorString9(hr));
+ /* Some drivers reject the combination of ps_3_0 and fixed function vertex processing. Accept
+ * the failure and do not check the color if it failed
+ */
+ if(!drawok) {
+ continue;
+ }
+
color = getPixelColor(device, 360, 240);
r = color & 0x00ff0000 >> 16;
g = color & 0x0000ff00 >> 8;