Zebediah Figura : wined3d: Introduce wined3d_stateblock_set_stream_source_freq().

Alexandre Julliard julliard at winehq.org
Wed Nov 13 16:01:11 CST 2019


Module: wine
Branch: master
Commit: 0ed36213f44f7849e674ec1e49a76cf48d32746f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0ed36213f44f7849e674ec1e49a76cf48d32746f

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Nov 11 19:56:01 2019 -0600

wined3d: Introduce wined3d_stateblock_set_stream_source_freq().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/stateblock.c | 30 ++++++++++++++++++++++++++++++
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  1 +
 3 files changed, 32 insertions(+)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index dd3a38cf0f..933ad46a93 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 5ff7ab1d0c..a4caebe718 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 b31e9573aa..a05305f4d6 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);




More information about the wine-cvs mailing list