d3d11/tests: Add test for line antialiasing blending.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-08-08 16:52:23 +02:00 committed by Alexandre Julliard
parent 57c60d9c43
commit f1214f222e
1 changed files with 83 additions and 0 deletions

View File

@ -10165,6 +10165,88 @@ static void test_face_culling(void)
release_test_context(&test_context);
}
static void test_line_antialiasing_blending(void)
{
ID3D11RasterizerState *rasterizer_state;
struct d3d11_test_context test_context;
D3D11_RASTERIZER_DESC rasterizer_desc;
ID3D11BlendState *blend_state;
ID3D11DeviceContext *context;
D3D11_BLEND_DESC blend_desc;
ID3D11Device *device;
HRESULT hr;
static const struct vec4 red = {1.0f, 0.0f, 0.0f, 0.8f};
static const struct vec4 green = {0.0f, 1.0f, 0.0f, 0.5f};
if (!init_test_context(&test_context, NULL))
return;
device = test_context.device;
context = test_context.immediate_context;
memset(&blend_desc, 0, sizeof(blend_desc));
blend_desc.AlphaToCoverageEnable = FALSE;
blend_desc.IndependentBlendEnable = FALSE;
blend_desc.RenderTarget[0].BlendEnable = TRUE;
blend_desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
blend_desc.RenderTarget[0].DestBlend = D3D11_BLEND_DEST_ALPHA;
blend_desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blend_desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
blend_desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA;
blend_desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blend_desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
hr = ID3D11Device_CreateBlendState(device, &blend_desc, &blend_state);
ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr);
ID3D11DeviceContext_OMSetBlendState(context, blend_state, NULL, D3D11_DEFAULT_SAMPLE_MASK);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &red.x);
draw_color_quad(&test_context, &green);
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D11DeviceContext_OMSetBlendState(context, NULL, NULL, D3D11_DEFAULT_SAMPLE_MASK);
ID3D11BlendState_Release(blend_state);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &red.x);
draw_color_quad(&test_context, &green);
check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
rasterizer_desc.FillMode = D3D11_FILL_SOLID;
rasterizer_desc.CullMode = D3D11_CULL_BACK;
rasterizer_desc.FrontCounterClockwise = FALSE;
rasterizer_desc.DepthBias = 0;
rasterizer_desc.DepthBiasClamp = 0.0f;
rasterizer_desc.SlopeScaledDepthBias = 0.0f;
rasterizer_desc.DepthClipEnable = TRUE;
rasterizer_desc.ScissorEnable = FALSE;
rasterizer_desc.MultisampleEnable = FALSE;
rasterizer_desc.AntialiasedLineEnable = TRUE;
hr = ID3D11Device_CreateRasterizerState(device, &rasterizer_desc, &rasterizer_state);
ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr);
ID3D11DeviceContext_RSSetState(context, rasterizer_state);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &red.x);
draw_color_quad(&test_context, &green);
todo_wine check_texture_color(test_context.backbuffer, 0x7f00ff00, 1);
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
todo_wine check_texture_color(test_context.backbuffer, 0xcc0000ff, 1);
ID3D11RasterizerState_Release(rasterizer_state);
release_test_context(&test_context);
}
START_TEST(d3d11)
{
test_create_device();
@ -10220,4 +10302,5 @@ START_TEST(d3d11)
test_uint_shader_instructions();
test_index_buffer_offset();
test_face_culling();
test_line_antialiasing_blending();
}