*We* know that these enums are equivalent, but Clang doesn't. So, tell Clang that it shouldn't care.
The remaining warnings are due to a bug in Clang around unions with enum types.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/ddraw/device.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 048ba7fba66..69b3c4d4f6c 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -2635,7 +2635,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, break; }
- wined3d_stateblock_set_render_state(device->update_state, state, value); + wined3d_stateblock_set_render_state(device->update_state, (enum wined3d_render_state)state, value); break; } wined3d_mutex_unlock(); @@ -3116,7 +3116,7 @@ static HRESULT d3d_device7_SetTransform(IDirect3DDevice7 *iface, wined3d_state = WINED3D_TS_WORLD_MATRIX(3); break; default: - wined3d_state = state; + wined3d_state = (enum wined3d_transform_state)state; }
if (!matrix) @@ -3225,7 +3225,7 @@ static HRESULT d3d_device7_GetTransform(IDirect3DDevice7 *iface, wined3d_state = WINED3D_TS_WORLD_MATRIX(3); break; default: - wined3d_state = state; + wined3d_state = (enum wined3d_transform_state)state; }
if (!matrix) @@ -3329,7 +3329,7 @@ static HRESULT d3d_device7_MultiplyTransform(IDirect3DDevice7 *iface, wined3d_state = WINED3D_TS_WORLD_MATRIX(3); break; default: - wined3d_state = state; + wined3d_state = (enum wined3d_transform_state)state; }
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ @@ -3504,7 +3504,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface, goto done;
wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf)); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vertex_count);
@@ -3715,7 +3715,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, wined3d_stateblock_set_index_buffer(device->state, device->index_buffer, WINED3DFMT_R16_UINT);
wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf)); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / stride); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(*indices), index_count); @@ -4042,7 +4042,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM goto done; wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf));
- wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / dst_stride, vertex_count);
@@ -4178,7 +4178,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface, wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vtx_dst_stride);
wined3d_stateblock_set_vertex_declaration(device->state, ddraw_find_decl(device->ddraw, fvf)); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
@@ -4300,7 +4300,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE }
/* Now draw the primitives */ - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count);
@@ -4454,7 +4454,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, return hr; }
- wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
@@ -6005,7 +6005,7 @@ static HRESULT d3d_device7_CreateStateBlock(IDirect3DDevice7 *iface, }
/* The D3DSTATEBLOCKTYPE enum is fine here. */ - hr = wined3d_stateblock_create(device->wined3d_device, device->state, type, &wined3d_sb); + hr = wined3d_stateblock_create(device->wined3d_device, device->state, (enum wined3d_stateblock_type)type, &wined3d_sb); if (FAILED(hr)) { WARN("Failed to create stateblock, hr %#x.\n", hr);
I wanted to teach Clang not to emit these warnings, but they insisted that yes, Clang really should warn on absolute values of differences. So I gave up on that.
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 15 ++++++++++----- dlls/ddraw/tests/ddraw2.c | 17 +++++++++++------ dlls/ddraw/tests/ddraw4.c | 17 +++++++++++------ dlls/ddraw/tests/ddraw7.c | 17 +++++++++++------ dlls/ddraw/tests/visual.c | 13 +++++++++---- 5 files changed, 52 insertions(+), 27 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 5bfca430086..1e4405eb74a 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -49,15 +49,20 @@ struct create_window_thread_param HANDLE thread; };
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
@@ -11756,7 +11761,7 @@ static void test_depth_readback(void) depth = *((DWORD *)ptr) & z_mask; expected_depth = (x * (0.9 / 640.0) + y * (0.1 / 480.0)) * z_mask; max_diff = ((0.5f * 0.9f) / 640.0f) * z_mask; - ok(abs(expected_depth - depth) <= max_diff, + ok(absdiff(expected_depth, depth) <= max_diff, "z_depth %u: Got depth 0x%08x (diff %d), expected 0x%08x+/-%u, at %u, %u.\n", z_depth, depth, expected_depth - depth, expected_depth, max_diff, x, y); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index b472b3d5883..c6e6ae9f794 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -50,15 +50,20 @@ struct create_window_thread_param HANDLE thread; };
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
@@ -12735,10 +12740,10 @@ static void test_depth_readback(void) /* The ddraw2 version of this test behaves similarly to the ddraw7 version on Nvidia GPUs, * except that we only have D16 (broken on geforce 9) and D24X8 (broken on geforce 7) available. * Accept all nvidia GPUs as broken here, but still expect one of the formats to pass. */ - ok(abs(expected_depth - depth) <= max_diff || ddraw_is_nvidia(ddraw), + ok(absdiff(expected_depth, depth) <= max_diff || ddraw_is_nvidia(ddraw), "Test %u: Got depth 0x%08x (diff %d), expected 0x%08x+/-%u, at %u, %u.\n", i, depth, expected_depth - depth, expected_depth, max_diff, x, y); - if (abs(expected_depth - depth) > max_diff) + if (absdiff(expected_depth, depth) > max_diff) all_pass = FALSE; } } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e6cf4c446a..e6c1b2c35a8 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -80,15 +80,20 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
@@ -15268,10 +15273,10 @@ static void test_depth_readback(void) * returns 0 for that format. Give up on pre-filtering formats, accept Nvidia as generally * broken here, but still expect at least one format (D16 or D24X8 in practise) to pass. */ todo_wine_if(tests[i].todo) - ok(abs(expected_depth - depth) <= max_diff || ddraw_is_nvidia(ddraw), + ok(absdiff(expected_depth, depth) <= max_diff || ddraw_is_nvidia(ddraw), "Test %u: Got depth 0x%08x (diff %d), expected 0x%08x+/-%u, at %u, %u.\n", i, depth, expected_depth - depth, expected_depth, max_diff, x, y); - if (abs(expected_depth - depth) > max_diff) + if (absdiff(expected_depth, depth) > max_diff) all_pass = FALSE;
hr = IDirectDrawSurface4_Unlock(ds, &r); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 5c0c5bb7c39..e7e5e756192 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -87,15 +87,20 @@ static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, floa && compare_float(vec->w, w, ulps); }
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL compare_color(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
@@ -14713,11 +14718,11 @@ static void test_depth_readback(void) * Arx Fatalis is broken on the Geforce 9 in the same way it was broken in Wine (bug 43654). * The !tests[i].s_depth is supposed to rule out D16 on GF9 and D24X8 on GF7. */ todo_wine_if(tests[i].todo) - ok(abs(expected_depth - depth) <= max_diff + ok(absdiff(expected_depth, depth) <= max_diff || (ddraw_is_nvidia(ddraw) && (all_zero || all_one || !tests[i].s_depth)), "Test %u: Got depth 0x%08x (diff %d), expected 0x%08x+/-%u, at %u, %u.\n", i, depth, expected_depth - depth, expected_depth, max_diff, x, y); - if (abs(expected_depth - depth) > max_diff) + if (absdiff(expected_depth, depth) > max_diff) all_pass = FALSE;
hr = IDirectDrawSurface7_Unlock(ds, &r); diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c index 2cb1c892314..4ae5958cd22 100644 --- a/dlls/ddraw/tests/visual.c +++ b/dlls/ddraw/tests/visual.c @@ -45,15 +45,20 @@ static BOOL refdevice = FALSE; static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *driver_guid, void **ddraw, REFIID interface_iid, IUnknown *outer);
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
From: Charles Davis cdavis5x@gmail.com
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/d3d8/device.c | 34 ++++++++++++++++++---------------- dlls/d3d8/directx.c | 12 ++++++------ dlls/d3d8/surface.c | 2 +- dlls/d3d8/texture.c | 4 ++-- 4 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 23e93df0616..2ecbcf25502 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -35,7 +35,7 @@ D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */ - if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format; + if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return (D3DFORMAT)format;
switch(format) { @@ -85,7 +85,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */ - if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format; + if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return (enum wined3d_format_id)format;
switch(format) { @@ -204,7 +204,7 @@ static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height; present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format); present_parameters->BackBufferCount = swapchain_desc->backbuffer_count; - present_parameters->MultiSampleType = swapchain_desc->multisample_type; + present_parameters->MultiSampleType = (D3DMULTISAMPLE_TYPE)swapchain_desc->multisample_type; present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect); present_parameters->hDeviceWindow = swapchain_desc->device_window; present_parameters->Windowed = swapchain_desc->windowed; @@ -291,7 +291,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat); swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount); swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET; - swapchain_desc->multisample_type = present_parameters->MultiSampleType; + swapchain_desc->multisample_type = (enum wined3d_multisample_type)present_parameters->MultiSampleType; swapchain_desc->multisample_quality = 0; /* d3d9 only */ swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect); swapchain_desc->device_window = present_parameters->hDeviceWindow; @@ -1241,7 +1241,8 @@ static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UI access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format), - multisample_type, WINED3D_BIND_RENDER_TARGET, access, width, height, surface); + (enum wined3d_multisample_type)multisample_type, WINED3D_BIND_RENDER_TARGET, access, + width, height, surface); }
static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface, @@ -1259,7 +1260,7 @@ static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *if *surface = NULL;
return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format), - multisample_type, WINED3D_BIND_DEPTH_STENCIL, + (enum wined3d_multisample_type)multisample_type, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, surface); }
@@ -1621,7 +1622,7 @@ static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface,
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_set_transform(device->update_state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_set_transform(device->update_state, (enum wined3d_transform_state)state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock();
return D3D_OK; @@ -1651,7 +1652,7 @@ static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface,
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_multiply_transform(device->state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_multiply_transform(device->state, (enum wined3d_transform_state)state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock();
return D3D_OK; @@ -1871,13 +1872,14 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD value) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); + enum wined3d_render_state wined3d_state = (enum wined3d_render_state)state;
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
wined3d_mutex_lock(); if (state == D3DRS_ZBIAS) - state = WINED3D_RS_DEPTHBIAS; - wined3d_stateblock_set_render_state(device->update_state, state, value); + wined3d_state = WINED3D_RS_DEPTHBIAS; + wined3d_stateblock_set_render_state(device->update_state, wined3d_state, value); if (state == D3DRS_POINTSIZE && value == D3D8_RESZ_CODE) resolve_depth_buffer(device); wined3d_mutex_unlock(); @@ -2439,7 +2441,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface, vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count); wined3d_mutex_lock(); d3d8_device_upload_sysmem_vertex_buffers(device, start_vertex, vertex_count); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); wined3d_mutex_unlock(); @@ -2464,7 +2466,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, base_vertex_index = device->stateblock_state->base_vertex_index; d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count); d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count); wined3d_mutex_unlock(); @@ -2558,7 +2560,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, if (FAILED(hr)) goto done;
- wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); @@ -2686,7 +2688,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface wined3dformat_from_d3dformat(index_format)); wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx);
- wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
@@ -3694,7 +3696,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(parent->wined3d_outputs[output_idx]); - if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, device_type, + if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, (enum wined3d_device_type)device_type, focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels), &device->device_parent, &device->wined3d_device))) { @@ -3704,7 +3706,7 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine return hr; }
- wined3d_get_device_caps(wined3d_adapter, device_type, &caps); + wined3d_get_device_caps(wined3d_adapter, (enum wined3d_device_type)device_type, &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst;
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 509a76239d6..aca3c5ad4c7 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -234,7 +234,7 @@ static HRESULT WINAPI d3d8_CheckDeviceType(IDirect3D8 *iface, UINT adapter, D3DD return WINED3DERR_NOTAVAILABLE;
wined3d_mutex_lock(); - hr = wined3d_check_device_type(d3d8->wined3d, d3d8->wined3d_outputs[output_idx], device_type, + hr = wined3d_check_device_type(d3d8->wined3d, d3d8->wined3d_outputs[output_idx], (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(display_format), wined3dformat_from_d3dformat(backbuffer_format), windowed); wined3d_mutex_unlock(); @@ -300,13 +300,13 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3 { DWORD levels;
- hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, + hr = wined3d_check_device_multisample_type(wined3d_adapter, (enum wined3d_device_type)device_type, WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels); if (SUCCEEDED(hr) && !levels) hr = D3DERR_NOTAVAILABLE; } else - hr = wined3d_check_device_format(d3d8->wined3d, wined3d_adapter, device_type, + hr = wined3d_check_device_format(d3d8->wined3d, wined3d_adapter, (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(adapter_format), usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock(); @@ -334,7 +334,7 @@ static HRESULT WINAPI d3d8_CheckDeviceMultiSampleType(IDirect3D8 *iface, UINT ad
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, + hr = wined3d_check_device_multisample_type(wined3d_adapter, (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(format), windowed, (enum wined3d_multisample_type)multisample_type, NULL); wined3d_mutex_unlock(); @@ -359,7 +359,7 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type, + hr = wined3d_check_depth_stencil_match(wined3d_adapter, (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(ds_format)); wined3d_mutex_unlock(); @@ -386,7 +386,7 @@ static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEV
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]); - hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); + hr = wined3d_get_device_caps(wined3d_adapter, (enum wined3d_device_type)device_type, &wined3d_caps); wined3d_mutex_unlock();
d3dcaps_from_wined3dcaps(caps, &wined3d_caps, adapter); diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index bbd7e38338b..53a4e498b96 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -193,7 +193,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_ desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index c82a75d87a4..35bf85de94c 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -255,7 +255,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; } @@ -602,7 +602,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Size = wined3d_desc.size; - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; }
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/d3d8/tests/device.c | 4 ++-- dlls/d3d8/tests/visual.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index d87832b716d..26687af5f15 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -1294,8 +1294,8 @@ static int compare_mode(const void *a, const void *b) { const struct mode *mode_a = a; const struct mode *mode_b = b; - unsigned int w = mode_a->w - mode_b->w; - unsigned int h = mode_a->h - mode_b->h; + int w = mode_a->w - mode_b->w; + int h = mode_a->h - mode_b->h; return abs(w) >= abs(h) ? -w : -h; }
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index ab194b9cedf..30d8eb231bc 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -51,15 +51,20 @@ static HWND create_window(void) 0, 0, rect.right - rect.left, rect.bottom - rect.top, 0, 0, 0, 0); }
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{ + return a > b ? a - b : b - a; +} + static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff) { - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; c1 >>= 8; c2 >>= 8; - if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE; + if (absdiff(c1 & 0xff, c2 & 0xff) > max_diff) return FALSE; return TRUE; }
From: Charles Davis cdavis5x@gmail.com
Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/d3d9/device.c | 51 +++++++++++++++++++++++-------------------- dlls/d3d9/directx.c | 27 ++++++++++++----------- dlls/d3d9/query.c | 4 ++-- dlls/d3d9/surface.c | 2 +- dlls/d3d9/swapchain.c | 2 +- dlls/d3d9/texture.c | 4 ++-- 6 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 61cb505d77a..a82831e8fd0 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -44,7 +44,7 @@ D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */ - if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format; + if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return (D3DFORMAT)format;
switch(format) { @@ -108,7 +108,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */ - if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format; + if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return (enum wined3d_format_id)format;
switch(format) { @@ -244,7 +244,7 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height; present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format); present_parameters->BackBufferCount = swapchain_desc->backbuffer_count; - present_parameters->MultiSampleType = swapchain_desc->multisample_type; + present_parameters->MultiSampleType = (D3DMULTISAMPLE_TYPE)swapchain_desc->multisample_type; present_parameters->MultiSampleQuality = swapchain_desc->multisample_quality; present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect); present_parameters->hDeviceWindow = swapchain_desc->device_window; @@ -335,7 +335,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat); swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount); swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET; - swapchain_desc->multisample_type = present_parameters->MultiSampleType; + swapchain_desc->multisample_type = (enum wined3d_multisample_type)present_parameters->MultiSampleType; swapchain_desc->multisample_quality = present_parameters->MultiSampleQuality; swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect); swapchain_desc->device_window = present_parameters->hDeviceWindow; @@ -1008,7 +1008,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device, wined3d_mode.height = mode->Height; wined3d_mode.refresh_rate = mode->RefreshRate; wined3d_mode.format_id = wined3dformat_from_d3dformat(mode->Format); - wined3d_mode.scanline_ordering = mode->ScanLineOrdering; + wined3d_mode.scanline_ordering = (enum wined3d_scanline_ordering)mode->ScanLineOrdering; }
if (!wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters, extended)) @@ -1522,7 +1522,8 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, unsigned i
if (user_mem) wined3d_texture_update_desc(texture, width, height, - desc.format, multisample_type, multisample_quality, user_mem, 0); + desc.format, (enum wined3d_multisample_type)multisample_type, multisample_quality, + user_mem, 0);
wined3d_texture_decref(texture);
@@ -1574,8 +1575,9 @@ static HRESULT WINAPI d3d9_device_CreateRenderTarget(IDirect3DDevice9Ex *iface, if (lockable) access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
- return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format), multisample_type, - multisample_quality, 0, WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface); + return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format), + (enum wined3d_multisample_type)multisample_type, multisample_quality, 0, WINED3D_BIND_RENDER_TARGET, + access, width, height, NULL, surface); }
static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex *iface, UINT width, UINT height, @@ -1606,7 +1608,7 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex * flags |= WINED3D_TEXTURE_CREATE_DISCARD;
return d3d9_device_create_surface(device, flags, wined3dformat_from_d3dformat(format), - multisample_type, multisample_quality, 0, WINED3D_BIND_DEPTH_STENCIL, + (enum wined3d_multisample_type)multisample_type, multisample_quality, 0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface); }
@@ -1807,7 +1809,7 @@ static HRESULT WINAPI d3d9_device_StretchRect(IDirect3DDevice9Ex *iface, IDirect }
hr = wined3d_texture_blt(dst->wined3d_texture, dst->sub_resource_idx, dst_rect, - src->wined3d_texture, src->sub_resource_idx, src_rect, 0, NULL, filter); + src->wined3d_texture, src->sub_resource_idx, src_rect, 0, NULL, (enum wined3d_texture_filter_type)filter); if (hr == WINEDDERR_INVALIDRECT) hr = D3DERR_INVALIDCALL; if (SUCCEEDED(hr) && dst->texture) @@ -2136,7 +2138,8 @@ static HRESULT WINAPI d3d9_device_SetTransform(IDirect3DDevice9Ex *iface,
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_set_transform(device->update_state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_set_transform(device->update_state, (enum wined3d_transform_state)state, + (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock();
return D3D_OK; @@ -2166,7 +2169,7 @@ static HRESULT WINAPI d3d9_device_MultiplyTransform(IDirect3DDevice9Ex *iface,
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - wined3d_stateblock_multiply_transform(device->state, state, (const struct wined3d_matrix *)matrix); + wined3d_stateblock_multiply_transform(device->state, (enum wined3d_transform_state)state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock();
return D3D_OK; @@ -2369,7 +2372,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
wined3d_mutex_lock(); - wined3d_stateblock_set_render_state(device->update_state, state, value); + wined3d_stateblock_set_render_state(device->update_state, (enum wined3d_render_state)state, value); if (state == D3DRS_POINTSIZE && value == D3D9_RESZ_CODE) resolve_depth_buffer(device); wined3d_mutex_unlock(); @@ -2715,7 +2718,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDev sampler -= D3DVERTEXTEXTURESAMPLER0 - WINED3D_VERTEX_SAMPLER_OFFSET;
wined3d_mutex_lock(); - wined3d_stateblock_set_sampler_state(device->update_state, sampler, state, value); + wined3d_stateblock_set_sampler_state(device->update_state, sampler, (enum wined3d_sampler_state)state, value); wined3d_mutex_unlock();
return D3D_OK; @@ -2965,7 +2968,7 @@ static HRESULT WINAPI d3d9_device_DrawPrimitive(IDirect3DDevice9Ex *iface, vertex_count = vertex_count_from_primitive_count(primitive_type, primitive_count); d3d9_device_upload_sysmem_vertex_buffers(device, 0, start_vertex, vertex_count); d3d9_generate_auto_mipmaps(device); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex, vertex_count); if (SUCCEEDED(hr)) d3d9_rts_flag_auto_gen_mipmap(device); @@ -2999,7 +3002,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface d3d9_device_upload_sysmem_index_buffer(device, start_idx, index_count); d3d9_generate_auto_mipmaps(device); wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count); if (SUCCEEDED(hr)) @@ -3108,7 +3111,7 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, goto done;
d3d9_generate_auto_mipmaps(device); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); wined3d_device_apply_stateblock(device->wined3d_device, device->state); hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); @@ -3252,7 +3255,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / vertex_stride - min_vertex_idx);
wined3d_device_apply_stateblock(device->wined3d_device, device->state); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0); + wined3d_device_set_primitive_type(device->wined3d_device, (enum wined3d_primitive_type)primitive_type, 0); hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0); @@ -4254,7 +4257,7 @@ static HRESULT WINAPI d3d9_device_CreateRenderTargetEx(IDirect3DDevice9Ex *iface access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format), - multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK, + (enum wined3d_multisample_type)multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK, WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface); }
@@ -4294,8 +4297,8 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex
*surface = NULL; return d3d9_device_create_surface(device, flags, wined3dformat_from_d3dformat(format), - multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK, WINED3D_BIND_DEPTH_STENCIL, - WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface); + (enum wined3d_multisample_type)multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK, + WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface); }
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, @@ -4347,7 +4350,7 @@ static HRESULT WINAPI d3d9_device_GetDisplayModeEx(IDirect3DDevice9Ex *iface, mode->Height = wined3d_mode.height; mode->RefreshRate = wined3d_mode.refresh_rate; mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id); - mode->ScanLineOrdering = wined3d_mode.scanline_ordering; + mode->ScanLineOrdering = (D3DSCANLINEORDERING)wined3d_mode.scanline_ordering; }
return hr; @@ -4658,7 +4661,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(parent->wined3d_outputs[output_idx]); - if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, device_type, + if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, (enum wined3d_device_type)device_type, focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels), &device->device_parent, &device->wined3d_device))) { @@ -4667,7 +4670,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine return hr; }
- wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); + wined3d_get_device_caps(wined3d_adapter, (enum wined3d_device_type)device_type, &wined3d_caps); d3d9_caps_from_wined3dcaps(parent, adapter, &caps, &wined3d_caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; device->vs_uniform_count = caps.MaxVertexShaderConst; diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 070387dde3e..0d68d792ea7 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -258,7 +258,7 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3 return WINED3DERR_NOTAVAILABLE;
wined3d_mutex_lock(); - hr = wined3d_check_device_type(d3d9->wined3d, d3d9->wined3d_outputs[output_idx], device_type, + hr = wined3d_check_device_type(d3d9->wined3d, d3d9->wined3d_outputs[output_idx], (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(display_format), wined3dformat_from_d3dformat(backbuffer_format), windowed); wined3d_mutex_unlock(); @@ -324,13 +324,13 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter, { DWORD levels;
- hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, + hr = wined3d_check_device_multisample_type(wined3d_adapter, (enum wined3d_device_type)device_type, WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels); if (SUCCEEDED(hr) && !levels) hr = D3DERR_NOTAVAILABLE; } else - hr = wined3d_check_device_format(d3d9->wined3d, wined3d_adapter, device_type, + hr = wined3d_check_device_format(d3d9->wined3d, wined3d_adapter, (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(adapter_format), usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock(); @@ -358,8 +358,9 @@ static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); - hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, - wined3dformat_from_d3dformat(format), windowed, multisample_type, levels); + hr = wined3d_check_device_multisample_type(wined3d_adapter, (enum wined3d_device_type)device_type, + wined3dformat_from_d3dformat(format), windowed, (enum wined3d_multisample_type)multisample_type, + levels); wined3d_mutex_unlock(); if (hr == WINED3DERR_NOTAVAILABLE && levels) *levels = 1; @@ -384,7 +385,7 @@ static HRESULT WINAPI d3d9_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT adap
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); - hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type, + hr = wined3d_check_depth_stencil_match(wined3d_adapter, (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(ds_format)); wined3d_mutex_unlock(); @@ -408,7 +409,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT
wined3d_mutex_lock(); hr = wined3d_check_device_format_conversion(d3d9->wined3d_outputs[output_idx], - device_type, wined3dformat_from_d3dformat(src_format), + (enum wined3d_device_type)device_type, wined3dformat_from_d3dformat(src_format), wined3dformat_from_d3dformat(dst_format)); wined3d_mutex_unlock();
@@ -436,7 +437,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
wined3d_mutex_lock(); wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]); - hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps); + hr = wined3d_get_device_caps(wined3d_adapter, (enum wined3d_device_type)device_type, &wined3d_caps); wined3d_mutex_unlock();
d3d9_caps_from_wined3dcaps(d3d9, adapter, caps, &wined3d_caps); @@ -515,7 +516,7 @@ static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface,
wined3d_mutex_lock(); count = wined3d_output_get_mode_count(d3d9->wined3d_outputs[output_idx], - wined3dformat_from_d3dformat(filter->Format), filter->ScanLineOrdering); + wined3dformat_from_d3dformat(filter->Format), (enum wined3d_scanline_ordering)filter->ScanLineOrdering); wined3d_mutex_unlock();
return count; @@ -541,8 +542,8 @@ static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface,
wined3d_mutex_lock(); hr = wined3d_output_get_mode(d3d9->wined3d_outputs[output_idx], - wined3dformat_from_d3dformat(filter->Format), filter->ScanLineOrdering, mode_idx, - &wined3d_mode); + wined3dformat_from_d3dformat(filter->Format), (enum wined3d_scanline_ordering)filter->ScanLineOrdering, + mode_idx, &wined3d_mode); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) @@ -551,7 +552,7 @@ static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface, mode->Height = wined3d_mode.height; mode->RefreshRate = wined3d_mode.refresh_rate; mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id); - mode->ScanLineOrdering = wined3d_mode.scanline_ordering; + mode->ScanLineOrdering = (D3DSCANLINEORDERING)wined3d_mode.scanline_ordering; }
return hr; @@ -586,7 +587,7 @@ static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, mode->Height = wined3d_mode.height; mode->RefreshRate = wined3d_mode.refresh_rate; mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id); - mode->ScanLineOrdering = wined3d_mode.scanline_ordering; + mode->ScanLineOrdering = (D3DSCANLINEORDERING)wined3d_mode.scanline_ordering; }
return hr; diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c index e9180fb481f..e4f2e57681d 100644 --- a/dlls/d3d9/query.c +++ b/dlls/d3d9/query.c @@ -98,7 +98,7 @@ static D3DQUERYTYPE WINAPI d3d9_query_GetType(IDirect3DQuery9 *iface) TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - type = wined3d_query_get_type(query->wined3d_query); + type = (D3DQUERYTYPE)wined3d_query_get_type(query->wined3d_query); wined3d_mutex_unlock();
return type; @@ -198,7 +198,7 @@ HRESULT query_init(struct d3d9_query *query, struct d3d9_device *device, D3DQUER query->refcount = 1;
wined3d_mutex_lock(); - if (FAILED(hr = wined3d_query_create(device->wined3d_device, type, + if (FAILED(hr = wined3d_query_create(device->wined3d_device, (enum wined3d_query_type)type, query, &d3d9_null_wined3d_parent_ops, &query->wined3d_query))) { wined3d_mutex_unlock(); diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index b74f6cacf7e..eacd58644cc 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -224,7 +224,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_ desc->Type = D3DRTYPE_SURFACE; desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->MultiSampleQuality = wined3d_desc.multisample_quality; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index be9c55ac3ef..427d7ead7ad 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -320,7 +320,7 @@ static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx(IDirect3DSwapChain9Ex *ifa mode->Height = wined3d_mode.height; mode->RefreshRate = wined3d_mode.refresh_rate; mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id); - mode->ScanLineOrdering = wined3d_mode.scanline_ordering; + mode->ScanLineOrdering = (D3DSCANLINEORDERING)wined3d_mode.scanline_ordering; }
return hr; diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 9be9d450ba0..3c83ed27751 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -367,7 +367,7 @@ static HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UIN desc->Type = D3DRTYPE_SURFACE; desc->Usage = texture->usage; desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->MultiSampleQuality = wined3d_desc.multisample_quality; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height; @@ -774,7 +774,7 @@ static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *ifac desc->Type = D3DRTYPE_SURFACE; desc->Usage = texture->usage; desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); - desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleType = (D3DMULTISAMPLE_TYPE)wined3d_desc.multisample_type; desc->MultiSampleQuality = wined3d_desc.multisample_quality; desc->Width = wined3d_desc.width; desc->Height = wined3d_desc.height;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=68184
Your paranoid android.
=== debiant (build log) ===
The task timed out
On Thu, 26 Mar 2020 at 12:33, Chip Davis cdavis@codeweavers.com wrote:
+static inline unsigned int absdiff(unsigned int a, unsigned int b) +{
- return a > b ? a - b : b - a;
+}
You don't need the "inline". For consistency with the other helpers like compare_float(), I'd probably do something like the following:
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_distance) { unsigned int distance = x > y ? x - y : y - x;
return distance <= max_distance; }
Note that we have one or two places where this particular issue has already been fixed in a different way, like e.g. the d3d9:visual tests. Ideally those would be updated as well.
On Thu, 26 Mar 2020 at 12:16, Chip Davis cdavis@codeweavers.com wrote:
*We* know that these enums are equivalent, but Clang doesn't. So, tell Clang that it shouldn't care.
The remaining warnings are due to a bug in Clang around unions with enum types.
I'm not sure this is really worth fixing (as opposed to just disabling the corresponding warning for Clang), but if we do, I'd prefer introducing conversion helpers along the lines of wined3dformat_from_ddrawformat(), wined3dmapflags_from_ddrawmapflags(), etc. You can of course still implement those by doing a cast, but I'd prefer not sprinkling those casts around the code.