[PATCH 3/7] d3d11: Add ID3D11Device stub interface.

Józef Kucia jkucia at codeweavers.com
Wed Aug 19 18:47:56 CDT 2015


At some point, we should extend ID3D11Device to ID3D11Device1,
ID3D11Device2 or ID3D11Device3.
---
 dlls/d3d11/d3d11_private.h |   2 +
 dlls/d3d11/device.c        | 411 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/dxgi/tests/device.c   |   2 +-
 3 files changed, 414 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 48e8c69..57fce1c 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -30,6 +30,7 @@
 #include "objbase.h"
 
 #include "d3d10_1.h"
+#include "d3d11_1.h"
 #ifdef D3D11_INIT_GUID
 #include "initguid.h"
 #endif
@@ -331,6 +332,7 @@ struct d3d10_query *unsafe_impl_from_ID3D10Query(ID3D10Query *iface) DECLSPEC_HI
 struct d3d_device
 {
     IUnknown IUnknown_inner;
+    ID3D11Device ID3D11Device_iface;
     ID3D10Device1 ID3D10Device1_iface;
     ID3D10Multithread ID3D10Multithread_iface;
     IWineDXGIDeviceParent IWineDXGIDeviceParent_iface;
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index e3c479f..5033840 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -50,6 +50,10 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *ifa
     {
         *out = &device->ID3D10Device1_iface;
     }
+    else if (IsEqualGUID(riid, &IID_ID3D11Device))
+    {
+        *out = &device->ID3D11Device_iface;
+    }
     else if (IsEqualGUID(riid, &IID_ID3D10Multithread))
     {
         *out = &device->ID3D10Multithread_iface;
@@ -2306,6 +2310,412 @@ static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
     d3d10_device_inner_Release,
 };
 
+/* ID3D11Device methods */
+
+static inline struct d3d_device *impl_from_ID3D11Device(ID3D11Device *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d_device, ID3D11Device_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_QueryInterface(ID3D11Device *iface, REFIID riid, void **out)
+{
+    struct d3d_device *device = impl_from_ID3D11Device(iface);
+    return IUnknown_QueryInterface(device->outer_unk, riid, out);
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_device_AddRef(ID3D11Device *iface)
+{
+    struct d3d_device *device = impl_from_ID3D11Device(iface);
+    return IUnknown_AddRef(device->outer_unk);
+}
+
+static ULONG STDMETHODCALLTYPE d3d11_device_Release(ID3D11Device *iface)
+{
+    struct d3d_device *device = impl_from_ID3D11Device(iface);
+    return IUnknown_Release(device->outer_unk);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBuffer(ID3D11Device *iface, const D3D11_BUFFER_DESC *desc,
+        const D3D11_SUBRESOURCE_DATA *data, ID3D11Buffer **buffer)
+{
+    FIXME("iface %p, desc %p, data %p, buffer %p stub!\n", iface, desc, data, buffer);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture1D(ID3D11Device *iface,
+        const D3D11_TEXTURE1D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture1D **texture)
+{
+    FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture2D(ID3D11Device *iface,
+        const D3D11_TEXTURE2D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture2D **texture)
+{
+    FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateTexture3D(ID3D11Device *iface,
+        const D3D11_TEXTURE3D_DESC *desc, const D3D11_SUBRESOURCE_DATA *data, ID3D11Texture3D **texture)
+{
+    FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateShaderResourceView(ID3D11Device *iface,
+        ID3D11Resource *resource, const D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11ShaderResourceView **view)
+{
+    FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateUnorderedAccessView(ID3D11Device *iface,
+        ID3D11Resource *resource, const D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11UnorderedAccessView **view)
+{
+    FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRenderTargetView(ID3D11Device *iface,
+        ID3D11Resource *resource, const D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11RenderTargetView **view)
+{
+    FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDepthStencilView(ID3D11Device *iface,
+        ID3D11Resource *resource, const D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11DepthStencilView **view)
+{
+    FIXME("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateInputLayout(ID3D11Device *iface,
+        const D3D11_INPUT_ELEMENT_DESC *element_descs, UINT element_count, const void *shader_byte_code,
+        SIZE_T shader_byte_code_length, ID3D11InputLayout **input_layout)
+{
+    FIXME("iface %p, element_descs %p, element_count %u, shader_byte_code %p, shader_byte_code_length %lu, "
+            "input_layout %p stub!\n", iface, element_descs, element_count, shader_byte_code,
+            shader_byte_code_length, input_layout);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateVertexShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11VertexShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11GeometryShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateGeometryShaderWithStreamOutput(ID3D11Device *iface,
+        const void *byte_code, SIZE_T byte_code_length, const D3D11_SO_DECLARATION_ENTRY *so_entries,
+        UINT entry_count, const UINT *buffer_strides, UINT strides_count, UINT rasterized_stream,
+        ID3D11ClassLinkage *class_linkage, ID3D11GeometryShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, so_entries %p, entry_count %u, "
+            "buffer_strides %p, strides_count %u, rasterized_stream %u, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, so_entries, entry_count, buffer_strides, strides_count,
+            rasterized_stream, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreatePixelShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11PixelShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateHullShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11HullShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDomainShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11DomainShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_length %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateComputeShader(ID3D11Device *iface, const void *byte_code,
+        SIZE_T byte_code_length, ID3D11ClassLinkage *class_linkage, ID3D11ComputeShader **shader)
+{
+    FIXME("iface %p, byte_code %p, byte_code_lenghth %lu, class_linkage %p, shader %p stub!\n",
+            iface, byte_code, byte_code_length, class_linkage, shader);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateClassLinkage(ID3D11Device *iface,
+        ID3D11ClassLinkage **class_linkage)
+{
+    FIXME("iface %p, class_linkage %p stub!\n", iface, class_linkage);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState(ID3D11Device *iface,
+        const D3D11_BLEND_DESC *desc, ID3D11BlendState **blend_state)
+{
+    FIXME("iface %p, desc %p, blend_state %p stub!\n", iface, desc, blend_state);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDepthStencilState(ID3D11Device *iface,
+        const D3D11_DEPTH_STENCIL_DESC *desc, ID3D11DepthStencilState **depth_stencil_state)
+{
+    FIXME("iface %p, desc %p, depth_stencil_state %p stub!\n", iface, desc, depth_stencil_state);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState(ID3D11Device *iface,
+        const D3D11_RASTERIZER_DESC *desc, ID3D11RasterizerState **rasterizer_state)
+{
+    FIXME("iface %p, desc %p, rasterizer_state %p stub!\n", iface, desc, rasterizer_state);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateSamplerState(ID3D11Device *iface,
+        const D3D11_SAMPLER_DESC *desc, ID3D11SamplerState **sampler_state)
+{
+    FIXME("iface %p, desc %p, sampler_state %p stub!\n", iface, desc, sampler_state);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateQuery(ID3D11Device *iface,
+    const D3D11_QUERY_DESC *desc, ID3D11Query **query)
+{
+    FIXME("iface %p, desc %p, query %p stub!\n", iface, desc, query);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreatePredicate(ID3D11Device *iface, const D3D11_QUERY_DESC *desc,
+        ID3D11Predicate **predicate)
+{
+    FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateCounter(ID3D11Device *iface, const D3D11_COUNTER_DESC *desc,
+        ID3D11Counter **counter)
+{
+    FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeferredContext(ID3D11Device *iface, UINT flags,
+        ID3D11DeviceContext **context)
+{
+    FIXME("iface %p, flags %#x, context %p stub!\n", iface, flags, context);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_OpenSharedResource(ID3D11Device *iface, HANDLE resource, REFIID riid,
+        void **out)
+{
+    FIXME("iface %p, resource %p, riid %s, out %p stub!\n", iface, resource, debugstr_guid(riid), out);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device *iface, DXGI_FORMAT format,
+        UINT *format_support)
+{
+    FIXME("iface %p, format %u, format_support %p stub!\n", iface, format, format_support);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CheckMultisampleQualityLevels(ID3D11Device *iface,
+        DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
+{
+    FIXME("iface %p, format %u, sample_count %u, quality_level_count %p stub!\n",
+            iface, format, sample_count, quality_level_count);
+
+    return E_NOTIMPL;
+}
+
+static void STDMETHODCALLTYPE d3d11_device_CheckCounterInfo(ID3D11Device *iface, D3D11_COUNTER_INFO *info)
+{
+    FIXME("iface %p, info %p stub!\n", iface, info);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CheckCounter(ID3D11Device *iface, const D3D11_COUNTER_DESC *desc,
+        D3D11_COUNTER_TYPE *type, UINT *active_counter_count, char *name, UINT *name_length,
+        char *units, UINT *units_length, char *description, UINT *description_length)
+{
+    FIXME("iface %p, desc %p, type %p, active_counter_count %p, name %p, name_length %p, "
+            "units %p, units_length %p, description %p, description_length %p stub!\n",
+            iface, desc, type, active_counter_count, name, name_length,
+            units, units_length, description, description_length);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device *iface, D3D11_FEATURE feature,
+        void *feature_support_data, UINT feature_support_data_size)
+{
+    FIXME("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u stub!\n",
+            iface, feature, feature_support_data, feature_support_data_size);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_GetPrivateData(ID3D11Device *iface, REFGUID guid,
+        UINT *data_size, void *data)
+{
+    FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_SetPrivateData(ID3D11Device *iface, REFGUID guid,
+        UINT data_size, const void *data)
+{
+    FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_SetPrivateDataInterface(ID3D11Device *iface, REFGUID guid,
+        const IUnknown *data_iface)
+{
+    FIXME("iface %p, guid %s, data_iface %p stub!\n", iface, debugstr_guid(guid), data_iface);
+
+    return E_NOTIMPL;
+}
+
+static D3D_FEATURE_LEVEL STDMETHODCALLTYPE d3d11_device_GetFeatureLevel(ID3D11Device *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return D3D_FEATURE_LEVEL_10_0;
+}
+
+static UINT STDMETHODCALLTYPE d3d11_device_GetCreationFlags(ID3D11Device *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return 0;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_GetDeviceRemovedReason(ID3D11Device *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return S_OK;
+}
+
+static void STDMETHODCALLTYPE d3d11_device_GetImmediateContext(ID3D11Device *iface,
+        ID3D11DeviceContext **immediate_context)
+{
+    FIXME("iface %p, immediate_context %p stub!\n", iface, immediate_context);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d11_device_SetExceptionMode(ID3D11Device *iface, UINT flags)
+{
+    FIXME("iface %p, flags %#x stub!\n", iface, flags);
+
+    return E_NOTIMPL;
+}
+
+static UINT STDMETHODCALLTYPE d3d11_device_GetExceptionMode(ID3D11Device *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return 0;
+}
+
+static const struct ID3D11DeviceVtbl d3d11_device_vtbl =
+{
+    /* IUnknown methods */
+    d3d11_device_QueryInterface,
+    d3d11_device_AddRef,
+    d3d11_device_Release,
+    /* ID3D11Device methods */
+    d3d11_device_CreateBuffer,
+    d3d11_device_CreateTexture1D,
+    d3d11_device_CreateTexture2D,
+    d3d11_device_CreateTexture3D,
+    d3d11_device_CreateShaderResourceView,
+    d3d11_device_CreateUnorderedAccessView,
+    d3d11_device_CreateRenderTargetView,
+    d3d11_device_CreateDepthStencilView,
+    d3d11_device_CreateInputLayout,
+    d3d11_device_CreateVertexShader,
+    d3d11_device_CreateGeometryShader,
+    d3d11_device_CreateGeometryShaderWithStreamOutput,
+    d3d11_device_CreatePixelShader,
+    d3d11_device_CreateHullShader,
+    d3d11_device_CreateDomainShader,
+    d3d11_device_CreateComputeShader,
+    d3d11_device_CreateClassLinkage,
+    d3d11_device_CreateBlendState,
+    d3d11_device_CreateDepthStencilState,
+    d3d11_device_CreateRasterizerState,
+    d3d11_device_CreateSamplerState,
+    d3d11_device_CreateQuery,
+    d3d11_device_CreatePredicate,
+    d3d11_device_CreateCounter,
+    d3d11_device_CreateDeferredContext,
+    d3d11_device_OpenSharedResource,
+    d3d11_device_CheckFormatSupport,
+    d3d11_device_CheckMultisampleQualityLevels,
+    d3d11_device_CheckCounterInfo,
+    d3d11_device_CheckCounter,
+    d3d11_device_CheckFeatureSupport,
+    d3d11_device_GetPrivateData,
+    d3d11_device_SetPrivateData,
+    d3d11_device_SetPrivateDataInterface,
+    d3d11_device_GetFeatureLevel,
+    d3d11_device_GetCreationFlags,
+    d3d11_device_GetDeviceRemovedReason,
+    d3d11_device_GetImmediateContext,
+    d3d11_device_SetExceptionMode,
+    d3d11_device_GetExceptionMode,
+};
+
+/* ID3D10Multithread methods */
+
 static inline struct d3d_device *impl_from_ID3D10Multithread(ID3D10Multithread *iface)
 {
     return CONTAINING_RECORD(iface, struct d3d_device, ID3D10Multithread_iface);
@@ -2634,6 +3044,7 @@ static const struct wine_rb_functions d3d10_rasterizer_state_rb_ops =
 HRESULT d3d10_device_init(struct d3d_device *device, void *outer_unknown)
 {
     device->IUnknown_inner.lpVtbl = &d3d10_device_inner_unknown_vtbl;
+    device->ID3D11Device_iface.lpVtbl = &d3d11_device_vtbl;
     device->ID3D10Device1_iface.lpVtbl = &d3d10_device1_vtbl;
     device->ID3D10Multithread_iface.lpVtbl = &d3d10_multithread_vtbl;
     device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index d4ed7c9..1f5ce0c 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -92,7 +92,7 @@ static void test_device_interfaces(void)
 
     if (SUCCEEDED(hr = IDXGIDevice_QueryInterface(device, &IID_ID3D11Device, (void **)&iface)))
         IUnknown_Release(iface);
-    todo_wine ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
+    ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
             "Failed to query ID3D11Device interface, hr %#x.\n", hr);
 
     refcount = IDXGIDevice_Release(device);
-- 
2.4.6




More information about the wine-patches mailing list