From 6b9018ccd23f44a23b3e1038bde4ad7c280cf1ff Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 3 May 2012 21:49:38 +0200 Subject: [PATCH] wined3d: Use the wined3d_matrix structure for the identity matrix. --- dlls/wined3d/device.c | 8 ++++---- dlls/wined3d/stateblock.c | 8 ++++---- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c659e47736a..fcf559580b7 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -52,13 +52,13 @@ const struct wined3d_light WINED3D_default_light = /********************************************************** * Global variable / Constants follow **********************************************************/ -const float identity[] = -{ +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 */ +}}}; /* When needed for comparisons */ /* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these * actually have the same values in GL and D3D. */ @@ -1832,7 +1832,7 @@ HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, * matrix. The Projection matrix stay projection matrix. */ if (d3dts == WINED3D_TS_VIEW) - device->view_ident = !memcmp(matrix, identity, 16 * sizeof(float)); + 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)); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 304a326ea1b..9544c6f6e38 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1108,11 +1108,11 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) memset(stateblock->changed.vertexShaderConstantsF, 0, device->d3d_vshader_constantF * sizeof(BOOL)); /* Set some of the defaults for lights, transforms etc */ - memcpy(&state->transforms[WINED3D_TS_PROJECTION], identity, sizeof(identity)); - memcpy(&state->transforms[WINED3D_TS_VIEW], identity, sizeof(identity)); + memcpy(&state->transforms[WINED3D_TS_PROJECTION], &identity, sizeof(identity)); + memcpy(&state->transforms[WINED3D_TS_VIEW], &identity, sizeof(identity)); for (i = 0; i < 256; ++i) { - memcpy(&state->transforms[WINED3D_TS_WORLD_MATRIX(i)], identity, sizeof(identity)); + memcpy(&state->transforms[WINED3D_TS_WORLD_MATRIX(i)], &identity, sizeof(identity)); } state->fb = &device->fb; @@ -1253,7 +1253,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) for (i = 0; i < MAX_TEXTURES; ++i) { TRACE("Setting up default texture states for texture Stage %u.\n", i); - memcpy(&state->transforms[WINED3D_TS_TEXTURE0 + i], identity, sizeof(identity)); + memcpy(&state->transforms[WINED3D_TS_TEXTURE0 + i], &identity, sizeof(identity)); state->texture_states[i][WINED3D_TSS_COLOR_OP] = i ? WINED3D_TOP_DISABLE : WINED3D_TOP_MODULATE; state->texture_states[i][WINED3D_TSS_COLOR_ARG1] = WINED3DTA_TEXTURE; state->texture_states[i][WINED3D_TSS_COLOR_ARG2] = WINED3DTA_CURRENT; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 976c4f4a0bb..6a78b65f257 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -860,7 +860,7 @@ do { debug_d3dformat(si->elements[name].format->id), si->elements[name].stream_idx); } while(0) /* Global variables */ -extern const float identity[16] DECLSPEC_HIDDEN; +extern const struct wined3d_matrix identity DECLSPEC_HIDDEN; enum wined3d_ffp_idx {