[PATCH 5/6] wined3d: Introduce wined3d_device_context_set_stream_output().

Zebediah Figura z.figura12 at gmail.com
Wed Mar 24 18:19:29 CDT 2021


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

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9766dfada2d..4dcb22ad461 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1224,27 +1224,9 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
 void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx,
         struct wined3d_buffer *buffer, UINT offset)
 {
-    struct wined3d_stream_output *stream;
-    struct wined3d_buffer *prev_buffer;
-
     TRACE("device %p, idx %u, buffer %p, offset %u.\n", device, idx, buffer, offset);
 
-    if (idx >= WINED3D_MAX_STREAM_OUTPUT_BUFFERS)
-    {
-        WARN("Invalid stream output %u.\n", idx);
-        return;
-    }
-
-    stream = &device->cs->c.state->stream_output[idx];
-    prev_buffer = stream->buffer;
-
-    if (buffer)
-        wined3d_buffer_incref(buffer);
-    stream->buffer = buffer;
-    stream->offset = offset;
     wined3d_device_context_emit_set_stream_output(&device->cs->c, idx, buffer, offset);
-    if (prev_buffer)
-        wined3d_buffer_decref(prev_buffer);
 }
 
 struct wined3d_buffer * CDECL wined3d_device_get_stream_output(struct wined3d_device *device,
@@ -2389,6 +2371,32 @@ void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_c
         wined3d_vertex_declaration_decref(prev);
 }
 
+void CDECL wined3d_device_context_set_stream_output(struct wined3d_device_context *context, unsigned int idx,
+        struct wined3d_buffer *buffer, unsigned int offset)
+{
+    struct wined3d_stream_output *stream;
+    struct wined3d_buffer *prev_buffer;
+
+    TRACE("context %p, idx %u, buffer %p, offset %u.\n", context, idx, buffer, offset);
+
+    if (idx >= WINED3D_MAX_STREAM_OUTPUT_BUFFERS)
+    {
+        WARN("Invalid stream output %u.\n", idx);
+        return;
+    }
+
+    stream = &context->state->stream_output[idx];
+    prev_buffer = stream->buffer;
+
+    if (buffer)
+        wined3d_buffer_incref(buffer);
+    stream->buffer = buffer;
+    stream->offset = offset;
+    wined3d_device_context_emit_set_stream_output(context, idx, buffer, offset);
+    if (prev_buffer)
+        wined3d_buffer_decref(prev_buffer);
+}
+
 void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
 {
     TRACE("device %p, shader %p.\n", device, shader);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 4f0d1e8e0b3..db2fbc6d256 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -178,6 +178,7 @@
 @ cdecl wined3d_device_context_set_scissor_rects(ptr long ptr)
 @ cdecl wined3d_device_context_set_shader(ptr long ptr)
 @ cdecl wined3d_device_context_set_shader_resource_view(ptr long long ptr)
+@ cdecl wined3d_device_context_set_stream_output(ptr long ptr long)
 @ cdecl wined3d_device_context_set_stream_source(ptr long ptr long long)
 @ cdecl wined3d_device_context_set_unordered_access_view(ptr long long ptr long)
 @ cdecl wined3d_device_context_set_vertex_declaration(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index e8f5e824bc3..e4431f786fb 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2579,6 +2579,8 @@ void __cdecl wined3d_device_context_set_shader(struct wined3d_device_context *co
         enum wined3d_shader_type type, struct wined3d_shader *shader);
 void __cdecl wined3d_device_context_set_shader_resource_view(struct wined3d_device_context *context,
         enum wined3d_shader_type type, unsigned int idx, struct wined3d_shader_resource_view *view);
+void __cdecl wined3d_device_context_set_stream_output(struct wined3d_device_context *context, unsigned int idx,
+        struct wined3d_buffer *buffer, unsigned int offset);
 HRESULT __cdecl wined3d_device_context_set_stream_source(struct wined3d_device_context *context,
         unsigned int stream_idx, struct wined3d_buffer *buffer, unsigned int offset, unsigned int stride);
 void __cdecl wined3d_device_context_set_unordered_access_view(struct wined3d_device_context *context,
-- 
2.30.2




More information about the wine-devel mailing list