Module: wine Branch: master Commit: 047d607e07df54be04a8c11511a14ccc7632130b URL: http://source.winehq.org/git/wine.git/?a=commit;h=047d607e07df54be04a8c11511...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Dec 7 00:07:07 2012 +0100
d3d10core: Implement d3d10_device_GSSetSamplers().
---
dlls/d3d10core/device.c | 13 ++++++++++++- dlls/wined3d/device.c | 21 +++++++++++++++++++++ dlls/wined3d/stateblock.c | 9 +++++++++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 1 + include/wine/wined3d.h | 1 + 6 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index ad07aee..0aa5f47 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -357,8 +357,19 @@ static void STDMETHODCALLTYPE d3d10_device_GSSetShaderResources(ID3D10Device *if static void STDMETHODCALLTYPE d3d10_device_GSSetSamplers(ID3D10Device *iface, UINT start_slot, UINT sampler_count, ID3D10SamplerState *const *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 = unsafe_impl_from_ID3D10SamplerState(samplers[i]); + + wined3d_device_set_gs_sampler(device->wined3d_device, start_slot + i, + sampler ? sampler->wined3d_sampler : NULL); + } }
static void STDMETHODCALLTYPE d3d10_device_OMSetRenderTargets(ID3D10Device *iface, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 24c6b4e..ed243cc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3267,6 +3267,27 @@ struct wined3d_buffer * CDECL wined3d_device_get_gs_cb(const struct wined3d_devi return device->stateBlock->state.gs_cb[idx]; }
+void CDECL wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler) +{ + struct wined3d_sampler *prev; + + TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.gs_sampler[idx]; + device->updateStateBlock->state.gs_sampler[idx] = sampler; + + if (sampler) + wined3d_sampler_incref(sampler); + if (prev) + wined3d_sampler_decref(prev); +} + /* Context activation is done by the caller. */ /* Do not call while under the GL lock. */ #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 0b55f18..45118f4 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -555,6 +555,15 @@ void stateblock_unbind_resources(struct wined3d_stateblock *stateblock) } }
+ for (i = 0; i < MAX_SAMPLER_OBJECTS; ++i) + { + if ((sampler = state->gs_sampler[i])) + { + state->gs_sampler[i] = NULL; + wined3d_sampler_decref(sampler); + } + } + if ((shader = state->pixel_shader)) { state->pixel_shader = NULL; diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 0b87f10..1ac4bf5 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -120,6 +120,7 @@ @ cdecl wined3d_device_set_gamma_ramp(ptr long long ptr) @ cdecl wined3d_device_set_geometry_shader(ptr ptr) @ cdecl wined3d_device_set_gs_cb(ptr long ptr) +@ cdecl wined3d_device_set_gs_sampler(ptr long ptr) @ cdecl wined3d_device_set_index_buffer(ptr ptr long) @ cdecl wined3d_device_set_light(ptr long ptr) @ cdecl wined3d_device_set_light_enable(ptr long long) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c347068..64da8e5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2315,6 +2315,7 @@ struct wined3d_state
struct wined3d_shader *geometry_shader; struct wined3d_buffer *gs_cb[MAX_CONSTANT_BUFFERS]; + struct wined3d_sampler *gs_sampler[MAX_SAMPLER_OBJECTS];
struct wined3d_shader *pixel_shader; struct wined3d_buffer *ps_cb[MAX_CONSTANT_BUFFERS]; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index cc60893..eb48ceb 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2211,6 +2211,7 @@ void __cdecl wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp); void __cdecl wined3d_device_set_geometry_shader(struct wined3d_device *device, struct wined3d_shader *shader); void __cdecl wined3d_device_set_gs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer); +void __cdecl wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); void __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id); HRESULT __cdecl wined3d_device_set_light(struct wined3d_device *device,