2008-10-20 15:28:09 +02:00
|
|
|
/*
|
2012-11-22 13:45:12 +01:00
|
|
|
* Copyright 2008-2012 Henri Verbeet for CodeWeavers
|
2008-10-20 15:28:09 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
#include "d3d10core_private.h"
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2012-07-12 13:44:21 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_null_wined3d_object_destroyed(void *parent) {}
|
|
|
|
|
|
|
|
const struct wined3d_parent_ops d3d10_null_wined3d_parent_ops =
|
|
|
|
{
|
|
|
|
d3d10_null_wined3d_object_destroyed,
|
|
|
|
};
|
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
/* Inner IUnknown methods */
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2012-03-22 17:18:47 +01:00
|
|
|
static inline struct d3d10_device *impl_from_IUnknown(IUnknown *iface)
|
2008-11-12 15:43:46 +01:00
|
|
|
{
|
2012-03-22 17:18:47 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d10_device, IUnknown_inner);
|
2008-11-12 15:43:46 +01:00
|
|
|
}
|
|
|
|
|
2012-03-22 17:18:47 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *iface, REFIID riid,
|
|
|
|
void **ppv)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-03-22 17:18:47 +01:00
|
|
|
struct d3d10_device *This = impl_from_IUnknown(iface);
|
2008-11-12 15:43:46 +01:00
|
|
|
|
2012-03-22 17:18:47 +01:00
|
|
|
TRACE("iface %p, riid %s, ppv %p\n", iface, debugstr_guid(riid), ppv);
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2012-03-22 17:18:47 +01:00
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3D10Device))
|
|
|
|
*ppv = &This->ID3D10Device_iface;
|
|
|
|
else if (IsEqualGUID(riid, &IID_IWineDXGIDeviceParent))
|
|
|
|
*ppv = &This->IWineDXGIDeviceParent_iface;
|
|
|
|
else
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-03-22 17:18:47 +01:00
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2012-03-22 17:18:47 +01:00
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_device_inner_AddRef(IUnknown *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-03-22 17:18:47 +01:00
|
|
|
struct d3d10_device *This = impl_from_IUnknown(iface);
|
2008-10-20 15:28:09 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&This->refcount);
|
|
|
|
|
|
|
|
TRACE("%p increasing refcount to %u\n", This, refcount);
|
|
|
|
|
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-12-11 22:27:31 +01:00
|
|
|
struct d3d10_device *device = impl_from_IUnknown(iface);
|
|
|
|
ULONG refcount = InterlockedDecrement(&device->refcount);
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", device, refcount);
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-03-23 08:30:17 +01:00
|
|
|
if (!refcount)
|
|
|
|
{
|
2012-12-11 22:27:31 +01:00
|
|
|
if (device->wined3d_device)
|
|
|
|
wined3d_device_decref(device->wined3d_device);
|
|
|
|
wine_rb_destroy(&device->sampler_states, NULL, NULL);
|
2013-01-02 12:07:27 +01:00
|
|
|
wine_rb_destroy(&device->rasterizer_states, NULL, NULL);
|
2012-12-13 22:08:59 +01:00
|
|
|
wine_rb_destroy(&device->depthstencil_states, NULL, NULL);
|
2012-12-12 23:10:42 +01:00
|
|
|
wine_rb_destroy(&device->blend_states, NULL, NULL);
|
2009-03-23 08:30:17 +01:00
|
|
|
}
|
2009-02-23 09:16:01 +01:00
|
|
|
|
2008-10-20 15:28:09 +02:00
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2008-11-12 15:43:46 +01:00
|
|
|
/* IUnknown methods */
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static inline struct d3d10_device *impl_from_ID3D10Device(ID3D10Device *iface)
|
2008-11-12 15:43:46 +01:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d10_device, ID3D10Device_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_QueryInterface(ID3D10Device *iface, REFIID riid,
|
2012-03-22 17:18:47 +01:00
|
|
|
void **ppv)
|
2011-07-11 12:13:25 +02:00
|
|
|
{
|
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
2008-11-12 15:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_device_AddRef(ID3D10Device *iface)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_AddRef(This->outer_unk);
|
2008-11-12 15:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device *iface)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_Release(This->outer_unk);
|
2008-11-12 15:43:46 +01:00
|
|
|
}
|
|
|
|
|
2008-10-20 15:28:09 +02:00
|
|
|
/* ID3D10Device methods */
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
|
|
|
|
{
|
2012-11-29 22:44:45 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-11-29 22:44:45 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_vs_cb(device->wined3d_device, start_slot + i,
|
|
|
|
buffer ? buffer->wined3d_buffer : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
|
|
|
|
ID3D10PixelShader *shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2011-07-12 01:55:11 +02:00
|
|
|
struct d3d10_pixel_shader *ps = unsafe_impl_from_ID3D10PixelShader(shader);
|
2009-05-08 17:44:25 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, shader %p\n", iface, shader);
|
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
wined3d_device_set_pixel_shader(This->wined3d_device, ps ? ps->wined3d_shader : NULL);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
|
|
|
|
{
|
2012-12-09 21:22:06 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-09 21:22:06 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler = unsafe_impl_from_ID3D10SamplerState(samplers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_ps_sampler(device->wined3d_device, start_slot + i,
|
|
|
|
sampler ? sampler->wined3d_sampler : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
|
|
|
|
ID3D10VertexShader *shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2011-07-12 01:51:41 +02:00
|
|
|
struct d3d10_vertex_shader *vs = unsafe_impl_from_ID3D10VertexShader(shader);
|
2009-05-28 08:44:21 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, shader %p\n", iface, shader);
|
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
wined3d_device_set_vertex_shader(This->wined3d_device, vs ? vs->wined3d_shader : NULL);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_DrawIndexed(ID3D10Device *iface, UINT index_count,
|
|
|
|
UINT start_index_location, INT base_vertex_location)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-09-10 16:57:18 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, index_count, start_index_location, base_vertex_location);
|
2009-09-10 16:57:18 +02:00
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
wined3d_device_set_base_vertex_index(This->wined3d_device, base_vertex_location);
|
2011-05-16 23:01:22 +02:00
|
|
|
wined3d_device_draw_indexed_primitive(This->wined3d_device, start_index_location, index_count);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device *iface, UINT vertex_count,
|
|
|
|
UINT start_vertex_location)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-05 12:30:44 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, vertex_count %u, start_vertex_location %u\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, vertex_count, start_vertex_location);
|
2009-03-05 12:30:44 +01:00
|
|
|
|
2011-05-16 23:01:22 +02:00
|
|
|
wined3d_device_draw_primitive(This->wined3d_device, start_vertex_location, vertex_count);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
|
|
|
|
{
|
2012-12-04 22:10:10 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-12-04 22:10:10 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_ps_cb(device->wined3d_device, start_slot + i,
|
|
|
|
buffer ? buffer->wined3d_buffer : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device *iface,
|
|
|
|
ID3D10InputLayout *input_layout)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2011-07-12 12:50:41 +02:00
|
|
|
struct d3d10_input_layout *layout = unsafe_impl_from_ID3D10InputLayout(input_layout);
|
2009-03-31 09:38:14 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, input_layout %p\n", iface, input_layout);
|
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
wined3d_device_set_vertex_declaration(This->wined3d_device,
|
2011-07-12 12:50:41 +02:00
|
|
|
layout ? layout->wined3d_decl : NULL);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IASetVertexBuffers(ID3D10Device *iface, UINT start_slot,
|
|
|
|
UINT buffer_count, ID3D10Buffer *const *buffers, const UINT *strides, const UINT *offsets)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-31 09:38:14 +02:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers, strides, offsets);
|
2009-03-31 09:38:14 +02:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
2012-04-15 18:57:11 +02:00
|
|
|
struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
|
|
|
|
|
2012-11-14 23:06:00 +01:00
|
|
|
wined3d_device_set_stream_source(This->wined3d_device, start_slot + i,
|
2012-04-15 18:57:11 +02:00
|
|
|
buffer ? buffer->wined3d_buffer : NULL, offsets[i], strides[i]);
|
2009-03-31 09:38:14 +02:00
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IASetIndexBuffer(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Buffer *buffer, DXGI_FORMAT format, UINT offset)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2012-04-15 18:57:11 +02:00
|
|
|
struct d3d10_buffer *buffer_impl = unsafe_impl_from_ID3D10Buffer(buffer);
|
2009-09-10 16:57:17 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, buffer %p, format %s, offset %u.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, buffer, debug_dxgi_format(format), offset);
|
2009-09-10 16:57:17 +02:00
|
|
|
|
2011-05-16 23:01:21 +02:00
|
|
|
wined3d_device_set_index_buffer(This->wined3d_device,
|
2012-04-15 18:57:11 +02:00
|
|
|
buffer_impl ? buffer_impl->wined3d_buffer : NULL,
|
2009-09-10 16:57:17 +02:00
|
|
|
wined3dformat_from_dxgi_format(format));
|
|
|
|
if (offset) FIXME("offset %u not supported.\n", offset);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_DrawIndexedInstanced(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT instance_index_count, UINT instance_count, UINT start_index_location,
|
|
|
|
INT base_vertex_location, UINT start_instance_location)
|
|
|
|
{
|
2012-11-26 22:52:41 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, instance_index_count %u, instance_count %u, start_index_location %u,\n"
|
|
|
|
"\tbase_vertex_location %d, start_instance_location %u.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, instance_index_count, instance_count, start_index_location,
|
|
|
|
base_vertex_location, start_instance_location);
|
2012-11-26 22:52:41 +01:00
|
|
|
|
|
|
|
wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_location);
|
|
|
|
wined3d_device_draw_indexed_primitive_instanced(device->wined3d_device, start_index_location,
|
|
|
|
instance_index_count, start_instance_location, instance_count);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT instance_vertex_count, UINT instance_count,
|
|
|
|
UINT start_vertex_location, UINT start_instance_location)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, instance_vertex_count %u, instance_count %u, start_vertex_location %u,\n"
|
|
|
|
"\tstart_instance_location %u stub!\n", iface, instance_vertex_count, instance_count,
|
|
|
|
start_vertex_location, start_instance_location);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
|
|
|
|
{
|
2012-12-03 21:16:33 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-12-03 21:16:33 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_gs_cb(device->wined3d_device, start_slot + i,
|
|
|
|
buffer ? buffer->wined3d_buffer : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device *iface, ID3D10GeometryShader *shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-13 21:24:22 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct d3d10_geometry_shader *gs = unsafe_impl_from_ID3D10GeometryShader(shader);
|
|
|
|
|
|
|
|
TRACE("iface %p, shader %p.\n", iface, shader);
|
|
|
|
|
|
|
|
wined3d_device_set_geometry_shader(device->wined3d_device, gs ? gs->wined3d_shader : NULL);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IASetPrimitiveTopology(ID3D10Device *iface,
|
|
|
|
D3D10_PRIMITIVE_TOPOLOGY topology)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-05 12:30:43 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, topology %s\n", iface, debug_d3d10_primitive_topology(topology));
|
|
|
|
|
2011-12-11 21:43:32 +01:00
|
|
|
wined3d_device_set_primitive_type(This->wined3d_device, (enum wined3d_primitive_type)topology);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSSetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSSetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
|
|
|
|
{
|
2012-12-05 21:01:47 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-05 21:01:47 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler = unsafe_impl_from_ID3D10SamplerState(samplers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_vs_sampler(device->wined3d_device, start_slot + i,
|
|
|
|
sampler ? sampler->wined3d_sampler : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_SetPredication(ID3D10Device *iface, ID3D10Predicate *predicate, BOOL value)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, predicate %p, value %d stub!\n", iface, predicate, value);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *samplers)
|
|
|
|
{
|
2012-12-07 00:07:07 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-07 00:07:07 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler = unsafe_impl_from_ID3D10SamplerState(samplers[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_gs_sampler(device->wined3d_device, start_slot + i,
|
|
|
|
sampler ? sampler->wined3d_sampler : NULL);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views,
|
|
|
|
ID3D10DepthStencilView *depth_stencil_view)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n",
|
|
|
|
iface, render_target_view_count, render_target_views, depth_stencil_view);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
|
|
|
|
{
|
2012-10-04 13:53:25 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);
|
2012-10-04 13:53:25 +02:00
|
|
|
|
|
|
|
device->blend_state = unsafe_impl_from_ID3D10BlendState(blend_state);
|
|
|
|
memcpy(device->blend_factor, blend_factor, 4 * sizeof(*blend_factor));
|
|
|
|
device->sample_mask = sample_mask;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10DepthStencilState *depth_stencil_state, UINT stencil_ref)
|
|
|
|
{
|
2012-10-02 22:15:36 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, depth_stencil_state %p, stencil_ref %u.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, depth_stencil_state, stencil_ref);
|
2012-10-02 22:15:36 +02:00
|
|
|
|
|
|
|
device->depth_stencil_state = unsafe_impl_from_ID3D10DepthStencilState(depth_stencil_state);
|
|
|
|
device->stencil_ref = stencil_ref;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
|
|
|
|
{
|
2012-11-22 21:13:37 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int count, i;
|
|
|
|
|
|
|
|
TRACE("iface %p, target_count %u, targets %p, offsets %p.\n", iface, target_count, targets, offsets);
|
|
|
|
|
|
|
|
count = min(target_count, 4);
|
|
|
|
for (i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(targets[i]);
|
|
|
|
|
|
|
|
wined3d_device_set_stream_output(device->wined3d_device, i,
|
|
|
|
buffer ? buffer->wined3d_buffer : NULL, offsets[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = count; i < 4; ++i)
|
|
|
|
{
|
|
|
|
wined3d_device_set_stream_output(device->wined3d_device, i, NULL, 0);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSSetState(ID3D10Device *iface, ID3D10RasterizerState *rasterizer_state)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-10-01 22:48:09 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
|
|
|
|
|
|
|
|
device->rasterizer_state = unsafe_impl_from_ID3D10RasterizerState(rasterizer_state);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT viewport_count, const D3D10_VIEWPORT *viewports)
|
|
|
|
{
|
2012-09-17 21:48:49 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct wined3d_viewport wined3d_vp;
|
|
|
|
|
|
|
|
TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports);
|
|
|
|
|
|
|
|
if (viewport_count > 1)
|
|
|
|
FIXME("Multiple viewports not implemented.\n");
|
|
|
|
|
|
|
|
if (!viewport_count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wined3d_vp.x = viewports[0].TopLeftX;
|
|
|
|
wined3d_vp.y = viewports[0].TopLeftY;
|
|
|
|
wined3d_vp.width = viewports[0].Width;
|
|
|
|
wined3d_vp.height = viewports[0].Height;
|
|
|
|
wined3d_vp.min_z = viewports[0].MinDepth;
|
|
|
|
wined3d_vp.max_z = viewports[0].MaxDepth;
|
|
|
|
|
|
|
|
wined3d_device_set_viewport(device->wined3d_device, &wined3d_vp);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSSetScissorRects(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT rect_count, const D3D10_RECT *rects)
|
|
|
|
{
|
2012-11-22 13:45:12 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, rect_count %u, rects %p.\n", iface, rect_count, rects);
|
|
|
|
|
|
|
|
if (rect_count > 1)
|
|
|
|
FIXME("Multiple scissor rects not implemented.\n");
|
|
|
|
|
|
|
|
if (!rect_count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wined3d_device_set_scissor_rect(device->wined3d_device, rects);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z,
|
|
|
|
ID3D10Resource *src_resource, UINT src_subresource_idx, const D3D10_BOX *src_box)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u,\n"
|
|
|
|
"\tsrc_resource %p, src_subresource_idx %u, src_box %p stub!\n",
|
|
|
|
iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
|
|
|
|
src_resource, src_subresource_idx, src_box);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_CopyResource(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *dst_resource, ID3D10Resource *src_resource)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, dst_resource %p, src_resource %p stub!\n", iface, dst_resource, src_resource);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_UpdateSubresource(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *resource, UINT subresource_idx, const D3D10_BOX *box,
|
|
|
|
const void *data, UINT row_pitch, UINT depth_pitch)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, resource %p, subresource_idx %u, box %p, data %p, row_pitch %u, depth_pitch %u stub!\n",
|
|
|
|
iface, resource, subresource_idx, box, data, row_pitch, depth_pitch);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4])
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2011-07-12 12:34:22 +02:00
|
|
|
struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view);
|
2011-11-15 21:18:27 +01:00
|
|
|
const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]};
|
2009-02-25 08:39:01 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
|
2009-02-25 08:39:01 +01:00
|
|
|
|
2011-07-12 12:34:22 +02:00
|
|
|
wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10DepthStencilView *depth_stencil_view, UINT flags, FLOAT depth, UINT8 stencil)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, depth_stencil_view %p, flags %#x, depth %f, stencil %u stub!\n",
|
|
|
|
iface, depth_stencil_view, flags, depth, stencil);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GenerateMips(ID3D10Device *iface, ID3D10ShaderResourceView *shader_resource_view)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, shader_resource_view %p stub!\n", iface, shader_resource_view);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *dst_resource, UINT dst_subresource_idx,
|
|
|
|
ID3D10Resource *src_resource, UINT src_subresource_idx, DXGI_FORMAT format)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, dst_resource %p, dst_subresource_idx %u,\n"
|
|
|
|
"\tsrc_resource %p, src_subresource_idx %u, format %s stub!\n",
|
|
|
|
iface, dst_resource, dst_subresource_idx,
|
|
|
|
src_resource, src_subresource_idx, debug_dxgi_format(format));
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
|
|
|
|
{
|
2012-11-29 22:44:46 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-11-29 22:44:46 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
if (!(wined3d_buffer = wined3d_device_get_vs_cb(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
buffers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
buffers[i] = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(buffers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSGetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSGetShader(ID3D10Device *iface, ID3D10PixelShader **shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-12 21:51:01 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct d3d10_pixel_shader *shader_impl;
|
|
|
|
struct wined3d_shader *wined3d_shader;
|
|
|
|
|
|
|
|
TRACE("iface %p, shader %p.\n", iface, shader);
|
|
|
|
|
|
|
|
if (!(wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device)))
|
|
|
|
{
|
|
|
|
*shader = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_impl = wined3d_shader_get_parent(wined3d_shader);
|
|
|
|
*shader = &shader_impl->ID3D10PixelShader_iface;
|
|
|
|
ID3D10PixelShader_AddRef(*shader);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSGetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
|
|
|
|
{
|
2012-12-09 21:22:07 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-09 21:22:07 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler_impl;
|
|
|
|
struct wined3d_sampler *wined3d_sampler;
|
|
|
|
|
|
|
|
if (!(wined3d_sampler = wined3d_device_get_ps_sampler(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
samplers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampler_impl = wined3d_sampler_get_parent(wined3d_sampler);
|
|
|
|
samplers[i] = &sampler_impl->ID3D10SamplerState_iface;
|
|
|
|
ID3D10SamplerState_AddRef(samplers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D10VertexShader **shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-12 21:51:00 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct d3d10_vertex_shader *shader_impl;
|
|
|
|
struct wined3d_shader *wined3d_shader;
|
|
|
|
|
|
|
|
TRACE("iface %p, shader %p.\n", iface, shader);
|
|
|
|
|
|
|
|
if (!(wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device)))
|
|
|
|
{
|
|
|
|
*shader = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_impl = wined3d_shader_get_parent(wined3d_shader);
|
|
|
|
*shader = &shader_impl->ID3D10VertexShader_iface;
|
|
|
|
ID3D10VertexShader_AddRef(*shader);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
|
|
|
|
{
|
2012-12-04 22:10:11 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-12-04 22:10:11 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
if (!(wined3d_buffer = wined3d_device_get_ps_cb(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
buffers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
buffers[i] = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(buffers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-24 17:17:08 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct wined3d_vertex_declaration *wined3d_declaration;
|
|
|
|
struct d3d10_input_layout *input_layout_impl;
|
|
|
|
|
|
|
|
TRACE("iface %p, input_layout %p.\n", iface, input_layout);
|
|
|
|
|
|
|
|
if (!(wined3d_declaration = wined3d_device_get_vertex_declaration(device->wined3d_device)))
|
|
|
|
{
|
|
|
|
*input_layout = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
input_layout_impl = wined3d_vertex_declaration_get_parent(wined3d_declaration);
|
|
|
|
*input_layout = &input_layout_impl->ID3D10InputLayout_iface;
|
|
|
|
ID3D10InputLayout_AddRef(*input_layout);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IAGetVertexBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers, UINT *strides, UINT *offsets)
|
|
|
|
{
|
2012-11-20 22:40:22 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p, strides %p, offsets %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers, strides, offsets);
|
2012-11-20 22:40:22 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
if (FAILED(wined3d_device_get_stream_source(device->wined3d_device, start_slot + i,
|
|
|
|
&wined3d_buffer, &offsets[i], &strides[i])))
|
|
|
|
ERR("Failed to get vertex buffer.\n");
|
|
|
|
|
|
|
|
if (!wined3d_buffer)
|
|
|
|
{
|
|
|
|
buffers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
buffers[i] = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(buffers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Buffer **buffer, DXGI_FORMAT *format, UINT *offset)
|
|
|
|
{
|
2012-11-20 22:40:21 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
enum wined3d_format_id wined3d_format;
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
TRACE("iface %p, buffer %p, format %p, offset %p.\n", iface, buffer, format, offset);
|
|
|
|
|
|
|
|
wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format);
|
|
|
|
*format = dxgi_format_from_wined3dformat(wined3d_format);
|
|
|
|
*offset = 0; /* FIXME */
|
|
|
|
if (!wined3d_buffer)
|
|
|
|
{
|
|
|
|
*buffer = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
*buffer = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(*buffer);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
|
|
|
|
{
|
2012-12-03 21:16:34 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, buffer_count, buffers);
|
2012-12-03 21:16:34 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
if (!(wined3d_buffer = wined3d_device_get_gs_cb(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
buffers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
buffers[i] = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(buffers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-13 21:24:23 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct d3d10_geometry_shader *shader_impl;
|
|
|
|
struct wined3d_shader *wined3d_shader;
|
|
|
|
|
|
|
|
TRACE("iface %p, shader %p.\n", iface, shader);
|
|
|
|
|
|
|
|
if (!(wined3d_shader = wined3d_device_get_geometry_shader(device->wined3d_device)))
|
|
|
|
{
|
|
|
|
*shader = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
shader_impl = wined3d_shader_get_parent(wined3d_shader);
|
|
|
|
*shader = &shader_impl->ID3D10GeometryShader_iface;
|
|
|
|
ID3D10GeometryShader_AddRef(*shader);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_IAGetPrimitiveTopology(ID3D10Device *iface,
|
|
|
|
D3D10_PRIMITIVE_TOPOLOGY *topology)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-05 12:30:43 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, topology %p\n", iface, topology);
|
|
|
|
|
2011-12-11 21:43:32 +01:00
|
|
|
wined3d_device_get_primitive_type(This->wined3d_device, (enum wined3d_primitive_type *)topology);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
|
|
|
|
{
|
2012-12-05 21:01:48 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-05 21:01:48 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler_impl;
|
|
|
|
struct wined3d_sampler *wined3d_sampler;
|
|
|
|
|
|
|
|
if (!(wined3d_sampler = wined3d_device_get_vs_sampler(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
samplers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampler_impl = wined3d_sampler_get_parent(wined3d_sampler);
|
|
|
|
samplers[i] = &sampler_impl->ID3D10SamplerState_iface;
|
|
|
|
ID3D10SamplerState_AddRef(samplers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Predicate **predicate, BOOL *value)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT view_count, ID3D10ShaderResourceView **views)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n",
|
|
|
|
iface, start_slot, view_count, views);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
|
|
|
|
{
|
2012-12-07 00:07:08 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, start_slot, sampler_count, samplers);
|
2012-12-07 00:07:08 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sampler_count; ++i)
|
|
|
|
{
|
|
|
|
struct d3d10_sampler_state *sampler_impl;
|
|
|
|
struct wined3d_sampler *wined3d_sampler;
|
|
|
|
|
|
|
|
if (!(wined3d_sampler = wined3d_device_get_gs_sampler(device->wined3d_device, start_slot + i)))
|
|
|
|
{
|
|
|
|
samplers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
sampler_impl = wined3d_sampler_get_parent(wined3d_sampler);
|
|
|
|
samplers[i] = &sampler_impl->ID3D10SamplerState_iface;
|
|
|
|
ID3D10SamplerState_AddRef(samplers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n",
|
|
|
|
iface, view_count, render_target_views, depth_stencil_view);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask)
|
|
|
|
{
|
2012-10-04 13:53:26 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, blend_state, blend_factor, sample_mask);
|
2012-10-04 13:53:26 +02:00
|
|
|
|
|
|
|
if ((*blend_state = device->blend_state ? &device->blend_state->ID3D10BlendState_iface : NULL))
|
|
|
|
ID3D10BlendState_AddRef(*blend_state);
|
|
|
|
memcpy(blend_factor, device->blend_factor, 4 * sizeof(*blend_factor));
|
|
|
|
*sample_mask = device->sample_mask;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
|
|
|
|
{
|
2012-10-02 22:15:37 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, depth_stencil_state, stencil_ref);
|
2012-10-02 22:15:37 +02:00
|
|
|
|
|
|
|
if ((*depth_stencil_state = device->depth_stencil_state
|
|
|
|
? &device->depth_stencil_state->ID3D10DepthStencilState_iface : NULL))
|
|
|
|
ID3D10DepthStencilState_AddRef(*depth_stencil_state);
|
|
|
|
*stencil_ref = device->stencil_ref;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT buffer_count, ID3D10Buffer **buffers, UINT *offsets)
|
|
|
|
{
|
2012-11-22 21:13:38 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
TRACE("iface %p, buffer_count %u, buffers %p, offsets %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, buffer_count, buffers, offsets);
|
2012-11-22 21:13:38 +01:00
|
|
|
|
|
|
|
for (i = 0; i < buffer_count; ++i)
|
|
|
|
{
|
|
|
|
struct wined3d_buffer *wined3d_buffer;
|
|
|
|
struct d3d10_buffer *buffer_impl;
|
|
|
|
|
|
|
|
if (!(wined3d_buffer = wined3d_device_get_stream_output(device->wined3d_device, i, &offsets[i])))
|
|
|
|
{
|
|
|
|
buffers[i] = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
|
|
|
|
buffers[i] = &buffer_impl->ID3D10Buffer_iface;
|
|
|
|
ID3D10Buffer_AddRef(buffers[i]);
|
|
|
|
}
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSGetState(ID3D10Device *iface, ID3D10RasterizerState **rasterizer_state)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-10-01 22:48:10 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, rasterizer_state %p.\n", iface, rasterizer_state);
|
|
|
|
|
|
|
|
if ((*rasterizer_state = device->rasterizer_state ? &device->rasterizer_state->ID3D10RasterizerState_iface : NULL))
|
|
|
|
ID3D10RasterizerState_AddRef(*rasterizer_state);
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSGetViewports(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
UINT *viewport_count, D3D10_VIEWPORT *viewports)
|
|
|
|
{
|
2012-09-17 21:48:50 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
struct wined3d_viewport wined3d_vp;
|
|
|
|
|
|
|
|
TRACE("iface %p, viewport_count %p, viewports %p.\n", iface, viewport_count, viewports);
|
|
|
|
|
|
|
|
if (!viewports)
|
|
|
|
{
|
|
|
|
*viewport_count = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!*viewport_count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wined3d_device_get_viewport(device->wined3d_device, &wined3d_vp);
|
|
|
|
|
|
|
|
viewports[0].TopLeftX = wined3d_vp.x;
|
|
|
|
viewports[0].TopLeftY = wined3d_vp.y;
|
|
|
|
viewports[0].Width = wined3d_vp.width;
|
|
|
|
viewports[0].Height = wined3d_vp.height;
|
|
|
|
viewports[0].MinDepth = wined3d_vp.min_z;
|
|
|
|
viewports[0].MaxDepth = wined3d_vp.max_z;
|
|
|
|
|
|
|
|
if (*viewport_count > 1)
|
|
|
|
memset(&viewports[1], 0, (*viewport_count - 1) * sizeof(*viewports));
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_RSGetScissorRects(ID3D10Device *iface, UINT *rect_count, D3D10_RECT *rects)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2012-11-22 13:45:13 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, rect_count %p, rects %p.\n", iface, rect_count, rects);
|
|
|
|
|
|
|
|
if (!rects)
|
|
|
|
{
|
|
|
|
*rect_count = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!*rect_count)
|
|
|
|
return;
|
|
|
|
|
|
|
|
wined3d_device_get_scissor_rect(device->wined3d_device, rects);
|
|
|
|
if (*rect_count > 1)
|
|
|
|
memset(&rects[1], 0, (*rect_count - 1) * sizeof(*rects));
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_GetDeviceRemovedReason(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_SetExceptionMode(ID3D10Device *iface, UINT flags)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, flags %#x stub!\n", iface, flags);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static UINT STDMETHODCALLTYPE d3d10_device_GetExceptionMode(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_GetPrivateData(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateData(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
REFGUID guid, const IUnknown *data)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBuffer(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Buffer **buffer)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-01-23 10:22:34 +01:00
|
|
|
struct d3d10_buffer *object;
|
2009-02-23 09:16:02 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-01-23 10:22:34 +01:00
|
|
|
FIXME("iface %p, desc %p, data %p, buffer %p partial stub!\n", iface, desc, data, buffer);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 buffer object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-09-17 23:03:27 +02:00
|
|
|
hr = d3d10_buffer_init(object, This, desc, data);
|
2009-02-23 09:16:02 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2009-09-17 23:03:27 +02:00
|
|
|
WARN("Failed to initialize buffer, hr %#x.\n", hr);
|
2009-02-23 09:16:02 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2012-04-15 18:57:11 +02:00
|
|
|
*buffer = &object->ID3D10Buffer_iface;
|
2009-01-23 10:22:34 +01:00
|
|
|
|
|
|
|
TRACE("Created ID3D10Buffer %p\n", object);
|
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_TEXTURE1D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture1D **texture)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, desc %p, data %p, texture %p stub!\n", iface, desc, data, texture);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
|
2011-07-11 12:13:25 +02:00
|
|
|
const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
|
|
|
|
ID3D10Texture2D **texture)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-01-15 09:58:44 +01:00
|
|
|
struct d3d10_texture2d *object;
|
2009-01-19 10:39:05 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-01-15 09:58:44 +01:00
|
|
|
FIXME("iface %p, desc %p, data %p, texture %p partial stub!\n", iface, desc, data, texture);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 texture2d object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-09-11 19:01:15 +02:00
|
|
|
hr = d3d10_texture2d_init(object, This, desc);
|
|
|
|
if (FAILED(hr))
|
2009-01-19 10:39:05 +01:00
|
|
|
{
|
2009-09-11 19:01:15 +02:00
|
|
|
WARN("Failed to initialize texture, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
2009-01-19 10:39:05 +01:00
|
|
|
}
|
|
|
|
|
2011-06-01 10:12:44 +02:00
|
|
|
*texture = &object->ID3D10Texture2D_iface;
|
2009-01-15 09:58:44 +01:00
|
|
|
|
|
|
|
TRACE("Created ID3D10Texture2D %p\n", object);
|
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture3D(ID3D10Device *iface,
|
2011-07-11 12:13:25 +02:00
|
|
|
const D3D10_TEXTURE3D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data,
|
|
|
|
ID3D10Texture3D **texture)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
2010-10-14 13:04:01 +02:00
|
|
|
struct d3d10_texture3d *object;
|
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2010-10-14 13:04:01 +02:00
|
|
|
TRACE("iface %p, desc %p, data %p, texture %p.\n", iface, desc, data, texture);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 texture3d object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = d3d10_texture3d_init(object, device, desc);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize texture, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created 3D texture %p.\n", object);
|
2011-06-01 10:16:55 +02:00
|
|
|
*texture = &object->ID3D10Texture3D_iface;
|
2010-10-14 13:04:01 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *resource, const D3D10_SHADER_RESOURCE_VIEW_DESC *desc, ID3D10ShaderResourceView **view)
|
|
|
|
{
|
2009-10-30 20:11:33 +01:00
|
|
|
struct d3d10_shader_resource_view *object;
|
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-10-30 20:11:33 +01:00
|
|
|
TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 shader resource view object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-09-14 13:11:31 +02:00
|
|
|
if (FAILED(hr = d3d10_shader_resource_view_init(object, resource, desc)))
|
2009-10-30 20:11:33 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created shader resource view %p.\n", object);
|
2011-06-01 10:46:00 +02:00
|
|
|
*view = &object->ID3D10ShaderResourceView_iface;
|
2009-10-30 20:11:33 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRenderTargetView(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc, ID3D10RenderTargetView **view)
|
|
|
|
{
|
2009-01-23 10:22:34 +01:00
|
|
|
struct d3d10_rendertarget_view *object;
|
2009-10-29 18:56:23 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-01-23 10:22:34 +01:00
|
|
|
TRACE("iface %p, resource %p, desc %p, view %p stub!\n", iface, resource, desc, view);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 rendertarget view object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2011-05-10 21:18:47 +02:00
|
|
|
hr = d3d10_rendertarget_view_init(object, resource, desc);
|
2009-10-29 18:56:23 +01:00
|
|
|
if (FAILED(hr))
|
2009-02-24 07:43:02 +01:00
|
|
|
{
|
2009-10-29 18:56:23 +01:00
|
|
|
WARN("Failed to initialize rendertarget view, hr %#x.\n", hr);
|
2009-02-24 07:43:02 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
2009-10-29 18:56:23 +01:00
|
|
|
return hr;
|
2009-02-24 07:43:02 +01:00
|
|
|
}
|
2009-01-23 10:22:34 +01:00
|
|
|
|
2009-10-29 18:56:23 +01:00
|
|
|
TRACE("Created rendertarget view %p.\n", object);
|
2011-07-12 12:37:59 +02:00
|
|
|
*view = &object->ID3D10RenderTargetView_iface;
|
2009-01-23 10:22:34 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc, ID3D10DepthStencilView **view)
|
|
|
|
{
|
2009-10-30 20:11:32 +01:00
|
|
|
struct d3d10_depthstencil_view *object;
|
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-10-30 20:11:32 +01:00
|
|
|
TRACE("iface %p, resource %p, desc %p, view %p.\n", iface, resource, desc, view);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 depthstencil view object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-09-13 09:18:14 +02:00
|
|
|
if (FAILED(hr = d3d10_depthstencil_view_init(object, resource, desc)))
|
2009-10-30 20:11:32 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize depthstencil view, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created depthstencil view %p.\n", object);
|
2011-06-01 10:37:49 +02:00
|
|
|
*view = &object->ID3D10DepthStencilView_iface;
|
2009-10-30 20:11:32 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateInputLayout(ID3D10Device *iface,
|
2011-07-11 12:13:25 +02:00
|
|
|
const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
|
|
|
|
const void *shader_byte_code, SIZE_T shader_byte_code_length,
|
|
|
|
ID3D10InputLayout **input_layout)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
struct d3d10_input_layout *object;
|
2009-03-30 11:24:55 +02:00
|
|
|
HRESULT hr;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-03-30 11:24:55 +02:00
|
|
|
TRACE("iface %p, element_descs %p, element_count %u, shader_byte_code %p,"
|
|
|
|
"\tshader_byte_code_length %lu, input_layout %p\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, element_descs, element_count, shader_byte_code,
|
|
|
|
shader_byte_code_length, input_layout);
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 input layout object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-09-23 10:05:48 +02:00
|
|
|
hr = d3d10_input_layout_init(object, This, element_descs, element_count,
|
|
|
|
shader_byte_code, shader_byte_code_length);
|
2009-03-30 11:24:55 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2009-09-23 10:05:48 +02:00
|
|
|
WARN("Failed to initialize input layout, hr %#x.\n", hr);
|
2009-03-30 11:24:55 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2009-09-23 10:05:48 +02:00
|
|
|
TRACE("Created input layout %p.\n", object);
|
2011-07-12 12:51:54 +02:00
|
|
|
*input_layout = &object->ID3D10InputLayout_iface;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const void *byte_code, SIZE_T byte_code_length, ID3D10VertexShader **shader)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
struct d3d10_vertex_shader *object;
|
2009-05-26 09:15:12 +02:00
|
|
|
HRESULT hr;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-05-26 09:15:12 +02:00
|
|
|
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, byte_code, byte_code_length, shader);
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 vertex shader object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-09-23 18:42:05 +02:00
|
|
|
hr = d3d10_vertex_shader_init(object, This, byte_code, byte_code_length);
|
2009-05-26 09:15:12 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2009-09-23 18:42:05 +02:00
|
|
|
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
|
2009-05-26 09:15:12 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2009-09-23 18:42:05 +02:00
|
|
|
TRACE("Created vertex shader %p.\n", object);
|
2011-07-12 01:54:04 +02:00
|
|
|
*shader = &object->ID3D10VertexShader_iface;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShader(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const void *byte_code, SIZE_T byte_code_length, ID3D10GeometryShader **shader)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
struct d3d10_geometry_shader *object;
|
2009-10-29 18:56:22 +01:00
|
|
|
HRESULT hr;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2012-12-10 21:54:35 +01:00
|
|
|
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p.\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, byte_code, byte_code_length, shader);
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 geometry shader object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2010-01-03 21:18:24 +01:00
|
|
|
hr = d3d10_geometry_shader_init(object, This, byte_code, byte_code_length);
|
2009-10-29 18:56:22 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
2012-09-19 21:50:19 +02:00
|
|
|
return hr;
|
2009-10-29 18:56:22 +01:00
|
|
|
}
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-10-29 18:56:22 +01:00
|
|
|
TRACE("Created geometry shader %p.\n", object);
|
2011-06-01 10:59:33 +02:00
|
|
|
*shader = &object->ID3D10GeometryShader_iface;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateGeometryShaderWithStreamOutput(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
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,\n"
|
|
|
|
"\toutput_stream_decl_count %u, output_stream_stride %u, shader %p stub!\n",
|
|
|
|
iface, byte_code, byte_code_length, output_stream_decls,
|
|
|
|
output_stream_decl_count, output_stream_stride, shader);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePixelShader(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const void *byte_code, SIZE_T byte_code_length, ID3D10PixelShader **shader)
|
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
struct d3d10_device *This = impl_from_ID3D10Device(iface);
|
2009-03-04 07:07:38 +01:00
|
|
|
struct d3d10_pixel_shader *object;
|
2009-04-27 09:37:14 +02:00
|
|
|
HRESULT hr;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
2009-04-27 09:37:14 +02:00
|
|
|
TRACE("iface %p, byte_code %p, byte_code_length %lu, shader %p\n",
|
2008-10-20 15:28:09 +02:00
|
|
|
iface, byte_code, byte_code_length, shader);
|
|
|
|
|
2009-03-04 07:07:38 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 pixel shader object memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2009-09-23 18:42:10 +02:00
|
|
|
hr = d3d10_pixel_shader_init(object, This, byte_code, byte_code_length);
|
2009-04-27 09:37:14 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2009-09-23 18:42:10 +02:00
|
|
|
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
|
2009-04-27 09:37:14 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2009-09-23 18:42:10 +02:00
|
|
|
TRACE("Created pixel shader %p.\n", object);
|
2011-07-12 01:56:39 +02:00
|
|
|
*shader = &object->ID3D10PixelShader_iface;
|
2009-03-04 07:07:38 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateBlendState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_BLEND_DESC *desc, ID3D10BlendState **blend_state)
|
|
|
|
{
|
2012-12-12 23:10:42 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
2009-11-04 10:37:13 +01:00
|
|
|
struct d3d10_blend_state *object;
|
2012-12-12 23:10:42 +01:00
|
|
|
struct wine_rb_entry *entry;
|
2009-11-04 10:37:13 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-11-04 10:37:13 +01:00
|
|
|
TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
|
|
|
|
|
2012-12-12 23:10:41 +01:00
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2012-12-12 23:10:42 +01:00
|
|
|
if ((entry = wine_rb_get(&device->blend_states, desc)))
|
|
|
|
{
|
|
|
|
object = WINE_RB_ENTRY_VALUE(entry, struct d3d10_blend_state, entry);
|
|
|
|
|
|
|
|
TRACE("Returning existing blend state %p.\n", object);
|
|
|
|
*blend_state = &object->ID3D10BlendState_iface;
|
|
|
|
ID3D10BlendState_AddRef(*blend_state);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-11-04 10:37:13 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 blend state object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-12-12 23:10:42 +01:00
|
|
|
if (FAILED(hr = d3d10_blend_state_init(object, device, desc)))
|
2009-11-04 10:37:13 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize blend state, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created blend state %p.\n", object);
|
2011-06-01 11:02:35 +02:00
|
|
|
*blend_state = &object->ID3D10BlendState_iface;
|
2009-11-04 10:37:13 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_DEPTH_STENCIL_DESC *desc, ID3D10DepthStencilState **depth_stencil_state)
|
|
|
|
{
|
2012-12-13 22:08:59 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
2009-10-30 20:11:34 +01:00
|
|
|
struct d3d10_depthstencil_state *object;
|
2012-12-13 22:08:59 +01:00
|
|
|
struct wine_rb_entry *entry;
|
2009-10-30 20:11:34 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-10-30 20:11:34 +01:00
|
|
|
TRACE("iface %p, desc %p, depth_stencil_state %p.\n", iface, desc, depth_stencil_state);
|
|
|
|
|
2012-12-13 22:08:58 +01:00
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2012-12-13 22:08:59 +01:00
|
|
|
if ((entry = wine_rb_get(&device->depthstencil_states, desc)))
|
|
|
|
{
|
|
|
|
object = WINE_RB_ENTRY_VALUE(entry, struct d3d10_depthstencil_state, entry);
|
|
|
|
|
|
|
|
TRACE("Returning existing depthstencil state %p.\n", object);
|
|
|
|
*depth_stencil_state = &object->ID3D10DepthStencilState_iface;
|
|
|
|
ID3D10DepthStencilState_AddRef(*depth_stencil_state);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-30 20:11:34 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 depthstencil state object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-12-13 22:08:59 +01:00
|
|
|
if (FAILED(hr = d3d10_depthstencil_state_init(object, device, desc)))
|
2009-10-30 20:11:34 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize depthstencil state, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created depthstencil state %p.\n", object);
|
2011-06-02 11:21:30 +02:00
|
|
|
*depth_stencil_state = &object->ID3D10DepthStencilState_iface;
|
2009-10-30 20:11:34 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_RASTERIZER_DESC *desc, ID3D10RasterizerState **rasterizer_state)
|
|
|
|
{
|
2013-01-02 12:07:27 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
2009-10-30 20:11:35 +01:00
|
|
|
struct d3d10_rasterizer_state *object;
|
2013-01-02 12:07:27 +01:00
|
|
|
struct wine_rb_entry *entry;
|
2009-10-30 20:11:35 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-10-30 20:11:35 +01:00
|
|
|
TRACE("iface %p, desc %p, rasterizer_state %p.\n", iface, desc, rasterizer_state);
|
|
|
|
|
2013-01-02 12:07:26 +01:00
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2013-01-02 12:07:27 +01:00
|
|
|
if ((entry = wine_rb_get(&device->rasterizer_states, desc)))
|
|
|
|
{
|
|
|
|
object = WINE_RB_ENTRY_VALUE(entry, struct d3d10_rasterizer_state, entry);
|
|
|
|
|
|
|
|
TRACE("Returning existing rasterizer state %p.\n", object);
|
|
|
|
*rasterizer_state = &object->ID3D10RasterizerState_iface;
|
|
|
|
ID3D10RasterizerState_AddRef(*rasterizer_state);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-30 20:11:35 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 rasterizer state object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2013-01-02 12:07:27 +01:00
|
|
|
if (FAILED(hr = d3d10_rasterizer_state_init(object, device, desc)))
|
2009-10-30 20:11:35 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize rasterizer state, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created rasterizer state %p.\n", object);
|
2011-06-02 11:22:49 +02:00
|
|
|
*rasterizer_state = &object->ID3D10RasterizerState_iface;
|
2009-10-30 20:11:35 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateSamplerState(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_SAMPLER_DESC *desc, ID3D10SamplerState **sampler_state)
|
|
|
|
{
|
2012-12-11 22:27:31 +01:00
|
|
|
struct d3d10_device *device = impl_from_ID3D10Device(iface);
|
2009-10-30 20:11:36 +01:00
|
|
|
struct d3d10_sampler_state *object;
|
2012-12-11 22:27:31 +01:00
|
|
|
struct wine_rb_entry *entry;
|
2009-10-30 20:11:36 +01:00
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2012-09-18 22:13:55 +02:00
|
|
|
TRACE("iface %p, desc %p, sampler_state %p.\n", iface, desc, sampler_state);
|
2009-10-30 20:11:36 +01:00
|
|
|
|
2012-12-11 22:27:30 +01:00
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
if ((entry = wine_rb_get(&device->sampler_states, desc)))
|
|
|
|
{
|
|
|
|
object = WINE_RB_ENTRY_VALUE(entry, struct d3d10_sampler_state, entry);
|
|
|
|
|
|
|
|
TRACE("Returning existing sampler state %p.\n", object);
|
|
|
|
*sampler_state = &object->ID3D10SamplerState_iface;
|
|
|
|
ID3D10SamplerState_AddRef(*sampler_state);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-30 20:11:36 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 sampler state object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
if (FAILED(hr = d3d10_sampler_state_init(object, device, desc)))
|
2009-10-30 20:11:36 +01:00
|
|
|
{
|
|
|
|
WARN("Failed to initialize sampler state, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created sampler state %p.\n", object);
|
2011-06-02 11:23:54 +02:00
|
|
|
*sampler_state = &object->ID3D10SamplerState_iface;
|
2009-10-30 20:11:36 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_QUERY_DESC *desc, ID3D10Query **query)
|
|
|
|
{
|
2009-12-13 22:03:57 +01:00
|
|
|
struct d3d10_query *object;
|
|
|
|
HRESULT hr;
|
2008-10-20 15:28:09 +02:00
|
|
|
|
2009-12-13 22:03:57 +01:00
|
|
|
TRACE("iface %p, desc %p, query %p.\n", iface, desc, query);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate D3D10 query object memory.\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = d3d10_query_init(object);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize query, hr %#x.\n", hr);
|
|
|
|
HeapFree(GetProcessHeap(), 0, object);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Created query %p.\n", object);
|
2011-06-02 11:24:44 +02:00
|
|
|
*query = &object->ID3D10Query_iface;
|
2009-12-13 22:03:57 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-20 15:28:09 +02:00
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_COUNTER_DESC *desc, ID3D10Counter **counter)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, desc %p, counter %p stub!\n", iface, desc, counter);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CheckFormatSupport(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
DXGI_FORMAT format, UINT *format_support)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, format %s, format_support %p stub!\n",
|
|
|
|
iface, debug_dxgi_format(format), format_support);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CheckMultisampleQualityLevels(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
DXGI_FORMAT format, UINT sample_count, UINT *quality_level_count)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, format %s, sample_count %u, quality_level_count %p stub!\n",
|
|
|
|
iface, debug_dxgi_format(format), sample_count, quality_level_count);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_CheckCounterInfo(ID3D10Device *iface, D3D10_COUNTER_INFO *counter_info)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, counter_info %p stub!\n", iface, counter_info);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CheckCounter(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
const D3D10_COUNTER_DESC *desc, D3D10_COUNTER_TYPE *type, UINT *active_counters, LPSTR name,
|
|
|
|
UINT *name_length, LPSTR units, UINT *units_length, LPSTR description, UINT *description_length)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, desc %p, type %p, active_counters %p, name %p, name_length %p,\n"
|
|
|
|
"\tunits %p, units_length %p, description %p, description_length %p stub!\n",
|
|
|
|
iface, desc, type, active_counters, name, name_length,
|
|
|
|
units, units_length, description, description_length);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static UINT STDMETHODCALLTYPE d3d10_device_GetCreationFlags(ID3D10Device *iface)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p stub!\n", iface);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE d3d10_device_OpenSharedResource(ID3D10Device *iface,
|
2008-10-20 15:28:09 +02:00
|
|
|
HANDLE resource_handle, REFIID guid, void **resource)
|
|
|
|
{
|
|
|
|
FIXME("iface %p, resource_handle %p, guid %s, resource %p stub!\n",
|
|
|
|
iface, resource_handle, debugstr_guid(guid), resource);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_SetTextFilterSize(ID3D10Device *iface, UINT width, UINT height)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
|
|
|
|
}
|
|
|
|
|
2008-10-28 09:27:20 +01:00
|
|
|
static void STDMETHODCALLTYPE d3d10_device_GetTextFilterSize(ID3D10Device *iface, UINT *width, UINT *height)
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
FIXME("iface %p, width %p, height %p stub!\n", iface, width, height);
|
|
|
|
}
|
|
|
|
|
2009-11-19 11:41:24 +01:00
|
|
|
static const struct ID3D10DeviceVtbl d3d10_device_vtbl =
|
2008-10-20 15:28:09 +02:00
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
d3d10_device_QueryInterface,
|
|
|
|
d3d10_device_AddRef,
|
|
|
|
d3d10_device_Release,
|
|
|
|
/* ID3D10Device methods */
|
|
|
|
d3d10_device_VSSetConstantBuffers,
|
|
|
|
d3d10_device_PSSetShaderResources,
|
|
|
|
d3d10_device_PSSetShader,
|
|
|
|
d3d10_device_PSSetSamplers,
|
|
|
|
d3d10_device_VSSetShader,
|
|
|
|
d3d10_device_DrawIndexed,
|
|
|
|
d3d10_device_Draw,
|
|
|
|
d3d10_device_PSSetConstantBuffers,
|
|
|
|
d3d10_device_IASetInputLayout,
|
|
|
|
d3d10_device_IASetVertexBuffers,
|
|
|
|
d3d10_device_IASetIndexBuffer,
|
|
|
|
d3d10_device_DrawIndexedInstanced,
|
|
|
|
d3d10_device_DrawInstanced,
|
|
|
|
d3d10_device_GSSetConstantBuffers,
|
|
|
|
d3d10_device_GSSetShader,
|
|
|
|
d3d10_device_IASetPrimitiveTopology,
|
|
|
|
d3d10_device_VSSetShaderResources,
|
|
|
|
d3d10_device_VSSetSamplers,
|
|
|
|
d3d10_device_SetPredication,
|
|
|
|
d3d10_device_GSSetShaderResources,
|
|
|
|
d3d10_device_GSSetSamplers,
|
|
|
|
d3d10_device_OMSetRenderTargets,
|
|
|
|
d3d10_device_OMSetBlendState,
|
|
|
|
d3d10_device_OMSetDepthStencilState,
|
|
|
|
d3d10_device_SOSetTargets,
|
|
|
|
d3d10_device_DrawAuto,
|
|
|
|
d3d10_device_RSSetState,
|
|
|
|
d3d10_device_RSSetViewports,
|
|
|
|
d3d10_device_RSSetScissorRects,
|
|
|
|
d3d10_device_CopySubresourceRegion,
|
|
|
|
d3d10_device_CopyResource,
|
|
|
|
d3d10_device_UpdateSubresource,
|
|
|
|
d3d10_device_ClearRenderTargetView,
|
|
|
|
d3d10_device_ClearDepthStencilView,
|
|
|
|
d3d10_device_GenerateMips,
|
|
|
|
d3d10_device_ResolveSubresource,
|
|
|
|
d3d10_device_VSGetConstantBuffers,
|
|
|
|
d3d10_device_PSGetShaderResources,
|
|
|
|
d3d10_device_PSGetShader,
|
|
|
|
d3d10_device_PSGetSamplers,
|
|
|
|
d3d10_device_VSGetShader,
|
|
|
|
d3d10_device_PSGetConstantBuffers,
|
|
|
|
d3d10_device_IAGetInputLayout,
|
|
|
|
d3d10_device_IAGetVertexBuffers,
|
|
|
|
d3d10_device_IAGetIndexBuffer,
|
|
|
|
d3d10_device_GSGetConstantBuffers,
|
|
|
|
d3d10_device_GSGetShader,
|
|
|
|
d3d10_device_IAGetPrimitiveTopology,
|
|
|
|
d3d10_device_VSGetShaderResources,
|
|
|
|
d3d10_device_VSGetSamplers,
|
|
|
|
d3d10_device_GetPredication,
|
|
|
|
d3d10_device_GSGetShaderResources,
|
|
|
|
d3d10_device_GSGetSamplers,
|
|
|
|
d3d10_device_OMGetRenderTargets,
|
|
|
|
d3d10_device_OMGetBlendState,
|
|
|
|
d3d10_device_OMGetDepthStencilState,
|
|
|
|
d3d10_device_SOGetTargets,
|
|
|
|
d3d10_device_RSGetState,
|
|
|
|
d3d10_device_RSGetViewports,
|
|
|
|
d3d10_device_RSGetScissorRects,
|
|
|
|
d3d10_device_GetDeviceRemovedReason,
|
|
|
|
d3d10_device_SetExceptionMode,
|
|
|
|
d3d10_device_GetExceptionMode,
|
|
|
|
d3d10_device_GetPrivateData,
|
|
|
|
d3d10_device_SetPrivateData,
|
|
|
|
d3d10_device_SetPrivateDataInterface,
|
|
|
|
d3d10_device_ClearState,
|
|
|
|
d3d10_device_Flush,
|
|
|
|
d3d10_device_CreateBuffer,
|
|
|
|
d3d10_device_CreateTexture1D,
|
|
|
|
d3d10_device_CreateTexture2D,
|
|
|
|
d3d10_device_CreateTexture3D,
|
|
|
|
d3d10_device_CreateShaderResourceView,
|
|
|
|
d3d10_device_CreateRenderTargetView,
|
|
|
|
d3d10_device_CreateDepthStencilView,
|
|
|
|
d3d10_device_CreateInputLayout,
|
|
|
|
d3d10_device_CreateVertexShader,
|
|
|
|
d3d10_device_CreateGeometryShader,
|
|
|
|
d3d10_device_CreateGeometryShaderWithStreamOutput,
|
|
|
|
d3d10_device_CreatePixelShader,
|
|
|
|
d3d10_device_CreateBlendState,
|
|
|
|
d3d10_device_CreateDepthStencilState,
|
|
|
|
d3d10_device_CreateRasterizerState,
|
|
|
|
d3d10_device_CreateSamplerState,
|
|
|
|
d3d10_device_CreateQuery,
|
|
|
|
d3d10_device_CreatePredicate,
|
|
|
|
d3d10_device_CreateCounter,
|
|
|
|
d3d10_device_CheckFormatSupport,
|
|
|
|
d3d10_device_CheckMultisampleQualityLevels,
|
|
|
|
d3d10_device_CheckCounterInfo,
|
|
|
|
d3d10_device_CheckCounter,
|
|
|
|
d3d10_device_GetCreationFlags,
|
|
|
|
d3d10_device_OpenSharedResource,
|
|
|
|
d3d10_device_SetTextFilterSize,
|
|
|
|
d3d10_device_GetTextFilterSize,
|
|
|
|
};
|
2008-11-12 15:43:46 +01:00
|
|
|
|
2009-11-19 11:41:24 +01:00
|
|
|
static const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
|
2008-11-12 15:43:46 +01:00
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
d3d10_device_inner_QueryInterface,
|
|
|
|
d3d10_device_inner_AddRef,
|
|
|
|
d3d10_device_inner_Release,
|
|
|
|
};
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2010-10-14 13:03:59 +02:00
|
|
|
static void STDMETHODCALLTYPE d3d10_subresource_destroyed(void *parent) {}
|
|
|
|
|
2011-05-13 16:38:06 +02:00
|
|
|
static const struct wined3d_parent_ops d3d10_subresource_parent_ops =
|
2010-10-14 13:03:59 +02:00
|
|
|
{
|
|
|
|
d3d10_subresource_destroyed,
|
|
|
|
};
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
/* IWineDXGIDeviceParent IUnknown methods */
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static inline struct d3d10_device *device_from_dxgi_device_parent(IWineDXGIDeviceParent *iface)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3d10_device, IWineDXGIDeviceParent_iface);
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_device_parent_QueryInterface(IWineDXGIDeviceParent *iface,
|
2012-03-22 17:18:47 +01:00
|
|
|
REFIID riid, void **ppv)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_QueryInterface(device->outer_unk, riid, ppv);
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static ULONG STDMETHODCALLTYPE dxgi_device_parent_AddRef(IWineDXGIDeviceParent *iface)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_AddRef(device->outer_unk);
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static ULONG STDMETHODCALLTYPE dxgi_device_parent_Release(IWineDXGIDeviceParent *iface)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
2012-03-22 17:18:47 +01:00
|
|
|
return IUnknown_Release(device->outer_unk);
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static struct wined3d_device_parent * STDMETHODCALLTYPE dxgi_device_parent_get_wined3d_device_parent(
|
|
|
|
IWineDXGIDeviceParent *iface)
|
|
|
|
{
|
|
|
|
struct d3d10_device *device = device_from_dxgi_device_parent(iface);
|
|
|
|
return &device->device_parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IWineDXGIDeviceParentVtbl d3d10_dxgi_device_parent_vtbl =
|
|
|
|
{
|
|
|
|
/* IUnknown methods */
|
|
|
|
dxgi_device_parent_QueryInterface,
|
|
|
|
dxgi_device_parent_AddRef,
|
|
|
|
dxgi_device_parent_Release,
|
|
|
|
/* IWineDXGIDeviceParent methods */
|
|
|
|
dxgi_device_parent_get_wined3d_device_parent,
|
|
|
|
};
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static inline struct d3d10_device *device_from_wined3d_device_parent(struct wined3d_device_parent *device_parent)
|
2009-02-23 09:16:01 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
return CONTAINING_RECORD(device_parent, struct d3d10_device, device_parent);
|
|
|
|
}
|
2009-02-23 09:16:01 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent,
|
|
|
|
struct wined3d_device *wined3d_device)
|
|
|
|
{
|
|
|
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
2009-02-23 09:16:01 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
TRACE("device_parent %p, wined3d_device %p.\n", device_parent, wined3d_device);
|
|
|
|
|
|
|
|
wined3d_device_incref(wined3d_device);
|
|
|
|
device->wined3d_device = wined3d_device;
|
2009-02-23 09:16:01 +01:00
|
|
|
}
|
|
|
|
|
2011-11-30 06:01:44 +01:00
|
|
|
static void CDECL device_parent_mode_changed(struct wined3d_device_parent *device_parent)
|
|
|
|
{
|
|
|
|
TRACE("device_parent %p.\n", device_parent);
|
|
|
|
}
|
|
|
|
|
2012-07-11 12:19:03 +02:00
|
|
|
static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
|
2011-03-07 21:45:25 +01:00
|
|
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
|
2012-10-24 21:23:36 +02:00
|
|
|
enum wined3d_pool pool, UINT sub_resource_idx, struct wined3d_surface **surface)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
2009-01-19 10:39:05 +01:00
|
|
|
|
2012-07-12 13:44:21 +02:00
|
|
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n"
|
2012-10-24 21:23:36 +02:00
|
|
|
"\tpool %#x, sub_resource_idx %u, surface %p.\n",
|
|
|
|
device_parent, container_parent, width, height, format, usage, pool, sub_resource_idx, surface);
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2012-10-23 21:01:05 +02:00
|
|
|
return wined3d_surface_create(device->wined3d_device, width, height, format, usage, pool,
|
2013-01-17 10:24:27 +01:00
|
|
|
WINED3D_MULTISAMPLE_NONE, 0, 0, container_parent, &d3d10_null_wined3d_parent_ops, surface);
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2012-07-11 12:19:03 +02:00
|
|
|
static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
|
|
|
|
void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
|
|
|
|
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
2012-07-12 13:44:21 +02:00
|
|
|
struct wined3d_resource *sub_resource;
|
2009-01-19 10:39:06 +01:00
|
|
|
struct d3d10_texture2d *texture;
|
|
|
|
D3D10_TEXTURE2D_DESC desc;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2012-07-11 12:19:03 +02:00
|
|
|
FIXME("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
|
|
|
|
"\tmultisample_type %#x, multisample_quality %u, surface %p partial stub!\n",
|
|
|
|
device_parent, container_parent, width, height, format_id, usage,
|
|
|
|
multisample_type, multisample_quality, surface);
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2009-02-19 16:59:42 +01:00
|
|
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
2009-01-19 10:39:06 +01:00
|
|
|
|
|
|
|
desc.Width = width;
|
|
|
|
desc.Height = height;
|
|
|
|
desc.MipLevels = 1;
|
|
|
|
desc.ArraySize = 1;
|
2012-07-11 12:19:03 +02:00
|
|
|
desc.Format = dxgi_format_from_wined3dformat(format_id);
|
2009-02-25 08:39:01 +01:00
|
|
|
desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
|
2009-01-19 10:39:06 +01:00
|
|
|
desc.SampleDesc.Quality = multisample_quality;
|
|
|
|
desc.Usage = D3D10_USAGE_DEFAULT;
|
|
|
|
desc.BindFlags = D3D10_BIND_RENDER_TARGET;
|
|
|
|
desc.CPUAccessFlags = 0;
|
|
|
|
desc.MiscFlags = 0;
|
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
|
|
|
|
(ID3D10Texture2D **)&texture);
|
2009-01-19 10:39:06 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("CreateTexture2D failed, returning %#x\n", hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2012-07-12 13:44:21 +02:00
|
|
|
sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, 0);
|
|
|
|
*surface = wined3d_surface_from_resource(sub_resource);
|
2011-04-29 13:03:41 +02:00
|
|
|
wined3d_surface_incref(*surface);
|
2011-06-01 10:12:44 +02:00
|
|
|
ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
|
2009-01-19 10:39:06 +01:00
|
|
|
|
|
|
|
return S_OK;
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
|
2011-03-07 21:45:25 +01:00
|
|
|
void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
|
2012-01-17 21:13:37 +01:00
|
|
|
enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2010-10-14 13:03:59 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, "
|
|
|
|
"format %#x, pool %#x, usage %#x, volume %p.\n",
|
|
|
|
device_parent, container_parent, width, height, depth,
|
|
|
|
format, pool, usage, volume);
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
hr = wined3d_volume_create(device_from_wined3d_device_parent(device_parent)->wined3d_device,
|
2010-10-14 13:03:59 +02:00
|
|
|
width, height, depth, usage, format, pool, NULL, &d3d10_subresource_parent_ops, volume);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2009-01-16 10:14:24 +01:00
|
|
|
}
|
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent,
|
2011-12-02 08:15:52 +01:00
|
|
|
struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain)
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
|
2009-02-24 07:43:02 +01:00
|
|
|
IWineDXGIDevice *wine_device;
|
|
|
|
HRESULT hr;
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-12-02 08:15:52 +01:00
|
|
|
TRACE("device_parent %p, desc %p, swapchain %p\n", device_parent, desc, swapchain);
|
2009-02-24 07:43:02 +01:00
|
|
|
|
2011-07-11 12:13:25 +02:00
|
|
|
hr = d3d10_device_QueryInterface(&device->ID3D10Device_iface, &IID_IWineDXGIDevice,
|
|
|
|
(void **)&wine_device);
|
2009-02-24 07:43:02 +01:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("Device should implement IWineDXGIDevice\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-12-02 08:15:52 +01:00
|
|
|
hr = IWineDXGIDevice_create_swapchain(wine_device, desc, swapchain);
|
2009-02-24 07:43:02 +01:00
|
|
|
IWineDXGIDevice_Release(wine_device);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("Failed to create DXGI swapchain, returning %#x\n", hr);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2009-01-16 10:14:24 +01:00
|
|
|
|
2011-05-18 22:30:13 +02:00
|
|
|
static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
|
2009-01-16 10:14:24 +01:00
|
|
|
{
|
2011-05-18 22:30:13 +02:00
|
|
|
device_parent_wined3d_device_created,
|
2011-11-30 06:01:44 +01:00
|
|
|
device_parent_mode_changed,
|
2012-07-11 12:19:03 +02:00
|
|
|
device_parent_create_swapchain_surface,
|
|
|
|
device_parent_create_texture_surface,
|
2011-05-18 22:30:13 +02:00
|
|
|
device_parent_create_volume,
|
|
|
|
device_parent_create_swapchain,
|
2009-01-16 10:14:24 +01:00
|
|
|
};
|
2009-11-19 11:41:24 +01:00
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
static void *d3d10_rb_alloc(size_t size)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *d3d10_rb_realloc(void *ptr, size_t size)
|
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void d3d10_rb_free(void *ptr)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int d3d10_sampler_state_compare(const void *key, const struct wine_rb_entry *entry)
|
|
|
|
{
|
|
|
|
const D3D10_SAMPLER_DESC *ka = key;
|
|
|
|
const D3D10_SAMPLER_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d10_sampler_state, entry)->desc;
|
|
|
|
|
|
|
|
return memcmp(ka, kb, sizeof(*ka));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wine_rb_functions d3d10_sampler_state_rb_ops =
|
|
|
|
{
|
|
|
|
d3d10_rb_alloc,
|
|
|
|
d3d10_rb_realloc,
|
|
|
|
d3d10_rb_free,
|
|
|
|
d3d10_sampler_state_compare,
|
|
|
|
};
|
|
|
|
|
2012-12-12 23:10:42 +01:00
|
|
|
static int d3d10_blend_state_compare(const void *key, const struct wine_rb_entry *entry)
|
|
|
|
{
|
|
|
|
const D3D10_BLEND_DESC *ka = key;
|
|
|
|
const D3D10_BLEND_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d10_blend_state, entry)->desc;
|
|
|
|
|
|
|
|
return memcmp(ka, kb, sizeof(*ka));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wine_rb_functions d3d10_blend_state_rb_ops =
|
|
|
|
{
|
|
|
|
d3d10_rb_alloc,
|
|
|
|
d3d10_rb_realloc,
|
|
|
|
d3d10_rb_free,
|
|
|
|
d3d10_blend_state_compare,
|
|
|
|
};
|
|
|
|
|
2012-12-13 22:08:59 +01:00
|
|
|
static int d3d10_depthstencil_state_compare(const void *key, const struct wine_rb_entry *entry)
|
|
|
|
{
|
|
|
|
const D3D10_DEPTH_STENCIL_DESC *ka = key;
|
|
|
|
const D3D10_DEPTH_STENCIL_DESC *kb = &WINE_RB_ENTRY_VALUE(entry,
|
|
|
|
const struct d3d10_depthstencil_state, entry)->desc;
|
|
|
|
|
|
|
|
return memcmp(ka, kb, sizeof(*ka));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wine_rb_functions d3d10_depthstencil_state_rb_ops =
|
|
|
|
{
|
|
|
|
d3d10_rb_alloc,
|
|
|
|
d3d10_rb_realloc,
|
|
|
|
d3d10_rb_free,
|
|
|
|
d3d10_depthstencil_state_compare,
|
|
|
|
};
|
|
|
|
|
2013-01-02 12:07:27 +01:00
|
|
|
static int d3d10_rasterizer_state_compare(const void *key, const struct wine_rb_entry *entry)
|
|
|
|
{
|
|
|
|
const D3D10_RASTERIZER_DESC *ka = key;
|
|
|
|
const D3D10_RASTERIZER_DESC *kb = &WINE_RB_ENTRY_VALUE(entry, const struct d3d10_rasterizer_state, entry)->desc;
|
|
|
|
|
|
|
|
return memcmp(ka, kb, sizeof(*ka));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct wine_rb_functions d3d10_rasterizer_state_rb_ops =
|
|
|
|
{
|
|
|
|
d3d10_rb_alloc,
|
|
|
|
d3d10_rb_realloc,
|
|
|
|
d3d10_rb_free,
|
|
|
|
d3d10_rasterizer_state_compare,
|
|
|
|
};
|
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
HRESULT d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
|
2009-11-19 11:41:24 +01:00
|
|
|
{
|
2011-07-11 12:13:25 +02:00
|
|
|
device->ID3D10Device_iface.lpVtbl = &d3d10_device_vtbl;
|
2012-03-22 17:18:47 +01:00
|
|
|
device->IUnknown_inner.lpVtbl = &d3d10_device_inner_unknown_vtbl;
|
2011-05-18 22:30:13 +02:00
|
|
|
device->IWineDXGIDeviceParent_iface.lpVtbl = &d3d10_dxgi_device_parent_vtbl;
|
|
|
|
device->device_parent.ops = &d3d10_wined3d_device_parent_ops;
|
2009-11-19 11:41:24 +01:00
|
|
|
device->refcount = 1;
|
2012-03-22 17:18:47 +01:00
|
|
|
/* COM aggregation always takes place */
|
|
|
|
device->outer_unk = outer_unknown;
|
2012-12-11 22:27:31 +01:00
|
|
|
|
2012-12-12 23:10:42 +01:00
|
|
|
if (wine_rb_init(&device->blend_states, &d3d10_blend_state_rb_ops) == -1)
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize blend state rbtree.\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-12-13 22:08:59 +01:00
|
|
|
if (wine_rb_init(&device->depthstencil_states, &d3d10_depthstencil_state_rb_ops) == -1)
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize depthstencil state rbtree.\n");
|
|
|
|
wine_rb_destroy(&device->blend_states, NULL, NULL);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2013-01-02 12:07:27 +01:00
|
|
|
if (wine_rb_init(&device->rasterizer_states, &d3d10_rasterizer_state_rb_ops) == -1)
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize rasterizer state rbtree.\n");
|
|
|
|
wine_rb_destroy(&device->depthstencil_states, NULL, NULL);
|
|
|
|
wine_rb_destroy(&device->blend_states, NULL, NULL);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:27:31 +01:00
|
|
|
if (wine_rb_init(&device->sampler_states, &d3d10_sampler_state_rb_ops) == -1)
|
|
|
|
{
|
|
|
|
WARN("Failed to initialize sampler state rbtree.\n");
|
2013-01-02 12:07:27 +01:00
|
|
|
wine_rb_destroy(&device->rasterizer_states, NULL, NULL);
|
2012-12-13 22:08:59 +01:00
|
|
|
wine_rb_destroy(&device->depthstencil_states, NULL, NULL);
|
2012-12-12 23:10:42 +01:00
|
|
|
wine_rb_destroy(&device->blend_states, NULL, NULL);
|
2012-12-11 22:27:31 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2009-11-19 11:41:24 +01:00
|
|
|
}
|