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
-- v7: 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
Borrowed from dlls/wined3d/wined3d_private.h
Signed-off-by: David Heidelberg david@ixit.cz --- dlls/d3d9/tests/visual.c | 45 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 36af662f19b..20df3d29b1b 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -29,6 +29,7 @@ */
#include <stdbool.h> +#include <stdint.h> #include <limits.h> #include <math.h>
@@ -107,6 +108,18 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
+static uint32_t float_to_int(float f) +{ + union + { + uint32_t u; + float f; + } u; + + u.f = f; + return u.u; +} + static BOOL adapter_is_warp(const D3DADAPTER_IDENTIFIER9 *identifier) { return !strcmp(identifier->Driver, "d3d10warp.dll"); @@ -3511,10 +3524,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 +3678,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 +11041,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
This merge request was approved by Zebediah Figura.
Since this series contains patches by other authors, you'll need to approve it yourself as well.
This merge request was approved by David Heidelberg.
Approved :smile: can be merged?
This merge request was approved by Jan Sikorski.