d3d10core: Implement d3d10_device_SOSetTargets().

This commit is contained in:
Henri Verbeet 2012-11-22 21:13:37 +01:00 committed by Alexandre Julliard
parent 63acbcbf8a
commit 5b781d709d
5 changed files with 70 additions and 1 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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)

View File

@ -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;

View File

@ -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);