wined3d: Store the instance count in the context structure.

This commit is contained in:
Stefan Dösinger 2013-09-16 12:43:20 +02:00 committed by Alexandre Julliard
parent 59e0b841c7
commit bbfca4863c
3 changed files with 9 additions and 11 deletions

View File

@ -676,8 +676,8 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
} }
stream_info = &context->stream_info; stream_info = &context->stream_info;
if (device->instance_count) if (context->instance_count)
instance_count = device->instance_count; instance_count = context->instance_count;
if (indexed) if (indexed)
{ {

View File

@ -4060,13 +4060,12 @@ static void unload_numbered_arrays(struct wined3d_context *context)
static void load_numbered_arrays(struct wined3d_context *context, static void load_numbered_arrays(struct wined3d_context *context,
const struct wined3d_stream_info *stream_info, const struct wined3d_state *state) const struct wined3d_stream_info *stream_info, const struct wined3d_state *state)
{ {
struct wined3d_device *device = context->swapchain->device;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0; GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
int i; int i;
/* Default to no instancing */ /* Default to no instancing */
device->instance_count = 0; context->instance_count = 0;
for (i = 0; i < MAX_ATTRIBS; i++) for (i = 0; i < MAX_ATTRIBS; i++)
{ {
@ -4085,8 +4084,8 @@ static void load_numbered_arrays(struct wined3d_context *context,
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA) if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
{ {
if (!device->instance_count) if (!context->instance_count)
device->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1; context->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1;
if (!gl_info->supported[ARB_INSTANCED_ARRAYS]) if (!gl_info->supported[ARB_INSTANCED_ARRAYS])
{ {
@ -4232,10 +4231,9 @@ static void load_numbered_arrays(struct wined3d_context *context,
checkGLcall("Loading numbered arrays"); checkGLcall("Loading numbered arrays");
} }
static void load_vertex_data(const struct wined3d_context *context, static void load_vertex_data(struct wined3d_context *context,
const struct wined3d_stream_info *si, const struct wined3d_state *state) const struct wined3d_stream_info *si, const struct wined3d_state *state)
{ {
struct wined3d_device *device = context->swapchain->device;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0; GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
const struct wined3d_stream_info_element *e; const struct wined3d_stream_info_element *e;
@ -4243,7 +4241,7 @@ static void load_vertex_data(const struct wined3d_context *context,
TRACE("Using fast vertex array code\n"); TRACE("Using fast vertex array code\n");
/* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */ /* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
device->instance_count = 0; context->instance_count = 0;
/* Blend Data ---------------------------------------------- */ /* Blend Data ---------------------------------------------- */
if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT)) if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))

View File

@ -1098,6 +1098,8 @@ struct wined3d_context
DWORD active_texture; DWORD active_texture;
DWORD texture_type[MAX_COMBINED_SAMPLERS]; DWORD texture_type[MAX_COMBINED_SAMPLERS];
UINT instance_count;
/* The actual opengl context */ /* The actual opengl context */
UINT level; UINT level;
HGLRC restore_ctx; HGLRC restore_ctx;
@ -1885,8 +1887,6 @@ struct wined3d_device
APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1]; APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];
const struct blit_shader *blitter; const struct blit_shader *blitter;
UINT instance_count;
BYTE vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */ BYTE vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */
BYTE bCursorVisible : 1; BYTE bCursorVisible : 1;
BYTE d3d_initialized : 1; BYTE d3d_initialized : 1;