Henri Verbeet : wined3d: Send vertex buffer binding updates through the command stream.
Alexandre Julliard
julliard at winehq.org
Wed Oct 2 15:49:12 CDT 2013
Module: wine
Branch: master
Commit: 57ec706ddea980faff67944d922b9622ca76948c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57ec706ddea980faff67944d922b9622ca76948c
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Oct 2 09:55:26 2013 +0200
wined3d: Send vertex buffer binding updates through the command stream.
---
dlls/wined3d/cs.c | 46 ++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 21 +----------------
dlls/wined3d/wined3d_private.h | 2 +
3 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1e427f4..cdb49ce 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -33,6 +33,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_RENDER_TARGET,
WINED3D_CS_OP_SET_DEPTH_STENCIL,
WINED3D_CS_OP_SET_VERTEX_DECLARATION,
+ WINED3D_CS_OP_SET_STREAM_SOURCE,
};
struct wined3d_cs_present
@@ -98,6 +99,15 @@ struct wined3d_cs_set_vertex_declaration
struct wined3d_vertex_declaration *declaration;
};
+struct wined3d_cs_set_stream_source
+{
+ enum wined3d_cs_op opcode;
+ UINT stream_idx;
+ struct wined3d_buffer *buffer;
+ UINT offset;
+ UINT stride;
+};
+
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -310,6 +320,41 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
+static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_stream_source *op = data;
+ struct wined3d_stream_state *stream;
+ struct wined3d_buffer *prev;
+
+ stream = &cs->state.streams[op->stream_idx];
+ prev = stream->buffer;
+ stream->buffer = op->buffer;
+ stream->offset = op->offset;
+ stream->stride = op->stride;
+
+ if (op->buffer)
+ InterlockedIncrement(&op->buffer->resource.bind_count);
+ if (prev)
+ InterlockedDecrement(&prev->resource.bind_count);
+
+ device_invalidate_state(cs->device, STATE_STREAMSRC);
+}
+
+void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
+ struct wined3d_buffer *buffer, UINT offset, UINT stride)
+{
+ struct wined3d_cs_set_stream_source *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE;
+ op->stream_idx = stream_idx;
+ op->buffer = buffer;
+ op->offset = offset;
+ op->stride = stride;
+
+ cs->ops->submit(cs);
+}
+
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
@@ -320,6 +365,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_RENDER_TARGET */ wined3d_cs_exec_set_render_target,
/* WINED3D_CS_OP_SET_DEPTH_STENCIL */ wined3d_cs_exec_set_depth_stencil,
/* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration,
+ /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d581479..6b6234b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1239,29 +1239,12 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
stream->offset = offset;
}
- /* Handle recording of state blocks. */
- if (device->recording)
- {
- TRACE("Recording... not performing anything.\n");
- if (buffer)
- wined3d_buffer_incref(buffer);
- if (prev_buffer)
- wined3d_buffer_decref(prev_buffer);
- return WINED3D_OK;
- }
-
if (buffer)
- {
- InterlockedIncrement(&buffer->resource.bind_count);
wined3d_buffer_incref(buffer);
- }
+ if (!device->recording)
+ wined3d_cs_emit_set_stream_source(device->cs, stream_idx, buffer, offset, stride);
if (prev_buffer)
- {
- InterlockedDecrement(&prev_buffer->resource.bind_count);
wined3d_buffer_decref(prev_buffer);
- }
-
- device_invalidate_state(device, STATE_STREAMSRC);
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 648780f..719aa87 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2490,6 +2490,8 @@ void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_sur
void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx,
struct wined3d_surface *render_target) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
+ struct wined3d_buffer *buffer, UINT offset, UINT stride) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list