[PATCH 4/5] d3d10core: Implement d3d10_device_PSSetSamplers().
Henri Verbeet
hverbeet at codeweavers.com
Sun Dec 9 14:22:06 CST 2012
---
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 138f3e4..8944491 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -153,8 +153,19 @@ static void STDMETHODCALLTYPE d3d10_device_PSSetShader(ID3D10Device *iface,
static void STDMETHODCALLTYPE d3d10_device_PSSetSamplers(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_ps_sampler(device->wined3d_device, start_slot + i,
+ sampler ? sampler->wined3d_sampler : NULL);
+ }
}
static void STDMETHODCALLTYPE d3d10_device_VSSetShader(ID3D10Device *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f9cd280..c74498a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3052,6 +3052,27 @@ struct wined3d_buffer * CDECL wined3d_device_get_ps_cb(const struct wined3d_devi
return device->stateBlock->state.ps_cb[idx];
}
+void CDECL wined3d_device_set_ps_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.ps_sampler[idx];
+ device->updateStateBlock->state.ps_sampler[idx] = sampler;
+
+ if (sampler)
+ wined3d_sampler_incref(sampler);
+ if (prev)
+ wined3d_sampler_decref(prev);
+}
+
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/stateblock.c b/dlls/wined3d/stateblock.c
index 45118f4..10104e1 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -570,6 +570,15 @@ void stateblock_unbind_resources(struct wined3d_stateblock *stateblock)
wined3d_shader_decref(shader);
}
+ for (i = 0; i < MAX_SAMPLER_OBJECTS; ++i)
+ {
+ if ((sampler = state->ps_sampler[i]))
+ {
+ state->ps_sampler[i] = NULL;
+ wined3d_sampler_decref(sampler);
+ }
+ }
+
for (i = 0; i < MAX_CONSTANT_BUFFERS; ++i)
{
if ((buffer = state->ps_cb[i]))
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 8c58563..231b958 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -134,6 +134,7 @@
@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long)
@ cdecl wined3d_device_set_ps_consts_f(ptr long ptr long)
@ cdecl wined3d_device_set_ps_consts_i(ptr long ptr long)
+@ cdecl wined3d_device_set_ps_sampler(ptr long ptr)
@ cdecl wined3d_device_set_render_state(ptr long long)
@ cdecl wined3d_device_set_render_target(ptr long ptr long)
@ cdecl wined3d_device_set_sampler_state(ptr long long long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 64da8e5..9830e8a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2319,6 +2319,7 @@ struct wined3d_state
struct wined3d_shader *pixel_shader;
struct wined3d_buffer *ps_cb[MAX_CONSTANT_BUFFERS];
+ struct wined3d_sampler *ps_sampler[MAX_SAMPLER_OBJECTS];
BOOL ps_consts_b[MAX_CONST_B];
INT ps_consts_i[MAX_CONST_I * 4];
float *ps_consts_f;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0e955ce..2dd9a1a 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2231,6 +2231,7 @@ HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device,
UINT start_register, const float *constants, UINT vector4f_count);
HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device,
UINT start_register, const int *constants, UINT vector4i_count);
+void __cdecl wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler);
void __cdecl wined3d_device_set_render_state(struct wined3d_device *device,
enum wined3d_render_state state, DWORD value);
HRESULT __cdecl wined3d_device_set_render_target(struct wined3d_device *device,
--
1.7.8.6
More information about the wine-patches
mailing list