mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 13:50:09 +01:00
i965: Move pre-draw resolve buffers to dd::UpdateState
No functional change except for glBegin/glEnd style rendering, where we now do the resolves at glBegin time instead of FLUSH_VERTICES time. This is also the reason for this change, so that when we later switch fast clear resolve to use meta, we won't be doing meta operations in the middle of a begin/end sequence. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
cf89b29d2f
commit
388f02729b
2 changed files with 25 additions and 40 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include "main/points.h"
|
||||
#include "main/version.h"
|
||||
#include "main/vtxfmt.h"
|
||||
#include "main/texobj.h"
|
||||
|
||||
#include "vbo/vbo_context.h"
|
||||
|
||||
|
|
@ -156,12 +157,36 @@ static void
|
|||
intel_update_state(struct gl_context * ctx, GLuint new_state)
|
||||
{
|
||||
struct brw_context *brw = brw_context(ctx);
|
||||
struct intel_texture_object *tex_obj;
|
||||
struct intel_renderbuffer *depth_irb;
|
||||
|
||||
if (ctx->swrast_context)
|
||||
_swrast_InvalidateState(ctx, new_state);
|
||||
_vbo_InvalidateState(ctx, new_state);
|
||||
|
||||
brw->NewGLState |= new_state;
|
||||
|
||||
_mesa_unlock_context_textures(ctx);
|
||||
|
||||
/* Resolve the depth buffer's HiZ buffer. */
|
||||
depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
|
||||
if (depth_irb)
|
||||
intel_renderbuffer_resolve_hiz(brw, depth_irb);
|
||||
|
||||
/* Resolve depth buffer and render cache of each enabled texture. */
|
||||
int maxEnabledUnit = ctx->Texture._MaxEnabledTexImageUnit;
|
||||
for (int i = 0; i <= maxEnabledUnit; i++) {
|
||||
if (!ctx->Texture.Unit[i]._Current)
|
||||
continue;
|
||||
tex_obj = intel_texture_object(ctx->Texture.Unit[i]._Current);
|
||||
if (!tex_obj || !tex_obj->mt)
|
||||
continue;
|
||||
intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
|
||||
intel_miptree_resolve_color(brw, tex_obj->mt);
|
||||
brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
|
||||
}
|
||||
|
||||
_mesa_lock_context_textures(ctx);
|
||||
}
|
||||
|
||||
#define flushFront(screen) ((screen)->image.loader ? (screen)->image.loader->flushFrontBuffer : (screen)->dri2.loader->flushFrontBuffer)
|
||||
|
|
|
|||
|
|
@ -302,40 +302,6 @@ static void brw_merge_inputs( struct brw_context *brw,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Resolve buffers before drawing.
|
||||
*
|
||||
* Resolve the depth buffer's HiZ buffer, resolve the depth buffer of each
|
||||
* enabled depth texture, and flush the render cache for any dirty textures.
|
||||
*
|
||||
* (In the future, this will also perform MSAA resolves).
|
||||
*/
|
||||
static void
|
||||
brw_predraw_resolve_buffers(struct brw_context *brw)
|
||||
{
|
||||
struct gl_context *ctx = &brw->ctx;
|
||||
struct intel_renderbuffer *depth_irb;
|
||||
struct intel_texture_object *tex_obj;
|
||||
|
||||
/* Resolve the depth buffer's HiZ buffer. */
|
||||
depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH);
|
||||
if (depth_irb)
|
||||
intel_renderbuffer_resolve_hiz(brw, depth_irb);
|
||||
|
||||
/* Resolve depth buffer and render cache of each enabled texture. */
|
||||
int maxEnabledUnit = ctx->Texture._MaxEnabledTexImageUnit;
|
||||
for (int i = 0; i <= maxEnabledUnit; i++) {
|
||||
if (!ctx->Texture.Unit[i]._Current)
|
||||
continue;
|
||||
tex_obj = intel_texture_object(ctx->Texture.Unit[i]._Current);
|
||||
if (!tex_obj || !tex_obj->mt)
|
||||
continue;
|
||||
intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
|
||||
intel_miptree_resolve_color(brw, tex_obj->mt);
|
||||
brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Call this after drawing to mark which buffers need resolving
|
||||
*
|
||||
|
|
@ -432,12 +398,6 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
|
|||
*/
|
||||
brw_workaround_depthstencil_alignment(brw, 0);
|
||||
|
||||
/* Resolves must occur after updating renderbuffers, updating context state,
|
||||
* and finalizing textures but before setting up any hardware state for
|
||||
* this draw call.
|
||||
*/
|
||||
brw_predraw_resolve_buffers(brw);
|
||||
|
||||
/* Bind all inputs, derive varying and size information:
|
||||
*/
|
||||
brw_merge_inputs( brw, arrays );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue