Commit 095964c4 authored by Pablo Martin's avatar Pablo Martin Committed by Alexandre Julliard

d3d11: Make d3d10 *SetConstantBuffers use a helper method.

parent 7d9e02fc
......@@ -3890,26 +3890,33 @@ static ULONG STDMETHODCALLTYPE d3d10_device_Release(ID3D10Device1 *iface)
/* ID3D10Device methods */
static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device1 *iface,
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
static void d3d10_device_set_constant_buffers(ID3D10Device1 *iface,
enum wined3d_shader_type type, UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
{
struct d3d_device *device = impl_from_ID3D10Device(iface);
unsigned int i;
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
iface, start_slot, buffer_count, buffers);
wined3d_mutex_lock();
for (i = 0; i < buffer_count; ++i)
{
struct d3d_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
wined3d_device_set_vs_cb(device->wined3d_device, start_slot + i,
wined3d_device_set_constant_buffer(device->wined3d_device, type, start_slot + i,
buffer ? buffer->wined3d_buffer : NULL);
}
wined3d_mutex_unlock();
}
static void STDMETHODCALLTYPE d3d10_device_VSSetConstantBuffers(ID3D10Device1 *iface,
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
{
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
iface, start_slot, buffer_count, buffers);
d3d10_device_set_constant_buffers(iface, WINED3D_SHADER_TYPE_VERTEX, start_slot,
buffer_count, buffers);
}
static void STDMETHODCALLTYPE d3d10_device_PSSetShaderResources(ID3D10Device1 *iface,
UINT start_slot, UINT view_count, ID3D10ShaderResourceView *const *views)
{
......@@ -4006,21 +4013,11 @@ static void STDMETHODCALLTYPE d3d10_device_Draw(ID3D10Device1 *iface, UINT verte
static void STDMETHODCALLTYPE d3d10_device_PSSetConstantBuffers(ID3D10Device1 *iface,
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
{
struct d3d_device *device = impl_from_ID3D10Device(iface);
unsigned int i;
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
iface, start_slot, buffer_count, buffers);
wined3d_mutex_lock();
for (i = 0; i < buffer_count; ++i)
{
struct d3d_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
wined3d_device_set_ps_cb(device->wined3d_device, start_slot + i,
buffer ? buffer->wined3d_buffer : NULL);
}
wined3d_mutex_unlock();
d3d10_device_set_constant_buffers(iface, WINED3D_SHADER_TYPE_PIXEL, start_slot,
buffer_count, buffers);
}
static void STDMETHODCALLTYPE d3d10_device_IASetInputLayout(ID3D10Device1 *iface,
......@@ -4110,21 +4107,11 @@ static void STDMETHODCALLTYPE d3d10_device_DrawInstanced(ID3D10Device1 *iface,
static void STDMETHODCALLTYPE d3d10_device_GSSetConstantBuffers(ID3D10Device1 *iface,
UINT start_slot, UINT buffer_count, ID3D10Buffer *const *buffers)
{
struct d3d_device *device = impl_from_ID3D10Device(iface);
unsigned int i;
TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
iface, start_slot, buffer_count, buffers);
wined3d_mutex_lock();
for (i = 0; i < buffer_count; ++i)
{
struct d3d_buffer *buffer = unsafe_impl_from_ID3D10Buffer(buffers[i]);
wined3d_device_set_gs_cb(device->wined3d_device, start_slot + i,
buffer ? buffer->wined3d_buffer : NULL);
}
wined3d_mutex_unlock();
d3d10_device_set_constant_buffers(iface, WINED3D_SHADER_TYPE_GEOMETRY, start_slot,
buffer_count, buffers);
}
static void STDMETHODCALLTYPE d3d10_device_GSSetShader(ID3D10Device1 *iface, ID3D10GeometryShader *shader)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment