d3d10core: Implement d3d10_device_PSSetSamplers().

This commit is contained in:
Henri Verbeet 2012-12-09 21:22:06 +01:00 committed by Alexandre Julliard
parent 5cea0f122c
commit 4c4131cd78
6 changed files with 45 additions and 1 deletions

View file

@ -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,

View file

@ -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)
{

View file

@ -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]))

View file

@ -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)

View file

@ -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;

View file

@ -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,