mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
gallium: remove support for separate depth/stencil buffers. Always combined now.
This commit is contained in:
parent
1cf3c77e08
commit
8de2331e43
14 changed files with 46 additions and 68 deletions
|
|
@ -74,14 +74,9 @@ framebuffer_size(const struct pipe_framebuffer_state *fb,
|
|||
*height = fb->cbufs[0]->height;
|
||||
return TRUE;
|
||||
}
|
||||
else if (fb->zbuf) {
|
||||
*width = fb->zbuf->width;
|
||||
*height = fb->zbuf->height;
|
||||
return TRUE;
|
||||
}
|
||||
else if (fb->sbuf) {
|
||||
*width = fb->sbuf->width;
|
||||
*height = fb->sbuf->height;
|
||||
else if (fb->zsbuf) {
|
||||
*width = fb->zsbuf->width;
|
||||
*height = fb->zsbuf->height;
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
|
|
@ -209,7 +204,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
|
|||
if (i915->hardware_dirty & I915_HW_STATIC)
|
||||
{
|
||||
struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
|
||||
struct pipe_surface *depth_surface = i915->framebuffer.zbuf;
|
||||
struct pipe_surface *depth_surface = i915->framebuffer.zsbuf;
|
||||
|
||||
if (cbuf_surface) {
|
||||
unsigned pitch = (cbuf_surface->pitch * cbuf_surface->cpp);
|
||||
|
|
@ -251,7 +246,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
|
|||
cformat = translate_format(cformat);
|
||||
|
||||
if (depth_surface)
|
||||
zformat = translate_depth_format( i915->framebuffer.zbuf->format );
|
||||
zformat = translate_depth_format( i915->framebuffer.zsbuf->format );
|
||||
|
||||
OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD);
|
||||
OUT_BATCH(DSTORG_HORT_BIAS(0x8) | /* .5 */
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ const struct brw_tracked_state brw_psp_urb_cbs = {
|
|||
*/
|
||||
static void upload_depthbuffer(struct brw_context *brw)
|
||||
{
|
||||
struct pipe_surface *depth_surface = brw->attribs.FrameBuffer.zbuf;
|
||||
struct pipe_surface *depth_surface = brw->attribs.FrameBuffer.zsbuf;
|
||||
|
||||
BEGIN_BATCH(5, INTEL_BATCH_NO_CLIPRECTS);
|
||||
OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (5 - 2));
|
||||
|
|
|
|||
|
|
@ -202,8 +202,7 @@ struct pipe_framebuffer_state
|
|||
unsigned num_cbufs;
|
||||
struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
|
||||
|
||||
struct pipe_surface *zbuf; /**< Z buffer */
|
||||
struct pipe_surface *sbuf; /**< Stencil buffer */
|
||||
struct pipe_surface *zsbuf; /**< Z/stencil buffer */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -53,24 +53,19 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
|
|||
softpipe_update_derived(softpipe); /* not needed?? */
|
||||
#endif
|
||||
|
||||
#if TILE_CLEAR_OPTIMIZATION
|
||||
if (ps == sp_tile_cache_get_surface(softpipe->zbuf_cache)) {
|
||||
sp_tile_cache_clear(softpipe->zbuf_cache, clearValue);
|
||||
if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) {
|
||||
sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
|
||||
if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) {
|
||||
sp_tile_cache_clear(softpipe->cbuf_cache[i], clearValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !TILE_CLEAR_OPTIMIZATION
|
||||
/* non-cached surface */
|
||||
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
|
||||
|
||||
#if 0
|
||||
sp_clear_tile_cache(ps, clearValue);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,7 @@ softpipe_map_surfaces(struct softpipe_context *sp)
|
|||
sp_tile_cache_map_surfaces(sp->cbuf_cache[i]);
|
||||
}
|
||||
|
||||
sp_tile_cache_map_surfaces(sp->zbuf_cache);
|
||||
|
||||
sp_tile_cache_map_surfaces(sp->sbuf_cache);
|
||||
sp_tile_cache_map_surfaces(sp->zsbuf_cache);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -98,16 +96,12 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
|
|||
|
||||
for (i = 0; i < sp->framebuffer.num_cbufs; i++)
|
||||
sp_flush_tile_cache(sp, sp->cbuf_cache[i]);
|
||||
sp_flush_tile_cache(sp, sp->zbuf_cache);
|
||||
sp_flush_tile_cache(sp, sp->sbuf_cache);
|
||||
sp_flush_tile_cache(sp, sp->zsbuf_cache);
|
||||
|
||||
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
|
||||
sp_tile_cache_unmap_surfaces(sp->cbuf_cache[i]);
|
||||
}
|
||||
|
||||
sp_tile_cache_unmap_surfaces(sp->zbuf_cache);
|
||||
|
||||
sp_tile_cache_unmap_surfaces(sp->sbuf_cache);
|
||||
sp_tile_cache_unmap_surfaces(sp->zsbuf_cache);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -134,8 +128,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
|
|||
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
||||
sp_destroy_tile_cache(softpipe->cbuf_cache[i]);
|
||||
sp_destroy_tile_cache(softpipe->zbuf_cache);
|
||||
sp_destroy_tile_cache(softpipe->sbuf_cache_sep);
|
||||
sp_destroy_tile_cache(softpipe->zsbuf_cache);
|
||||
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
|
||||
sp_destroy_tile_cache(softpipe->tex_cache[i]);
|
||||
|
|
@ -298,9 +291,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
|
|||
*/
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
||||
softpipe->cbuf_cache[i] = sp_create_tile_cache();
|
||||
softpipe->zbuf_cache = sp_create_tile_cache();
|
||||
softpipe->sbuf_cache_sep = sp_create_tile_cache();
|
||||
softpipe->sbuf_cache = softpipe->sbuf_cache_sep; /* initial value */
|
||||
softpipe->zsbuf_cache = sp_create_tile_cache();
|
||||
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
|
||||
softpipe->tex_cache[i] = sp_create_tile_cache();
|
||||
|
|
|
|||
|
|
@ -131,11 +131,7 @@ struct softpipe_context {
|
|||
uint current_cbuf; /**< current color buffer being written to */
|
||||
|
||||
struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS];
|
||||
struct softpipe_tile_cache *zbuf_cache;
|
||||
/** Stencil buffer cache, for stencil separate from Z */
|
||||
struct softpipe_tile_cache *sbuf_cache_sep;
|
||||
/** This either points to zbuf_cache or sbuf_cache_sep */
|
||||
struct softpipe_tile_cache *sbuf_cache;
|
||||
struct softpipe_tile_cache *zsbuf_cache;
|
||||
|
||||
struct softpipe_tile_cache *tex_cache[PIPE_MAX_SAMPLERS];
|
||||
|
||||
|
|
|
|||
|
|
@ -59,11 +59,8 @@ softpipe_flush( struct pipe_context *pipe,
|
|||
if (softpipe->cbuf_cache[i])
|
||||
sp_flush_tile_cache(softpipe, softpipe->cbuf_cache[i]);
|
||||
|
||||
if (softpipe->zbuf_cache)
|
||||
sp_flush_tile_cache(softpipe, softpipe->zbuf_cache);
|
||||
|
||||
if (softpipe->sbuf_cache)
|
||||
sp_flush_tile_cache(softpipe, softpipe->sbuf_cache);
|
||||
if (softpipe->zsbuf_cache)
|
||||
sp_flush_tile_cache(softpipe, softpipe->zsbuf_cache);
|
||||
|
||||
/* Need this call for hardware buffers before swapbuffers.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ sp_build_depth_stencil(
|
|||
sp_push_quad_first( sp, sp->quad.stencil_test );
|
||||
}
|
||||
else if (sp->depth_stencil->depth.enabled &&
|
||||
sp->framebuffer.zbuf) {
|
||||
sp->framebuffer.zsbuf) {
|
||||
sp_push_quad_first( sp, sp->quad.depth_test );
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
|
|||
{
|
||||
boolean early_depth_test =
|
||||
sp->depth_stencil->depth.enabled &&
|
||||
sp->framebuffer.zbuf &&
|
||||
sp->framebuffer.zsbuf &&
|
||||
!sp->depth_stencil->alpha.enabled &&
|
||||
sp->fs->shader.output_semantic_name[0] != TGSI_SEMANTIC_POSITION;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ void
|
|||
sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
|
||||
{
|
||||
struct softpipe_context *softpipe = qs->softpipe;
|
||||
struct pipe_surface *ps = softpipe->framebuffer.zbuf;
|
||||
struct pipe_surface *ps = softpipe->framebuffer.zsbuf;
|
||||
const enum pipe_format format = ps->format;
|
||||
unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
|
||||
unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */
|
||||
unsigned zmask = 0;
|
||||
unsigned j;
|
||||
struct softpipe_cached_tile *tile
|
||||
= sp_get_cached_tile(softpipe, softpipe->zbuf_cache, quad->x0, quad->y0);
|
||||
= sp_get_cached_tile(softpipe, softpipe->zsbuf_cache, quad->x0, quad->y0);
|
||||
|
||||
assert(ps); /* shouldn't get here if there's no zbuffer */
|
||||
|
||||
|
|
|
|||
|
|
@ -201,12 +201,12 @@ static void
|
|||
stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
|
||||
{
|
||||
struct softpipe_context *softpipe = qs->softpipe;
|
||||
struct pipe_surface *ps = softpipe->framebuffer.sbuf;
|
||||
struct pipe_surface *ps = softpipe->framebuffer.zsbuf;
|
||||
unsigned func, zFailOp, zPassOp, failOp;
|
||||
ubyte ref, wrtMask, valMask;
|
||||
ubyte stencilVals[QUAD_SIZE];
|
||||
struct softpipe_cached_tile *tile
|
||||
= sp_get_cached_tile(softpipe, softpipe->sbuf_cache, quad->x0, quad->y0);
|
||||
= sp_get_cached_tile(softpipe, softpipe->zsbuf_cache, quad->x0, quad->y0);
|
||||
uint j;
|
||||
uint face = quad->facing;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,17 +65,18 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|||
sp->framebuffer.num_cbufs = fb->num_cbufs;
|
||||
|
||||
/* zbuf changing? */
|
||||
if (sp->framebuffer.zbuf != fb->zbuf) {
|
||||
if (sp->framebuffer.zsbuf != fb->zsbuf) {
|
||||
/* flush old */
|
||||
sp_flush_tile_cache(sp, sp->zbuf_cache);
|
||||
sp_flush_tile_cache(sp, sp->zsbuf_cache);
|
||||
|
||||
/* assign new */
|
||||
sp->framebuffer.zbuf = fb->zbuf;
|
||||
sp->framebuffer.zsbuf = fb->zsbuf;
|
||||
|
||||
/* update cache */
|
||||
sp_tile_cache_set_surface(sp->zbuf_cache, fb->zbuf);
|
||||
sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* XXX combined depth/stencil here */
|
||||
|
||||
/* sbuf changing? */
|
||||
|
|
@ -98,6 +99,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|||
sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
sp->dirty |= SP_NEW_FRAMEBUFFER;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ static XMesaVisual
|
|||
create_glx_visual( Display *dpy, XVisualInfo *visinfo )
|
||||
{
|
||||
int vislevel;
|
||||
GLint zBits = default_depth_bits();
|
||||
GLint zBits = 24; /*default_depth_bits();*/
|
||||
GLint accBits = default_accum_bits();
|
||||
GLboolean alphaFlag = default_alpha_bits() > 0;
|
||||
|
||||
|
|
@ -1289,7 +1289,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
|
|||
double_flag = GL_TRUE;
|
||||
if (vis->depth > 8)
|
||||
rgb_flag = GL_TRUE;
|
||||
depth_size = default_depth_bits();
|
||||
depth_size = 24; /*default_depth_bits();*/
|
||||
stencil_size = STENCIL_BITS;
|
||||
/* XXX accum??? */
|
||||
}
|
||||
|
|
@ -1336,7 +1336,9 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
|
|||
* largest depth buffer size, which is 32bits/value. Instead, we
|
||||
* return 16 to maintain performance with earlier versions of Mesa.
|
||||
*/
|
||||
if (depth_size > 24)
|
||||
if (stencil_size > 0)
|
||||
depth_size = 24; /* if Z and stencil, always use 24+8 format */
|
||||
else if (depth_size > 24)
|
||||
depth_size = 32;
|
||||
else if (depth_size > 16)
|
||||
depth_size = 24;
|
||||
|
|
|
|||
|
|
@ -65,14 +65,15 @@ update_framebuffer_state( struct st_context *st )
|
|||
if (strb) {
|
||||
strb = st_renderbuffer(strb->Base.Wrapped);
|
||||
assert(strb->surface);
|
||||
framebuffer.zbuf = strb->surface;
|
||||
framebuffer.zsbuf = strb->surface;
|
||||
}
|
||||
|
||||
strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
|
||||
if (strb) {
|
||||
strb = st_renderbuffer(strb->Base.Wrapped);
|
||||
assert(strb->surface);
|
||||
framebuffer.sbuf = strb->surface;
|
||||
else {
|
||||
strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
|
||||
if (strb) {
|
||||
strb = st_renderbuffer(strb->Base.Wrapped);
|
||||
assert(strb->surface);
|
||||
framebuffer.zsbuf = strb->surface;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: The memcmp is insufficient for eliminating redundant state changes,
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||
{
|
||||
struct st_context *st = ctx->st;
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct pipe_surface *ps = st->state.framebuffer.sbuf;
|
||||
struct pipe_surface *ps = st->state.framebuffer.zsbuf;
|
||||
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
|
||||
GLint skipPixels;
|
||||
ubyte *stmap;
|
||||
|
|
@ -940,13 +940,13 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||
st_validate_state(st);
|
||||
|
||||
if (format == GL_DEPTH_COMPONENT) {
|
||||
ps = st->state.framebuffer.zbuf;
|
||||
ps = st->state.framebuffer.zsbuf;
|
||||
stfp = make_fragment_shader_z(ctx->st);
|
||||
stvp = make_vertex_shader(ctx->st, GL_TRUE);
|
||||
color = ctx->Current.RasterColor;
|
||||
}
|
||||
else if (format == GL_STENCIL_INDEX) {
|
||||
ps = st->state.framebuffer.sbuf;
|
||||
ps = st->state.framebuffer.zsbuf;
|
||||
/* XXX special case - can't use texture map */
|
||||
color = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue