From fe4a226bfa405a46a0cf40eb2f6bb5addbf06990 Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Wed, 18 Mar 2015 21:07:34 +0100 Subject: [PATCH] wined3d: Introduce a get_identity_matrix() function. --- dlls/wined3d/stateblock.c | 9 ++------- dlls/wined3d/utils.c | 13 +++++++++++++ dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index dc146fcae2d..62b1841ba05 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1121,16 +1121,11 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d DWORD d; } tmpfloat; unsigned int i; - 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, - }}}; + struct wined3d_matrix identity; TRACE("state %p, gl_info %p.\n", state, gl_info); + get_identity_matrix(&identity); state->gl_primitive_type = ~0u; /* Set some of the defaults for lights, transforms etc */ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 725318f9407..551dca8b575 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3117,6 +3117,19 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage, return FALSE; } +void get_identity_matrix(struct wined3d_matrix *mat) +{ + 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, + }}}; + + *mat = identity; +} + /* Setup this textures matrix according to the texture flags. */ /* Context activation is done by the caller (state handler). */ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b0c7a53a817..4f03b1b93fa 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3037,6 +3037,8 @@ static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader, return FALSE; } +void get_identity_matrix(struct wined3d_matrix *mat) DECLSPEC_HIDDEN; + /* Using additional shader constants (uniforms in GLSL / program environment * or local parameters in ARB) is costly: * ARB only knows float4 parameters and GLSL compiler are not really smart -- 2.11.4.GIT