diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 1a75ee57fb1..ad07aee5945 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -772,8 +772,27 @@ static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *if static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface, UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers) { - FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n", + struct d3d10_device *device = impl_from_ID3D10Device(iface); + unsigned int i; + + TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n", iface, start_slot, sampler_count, samplers); + + 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]); + } } static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d0c36383877..24c6b4e2eed 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2605,6 +2605,19 @@ void CDECL wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx wined3d_sampler_decref(prev); } +struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.vs_sampler[idx]; +} + HRESULT CDECL wined3d_device_set_vs_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 29d6740d405..0b87f10b071 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -100,6 +100,7 @@ @ cdecl wined3d_device_get_vs_consts_b(ptr long ptr long) @ cdecl wined3d_device_get_vs_consts_f(ptr long ptr long) @ cdecl wined3d_device_get_vs_consts_i(ptr long ptr long) +@ cdecl wined3d_device_get_vs_sampler(ptr long) @ cdecl wined3d_device_incref(ptr) @ cdecl wined3d_device_init_3d(ptr ptr) @ cdecl wined3d_device_init_gdi(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 90fb8de9241..cc60893f73e 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2180,6 +2180,7 @@ HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *devi UINT start_register, float *constants, UINT vector4f_count); HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *device, UINT start_register, int *constants, UINT vector4i_count); +struct wined3d_sampler * __cdecl wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx); ULONG __cdecl wined3d_device_incref(struct wined3d_device *device); HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc); HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);