[PATCH 2/4] d3d9/tests: Test that Direct3D9 doesn't modify the pixel format of the window it targets. (try 4)

Henri Verbeet hverbeet at gmail.com
Wed Feb 19 04:36:14 CST 2014


On 19 February 2014 04:30, Ken Thomases <ken at codeweavers.com> wrote:
> I guess this may be less efficient than we'd want.  Ideally, as little WGL state as possible would be checked other than when context->level transitions from 0 to 1.  context_enter() could check it at that time.  Rather than using restore_ctx being non-NULL as a proxy for whether the context needs to be set, we'd use a separate, explicit flag:
>
> diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
> index 4679b25..a0d078c 100644
> --- a/dlls/wined3d/context.c
> +++ b/dlls/wined3d/context.c
> @@ -1109,6 +1109,7 @@ void context_release(struct wined3d_context *context)
>              context->restore_ctx = NULL;
>              context->restore_dc = NULL;
>          }
> +        context->needs_set = 0;
>      }
>  }
>
> @@ -1127,7 +1128,10 @@ static void context_enter(struct wined3d_context *context)
>                      current_gl, wglGetCurrentDC());
>              context->restore_ctx = current_gl;
>              context->restore_dc = wglGetCurrentDC();
> +            context->needs_set = 1;
>          }
> +        else if (context->pixel_format != GetPixelFormat(context->hdc))
> +            context->needs_set = 1;
>      }
>  }
>
> @@ -3051,7 +3055,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
>          if (!context_set_current(context))
>              ERR("Failed to activate the new context.\n");
>      }
> -    else if (context->restore_ctx)
> +    else if (context->needs_set)
>      {
>          context_set_gl_context(context);
>      }
> diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
> index 0a1511b..0ceb6f1 100644
> --- a/dlls/wined3d/wined3d_private.h
> +++ b/dlls/wined3d/wined3d_private.h
> @@ -1085,7 +1085,8 @@ struct wined3d_context
>      DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */
>      DWORD lowest_disabled_stage : 4;    /* Max MAX_TEXTURES, 8 */
>      DWORD rebind_fbo : 1;
> -    DWORD padding : 19;
> +    DWORD needs_set : 1;
> +    DWORD padding : 18;
>      DWORD shader_update_mask;
>      DWORD constant_update_mask;
>      DWORD                   numbered_array_mask;
I think that mostly works, but you'll probably want to clear needs_set
in context_set_gl_context() instead of in context_release(). I think
there's also an argument somewhere that context_update_window() should
set needs_set instead of calling context_set_pixel_format() and
context_set_gl_context().



More information about the wine-devel mailing list