@@ -3439,6 +3439,12 @@ void d3d_device_sync_surfaces(struct d3d_device *device)
34393439 }
34403440}
34413441
3442+ static void d3d_device_apply_state (struct d3d_device * device )
3443+ {
3444+ wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
3445+ d3d_device_sync_surfaces (device );
3446+ }
3447+
34423448static HRESULT d3d_device7_DrawPrimitive (IDirect3DDevice7 * iface ,
34433449 D3DPRIMITIVETYPE primitive_type , DWORD fvf , void * vertices ,
34443450 DWORD vertex_count , DWORD flags )
@@ -3473,8 +3479,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
34733479 wined3d_stateblock_set_vertex_declaration (device -> state , ddraw_find_decl (device -> ddraw , fvf ));
34743480 wined3d_device_context_set_primitive_type (device -> immediate_context ,
34753481 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
3476- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
3477- d3d_device_sync_surfaces (device );
3482+ d3d_device_apply_state (device );
34783483 wined3d_device_context_draw (device -> immediate_context , vb_pos / stride , vertex_count , 0 , 0 );
34793484
34803485done :
@@ -3616,8 +3621,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
36163621 wined3d_stateblock_set_vertex_declaration (device -> state , ddraw_find_decl (device -> ddraw , fvf ));
36173622 wined3d_device_context_set_primitive_type (device -> immediate_context ,
36183623 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
3619- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
3620- d3d_device_sync_surfaces (device );
3624+ d3d_device_apply_state (device );
36213625 wined3d_device_context_draw_indexed (device -> immediate_context , vb_pos / stride ,
36223626 ib_pos / sizeof (* indices ), index_count , 0 , 0 );
36233627
@@ -3928,8 +3932,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
39283932
39293933 wined3d_device_context_set_primitive_type (device -> immediate_context ,
39303934 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
3931- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
3932- d3d_device_sync_surfaces (device );
3935+ d3d_device_apply_state (device );
39333936 wined3d_device_context_draw (device -> immediate_context , vb_pos / dst_stride , vertex_count , 0 , 0 );
39343937
39353938done :
@@ -4034,8 +4037,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
40344037 wined3d_stateblock_set_vertex_declaration (device -> state , ddraw_find_decl (device -> ddraw , fvf ));
40354038 wined3d_device_context_set_primitive_type (device -> immediate_context ,
40364039 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
4037- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
4038- d3d_device_sync_surfaces (device );
4040+ d3d_device_apply_state (device );
40394041 wined3d_device_context_draw_indexed (device -> immediate_context ,
40404042 vb_pos / vtx_dst_stride , ib_pos / sizeof (WORD ), index_count , 0 , 0 );
40414043
@@ -4161,8 +4163,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
41614163 /* Now draw the primitives */
41624164 wined3d_device_context_set_primitive_type (device -> immediate_context ,
41634165 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
4164- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
4165- d3d_device_sync_surfaces (device );
4166+ d3d_device_apply_state (device );
41664167 wined3d_device_context_draw (device -> immediate_context , start_vertex , vertex_count , 0 , 0 );
41674168
41684169 wined3d_mutex_unlock ();
@@ -4298,8 +4299,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
42984299
42994300 wined3d_device_context_set_primitive_type (device -> immediate_context ,
43004301 wined3d_primitive_type_from_ddraw (primitive_type ), 0 );
4301- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
4302- d3d_device_sync_surfaces (device );
4302+ d3d_device_apply_state (device );
43034303 wined3d_device_context_draw_indexed (device -> immediate_context , start_vertex ,
43044304 ib_pos / sizeof (WORD ), index_count , 0 , 0 );
43054305
@@ -5163,8 +5163,7 @@ static HRESULT d3d_device7_Clear(IDirect3DDevice7 *iface, DWORD count,
51635163 }
51645164
51655165 wined3d_mutex_lock ();
5166- wined3d_device_apply_stateblock (device -> wined3d_device , device -> state );
5167- d3d_device_sync_rendertarget (device );
5166+ d3d_device_apply_state (device );
51685167 hr = wined3d_device_clear (device -> wined3d_device , count , (RECT * )rects , flags , & c , z , stencil );
51695168 wined3d_mutex_unlock ();
51705169
0 commit comments