d3d9/tests: Add a test for the dsy SM3 instruction.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
65f20ffc50
commit
13ae8c91d1
|
@ -21804,6 +21804,133 @@ static void test_line_antialiasing_blending(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_dsy(void)
|
||||
{
|
||||
static const DWORD vs_code[] =
|
||||
{
|
||||
0xfffe0300, /* vs_3_0 */
|
||||
0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
|
||||
0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */
|
||||
0x0200001f, 0x80000000, 0xe00f0000, /* dcl_position o0 */
|
||||
0x0200001f, 0x8000000a, 0xe00f0001, /* dcl_color0 o1 */
|
||||
0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */
|
||||
0x02000001, 0xe00f0001, 0x90e40001, /* mov o1, v1 */
|
||||
0x0000ffff
|
||||
};
|
||||
static const DWORD ps_code[] =
|
||||
{
|
||||
0xffff0300, /* ps_3_0 */
|
||||
0x0200001f, 0x8000000a, 0x900f0000, /* dcl_color0 v0 */
|
||||
0x05000051, 0xa00f0000, 0x43700000, 0x3f000000, 0x00000000, 0x00000000, /* def c0, 240.0, 0.5, 0.0, 0.0 */
|
||||
0x0200005c, 0x800f0000, 0x90e40000, /* dsy r0, v0 */
|
||||
0x03000005, 0x800f0000, 0x80e40000, 0xa0000000, /* mul r0, r0, c0.x */
|
||||
0x03000002, 0x800f0800, 0x80e40000, 0xa0550000, /* add oC0, r0, c0.y */
|
||||
0x0000ffff
|
||||
};
|
||||
static const struct
|
||||
{
|
||||
struct vec3 pos;
|
||||
D3DCOLOR color;
|
||||
}
|
||||
quad[] =
|
||||
{
|
||||
{{-1.0f, -1.0f, 0.1f}, 0x00ff0000},
|
||||
{{-1.0f, 1.0f, 0.1f}, 0x0000ff00},
|
||||
{{ 1.0f, -1.0f, 0.1f}, 0x00ff0000},
|
||||
{{ 1.0f, 1.0f, 0.1f}, 0x0000ff00},
|
||||
};
|
||||
IDirect3DSurface9 *backbuffer, *rt;
|
||||
IDirect3DVertexShader9 *vs;
|
||||
IDirect3DPixelShader9 *ps;
|
||||
IDirect3DDevice9 *device;
|
||||
IDirect3D9 *d3d;
|
||||
ULONG refcount;
|
||||
D3DCAPS9 caps;
|
||||
DWORD color;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
window = create_window();
|
||||
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
ok(!!d3d, "Failed to create a D3D object.\n");
|
||||
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||
{
|
||||
skip("Failed to create a D3D device, skipping tests.\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
|
||||
{
|
||||
skip("No ps_3_0 support, skipping dsy tests.\n");
|
||||
IDirect3DDevice9_Release(device);
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer);
|
||||
ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8,
|
||||
D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create offscreen render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt);
|
||||
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateVertexShader(device, vs_code, &vs);
|
||||
ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreatePixelShader(device, ps_code, &ps);
|
||||
ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetVertexShader(device, vs);
|
||||
ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetPixelShader(device, ps);
|
||||
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
|
||||
ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
|
||||
color = getPixelColor(device, 360, 240);
|
||||
ok(color_match(color, 0x00ff007f, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice9_SetRenderTarget(device, 0, backbuffer);
|
||||
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
|
||||
ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
|
||||
color = getPixelColor(device, 360, 240);
|
||||
ok(color_match(color, 0x00ff007f, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to present frame, hr %#x.\n", hr);
|
||||
|
||||
IDirect3DSurface9_Release(rt);
|
||||
IDirect3DSurface9_Release(backbuffer);
|
||||
IDirect3DVertexShader9_Release(vs);
|
||||
IDirect3DPixelShader9_Release(ps);
|
||||
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
done:
|
||||
IDirect3D9_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(visual)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 identifier;
|
||||
|
@ -21928,4 +22055,5 @@ START_TEST(visual)
|
|||
test_texture_blending();
|
||||
test_color_clamping();
|
||||
test_line_antialiasing_blending();
|
||||
test_dsy();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue