Matteo Bruni : d3d9/tests: Test the default diffuse color for vertex shaders.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jun 12 07:36:13 CDT 2015
Module: wine
Branch: master
Commit: 3c7e48a13246866ece788a52c95e8b81e5100d40
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3c7e48a13246866ece788a52c95e8b81e5100d40
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Thu Jun 11 23:13:38 2015 +0200
d3d9/tests: Test the default diffuse color for vertex shaders.
---
dlls/d3d9/tests/visual.c | 44 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index ae67d5c..c0ed616 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -7388,6 +7388,7 @@ static void test_vshader_input(void)
{
IDirect3DVertexDeclaration9 *decl_twotexcrd, *decl_onetexcrd, *decl_twotex_wrongidx, *decl_twotexcrd_rightorder;
IDirect3DVertexDeclaration9 *decl_texcoord_color, *decl_color_color, *decl_color_ubyte, *decl_color_float;
+ IDirect3DVertexDeclaration9 *decl_nocolor;
IDirect3DVertexShader9 *swapped_shader, *texcoord_color_shader, *color_color_shader;
D3DADAPTER_IDENTIFIER9 identifier;
IDirect3DPixelShader9 *ps;
@@ -7576,6 +7577,13 @@ static void test_vshader_input(void)
1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 0.0f, 1.0f,
};
+ static const struct vec3 quad_nocolor[] =
+ {
+ {-1.0f, -1.0f, 0.1f},
+ {-1.0f, 1.0f, 0.1f},
+ { 1.0f, -1.0f, 0.1f},
+ { 1.0f, 1.0f, 0.1f},
+ };
static const D3DVERTEXELEMENT9 decl_elements_twotexcrd[] =
{
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
@@ -7627,6 +7635,11 @@ static void test_vshader_input(void)
{0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
+ static const D3DVERTEXELEMENT9 decl_elements_nocolor[] =
+ {
+ {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
+ D3DDECL_END()
+ };
static const float normalize[4] = {1.0f / 256.0f, 1.0f / 256.0f, 1.0f / 256.0f, 1.0f / 256.0f};
static const float no_normalize[4] = {1.0f, 1.0f, 1.0f, 1.0f};
@@ -7670,6 +7683,8 @@ static void test_vshader_input(void)
ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexDeclaration returned %08x\n", hr);
hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_color_float, &decl_color_float);
ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexDeclaration returned %08x\n", hr);
+ hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_nocolor, &decl_nocolor);
+ ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexDeclaration returned %08x\n", hr);
hr = IDirect3DDevice9_CreatePixelShader(device, ps3_code, &ps);
ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr);
@@ -7876,10 +7891,6 @@ static void test_vshader_input(void)
hr = IDirect3DDevice9_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
- IDirect3DDevice9_SetVertexShader(device, NULL);
- IDirect3DDevice9_SetVertexDeclaration(device, NULL);
- IDirect3DDevice9_SetPixelShader(device, NULL);
-
color = getPixelColor(device, 160, 360);
ok(color_match(color, D3DCOLOR_ARGB(0x00, 0xff, 0x80, 0x40), 1),
"Input test: Quad 1(color-texcoord) returned color 0x%08x, expected 0x00ff8040\n", color);
@@ -7896,6 +7907,30 @@ static void test_vshader_input(void)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
+ hr = IDirect3DDevice9_SetVertexDeclaration(device, decl_nocolor);
+ ok(SUCCEEDED(hr), "Failed to set vertex declaration, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 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_nocolor, sizeof(quad_nocolor[0]));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ /* WARP ends up using the color attribute from the previous draw. Let's mark
+ * that behavior as broken. */
+ color = getPixelColor(device, 160, 360);
+ ok(color_match(color, 0x00000000, 1)
+ || broken(color_match(color, 0x00ffff00, 1)),
+ "Got unexpected color 0x%08x for no color attribute test.\n", color);
+
+ IDirect3DDevice9_SetVertexShader(device, NULL);
+ IDirect3DDevice9_SetVertexDeclaration(device, NULL);
+ IDirect3DDevice9_SetPixelShader(device, NULL);
+
IDirect3DVertexShader9_Release(texcoord_color_shader);
IDirect3DVertexShader9_Release(color_color_shader);
}
@@ -7909,6 +7944,7 @@ static void test_vshader_input(void)
IDirect3DVertexDeclaration9_Release(decl_color_color);
IDirect3DVertexDeclaration9_Release(decl_color_ubyte);
IDirect3DVertexDeclaration9_Release(decl_color_float);
+ IDirect3DVertexDeclaration9_Release(decl_nocolor);
IDirect3DPixelShader9_Release(ps);
refcount = IDirect3DDevice9_Release(device);
More information about the wine-cvs
mailing list