From 6ac3c48384f3d17c8897d52fadfdd5017f232864 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 4 Dec 2012 22:10:11 +0100 Subject: [PATCH] d3d10core: Implement d3d10_device_PSGetConstantBuffers(). --- dlls/d3d10core/device.c | 21 ++++++++++++++++++++- dlls/wined3d/device.c | 13 +++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index cb0c1687932..03c1e676084 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -600,8 +600,27 @@ static void STDMETHODCALLTYPE d3d10_device_VSGetShader(ID3D10Device *iface, ID3D static void STDMETHODCALLTYPE d3d10_device_PSGetConstantBuffers(ID3D10Device *iface, UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers) { - FIXME("iface %p, start_slot %u, buffer_count %u, buffer %p stub!\n", + struct d3d10_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); + + 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]); + } } static void STDMETHODCALLTYPE d3d10_device_IAGetInputLayout(ID3D10Device *iface, ID3D10InputLayout **input_layout) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d55a155743f..fd1de1b8af3 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3005,6 +3005,19 @@ void CDECL wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, str } } +struct wined3d_buffer * CDECL wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.ps_cb[idx]; +} + HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, UINT start_register, const BOOL *constants, UINT bool_count) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index b1b451373fb..f94057db417 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -74,6 +74,7 @@ @ cdecl wined3d_device_get_npatch_mode(ptr) @ cdecl wined3d_device_get_pixel_shader(ptr) @ cdecl wined3d_device_get_primitive_type(ptr ptr) +@ cdecl wined3d_device_get_ps_cb(ptr long) @ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long) @ cdecl wined3d_device_get_ps_consts_f(ptr long ptr long) @ cdecl wined3d_device_get_ps_consts_i(ptr long ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index bdc1092789c..258c926814b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2138,6 +2138,7 @@ float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device); void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device, enum wined3d_primitive_type *primitive_topology); +struct wined3d_buffer * __cdecl wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_ps_consts_b(const struct wined3d_device *device, UINT start_register, BOOL *constants, UINT bool_count); HRESULT __cdecl wined3d_device_get_ps_consts_f(const struct wined3d_device *device,