diff options
author | Thomas Hellstrom <[email protected]> | 2011-06-29 09:00:23 +0200 |
---|---|---|
committer | Thomas Hellstrom <[email protected]> | 2011-06-29 12:48:59 +0200 |
commit | ac8fdbc1c723afb19eeaba5457ba78d0bf33b8d4 (patch) | |
tree | 34b7c9d72551aa7976d634738585d65a256760ae /src/mesa/state_tracker/st_cb_viewport.c | |
parent | 1a7e17e44a1129bbd6a0f454fe95b3ce8240cd45 (diff) |
st-api: Rework how drawables are invalidated v3.
The api and the state tracker manager code as well as the state tracker code
assumed that only a single context could be bound to a drawable. That is not
a valid assumption, since multiple contexts can bind to the same drawable.
Fix this by making it the state tracker's responsibility to update all
contexts binding to a drawable
Note that the state trackers themselves don't use atomic stamps on
frame-buffers. Multiple context rendering to the same drawable should
be protected by the application.
Signed-off-by: Thomas Hellstrom <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_viewport.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_viewport.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c index 049755e45c0..d4742eb897d 100644 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -56,13 +56,20 @@ static void st_viewport(struct gl_context * ctx, GLint x, GLint y, if (!st->invalidate_on_gl_viewport) return; + /* + * Normally we'd want the state tracker manager to mark the drawables + * invalid only when needed. This will force the state tracker manager + * to revalidate the drawable, rather than just update the context with + * the latest cached drawable info. + */ + stdraw = st_ws_framebuffer(st->ctx->DrawBuffer); stread = st_ws_framebuffer(st->ctx->ReadBuffer); - if (stdraw) - p_atomic_set(&stdraw->revalidate, TRUE); - if (stread && stread != stdraw) - p_atomic_set(&stread->revalidate, TRUE); + if (stdraw && stdraw->iface) + stdraw->iface_stamp = p_atomic_read(&stdraw->iface->stamp) - 1; + if (stread && stread != stdraw && stread->iface) + stread->iface_stamp = p_atomic_read(&stread->iface->stamp) - 1; } void st_init_viewport_functions(struct dd_function_table *functions) |