Commit c371af0d authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Get rid of device->view_ident.

parent 098105dc
......@@ -53,17 +53,6 @@ const struct wined3d_light WINED3D_default_light =
0.0f /* Phi */
};
/**********************************************************
* Global variable / Constants follow
**********************************************************/
const struct wined3d_matrix identity =
{{{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
}}}; /* When needed for comparisons */
/* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these
* actually have the same values in GL and D3D. */
GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type)
......@@ -1208,8 +1197,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
create_dummy_textures(device, context);
/* Initialize the current view state */
device->view_ident = 1;
device->contexts[0]->last_was_rhw = 0;
switch (wined3d_settings.offscreen_rendering_mode)
......@@ -1684,8 +1671,6 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
}
device->stateBlock->state.transforms[d3dts] = *matrix;
if (d3dts == WINED3D_TS_VIEW)
device->view_ident = !memcmp(matrix, &identity, sizeof(identity));
if (d3dts < WINED3D_TS_WORLD_MATRIX(device->adapter->gl_info.limits.blends))
device_invalidate_state(device, STATE_TRANSFORM(d3dts));
......
......@@ -3801,19 +3801,10 @@ static void transform_world(struct wined3d_context *context, const struct wined3
}
else
{
/* In the general case, the view matrix is the identity matrix */
if (context->swapchain->device->view_ident)
{
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(0)].u.m[0][0]);
checkGLcall("glLoadMatrixf");
}
else
{
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(0)].u.m[0][0]);
checkGLcall("glMultMatrixf");
}
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(0)].u.m[0][0]);
checkGLcall("glMultMatrixf");
}
}
......@@ -3883,18 +3874,10 @@ static void transform_worldex(struct wined3d_context *context, const struct wine
/* World matrix 0 is multiplied with the view matrix because d3d uses 3
* matrices while gl uses only 2. To avoid weighting the view matrix
* incorrectly it has to be multiplied into every GL modelview matrix. */
if (context->swapchain->device->view_ident)
{
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)].u.m[0][0]);
checkGLcall("glLoadMatrixf");
}
else
{
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)].u.m[0][0]);
checkGLcall("glMultMatrixf");
}
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)].u.m[0][0]);
checkGLcall("glMultMatrixf");
}
static void state_vertexblend_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
......
......@@ -1161,6 +1161,13 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
unsigned int i;
struct wined3d_swapchain *swapchain;
struct wined3d_surface *backbuffer;
static const struct wined3d_matrix identity =
{{{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
}}};
TRACE("stateblock %p.\n", stateblock);
......
......@@ -863,9 +863,6 @@ do { \
#define checkGLcall(A) do {} while(0)
#endif
/* Global variables */
extern const struct wined3d_matrix identity DECLSPEC_HIDDEN;
enum wined3d_ffp_idx
{
WINED3D_FFP_POSITION = 0,
......@@ -1704,7 +1701,6 @@ struct wined3d_device
DWORD vs_clipping;
UINT instance_count;
WORD view_ident : 1; /* true iff view matrix is identity */
WORD vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */
WORD isRecordingState : 1;
WORD isInDraw : 1;
......@@ -1714,7 +1710,7 @@ struct wined3d_device
WORD softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */
WORD useDrawStridedSlow : 1;
WORD filter_messages : 1;
WORD padding : 6;
WORD padding : 7;
BYTE fixed_function_usage_map; /* MAX_TEXTURES, 8 */
......
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