Henri Verbeet : d3d10core: Implement d3d10_device_SOSetTargets().
Alexandre Julliard
julliard at winehq.org
Fri Nov 23 12:53:23 CST 2012
Module: wine
Branch: master
Commit: 5b781d709d40aa3b706a072807b1e4a903f96442
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b781d709d40aa3b706a072807b1e4a903f96442
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Nov 22 21:13:37 2012 +0100
d3d10core: Implement d3d10_device_SOSetTargets().
---
dlls/d3d10core/device.c | 19 +++++++++++++++++-
dlls/wined3d/device.c | 41 ++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 8 +++++++
include/wine/wined3d.h | 2 +
5 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 78c9d1b..3b09a04 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -347,7 +347,24 @@ static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device *
static void STDMETHODCALLTYPE d3d10_device_SOSetTargets(ID3D10Device *iface,
UINT target_count, ID3D10Buffer *const *targets, const UINT *offsets)
{
- FIXME("iface %p, target_count %u, targets %p, offsets %p stub!\n", iface, target_count, targets, offsets);
+ struct d3d10_device *device = impl_from_ID3D10Device(iface);
+ unsigned int count, i;
+
+ TRACE("iface %p, target_count %u, targets %p, offsets %p.\n", iface, target_count, targets, offsets);
+
+ count = min(target_count, 4);
+ for (i = 0; i < count; ++i)
+ {
+ struct d3d10_buffer *buffer = unsafe_impl_from_ID3D10Buffer(targets[i]);
+
+ wined3d_device_set_stream_output(device->wined3d_device, i,
+ buffer ? buffer->wined3d_buffer : NULL, offsets[i]);
+ }
+
+ for (i = count; i < 4; ++i)
+ {
+ wined3d_device_set_stream_output(device->wined3d_device, i, NULL, 0);
+ }
}
static void STDMETHODCALLTYPE d3d10_device_DrawAuto(ID3D10Device *iface)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3211038..b0e7ac2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1559,6 +1559,47 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
return device->adapter->TextureRam - device->adapter->UsedTextureRam;
}
+void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx,
+ struct wined3d_buffer *buffer, UINT offset)
+{
+ struct wined3d_buffer *prev_buffer;
+
+ TRACE("device %p, idx %u, buffer %p, offset %u.\n", device, idx, buffer, offset);
+
+ if (idx >= MAX_STREAM_OUT)
+ {
+ WARN("Invalid stream output %u.\n", idx);
+ return;
+ }
+
+ prev_buffer = device->updateStateBlock->state.stream_output[idx].buffer;
+ device->updateStateBlock->state.stream_output[idx].buffer = buffer;
+ device->updateStateBlock->state.stream_output[idx].offset = offset;
+
+ if (device->isRecordingState)
+ {
+ if (buffer)
+ wined3d_buffer_incref(buffer);
+ if (prev_buffer)
+ wined3d_buffer_decref(buffer);
+ return;
+ }
+
+ if (prev_buffer != buffer)
+ {
+ if (buffer)
+ {
+ InterlockedIncrement(&buffer->resource.bind_count);
+ wined3d_buffer_incref(buffer);
+ }
+ if (prev_buffer)
+ {
+ InterlockedDecrement(&prev_buffer->resource.bind_count);
+ wined3d_buffer_decref(prev_buffer);
+ }
+ }
+}
+
HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx,
struct wined3d_buffer *buffer, UINT offset, UINT stride)
{
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index cb8304a..56e73e9 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -129,6 +129,7 @@
@ cdecl wined3d_device_set_sampler_state(ptr long long long)
@ cdecl wined3d_device_set_scissor_rect(ptr ptr)
@ cdecl wined3d_device_set_software_vertex_processing(ptr long)
+@ cdecl wined3d_device_set_stream_output(ptr long ptr long)
@ cdecl wined3d_device_set_stream_source(ptr long ptr long long)
@ cdecl wined3d_device_set_stream_source_freq(ptr long long)
@ cdecl wined3d_device_set_texture(ptr long ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ec7c3bf..ea3010f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -154,6 +154,7 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN;
/* Device caps */
#define MAX_PALETTES 65536
+#define MAX_STREAM_OUT 4
#define MAX_STREAMS 16
#define MAX_TEXTURES 8
#define MAX_FRAGMENT_SAMPLERS 16
@@ -2273,6 +2274,12 @@ struct StageState {
DWORD state;
};
+struct wined3d_stream_output
+{
+ struct wined3d_buffer *buffer;
+ UINT offset;
+};
+
struct wined3d_stream_state
{
struct wined3d_buffer *buffer;
@@ -2287,6 +2294,7 @@ struct wined3d_state
const struct wined3d_fb_state *fb;
struct wined3d_vertex_declaration *vertex_declaration;
+ struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */];
BOOL user_stream;
struct wined3d_buffer *index_buffer;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index cf86df6..76e44f1 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2226,6 +2226,8 @@ void __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device,
UINT sampler_idx, enum wined3d_sampler_state state, DWORD value);
void __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect);
void __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software);
+void __cdecl wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx,
+ struct wined3d_buffer *buffer, UINT offset);
HRESULT __cdecl wined3d_device_set_stream_source(struct wined3d_device *device,
UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride);
HRESULT __cdecl wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider);
More information about the wine-cvs
mailing list