wined3d: Move the primitive type to wined3d_state.

This commit is contained in:
Henri Verbeet 2010-09-21 21:20:53 +02:00 committed by Alexandre Julliard
parent 32089dc604
commit f4df53c41a
4 changed files with 10 additions and 12 deletions

View File

@ -4655,7 +4655,7 @@ static void WINAPI IWineD3DDeviceImpl_SetPrimitiveType(IWineD3DDevice *iface,
TRACE("iface %p, primitive_type %s\n", iface, debug_d3dprimitivetype(primitive_type)); TRACE("iface %p, primitive_type %s\n", iface, debug_d3dprimitivetype(primitive_type));
This->updateStateBlock->changed.primitive_type = TRUE; This->updateStateBlock->changed.primitive_type = TRUE;
This->updateStateBlock->gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); This->updateStateBlock->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
} }
static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface, static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface,
@ -4665,7 +4665,7 @@ static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface,
TRACE("iface %p, primitive_type %p\n", iface, primitive_type); TRACE("iface %p, primitive_type %p\n", iface, primitive_type);
*primitive_type = d3d_primitive_type_from_gl(This->stateBlock->gl_primitive_type); *primitive_type = d3d_primitive_type_from_gl(This->stateBlock->state.gl_primitive_type);
TRACE("Returning %s\n", debug_d3dprimitivetype(*primitive_type)); TRACE("Returning %s\n", debug_d3dprimitivetype(*primitive_type));
} }
@ -5513,10 +5513,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UI
} }
This->currentPatch = patch; This->currentPatch = patch;
old_primitive_type = This->stateBlock->gl_primitive_type; old_primitive_type = This->stateBlock->state.gl_primitive_type;
This->stateBlock->gl_primitive_type = GL_TRIANGLES; This->stateBlock->state.gl_primitive_type = GL_TRIANGLES;
IWineD3DDevice_DrawPrimitiveStrided(iface, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided); IWineD3DDevice_DrawPrimitiveStrided(iface, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided);
This->stateBlock->gl_primitive_type = old_primitive_type; This->stateBlock->state.gl_primitive_type = old_primitive_type;
This->currentPatch = NULL; This->currentPatch = NULL;
/* Destroy uncached patches */ /* Destroy uncached patches */

View File

@ -651,7 +651,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
|| (!glPointParameteri && !context->gl_info->supported[NV_POINT_SPRITE])) || (!glPointParameteri && !context->gl_info->supported[NV_POINT_SPRITE]))
&& context->render_offscreen && context->render_offscreen
&& This->stateBlock->state.render_states[WINED3DRS_POINTSPRITEENABLE] && This->stateBlock->state.render_states[WINED3DRS_POINTSPRITEENABLE]
&& This->stateBlock->gl_primitive_type == GL_POINTS) && This->stateBlock->state.gl_primitive_type == GL_POINTS)
{ {
FIXME("Point sprite coordinate origin switching not supported.\n"); FIXME("Point sprite coordinate origin switching not supported.\n");
} }
@ -659,7 +659,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
/* Ok, we will be updating the screen from here onwards so grab the lock */ /* Ok, we will be updating the screen from here onwards so grab the lock */
ENTER_GL(); ENTER_GL();
{ {
GLenum glPrimType = This->stateBlock->gl_primitive_type; GLenum glPrimType = This->stateBlock->state.gl_primitive_type;
BOOL emulation = FALSE; BOOL emulation = FALSE;
const struct wined3d_stream_info *stream_info = &This->strided_streams; const struct wined3d_stream_info *stream_info = &This->strided_streams;
struct wined3d_stream_info stridedlcl; struct wined3d_stream_info stridedlcl;

View File

@ -718,7 +718,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This->state.transforms[transform] = targetStateBlock->state.transforms[transform]; This->state.transforms[transform] = targetStateBlock->state.transforms[transform];
} }
if (This->changed.primitive_type) This->gl_primitive_type = targetStateBlock->gl_primitive_type; if (This->changed.primitive_type) This->state.gl_primitive_type = targetStateBlock->state.gl_primitive_type;
if (This->changed.indices if (This->changed.indices
&& ((This->state.index_buffer != targetStateBlock->state.index_buffer) && ((This->state.index_buffer != targetStateBlock->state.index_buffer)
@ -995,7 +995,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if (This->changed.primitive_type) if (This->changed.primitive_type)
{ {
This->device->updateStateBlock->changed.primitive_type = TRUE; This->device->updateStateBlock->changed.primitive_type = TRUE;
This->device->updateStateBlock->gl_primitive_type = This->gl_primitive_type; This->device->updateStateBlock->state.gl_primitive_type = This->state.gl_primitive_type;
} }
if (This->changed.indices) if (This->changed.indices)

View File

@ -2356,6 +2356,7 @@ struct wined3d_state
enum wined3d_format_id index_format; enum wined3d_format_id index_format;
INT base_vertex_index; INT base_vertex_index;
INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */ INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
GLenum gl_primitive_type;
struct IWineD3DVertexShaderImpl *vertex_shader; struct IWineD3DVertexShaderImpl *vertex_shader;
BOOL vs_consts_b[MAX_CONST_B]; BOOL vs_consts_b[MAX_CONST_B];
@ -2394,9 +2395,6 @@ struct IWineD3DStateBlockImpl
SAVEDSTATES changed; SAVEDSTATES changed;
struct wined3d_state state; struct wined3d_state state;
/* primitive type */
GLenum gl_primitive_type;
/* Light hashmap . Collisions are handled using standard wine double linked lists */ /* Light hashmap . Collisions are handled using standard wine double linked lists */
#define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */ #define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */
#define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */ #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */