Henri Verbeet : wined3d: Send pixel shader binding updates through the command stream.
Alexandre Julliard
julliard at winehq.org
Fri Oct 4 15:08:40 CDT 2013
Module: wine
Branch: master
Commit: 82cf8b2066f1e1eef1603fa35895c29570b0f0ae
URL: http://source.winehq.org/git/wine.git/?a=commit;h=82cf8b2066f1e1eef1603fa35895c29570b0f0ae
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Oct 3 23:31:46 2013 +0200
wined3d: Send pixel shader binding updates through the command stream.
---
dlls/wined3d/cs.c | 21 +++++++++++++++++++++
dlls/wined3d/device.c | 22 +++++++---------------
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e49ce3a..7f54ac9 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -40,6 +40,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_TEXTURE,
WINED3D_CS_OP_SET_VERTEX_SHADER,
WINED3D_CS_OP_SET_GEOMETRY_SHADER,
+ WINED3D_CS_OP_SET_PIXEL_SHADER,
};
struct wined3d_cs_present
@@ -551,6 +552,25 @@ void wined3d_cs_emit_set_geometry_shader(struct wined3d_cs *cs, struct wined3d_s
cs->ops->submit(cs);
}
+static void wined3d_cs_exec_set_pixel_shader(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_shader *op = data;
+
+ cs->state.pixel_shader = op->shader;
+ device_invalidate_state(cs->device, STATE_PIXELSHADER);
+}
+
+void wined3d_cs_emit_set_pixel_shader(struct wined3d_cs *cs, struct wined3d_shader *shader)
+{
+ struct wined3d_cs_set_shader *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_PIXEL_SHADER;
+ op->shader = shader;
+
+ 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,
@@ -567,6 +587,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture,
/* WINED3D_CS_OP_SET_VERTEX_SHADER */ wined3d_cs_exec_set_vertex_shader,
/* WINED3D_CS_OP_SET_GEOMETRY_SHADER */ wined3d_cs_exec_set_geometry_shader,
+ /* WINED3D_CS_OP_SET_PIXEL_SHADER */ wined3d_cs_exec_set_pixel_shader,
};
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 b2f10cf..49f39d7 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2345,27 +2345,19 @@ void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct
TRACE("device %p, shader %p.\n", device, shader);
- if (shader)
- wined3d_shader_incref(shader);
- if (prev)
- wined3d_shader_decref(prev);
-
- device->update_state->pixel_shader = shader;
-
if (device->recording)
- {
- TRACE("Recording... not performing anything.\n");
device->recording->changed.pixelShader = TRUE;
- return;
- }
if (shader == prev)
- {
- TRACE("Application is setting the old shader over, nothing to do.\n");
return;
- }
- device_invalidate_state(device, STATE_PIXELSHADER);
+ if (shader)
+ wined3d_shader_incref(shader);
+ device->update_state->pixel_shader = shader;
+ if (!device->recording)
+ wined3d_cs_emit_set_pixel_shader(device->cs, shader);
+ if (prev)
+ wined3d_shader_decref(prev);
}
struct wined3d_shader * CDECL wined3d_device_get_pixel_shader(const struct wined3d_device *device)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 545c8d3..a1112ef 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2490,6 +2490,7 @@ void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_sur
void wined3d_cs_emit_set_geometry_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_pixel_shader(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN;
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;
More information about the wine-cvs
mailing list