diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index dd3a38cf0f3..933ad46a93d 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1611,6 +1611,36 @@ HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *st return WINED3D_OK; } +HRESULT CDECL wined3d_stateblock_set_stream_source_freq(struct wined3d_stateblock *stateblock, + UINT stream_idx, UINT divider) +{ + struct wined3d_stream_state *stream; + + TRACE("stateblock %p, stream_idx %u, divider %#x.\n", stateblock, stream_idx, divider); + + if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (divider & WINED3DSTREAMSOURCE_INDEXEDDATA)) + { + WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx) + { + WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + if (!divider) + { + WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + + stream = &stateblock->stateblock_state.streams[stream_idx]; + stream->flags = divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA); + stream->frequency = divider & 0x7fffff; + stateblock->changed.streamFreq |= 1u << stream_idx; + return WINED3D_OK; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 5ff7ab1d0cd..a4caebe7185 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -276,6 +276,7 @@ @ cdecl wined3d_stateblock_set_sampler_state(ptr long long long) @ cdecl wined3d_stateblock_set_scissor_rect(ptr ptr) @ cdecl wined3d_stateblock_set_stream_source(ptr long ptr long long) +@ cdecl wined3d_stateblock_set_stream_source_freq(ptr long long) @ cdecl wined3d_stateblock_set_texture(ptr long ptr) @ cdecl wined3d_stateblock_set_texture_stage_state(ptr long long long) @ cdecl wined3d_stateblock_set_transform(ptr long ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index b31e9573aaf..a05305f4d6c 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2690,6 +2690,7 @@ void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *sta void __cdecl wined3d_stateblock_set_scissor_rect(struct wined3d_stateblock *stateblock, const RECT *rect); HRESULT __cdecl wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride); +HRESULT __cdecl wined3d_stateblock_set_stream_source_freq(struct wined3d_stateblock *stateblock, UINT stream_idx, UINT divider); void __cdecl wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, UINT stage, struct wined3d_texture *texture); void __cdecl wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, UINT stage, enum wined3d_texture_stage_state state, DWORD value);