These two commits shouldn't change anything functional wise, but with minimal changes on wine side, they allow easy integration of d3d9/tests/visual.c into GoogleTest native runner. visual.c code is C++ compatible, except the `enums`.
Second change is done, because we had to redefine `ok()` macro, so without proper braces around conditions it cannot be expanded to multiple lines.
Here is [MR how we import](https://github.com/axeldavy/Xnine/pull/12) the `visual.c`
Third commit just correct my name in the `.mailmap`
My main goal here is bring code which run in Mesa3D CI workflow as closer to the original wine d3d9 tests, so we can easily update from wine and eventually provide also fixes and improvements back.
If you find this MR suitable, we could try figure out a way, to incorporate data about [nine_todo](https://github.com/axeldavy/Xnine/commit/7ac97c8350ea5b2bfd7307ca750ed1d0e51...), of course only if you find some use of these extra information.
/cc @zfigura
-- v5: mailmap: Add a mailmap entry for myself with the proper name d3d9/tests: replace LPDWORD cast with float_to_int function
From: Pavel Ondračka pavel.ondracka@gmail.com
Co-authored-by: David Heidelberg david@ixit.cz Signed-off-by: David Heidelberg david@ixit.cz --- dlls/d3d9/tests/visual.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index d05649ab92e..36af662f19b 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1667,16 +1667,17 @@ static void color_fill_test(void) {D3DPOOL_MANAGED, 0, D3DERR_INVALIDCALL}, {D3DPOOL_SCRATCH, 0, D3DERR_INVALIDCALL}, }; + enum format_flags + { + CHECK_FILL_VALUE = 0x1, + BLOCKS = 0x2, + FLOAT_VALUES = 0x4, + }; static const struct { D3DFORMAT format; const char *name; - enum - { - CHECK_FILL_VALUE = 0x1, - BLOCKS = 0x2, - FLOAT_VALUES = 0x4, - } flags; + enum format_flags flags; unsigned int fill_i[4]; float fill_f[4]; } @@ -23249,16 +23250,17 @@ static void test_texture_blending(void) DWORD value; };
+ enum texture_stage_texture + { + TEXTURE_INVALID, + TEXTURE_NONE, + TEXTURE_BUMPMAP, + TEXTURE_RED, + }; + struct texture_stage { - enum - { - TEXTURE_INVALID, - TEXTURE_NONE, - TEXTURE_BUMPMAP, - TEXTURE_RED, - } - texture; + enum texture_stage_texture texture; struct texture_stage_state state[20]; };
From: David Heidelberg david@ixit.cz
Signed-off-by: David Heidelberg david@ixit.cz --- dlls/d3d9/tests/visual.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 36af662f19b..82ca756b92d 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -35,6 +35,7 @@ #define COBJMACROS #include <d3d9.h> #include "utils.h" +#include "../../wined3d/wined3d_private.h"
struct vec2 { @@ -3511,10 +3512,10 @@ static void texbem_test(void)
generate_bumpmap_textures(device);
- IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT00, *(LPDWORD)&bumpenvmat[0]); - IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT01, *(LPDWORD)&bumpenvmat[1]); - IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT10, *(LPDWORD)&bumpenvmat[2]); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT11, *(LPDWORD)&bumpenvmat[3]); + IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT00, float_to_int(bumpenvmat[0])); + IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT01, float_to_int(bumpenvmat[1])); + IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT10, float_to_int(bumpenvmat[2])); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT11, float_to_int(bumpenvmat[3])); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirect3DDevice9_SetVertexShader(device, NULL); @@ -3665,24 +3666,24 @@ static void texbem_test(void)
bumpenvmat[0] =-1.0; bumpenvmat[2] = 2.0; bumpenvmat[1] = 0.0; bumpenvmat[3] = 0.0; - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT00, *(LPDWORD)&bumpenvmat[0]); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT00, float_to_int(bumpenvmat[0])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT01, *(LPDWORD)&bumpenvmat[1]); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT01, float_to_int(bumpenvmat[1])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT10, *(LPDWORD)&bumpenvmat[2]); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT10, float_to_int(bumpenvmat[2])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT11, *(LPDWORD)&bumpenvmat[3]); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_BUMPENVMAT11, float_to_int(bumpenvmat[3])); ok(hr == S_OK, "Got hr %#lx.\n", hr);
bumpenvmat[0] = 1.5; bumpenvmat[2] = 0.0; bumpenvmat[1] = 0.0; bumpenvmat[3] = 0.5; - hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT00, *(LPDWORD)&bumpenvmat[0]); + hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT00, float_to_int(bumpenvmat[0])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT01, *(LPDWORD)&bumpenvmat[1]); + hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT01, float_to_int(bumpenvmat[1])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT10, *(LPDWORD)&bumpenvmat[2]); + hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT10, float_to_int(bumpenvmat[2])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT11, *(LPDWORD)&bumpenvmat[3]); + hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_BUMPENVMAT11, float_to_int(bumpenvmat[3])); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); @@ -11028,13 +11029,13 @@ static void fixed_function_bumpmap_test(void) /* Generate the textures */ generate_bumpmap_textures(device);
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT00, *(LPDWORD)&bumpenvmat[0]); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT00, float_to_int(bumpenvmat[0])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT01, *(LPDWORD)&bumpenvmat[1]); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT01, float_to_int(bumpenvmat[1])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT10, *(LPDWORD)&bumpenvmat[2]); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT10, float_to_int(bumpenvmat[2])); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT11, *(LPDWORD)&bumpenvmat[3]); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_BUMPENVMAT11, float_to_int(bumpenvmat[3])); ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_BUMPENVMAP);
From: David Heidelberg david@ixit.cz
Signed-off-by: David Heidelberg david@ixit.cz --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.mailmap b/.mailmap index 4bd0cee2b2c..7cf13e67174 100644 --- a/.mailmap +++ b/.mailmap @@ -18,7 +18,7 @@ Charles Davis cdavis@codeweavers.com Charles Davis cdavis5x@gmail.com Christopher Gautier krys@via.ecp.fr David A. Cuthbert dacut@ece.cmu.edu -David Heidelberger david@ixit.cz +David Heidelberg david@ixit.cz Dennis Björklund db@zigo.dhs.org Dennis Björklund dennisb@cs.chalmers.se Dimitrie O. Paun dimi@bigfoot.com
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=144205
Your paranoid android.
=== build (build log) ===
../wine/dlls/d3d9/tests/../../wined3d/wined3d_private.h:36:10: fatal error: vkd3d_shader.h: No such file or directory Task: The exe32 Wine build failed
=== debian11 (build log) ===
../wine/dlls/d3d9/tests/../../wined3d/wined3d_private.h:36:10: fatal error: vkd3d_shader.h: No such file or directory Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/dlls/d3d9/tests/../../wined3d/wined3d_private.h:36:10: fatal error: vkd3d_shader.h: No such file or directory Task: The wow64 Wine build failed
On Tue Mar 19 17:19:37 2024 +0000, David Heidelberg wrote:
~~done~~, I imported `float_to_int()` to our code and it works well. edit: But we need to figure out where to put it inside wine code (since it's used only from `wined3d`)
Sorry, I should have been more clear. We don't want to import a wined3d private header from d3d9, and that doesn't even compile. Just copy the function definition to this source file instead (and remove the inline since it's not defined in a header anymore).