Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10core/tests/device.c | 219 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 103b6705e342..9b1b89a653bb 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -14636,6 +14636,224 @@ static void test_generate_mips(void) release_test_context(&test_context); }
+static void test_alpha_to_coverage(void) +{ + struct ps_cb + { + struct vec2 top; + struct vec2 bottom; + float alpha[2]; + float padding[2]; + }; + + struct d3d10core_test_context test_context; + ID3D10Texture2D *render_targets[3]; + D3D10_TEXTURE2D_DESC texture_desc; + ID3D10Texture2D *readback_texture; + ID3D10RenderTargetView *rtvs[3]; + ID3D10BlendState *blend_state; + D3D10_BLEND_DESC blend_desc; + struct resource_readback rb; + UINT quality_level_count; + ID3D10PixelShader *ps; + struct ps_cb cb_data; + ID3D10Device *device; + ID3D10Buffer *cb; + unsigned int i; + HRESULT hr; + RECT rect; + + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const DWORD ps_code[] = + { +#if 0 + float2 top; + float2 bottom; + float alpha1; + float alpha2; + + void main(float4 position : SV_Position, + out float4 target0 : SV_Target0, + out float4 target1 : SV_Target1, + out float4 target2 : SV_Target2) + { + float alpha = all(top <= position.xy) && all(position.xy <= bottom) ? 1.0f : 0.0f; + target0 = float4(0.0f, 1.0f, 0.0f, alpha); + target1 = float4(0.0f, 0.0f, 1.0f, alpha1); + target2 = float4(0.0f, 1.0f, 0.0f, alpha2); + } +#endif + 0x43425844, 0x771ff802, 0xca927279, 0x5bdd75ae, 0xf53cb31b, 0x00000001, 0x00000264, 0x00000003, + 0x0000002c, 0x00000060, 0x000000c4, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000030f, 0x505f5653, 0x7469736f, 0x006e6f69, + 0x4e47534f, 0x0000005c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x00000050, 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, + 0x00000050, 0x00000002, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x545f5653, 0x65677261, + 0xabab0074, 0x52444853, 0x00000198, 0x00000040, 0x00000066, 0x04000059, 0x00208e46, 0x00000000, + 0x00000002, 0x04002064, 0x00101032, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, + 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000001, + 0x0800001d, 0x00100032, 0x00000000, 0x00101046, 0x00000000, 0x00208046, 0x00000000, 0x00000000, + 0x07000001, 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0800001d, + 0x00100062, 0x00000000, 0x00208ba6, 0x00000000, 0x00000000, 0x00101106, 0x00000000, 0x07000001, + 0x00100022, 0x00000000, 0x0010002a, 0x00000000, 0x0010001a, 0x00000000, 0x07000001, 0x00100012, + 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x07000001, 0x00102082, 0x00000000, + 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x08000036, 0x00102072, 0x00000000, 0x00004002, + 0x00000000, 0x3f800000, 0x00000000, 0x00000000, 0x08000036, 0x00102072, 0x00000001, 0x00004002, + 0x00000000, 0x00000000, 0x3f800000, 0x00000000, 0x06000036, 0x00102082, 0x00000001, 0x0020800a, + 0x00000000, 0x00000001, 0x08000036, 0x00102072, 0x00000002, 0x00004002, 0x00000000, 0x3f800000, + 0x00000000, 0x00000000, 0x06000036, 0x00102082, 0x00000002, 0x0020801a, 0x00000000, 0x00000001, + 0x0100003e, + }; + static const DWORD colors[] = {0xff00ff00, 0xbfff0000, 0x8000ff00}; + + if (!init_test_context(&test_context)) + return; + device = test_context.device; + + hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + ID3D10Device_PSSetShader(device, ps); + + memset(&blend_desc, 0, sizeof(blend_desc)); + blend_desc.AlphaToCoverageEnable = TRUE; + for (i = 0; i < ARRAY_SIZE(blend_desc.RenderTargetWriteMask); ++i) + blend_desc.RenderTargetWriteMask[i] = D3D10_COLOR_WRITE_ENABLE_ALL; + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &blend_state); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + ID3D10Device_OMSetBlendState(device, blend_state, NULL, D3D10_DEFAULT_SAMPLE_MASK); + + render_targets[0] = test_context.backbuffer; + rtvs[0] = test_context.backbuffer_rtv; + for (i = 1; i < ARRAY_SIZE(render_targets); ++i) + { + ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &render_targets[i]); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateRenderTargetView(device, + (ID3D10Resource *)render_targets[i], NULL, &rtvs[i]); + ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr); + } + ID3D10Device_OMSetRenderTargets(device, ARRAY_SIZE(rtvs), rtvs, NULL); + + cb_data.top.x = cb_data.top.y = 0.0f; + cb_data.bottom.x = cb_data.bottom.y = 200.0f; + cb_data.alpha[0] = 0.75; + cb_data.alpha[1] = 0.5f; + cb = create_buffer(device, D3D10_BIND_CONSTANT_BUFFER, sizeof(cb_data), &cb_data); + ID3D10Device_PSSetConstantBuffers(device, 0, 1, &cb); + + for (i = 0; i < ARRAY_SIZE(rtvs); ++i) + ID3D10Device_ClearRenderTargetView(device, rtvs[i], white); + draw_quad(&test_context); + for (i = 0; i < ARRAY_SIZE(render_targets); ++i) + { + DWORD expected_color; + + assert(i < ARRAY_SIZE(colors)); + expected_color = colors[i]; + get_texture_readback(render_targets[i], 0, &rb); + SetRect(&rect, 0, 0, 200, 200); + check_readback_data_color(&rb, &rect, expected_color, 1); + SetRect(&rect, 200, 0, 640, 200); + todo_wine + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + SetRect(&rect, 0, 200, 640, 480); + todo_wine + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + release_resource_readback(&rb); + + if (i > 0) + ID3D10Texture2D_Release(render_targets[i]); + render_targets[i] = NULL; + } + + ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); + texture_desc.Format = DXGI_FORMAT_R16G16_UNORM; + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &render_targets[0]); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateRenderTargetView(device, + (ID3D10Resource *)render_targets[0], NULL, &rtvs[0]); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + ID3D10Device_OMSetRenderTargets(device, ARRAY_SIZE(rtvs), rtvs, NULL); + + ID3D10Device_ClearRenderTargetView(device, rtvs[0], white); + draw_quad(&test_context); + get_texture_readback(render_targets[0], 0, &rb); + SetRect(&rect, 0, 0, 200, 200); + check_readback_data_color(&rb, &rect, 0xffff0000, 1); + SetRect(&rect, 200, 0, 640, 200); + todo_wine + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + SetRect(&rect, 0, 200, 640, 480); + todo_wine + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + release_resource_readback(&rb); + + ID3D10Texture2D_Release(render_targets[0]); + for (i = 0; i < ARRAY_SIZE(rtvs); ++i) + ID3D10RenderTargetView_Release(rtvs[i]); + + ID3D10Texture2D_GetDesc(test_context.backbuffer, &texture_desc); + hr = ID3D10Device_CheckMultisampleQualityLevels(device, + texture_desc.Format, 4, &quality_level_count); + if (FAILED(hr)) + { + skip("4xMSAA not supported.\n"); + goto done; + } + texture_desc.SampleDesc.Count = 4; + texture_desc.SampleDesc.Quality = 0; + + for (i = 0; i < ARRAY_SIZE(render_targets); ++i) + { + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &render_targets[i]); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateRenderTargetView(device, + (ID3D10Resource *)render_targets[i], NULL, &rtvs[i]); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + } + ID3D10Device_OMSetRenderTargets(device, ARRAY_SIZE(rtvs), rtvs, NULL); + + for (i = 0; i < ARRAY_SIZE(rtvs); ++i) + ID3D10Device_ClearRenderTargetView(device, rtvs[i], white); + draw_quad(&test_context); + texture_desc.SampleDesc.Count = 1; + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &readback_texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(render_targets); ++i) + { + DWORD expected_color; + + assert(i < ARRAY_SIZE(colors)); + expected_color = colors[i]; + + ID3D10Device_ResolveSubresource(device, (ID3D10Resource *)readback_texture, 0, + (ID3D10Resource *)render_targets[i], 0, texture_desc.Format); + + get_texture_readback(readback_texture, 0, &rb); + SetRect(&rect, 0, 0, 200, 200); + check_readback_data_color(&rb, &rect, expected_color, 1); + SetRect(&rect, 200, 0, 640, 200); + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + SetRect(&rect, 0, 200, 640, 480); + check_readback_data_color(&rb, &rect, 0xffffffff, 1); + release_resource_readback(&rb); + } + ID3D10Texture2D_Release(readback_texture); + + for (i = 0; i < ARRAY_SIZE(render_targets); ++i) + { + ID3D10Texture2D_Release(render_targets[i]); + ID3D10RenderTargetView_Release(rtvs[i]); + } + +done: + ID3D10Buffer_Release(cb); + ID3D10PixelShader_Release(ps); + ID3D10BlendState_Release(blend_state); + release_test_context(&test_context); +} + START_TEST(device) { test_feature_level(); @@ -14716,4 +14934,5 @@ START_TEST(device) test_clip_distance(); test_combined_clip_and_cull_distances(); test_generate_mips(); + test_alpha_to_coverage(); }
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/utils.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c index a881746fb31b..74f0ae0529dc 100644 --- a/dlls/dxgi/utils.c +++ b/dlls/dxgi/utils.c @@ -148,6 +148,7 @@ const char *debug_dxgi_format(DXGI_FORMAT format) WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_TYPELESS); WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_UNORM); WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_UNORM_SRGB); + WINE_DXGI_TO_STR(DXGI_FORMAT_B4G4R4A4_UNORM); default: FIXME("Unrecognized DXGI_FORMAT %#x.\n", format); return "unrecognized"; @@ -260,6 +261,7 @@ DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) case WINED3DFMT_BC7_TYPELESS: return DXGI_FORMAT_BC7_TYPELESS; case WINED3DFMT_BC7_UNORM: return DXGI_FORMAT_BC7_UNORM; case WINED3DFMT_BC7_UNORM_SRGB: return DXGI_FORMAT_BC7_UNORM_SRGB; + case WINED3DFMT_B4G4R4A4_UNORM: return DXGI_FORMAT_B4G4R4A4_UNORM; default: FIXME("Unhandled wined3d format %#x.\n", format); return DXGI_FORMAT_UNKNOWN; @@ -370,6 +372,7 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) case DXGI_FORMAT_BC7_TYPELESS: return WINED3DFMT_BC7_TYPELESS; case DXGI_FORMAT_BC7_UNORM: return WINED3DFMT_BC7_UNORM; case DXGI_FORMAT_BC7_UNORM_SRGB: return WINED3DFMT_BC7_UNORM_SRGB; + case DXGI_FORMAT_B4G4R4A4_UNORM: return WINED3DFMT_B4G4R4A4_UNORM; default: FIXME("Unhandled DXGI_FORMAT %#x.\n", format); return WINED3DFMT_UNKNOWN;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d11/utils.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/d3d11/utils.c b/dlls/d3d11/utils.c index b3894bbfa585..ba4d92029951 100644 --- a/dlls/d3d11/utils.c +++ b/dlls/d3d11/utils.c @@ -150,6 +150,7 @@ const char *debug_dxgi_format(DXGI_FORMAT format) WINE_D3D_TO_STR(DXGI_FORMAT_BC7_TYPELESS); WINE_D3D_TO_STR(DXGI_FORMAT_BC7_UNORM); WINE_D3D_TO_STR(DXGI_FORMAT_BC7_UNORM_SRGB); + WINE_D3D_TO_STR(DXGI_FORMAT_B4G4R4A4_UNORM); default: FIXME("Unrecognized DXGI_FORMAT %#x.\n", format); return "unrecognized"; @@ -311,6 +312,7 @@ DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) case WINED3DFMT_BC7_TYPELESS: return DXGI_FORMAT_BC7_TYPELESS; case WINED3DFMT_BC7_UNORM: return DXGI_FORMAT_BC7_UNORM; case WINED3DFMT_BC7_UNORM_SRGB: return DXGI_FORMAT_BC7_UNORM_SRGB; + case WINED3DFMT_B4G4R4A4_UNORM: return DXGI_FORMAT_B4G4R4A4_UNORM; default: FIXME("Unhandled wined3d format %#x.\n", format); return DXGI_FORMAT_UNKNOWN; @@ -421,6 +423,7 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) case DXGI_FORMAT_BC7_TYPELESS: return WINED3DFMT_BC7_TYPELESS; case DXGI_FORMAT_BC7_UNORM: return WINED3DFMT_BC7_UNORM; case DXGI_FORMAT_BC7_UNORM_SRGB: return WINED3DFMT_BC7_UNORM_SRGB; + case DXGI_FORMAT_B4G4R4A4_UNORM: return WINED3DFMT_B4G4R4A4_UNORM; default: FIXME("Unhandled DXGI_FORMAT %#x.\n", format); return WINED3DFMT_UNKNOWN;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d9/tests/visual.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 4a257c3e0344..72511101dc0f 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -4072,6 +4072,135 @@ done: DestroyWindow(window); }
+static void test_multisample_stretch_rect(void) +{ + static const D3DTEXTUREFILTERTYPE filters[] = + { + D3DTEXF_NONE, + D3DTEXF_POINT, + D3DTEXF_LINEAR, + }; + IDirect3DSurface9 *rt, *ms_rt, *rt_r5g6b5; + struct surface_readback rb; + IDirect3DDevice9 *device; + DWORD quality_levels; + IDirect3D9 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + DWORD color; + HRESULT hr; + RECT rect; + + window = create_window(); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, &quality_levels) == D3DERR_NOTAVAILABLE) + { + skip("Multisampling not supported for D3DFMT_A8R8G8B8.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_CreateRenderTarget(device, 128, 128, + D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL); + ok(hr == S_OK, "Failed to create render target, hr %#x.\n", hr); + hr = IDirect3DDevice9_CreateRenderTarget(device, 128, 128, + D3DFMT_A8R8G8B8, D3DMULTISAMPLE_2_SAMPLES, quality_levels - 1, FALSE, &ms_rt, NULL); + ok(hr == S_OK, "Failed to create render target, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderTarget(device, 0, ms_rt); + ok(hr == D3D_OK, "Failed to set render target, hr %#x.\n", hr); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff00ff, 0.0f, 0); + ok(hr == D3D_OK, "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt); + ok(hr == D3D_OK, "Failed to set render target, hr %#x.\n", hr); + + for (i = 0; i < sizeof(filters) / sizeof(*filters); ++i) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); + ok(hr == D3D_OK, "Test %u: Failed to clear, hr %#x.\n", i, hr); + hr = IDirect3DDevice9_StretchRect(device, ms_rt, NULL, rt, NULL, filters[i]); + ok(hr == S_OK, "Test %u: Failed to stretch rect, hr %#x.\n", i, hr); + color = getPixelColor(device, 64, 64); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + } + + /* Scaling */ + SetRect(&rect, 0, 0, 64, 64); + for (i = 0; i < sizeof(filters) / sizeof(*filters); ++i) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); + ok(hr == D3D_OK, "Test %u: Failed to clear, hr %#x.\n", i, hr); + hr = IDirect3DDevice9_StretchRect(device, ms_rt, NULL, rt, &rect, filters[i]); + ok(hr == S_OK, "Test %u: Failed to stretch rect, hr %#x.\n", i, hr); + get_rt_readback(rt, &rb); + color = get_readback_color(&rb, 32, 32); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + color = get_readback_color(&rb, 64, 64); + ok(color == 0xffffffff, "Test %u: Got color 0x%08x.\n", i, color); + color = get_readback_color(&rb, 96, 96); + ok(color == 0xffffffff, "Test %u: Got color 0x%08x.\n", i, color); + release_surface_readback(&rb); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); + ok(hr == D3D_OK, "Test %u: Failed to clear, hr %#x.\n", i, hr); + hr = IDirect3DDevice9_StretchRect(device, ms_rt, &rect, rt, NULL, filters[i]); + ok(hr == S_OK, "Test %u: Failed to stretch rect, hr %#x.\n", i, hr); + get_rt_readback(rt, &rb); + color = get_readback_color(&rb, 32, 32); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + color = get_readback_color(&rb, 64, 64); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + color = get_readback_color(&rb, 96, 96); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + release_surface_readback(&rb); + } + + /* Format conversion */ + hr = IDirect3DDevice9_CreateRenderTarget(device, 128, 128, + D3DFMT_R5G6B5, D3DMULTISAMPLE_NONE, 0, FALSE, &rt_r5g6b5, NULL); + if (FAILED(hr)) + { + skip("Failed to create D3DFMT_R5G6B5 render target.\n"); + goto done; + } + + for (i = 0; i < sizeof(filters) / sizeof(*filters); ++i) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); + ok(hr == D3D_OK, "Test %u: Failed to clear, hr %#x.\n", i, hr); + hr = IDirect3DDevice9_StretchRect(device, ms_rt, NULL, rt_r5g6b5, NULL, filters[i]); + ok(hr == S_OK, "Test %u: Failed to stretch rect, hr %#x.\n", i, hr); + hr = IDirect3DDevice9_StretchRect(device, rt_r5g6b5, NULL, rt, NULL, filters[i]); + ok(hr == S_OK, "Test %u: Failed to stretch rect, hr %#x.\n", i, hr); + color = getPixelColor(device, 64, 64); + ok(color == 0x00ff00ff, "Test %u: Got color 0x%08x.\n", i, color); + } + + IDirect3DSurface9_Release(rt_r5g6b5); + +done: + IDirect3DSurface9_Release(ms_rt); + IDirect3DSurface9_Release(rt); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + static void maxmip_test(void) { IDirect3DTexture9 *texture; @@ -23291,6 +23420,7 @@ START_TEST(visual) test_sanity(); depth_clamp_test(); stretchrect_test(); + test_multisample_stretch_rect(); lighting_test(); test_specular_lighting(); clear_test();
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Direct3D 9 allows blits from multisample resources to non-multisample resources with scaling or format conversion. In OpenGL, we resolve multisample texture to the renderbuffer associated with the texture before doing the actual blit with scaling/format conversion.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/surface.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 1f5a98a2fee0..5cb9cda7b6e6 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -350,6 +350,15 @@ static void surface_depth_blt_fbo(const struct wined3d_device *device, context_release(context); }
+static BOOL is_multisample_location(const struct wined3d_texture *texture, DWORD location) +{ + if (location == WINED3D_LOCATION_RB_MULTISAMPLE) + return TRUE; + if (location != WINED3D_LOCATION_TEXTURE_RGB && location != WINED3D_LOCATION_TEXTURE_SRGB) + return FALSE; + return texture->target == GL_TEXTURE_2D_MULTISAMPLE || texture->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY; +} + /* Blit between surface locations. Onscreen on different swapchains is not supported. * Depth / stencil is not supported. Context activation is done by the caller. */ static void surface_blt_fbo(const struct wined3d_device *device, @@ -392,7 +401,7 @@ static void surface_blt_fbo(const struct wined3d_device *device, }
/* Resolve the source surface first if needed. */ - if (src_location == WINED3D_LOCATION_RB_MULTISAMPLE + if (is_multisample_location(src_texture, src_location) && (src_texture->resource.format->id != dst_texture->resource.format->id || abs(src_rect.bottom - src_rect.top) != abs(dst_rect.bottom - dst_rect.top) || abs(src_rect.right - src_rect.left) != abs(dst_rect.right - dst_rect.left)))
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com