diff options
author | Marek Olšák <[email protected]> | 2017-06-09 22:19:33 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-06-22 01:51:02 +0200 |
commit | 585c5cf8a514783d9ed31dba3aa432797dd5f0e8 (patch) | |
tree | 498d2a9bf82c35ab7caf86fe09ab9b8a97fc0ecf /src/mesa/drivers | |
parent | ab784e0feeaa6af46afc5ee6ce3527324de29dea (diff) |
mesa: don't update draw buffer bounds in _mesa_update_state
st/mesa doesn't need the draw bounds for draw calls. I've added the call
where it's necessary in core Mesa and drivers, but I suspect that most
drivers can just move the call to the right places.
The core Mesa places aren't hot paths, so the call overhead doesn't matter
there.
For now, only st/mesa is made such that this function is invoked very
rarely.
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_state.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_state.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/osmesa/osmesa.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 3 |
9 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 4d89af182d5..4f6bdb74e7c 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -27,6 +27,7 @@ #include "i915_context.h" #include "main/api_exec.h" +#include "main/framebuffer.h" #include "main/imports.h" #include "main/macros.h" #include "main/version.h" @@ -62,6 +63,9 @@ i915InvalidateState(struct gl_context * ctx) _tnl_invalidate_vertex_state(ctx, new_state); intel_context(ctx)->NewGLState |= new_state; + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + /* Todo: gather state values under which tracked parameters become * invalidated, add callbacks for things like * ProgramLocalParameters, etc. diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 7f3924573f9..e0766a0e3f3 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -324,6 +324,9 @@ intelInvalidateState(struct gl_context * ctx) intel->NewGLState |= new_state; + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + if (intel->vtbl.invalidate_state) intel->vtbl.invalidate_state( intel, new_state ); } diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index e9de5b7b238..e921a41c827 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -203,6 +203,9 @@ intel_update_state(struct gl_context * ctx) _mesa_unlock_context_textures(ctx); + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) { brw->stencil_enabled = _mesa_stencil_is_enabled(ctx); brw->stencil_two_sided = _mesa_stencil_is_two_sided(ctx); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index 6d998fca832..1aa26e955bf 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -32,6 +32,7 @@ #include "swrast/swrast.h" #include "tnl/tnl.h" #include "util/bitscan.h" +#include "main/framebuffer.h" static void nouveau_alpha_func(struct gl_context *ctx, GLenum func, GLfloat ref) @@ -456,6 +457,9 @@ nouveau_update_state(struct gl_context *ctx) GLbitfield new_state = ctx->NewState; int i; + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + if (new_state & (_NEW_PROJECTION | _NEW_MODELVIEW)) context_dirty(ctx, PROJECTION); diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 30437e3201a..b157572832c 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2282,6 +2282,9 @@ static void r200InvalidateState(struct gl_context *ctx) r200ContextPtr rmesa = R200_CONTEXT(ctx); + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 940f8de3b48..d2ca812155f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2048,6 +2048,9 @@ static void radeonInvalidateState(struct gl_context *ctx) { GLuint new_state = ctx->NewState; + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 3b1de420f6d..e66b2257de8 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -701,6 +701,9 @@ update_state(struct gl_context *ctx) { GLuint new_state = ctx->NewState; + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + /* not much to do here - pass it on */ _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index c77dcc4d372..734a4e891cb 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -119,6 +119,9 @@ get_string( struct gl_context *ctx, GLenum name ) static void osmesa_update_state(struct gl_context *ctx, GLuint new_state) { + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + /* easy - just propogate */ _swrast_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 61aa6c88aa3..27534da60c2 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -684,6 +684,9 @@ xmesa_update_state(struct gl_context *ctx) GLbitfield new_state = ctx->NewState; const XMesaContext xmesa = XMESA_CONTEXT(ctx); + if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) + _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer); + /* Propagate statechange information to swrast and swrast_setup * modules. The X11 driver has no internal GL-dependent state. */ |