[PATCH 1/5] wined3d: Introduce wined3d_stateblock_set_stream_source().

Zebediah Figura z.figura12 at gmail.com
Mon Nov 11 19:55:58 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/stateblock.c | 27 +++++++++++++++++++++++++++
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  2 ++
 3 files changed, 30 insertions(+)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index f8724da967c..dd3a38cf0f3 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1584,6 +1584,33 @@ void CDECL wined3d_stateblock_set_base_vertex_index(struct wined3d_stateblock *s
     stateblock->stateblock_state.base_vertex_index = base_index;
 }
 
+HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock,
+        UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
+{
+    struct wined3d_stream_state *stream;
+
+    TRACE("stateblock %p, stream_idx %u, buffer %p, stride %u.\n",
+            stateblock, stream_idx, buffer, stride);
+
+    if (stream_idx >= WINED3D_MAX_STREAMS)
+    {
+        WARN("Stream index %u out of range.\n", stream_idx);
+        return WINED3DERR_INVALIDCALL;
+    }
+
+    stream = &stateblock->stateblock_state.streams[stream_idx];
+
+    if (buffer)
+        wined3d_buffer_incref(buffer);
+    if (stream->buffer)
+        wined3d_buffer_decref(stream->buffer);
+    stream->buffer = buffer;
+    stream->stride = stride;
+    stream->offset = offset;
+    stateblock->changed.streamSource |= 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 8a9c9858e92..5ff7ab1d0cd 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -275,6 +275,7 @@
 @ cdecl wined3d_stateblock_set_render_state(ptr long long)
 @ 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_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 10e2ae70ebd..b31e9573aaf 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2688,6 +2688,8 @@ void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stat
 void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock,
         UINT sampler_idx, enum wined3d_sampler_state state, DWORD value);
 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);
 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);
-- 
2.23.0




More information about the wine-devel mailing list