From c3af27da9a6025a1d2e25307a97aa23ec89b38ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Aug 2017 01:47:49 +0200
Subject: [PATCH 3/5] d3d9/tests: Check MaxVertexBlendMatrixIndex capability.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
---
 dlls/d3d9/tests/visual.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index e665b9dbb3..6d9bdcf3da 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -21796,7 +21796,9 @@ static void test_indexed_vertex_blending(void)
     IDirect3DDevice9 *device;
     IDirect3D9 *d3d;
     ULONG refcount;
+    D3DCAPS9 caps;
     HWND window;
+    HRESULT hr;
 
     window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
             0, 0, 640, 480, NULL, NULL, NULL, NULL);
@@ -21825,7 +21827,14 @@ static void test_indexed_vertex_blending(void)
     if (SUCCEEDED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
             D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device)))
     {
+        memset(&caps, 0, sizeof(caps));
+        hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+        ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
+        todo_wine ok(caps.MaxVertexBlendMatrixIndex == 255, "Expected 255 as maximum blend matrix index, got %u.\n",
+                caps.MaxVertexBlendMatrixIndex);
+
         do_test_indexed_vertex_blending(device,"IVB software");
+
         refcount = IDirect3DDevice9_Release(device);
         ok(!refcount, "Device has %u references left.\n", refcount);
     }
@@ -21835,7 +21844,26 @@ static void test_indexed_vertex_blending(void)
     if (SUCCEEDED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
             D3DCREATE_MIXED_VERTEXPROCESSING, &present_parameters, &device)))
     {
+        memset(&caps, 0, sizeof(caps));
+        hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+        ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
+        ok(caps.MaxVertexBlendMatrixIndex < 255, "Expected less than 255 as maximum blend matrix index, got %u.\n",
+                caps.MaxVertexBlendMatrixIndex);
+
+        hr = IDirect3DDevice9_SetSoftwareVertexProcessing(device, TRUE);
+        ok(SUCCEEDED(hr), "Failed to enable software processing, hr %#x.\n", hr);
+
+        memset(&caps, 0, sizeof(caps));
+        hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
+        ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
+        todo_wine ok(caps.MaxVertexBlendMatrixIndex == 255, "Expected 255 as maximum blend matrix index, got %u.\n",
+                caps.MaxVertexBlendMatrixIndex);
+
+        hr = IDirect3DDevice9_SetSoftwareVertexProcessing(device, FALSE);
+        ok(SUCCEEDED(hr), "Failed to disable software processing, hr %#x.\n", hr);
+
         do_test_indexed_vertex_blending(device,"IVB mixed");
+
         refcount = IDirect3DDevice9_Release(device);
         ok(!refcount, "Device has %u references left.\n", refcount);
     }
-- 
2.20.1

