swr_destroy_scratch_buffers(ctx);
+ /* Only update screen->pipe if current context is being destroyed */
assert(screen);
- screen->pipe = NULL;
+ if (screen->pipe == pipe)
+ screen->pipe = NULL;
FREE(ctx);
}
swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
{
struct swr_context *ctx = CALLOC_STRUCT(swr_context);
- struct swr_screen *screen = swr_screen(p_screen);
ctx->blendJIT =
new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;
if (ctx->swrContext == NULL)
goto fail;
- screen->pipe = &ctx->pipe;
ctx->pipe.screen = p_screen;
ctx->pipe.destroy = swr_destroy;
ctx->pipe.priv = priv;
struct swr_context *ctx = swr_context(pipe);
struct swr_screen *screen = swr_screen(ctx->pipe.screen);
+ /* Update screen->pipe to current pipe context. */
+ if (screen->pipe != pipe)
+ screen->pipe = pipe;
+
/* Any state that requires dirty flags to be re-triggered sets this mask */
/* For example, user_buffer vertex and index buffers. */
unsigned post_update_dirty_flags = 0;