[PATCH 8/9] wined3d: Introduce wined3d_buffer_get_memory().

Józef Kucia jkucia at codeweavers.com
Thu Oct 20 05:50:57 CDT 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/buffer.c          | 26 +++++++++++++++++++++++++-
 dlls/wined3d/context.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  4 ++--
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 7a66283..08cbfc2 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -611,7 +611,7 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
 }
 
 /* Context activation is done by the caller. */
-void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
+static void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
         struct wined3d_bo_address *data)
 {
     data->buffer_object = buffer->buffer_object;
@@ -635,6 +635,30 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
     }
 }
 
+void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
+        struct wined3d_bo_address *data, DWORD locations)
+{
+    TRACE("buffer %p, data %p, locations %s.\n",
+            buffer, data, wined3d_debug_location(locations));
+
+    if (locations & WINED3D_LOCATION_BUFFER)
+    {
+        data->buffer_object = buffer->buffer_object;
+        data->addr = NULL;
+        return;
+    }
+    if (locations & WINED3D_LOCATION_SYSMEM)
+    {
+        data->buffer_object = 0;
+        data->addr = buffer->resource.heap_memory;
+        return;
+    }
+
+    ERR("Unexpected locations %s.\n", wined3d_debug_location(locations));
+    data->buffer_object = 0;
+    data->addr = NULL;
+}
+
 static void buffer_unload(struct wined3d_resource *resource)
 {
     struct wined3d_buffer *buffer = buffer_from_resource(resource);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index a7835f6..594f55f 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3201,7 +3201,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
         else
         {
             wined3d_buffer_load(buffer, context, state);
-            buffer_get_memory(buffer, context, &data);
+            wined3d_buffer_get_memory(buffer, &data, buffer->locations);
             element->data.buffer_object = data.buffer_object;
             element->data.addr += (ULONG_PTR)data.addr;
         }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8001e5e..4e7bb88 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3179,9 +3179,9 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
     return CONTAINING_RECORD(resource, struct wined3d_buffer, resource);
 }
 
-void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
-        struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
 void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
+        struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
 void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
 void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
         const struct wined3d_state *state) DECLSPEC_HIDDEN;
-- 
2.7.3




More information about the wine-patches mailing list