On Wed, Oct 14, 2015 at 2:08 AM, Józef Kucia jkucia@codeweavers.com wrote:
Signed-off-by: Józef Kucia jkucia@codeweavers.com
dlls/d3d11/device.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 8a7a794..a06f3e6 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -39,6 +39,12 @@ static inline struct d3d11_immediate_context *impl_from_ID3D11DeviceContext(ID3D return CONTAINING_RECORD(iface, struct d3d11_immediate_context, ID3D11DeviceContext_iface); }
+static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D11DeviceContext *iface) +{
- struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface);
- return CONTAINING_RECORD(context, struct d3d_device, immediate_context);
+}
static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_QueryInterface(ID3D11DeviceContext *iface, REFIID riid, void **out) { @@ -249,7 +255,13 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_GSSetShader(ID3D11DeviceCo static void STDMETHODCALLTYPE d3d11_immediate_context_IASetPrimitiveTopology(ID3D11DeviceContext *iface, D3D11_PRIMITIVE_TOPOLOGY topology) {
- FIXME("iface %p, topology %u stub!\n", iface, topology);
- struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
We could alternatively keep a pointer to d3d_device in d3d_immediate_context instead of a pointer to ID3D11Device.
On 14 October 2015 at 02:25, Józef Kucia joseph.kucia@gmail.com wrote:
+static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D11DeviceContext *iface) +{
- struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface);
- return CONTAINING_RECORD(context, struct d3d_device, immediate_context);
+}
It probably doesn't matter much in practice, but note that you can just do return CONTAINING_RECORD(iface, struct d3d_device, immediate_context.ID3D11DeviceContext_iface);
We could alternatively keep a pointer to d3d_device in d3d_immediate_context instead of a pointer to ID3D11Device.
You don't really need either at this point. I.e., in e.g. d3d11_immediate_context_AddRef() you can just do device = device_from_immediate_ID3D11DeviceContext(); ID3D11Device_AddRef(&device->ID3D11Device_iface);
On Thu, Oct 15, 2015 at 10:43 AM, Henri Verbeet hverbeet@gmail.com wrote:
On 14 October 2015 at 02:25, Józef Kucia joseph.kucia@gmail.com wrote:
+static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D11DeviceContext *iface) +{
- struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface);
- return CONTAINING_RECORD(context, struct d3d_device, immediate_context);
+}
It probably doesn't matter much in practice, but note that you can just do return CONTAINING_RECORD(iface, struct d3d_device, immediate_context.ID3D11DeviceContext_iface);
We could alternatively keep a pointer to d3d_device in d3d_immediate_context instead of a pointer to ID3D11Device.
You don't really need either at this point. I.e., in e.g. d3d11_immediate_context_AddRef() you can just do device = device_from_immediate_ID3D11DeviceContext(); ID3D11Device_AddRef(&device->ID3D11Device_iface);
On Thu, Oct 15, 2015 at 11:25 AM, Józef Kucia joseph.kucia@gmail.com wrote:
On Thu, Oct 15, 2015 at 10:43 AM, Henri Verbeet hverbeet@gmail.com wrote:
On 14 October 2015 at 02:25, Józef Kucia joseph.kucia@gmail.com wrote:
+static inline struct d3d_device *device_from_immediate_ID3D11DeviceContext(ID3D11DeviceContext *iface) +{
- struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface);
- return CONTAINING_RECORD(context, struct d3d_device, immediate_context);
+}
It probably doesn't matter much in practice, but note that you can just do return CONTAINING_RECORD(iface, struct d3d_device, immediate_context.ID3D11DeviceContext_iface);
We could alternatively keep a pointer to d3d_device in d3d_immediate_context instead of a pointer to ID3D11Device.
You don't really need either at this point. I.e., in e.g. d3d11_immediate_context_AddRef() you can just do device = device_from_immediate_ID3D11DeviceContext(); ID3D11Device_AddRef(&device->ID3D11Device_iface);
My point was that if we don't want to introduce device_from_immediate_ID3D11DeviceContext(). We could use struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); and then wined3d_device_set_primitive_type(context->device->wined3d_device, (enum wined3d_primitive_type)topology);
On 15 October 2015 at 11:29, Józef Kucia joseph.kucia@gmail.com wrote:
My point was that if we don't want to introduce device_from_immediate_ID3D11DeviceContext(). We could use struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext(iface); and then wined3d_device_set_primitive_type(context->device->wined3d_device, (enum wined3d_primitive_type)topology);
Yeah, I got that, but it's not really any better.