=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d10core/tests: Add test for geometry shader to test_create_shaders().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 6 09:43:59 CDT 2015


Module: wine
Branch: master
Commit: b27efb4bdf326bf9be6fc86c1c556326107958f0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b27efb4bdf326bf9be6fc86c1c556326107958f0

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Oct  6 01:49:30 2015 +0200

d3d10core/tests: Add test for geometry shader to test_create_shaders().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>

---

 dlls/d3d10core/tests/device.c | 74 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 72 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 99890a2..ee12b40 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -1081,10 +1081,55 @@ float4 main(const float4 color : COLOR) : SV_TARGET
         0x00000000, 0x00000000,
     };
 
+#if 0
+struct gs_out
+{
+    float4 pos : SV_POSITION;
+};
+
+[maxvertexcount(4)]
+void main(point float4 vin[1] : POSITION, inout TriangleStream<gs_out> vout)
+{
+    float offset = 0.1 * vin[0].w;
+    gs_out v;
+
+    v.pos = float4(vin[0].x - offset, vin[0].y - offset, vin[0].z, vin[0].w);
+    vout.Append(v);
+    v.pos = float4(vin[0].x - offset, vin[0].y + offset, vin[0].z, vin[0].w);
+    vout.Append(v);
+    v.pos = float4(vin[0].x + offset, vin[0].y - offset, vin[0].z, vin[0].w);
+    vout.Append(v);
+    v.pos = float4(vin[0].x + offset, vin[0].y + offset, vin[0].z, vin[0].w);
+    vout.Append(v);
+}
+#endif
+    static const DWORD gs_4_0[] =
+    {
+        0x43425844, 0x000ee786, 0xc624c269, 0x885a5cbe, 0x444b3b1f, 0x00000001, 0x0000023c, 0x00000003,
+        0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
+        0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00,
+        0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003,
+        0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x000001a0, 0x00020040,
+        0x00000068, 0x0400005f, 0x002010f2, 0x00000001, 0x00000000, 0x02000068, 0x00000001, 0x0100085d,
+        0x0100285c, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x0200005e, 0x00000004, 0x0f000032,
+        0x00100032, 0x00000000, 0x80201ff6, 0x00000041, 0x00000000, 0x00000000, 0x00004002, 0x3dcccccd,
+        0x3dcccccd, 0x00000000, 0x00000000, 0x00201046, 0x00000000, 0x00000000, 0x05000036, 0x00102032,
+        0x00000000, 0x00100046, 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000,
+        0x00000000, 0x01000013, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0e000032,
+        0x00100052, 0x00000000, 0x00201ff6, 0x00000000, 0x00000000, 0x00004002, 0x3dcccccd, 0x00000000,
+        0x3dcccccd, 0x00000000, 0x00201106, 0x00000000, 0x00000000, 0x05000036, 0x00102022, 0x00000000,
+        0x0010002a, 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000, 0x00000000,
+        0x01000013, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x05000036, 0x00102022,
+        0x00000000, 0x0010001a, 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000,
+        0x00000000, 0x01000013, 0x05000036, 0x00102032, 0x00000000, 0x00100086, 0x00000000, 0x06000036,
+        0x001020c2, 0x00000000, 0x00201ea6, 0x00000000, 0x00000000, 0x01000013, 0x0100003e,
+    };
+
     ULONG refcount, expected_refcount;
-    ID3D10VertexShader *vs = NULL;
-    ID3D10PixelShader *ps = NULL;
     ID3D10Device *device, *tmp;
+    ID3D10GeometryShader *gs;
+    ID3D10VertexShader *vs;
+    ID3D10PixelShader *ps;
     IUnknown *iface;
     HRESULT hr;
 
@@ -1094,6 +1139,7 @@ float4 main(const float4 color : COLOR) : SV_TARGET
         return;
     }
 
+    /* vertex shader */
     expected_refcount = get_refcount((IUnknown *)device) + 1;
     hr = ID3D10Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), &vs);
     ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
@@ -1125,6 +1171,7 @@ float4 main(const float4 color : COLOR) : SV_TARGET
     hr = ID3D10Device_CreateVertexShader(device, ps_4_0, sizeof(ps_4_0), &vs);
     ok(hr == E_INVALIDARG, "Created a SM4 vertex shader from a pixel shader source, hr %#x\n", hr);
 
+    /* pixel shader */
     expected_refcount = get_refcount((IUnknown *)device) + 1;
     hr = ID3D10Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), &ps);
     ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x\n", hr);
@@ -1147,6 +1194,29 @@ float4 main(const float4 color : COLOR) : SV_TARGET
     refcount = ID3D10PixelShader_Release(ps);
     ok(!refcount, "Pixel shader has %u references left.\n", refcount);
 
+    /* geometry shader */
+    expected_refcount = get_refcount((IUnknown *)device) + 1;
+    hr = ID3D10Device_CreateGeometryShader(device, gs_4_0, sizeof(gs_4_0), &gs);
+    ok(SUCCEEDED(hr), "Failed to create SM4 geometry shader, hr %#x.\n", hr);
+
+    refcount = get_refcount((IUnknown *)device);
+    ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n", refcount, expected_refcount);
+    tmp = NULL;
+    expected_refcount = refcount + 1;
+    ID3D10GeometryShader_GetDevice(gs, &tmp);
+    ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
+    refcount = get_refcount((IUnknown *)device);
+    ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
+    ID3D10Device_Release(tmp);
+
+    hr = ID3D10GeometryShader_QueryInterface(gs, &IID_ID3D11GeometryShader, (void **)&iface);
+    ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
+            "Geometry shader should implement ID3D11GeometryShader.\n");
+    if (SUCCEEDED(hr)) IUnknown_Release(iface);
+
+    refcount = ID3D10GeometryShader_Release(gs);
+    ok(!refcount, "Geometry shader has %u references left.\n", refcount);
+
     refcount = ID3D10Device_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);
 }




More information about the wine-cvs mailing list