Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 80 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 6982a4ed14b0..421512f40cc9 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -10583,6 +10583,7 @@ static void test_shader_interstage_interface(void) ID3D10Device *device; UINT stride, offset; ID3D10Buffer *vb; + unsigned int i; HRESULT hr;
static const DWORD vs_code[] = @@ -10655,6 +10656,56 @@ static void test_shader_interstage_interface(void) 0x0010000a, 0x00000000, 0x07000000, 0x00102012, 0x00000000, 0x0010101a, 0x00000001, 0x0010100a, 0x00000002, 0x05000036, 0x001020c2, 0x00000000, 0x001012a6, 0x00000001, 0x0100003e, }; + static const DWORD ps_partial_input_code[] = + { +#if 0 + void main(float4 position : SV_Position, float2 t0 : TEXCOORD0, + nointerpolation float t1 : TEXCOORD1, uint t2 : TEXCOORD2, + uint t3 : TEXCOORD3, out float4 o : SV_Target) + { + o.x = t0.y + t1; + o.y = t2 + t3; + o.z = 0.0f; + o.w = t0.x; + } +#endif + 0x43425844, 0x5b1db356, 0xaa5a5e9d, 0xb916a081, 0x61e6dcb1, 0x00000001, 0x000001cc, 0x00000003, + 0x0000002c, 0x000000cc, 0x00000100, 0x4e475349, 0x00000098, 0x00000005, 0x00000008, 0x00000080, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000008c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x0000008c, 0x00000001, 0x00000000, 0x00000003, 0x00000002, + 0x00000101, 0x0000008c, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000202, 0x0000008c, + 0x00000003, 0x00000000, 0x00000001, 0x00000002, 0x00000404, 0x505f5653, 0x7469736f, 0x006e6f69, + 0x43584554, 0x44524f4f, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, + 0x52444853, 0x000000c4, 0x00000040, 0x00000031, 0x03001062, 0x00101032, 0x00000001, 0x03000862, + 0x00101012, 0x00000002, 0x03000862, 0x00101022, 0x00000002, 0x03000862, 0x00101042, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x0700001e, 0x00100012, 0x00000000, + 0x0010102a, 0x00000002, 0x0010101a, 0x00000002, 0x05000056, 0x00102022, 0x00000000, 0x0010000a, + 0x00000000, 0x07000000, 0x00102012, 0x00000000, 0x0010101a, 0x00000001, 0x0010100a, 0x00000002, + 0x05000036, 0x00102042, 0x00000000, 0x00004001, 0x00000000, 0x05000036, 0x00102082, 0x00000000, + 0x0010100a, 0x00000001, 0x0100003e, + }; + static const DWORD ps_single_input_code[] = + { +#if 0 + void main(float4 position : SV_Position, float2 t0 : TEXCOORD0, out float4 o : SV_Target) + { + o.x = t0.x; + o.y = t0.y; + o.z = 1.0f; + o.w = 2.0f; + } +#endif + 0x43425844, 0x7cc601b6, 0xc65b8bdb, 0x54d0f606, 0x9cc74d3d, 0x00000001, 0x00000118, 0x00000003, + 0x0000002c, 0x00000084, 0x000000b8, 0x4e475349, 0x00000050, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x505f5653, 0x7469736f, 0x006e6f69, 0x43584554, 0x44524f4f, + 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000058, + 0x00000040, 0x00000016, 0x03001062, 0x00101032, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, + 0x05000036, 0x00102032, 0x00000000, 0x00101046, 0x00000001, 0x08000036, 0x001020c2, 0x00000000, + 0x00004002, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x0100003e, + }; static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = { {"SV_POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, @@ -10681,7 +10732,18 @@ static void test_shader_interstage_interface(void) {{ 1.0f, 1.0f}, {3.0f, 5.0f}, 5.0f, 2, 6, 7.0f}, }; static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static const struct vec4 expected_result = {10.0f, 8.0f, 7.0f, 3.0f}; + static const struct + { + const DWORD *ps_code; + size_t ps_size; + struct vec4 expected_result; + } + tests[] = + { + {ps_code, sizeof(ps_code), {10.0f, 8.0f, 7.0f, 3.0f}}, + {ps_partial_input_code, sizeof(ps_partial_input_code), {10.0f, 8.0f, 0.0f, 3.0f}}, + {ps_single_input_code, sizeof(ps_single_input_code), {3.0f, 5.0f, 1.0f, 2.0f}}, + };
if (!init_test_context(&test_context)) return; @@ -10690,8 +10752,6 @@ static void test_shader_interstage_interface(void)
hr = ID3D10Device_CreateVertexShader(device, vs_code, sizeof(vs_code), &vs); ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); - hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); - ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); texture_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; @@ -10711,20 +10771,26 @@ static void test_shader_interstage_interface(void)
ID3D10Device_OMSetRenderTargets(device, 1, &rtv, NULL);
- ID3D10Device_PSSetShader(device, ps); ID3D10Device_VSSetShader(device, vs); ID3D10Device_IASetInputLayout(device, input_layout); ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); offset = 0; stride = sizeof(*quad); ID3D10Device_IASetVertexBuffers(device, 0, 1, &vb, &stride, &offset); - ID3D10Device_Draw(device, 4, 0); - check_texture_vec4(render_target, &expected_result, 0); + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + hr = ID3D10Device_CreatePixelShader(device, tests[i].ps_code, tests[i].ps_size, &ps); + ok(hr == S_OK, "Failed to create pixel shader, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_Draw(device, 4, 0); + check_texture_vec4(render_target, &tests[i].expected_result, 0); + ID3D10PixelShader_Release(ps); + }
ID3D10InputLayout_Release(input_layout); ID3D10RenderTargetView_Release(rtv); ID3D10Texture2D_Release(render_target); - ID3D10PixelShader_Release(ps); ID3D10VertexShader_Release(vs); ID3D10Buffer_Release(vb); release_test_context(&test_context);
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 123 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 421512f40cc9..0cfd5472c171 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -17,6 +17,7 @@ */
#include <assert.h> +#include <float.h> #include <limits.h> #include <math.h> #define COBJMACROS @@ -8096,6 +8097,127 @@ static void test_private_data(void) ok(!refcount, "Test object has %u references left.\n", refcount); }
+static void test_state_refcounting(void) +{ + ID3D10RasterizerState *rasterizer_state, *tmp_rasterizer_state; + D3D10_RASTERIZER_DESC rasterizer_desc; + D3D10_TEXTURE2D_DESC texture_desc; + D3D10_QUERY_DESC predicate_desc; + D3D10_SAMPLER_DESC sampler_desc; + ID3D10ShaderResourceView *srv; + ID3D10RenderTargetView *rtv; + ID3D10SamplerState *sampler; + ID3D10Predicate *predicate; + ID3D10Texture2D *texture; + ID3D10Device *device; + ULONG refcount; + HRESULT hr; + + if (!(device = create_device())) + { + skip("Failed to create device.\n"); + return; + } + + /* ID3D10SamplerState */ + memset(&sampler_desc, 0, sizeof(sampler_desc)); + sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; + sampler_desc.AddressU = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.AddressV = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.AddressW = D3D10_TEXTURE_ADDRESS_WRAP; + sampler_desc.MaxLOD = FLT_MAX; + hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + + refcount = get_refcount(sampler); + ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount); + ID3D10Device_PSSetSamplers(device, 0, 1, &sampler); + refcount = ID3D10SamplerState_Release(sampler); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + sampler = NULL; + ID3D10Device_PSGetSamplers(device, 0, 1, &sampler); + todo_wine ok(!sampler, "Got unexpected pointer %p, expected NULL.\n", sampler); + if (sampler) + ID3D10SamplerState_Release(sampler); + + /* ID3D10RasterizerState */ + memset(&rasterizer_desc, 0, sizeof(rasterizer_desc)); + rasterizer_desc.FillMode = D3D10_FILL_SOLID; + rasterizer_desc.CullMode = D3D10_CULL_BACK; + rasterizer_desc.DepthClipEnable = TRUE; + hr = ID3D10Device_CreateRasterizerState(device, &rasterizer_desc, &rasterizer_state); + ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); + + ID3D10Device_RSSetState(device, rasterizer_state); + refcount = ID3D10RasterizerState_Release(rasterizer_state); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + ID3D10Device_RSGetState(device, &tmp_rasterizer_state); + ok(tmp_rasterizer_state == rasterizer_state, "Got rasterizer state %p, expected %p.\n", + tmp_rasterizer_state, rasterizer_state); + refcount = ID3D10RasterizerState_Release(tmp_rasterizer_state); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + + /* ID3D10ShaderResourceView */ + memset(&texture_desc, 0, sizeof(texture_desc)); + texture_desc.Width = 32; + texture_desc.Height = 32; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texture_desc.SampleDesc.Count = 1; + texture_desc.Usage = D3D10_USAGE_DEFAULT; + texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE; + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture, NULL, &srv); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ID3D10Texture2D_Release(texture); + + ID3D10Device_PSSetShaderResources(device, 0, 1, &srv); + refcount = ID3D10ShaderResourceView_Release(srv); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + srv = NULL; + ID3D10Device_PSGetShaderResources(device, 0, 1, &srv); + todo_wine ok(!srv, "Got unexpected pointer %p, expected NULL.\n", srv); + if (srv) + ID3D10ShaderResourceView_Release(srv); + + /* ID3D10RenderTargetView */ + texture_desc.BindFlags = D3D10_BIND_RENDER_TARGET; + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)texture, NULL, &rtv); + ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr); + ID3D10Texture2D_Release(texture); + + ID3D10Device_OMSetRenderTargets(device, 1, &rtv, NULL); + refcount = ID3D10RenderTargetView_Release(rtv); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + rtv = NULL; + ID3D10Device_OMGetRenderTargets(device, 1, &rtv, NULL); + todo_wine ok(!rtv, "Got unexpected pointer %p, expected NULL.\n", rtv); + if (rtv) + ID3D10RenderTargetView_Release(rtv); + + /* ID3D10Predicate */ + predicate_desc.Query = D3D10_QUERY_OCCLUSION_PREDICATE; + predicate_desc.MiscFlags = 0; + hr = ID3D10Device_CreatePredicate(device, &predicate_desc, &predicate); + ok(SUCCEEDED(hr), "Failed to create predicate, hr %#x.\n", hr); + + ID3D10Device_SetPredication(device, predicate, TRUE); + refcount = ID3D10Predicate_Release(predicate); + ok(!refcount, "Got refcount %u, expected 0.\n", refcount); + predicate = NULL; + ID3D10Device_GetPredication(device, &predicate, NULL); + todo_wine ok(!predicate, "Got unexpected pointer %p, expected NULL.\n", predicate); + if (predicate) + ID3D10Predicate_Release(predicate); + + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + static void test_il_append_aligned(void) { struct d3d10core_test_context test_context; @@ -16299,6 +16421,7 @@ START_TEST(device) test_depth_stencil_sampling(); test_multiple_render_targets(); test_private_data(); + test_state_refcounting(); test_il_append_aligned(); test_instance_id(); test_fragment_coords();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index b3597ad1b394..36320f44bbb7 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -26110,6 +26110,146 @@ todo_wine release_test_context(&test_context); }
+static void test_multisample_resolve(void) +{ + struct d3d11_test_context test_context; + D3D11_RENDER_TARGET_VIEW_DESC rtv_desc; + ID3D11Texture2D *texture, *ms_texture; + D3D11_TEXTURE2D_DESC texture_desc; + ID3D11DeviceContext *context; + ID3D11RenderTargetView *rtv; + ID3D11Device *device; + unsigned int i; + HRESULT hr; + + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const struct vec4 green = {0.0f, 1.0f, 0.0f, 1.0f}; + static const struct vec4 color = {0.25f, 0.5f, 0.75f, 1.0f}; + static const struct + { + DXGI_FORMAT src_format; + DXGI_FORMAT dst_format; + DXGI_FORMAT format; + + DXGI_FORMAT rtv_format; + + const struct vec4 *color; + DWORD expected_color; + + BOOL todo; + } + tests[] = + { + {DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &green, 0xff00ff00}, + {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &green, 0xff00ff00}, + {DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &color, 0xffbf7f40}, + {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &color, 0xffe1bc89}, + + {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &green, 0xff00ff00, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &green, 0xff00ff00, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &color, 0xffe1bc89, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + &color, 0xffe1bc89, TRUE}, + + {DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &green, 0xff00ff00, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &green, 0xff00ff00, TRUE}, + {DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &color, 0xffbf7f40, TRUE}, + {DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM, + &color, 0xffbf7f40, TRUE}, + }; + + if (!init_test_context(&test_context, NULL)) + return; + device = test_context.device; + context = test_context.immediate_context; + + if (FAILED(hr = ID3D11Device_CheckMultisampleQualityLevels(device, + DXGI_FORMAT_R8G8B8A8_TYPELESS, 4, &i))) + { + skip("4xMSAA not supported.\n"); + release_test_context(&test_context); + return; + } + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc); + texture_desc.Format = tests[i].dst_format; + hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); + ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr); + + texture_desc.Format = tests[i].src_format; + texture_desc.SampleDesc.Count = 4; + texture_desc.SampleDesc.Quality = 0; + hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &ms_texture); + ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr); + rtv_desc.Format = tests[i].rtv_format; + rtv_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)ms_texture, &rtv_desc, &rtv); + ok(hr == S_OK, "Failed to create render target view, hr %#x.\n", hr); + + ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL); + ID3D11DeviceContext_ClearRenderTargetView(context, rtv, white); + draw_color_quad(&test_context, tests[i].color); + ID3D11DeviceContext_ResolveSubresource(context, (ID3D11Resource *)texture, 0, + (ID3D11Resource *)ms_texture, 0, tests[i].format); + todo_wine_if(tests[i].todo) + check_texture_color(texture, tests[i].expected_color, 2); + + ID3D11RenderTargetView_Release(rtv); + ID3D11Texture2D_Release(ms_texture); + ID3D11Texture2D_Release(texture); + } + + release_test_context(&test_context); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -26244,4 +26384,5 @@ START_TEST(d3d11) test_alpha_to_coverage(); test_unbound_multisample_texture(); test_multiple_viewports(); + test_multisample_resolve(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d9/directx.c | 6 ++++++ dlls/d3d9/tests/device.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index cdce669d979a..98f4a99c4943 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -254,6 +254,12 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter, TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n", iface, adapter, device_type, adapter_format, usage, resource_type, format);
+ if (!adapter_format) + { + WARN("Invalid adapter format.\n"); + return D3DERR_INVALIDCALL; + } + usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK); switch (resource_type) { diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index dc900f19232e..0eba7662bfd2 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -11638,6 +11638,7 @@ static void test_check_device_format(void)
D3DFORMAT adapter_format, format; BOOL render_target_supported; + D3DDEVTYPE device_type; unsigned int i, j; IDirect3D9 *d3d; HRESULT hr; @@ -11660,6 +11661,22 @@ static void test_check_device_format(void) ok(FAILED(hr), "Got unexpected hr %#x.\n", hr); }
+ for (device_type = D3DDEVTYPE_HAL; device_type < D3DDEVTYPE_NULLREF; ++device_type) + { + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_SURFACE, D3DFMT_A8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_TEXTURE, D3DFMT_A8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_TEXTURE, D3DFMT_X8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + } + hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_VERTEXBUFFER, D3DFMT_VERTEXDATA); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com