[PATCH 2/5] d3d11: Implement d3d10_device_CreateGeometryShaderWithStreamOutput().

Józef Kucia jkucia at codeweavers.com
Fri Mar 31 06:11:50 CDT 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/d3d10core/tests/device.c |  4 +---
 dlls/d3d11/device.c           | 39 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 3e8a1e8..baa7792 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -9946,8 +9946,7 @@ static void test_index_buffer_offset(void)
     hr = ID3D10Device_CreateGeometryShaderWithStreamOutput(device, gs_code, sizeof(gs_code),
             so_declaration, sizeof(so_declaration) / sizeof(*so_declaration),
             stride, &gs);
-    todo_wine ok(SUCCEEDED(hr), "Failed to create geometry shader with stream output, hr %#x.\n", hr);
-    if (FAILED(hr)) goto cleanup;
+    ok(SUCCEEDED(hr), "Failed to create geometry shader with stream output, hr %#x.\n", hr);
 
     hr = ID3D10Device_CreateVertexShader(device, vs_code, sizeof(vs_code), &vs);
     ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
@@ -9992,7 +9991,6 @@ static void test_index_buffer_offset(void)
     ID3D10Buffer_Release(vb);
     ID3D10VertexShader_Release(vs);
     ID3D10GeometryShader_Release(gs);
-cleanup:
     ID3D10InputLayout_Release(input_layout);
     release_test_context(&test_context);
 }
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 5ae305d..13bfda4 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -4927,12 +4927,45 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutp
         const void *byte_code, SIZE_T byte_code_length, const D3D10_SO_DECLARATION_ENTRY *output_stream_decls,
         UINT output_stream_decl_count, UINT output_stream_stride, ID3D10GeometryShader **shader)
 {
-    FIXME("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p, "
-            "output_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
+    struct d3d_device *device = impl_from_ID3D10Device(iface);
+    D3D11_SO_DECLARATION_ENTRY *so_entries;
+    struct d3d_geometry_shader *object;
+    unsigned int i, stride_count = 1;
+    HRESULT hr;
+
+    TRACE("iface %p, byte_code %p, byte_code_length %lu, output_stream_decls %p, "
+            "output_stream_decl_count %u, output_stream_stride %u, shader %p.\n",
             iface, byte_code, byte_code_length, output_stream_decls,
             output_stream_decl_count, output_stream_stride, shader);
 
-    return E_NOTIMPL;
+    if (!(so_entries = d3d11_calloc(output_stream_decl_count, sizeof(*so_entries))))
+    {
+        ERR("Failed to allocate D3D11 SO declaration array memory.\n");
+        return E_OUTOFMEMORY;
+    }
+
+    for (i = 0; i < output_stream_decl_count; ++i)
+    {
+        so_entries[i].Stream = 0;
+        so_entries[i].SemanticName = output_stream_decls[i].SemanticName;
+        so_entries[i].SemanticIndex = output_stream_decls[i].SemanticIndex;
+        so_entries[i].StartComponent = output_stream_decls[i].StartComponent;
+        so_entries[i].ComponentCount = output_stream_decls[i].ComponentCount;
+        so_entries[i].OutputSlot = output_stream_decls[i].OutputSlot;
+
+        if (output_stream_decls[i].OutputSlot)
+           stride_count = 0;
+    }
+
+    hr = d3d_geometry_shader_create(device, byte_code, byte_code_length,
+            so_entries, output_stream_decl_count, &output_stream_stride, stride_count, 0, &object);
+    HeapFree(GetProcessHeap(), 0, so_entries);
+    if (FAILED(hr))
+        return hr;
+
+    *shader = &object->ID3D10GeometryShader_iface;
+
+    return hr;
 }
 
 static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device1 *iface,
-- 
2.10.2




More information about the wine-patches mailing list