Commit a63af560 authored by David Heidelberg's avatar David Heidelberg Committed by Alexandre Julliard

d3d9/tests: Replace LPDWORD cast with float_to_int function.

Borrowed from dlls/wined3d/wined3d_private.h Signed-off-by: 's avatarDavid Heidelberg <david@ixit.cz>
parent d0e37372
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment