Commit 351e6ddf authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Handle CS op emission from CS op handlers.

parent 2a28c206
......@@ -1576,26 +1576,47 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
{
if (size > cs->data_size)
if (size > (cs->data_size - cs->end))
{
size_t new_size;
void *new_data;
size = max( size, cs->data_size * 2 );
if (!(new_data = HeapReAlloc(GetProcessHeap(), 0, cs->data, size)))
new_size = max(size, cs->data_size * 2);
if (!cs->end)
new_data = HeapReAlloc(GetProcessHeap(), 0, cs->data, new_size);
else
new_data = HeapAlloc(GetProcessHeap(), 0, new_size);
if (!new_data)
return NULL;
cs->data_size = size;
cs->data_size = new_size;
cs->start = cs->end = 0;
cs->data = new_data;
}
return cs->data;
cs->end += size;
return (BYTE *)cs->data + cs->start;
}
static void wined3d_cs_st_submit(struct wined3d_cs *cs)
{
enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)cs->data;
wined3d_cs_op_handlers[opcode](cs, cs->data);
enum wined3d_cs_op opcode;
size_t start;
BYTE *data;
data = cs->data;
start = cs->start;
cs->start = cs->end;
opcode = *(const enum wined3d_cs_op *)&data[start];
wined3d_cs_op_handlers[opcode](cs, &data[start]);
if (!start)
{
if (cs->data != data)
HeapFree(GetProcessHeap(), 0, data);
else
cs->start = cs->end = 0;
}
}
static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
......
......@@ -3170,7 +3170,7 @@ struct wined3d_cs
struct wined3d_fb_state fb;
struct wined3d_state state;
size_t data_size;
size_t data_size, start, end;
void *data;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment