summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-23 15:45:52 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-23 15:45:52 -0700
commit8de2331e432e2ea6f978acb6c80666da99c6c4a1 (patch)
tree24d24901a45854fa3f5e37739ef6b4c6b8f784c5 /src
parent1cf3c77e086d3f8b01921aae9b7309aa62b3d15e (diff)
gallium: remove support for separate depth/stencil buffers. Always combined now.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/i915simple/i915_state_emit.c15
-rw-r--r--src/mesa/pipe/i965simple/brw_misc_state.c2
-rw-r--r--src/mesa/pipe/p_state.h3
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c11
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c19
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h6
-rw-r--r--src/mesa/pipe/softpipe/sp_flush.c7
-rw-r--r--src/mesa/pipe/softpipe/sp_quad.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stencil.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c10
-rw-r--r--src/mesa/pipe/xlib/fakeglx.c8
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c15
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c6
14 files changed, 46 insertions, 68 deletions
diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c
index 09bf1fa2d6..8598eacc9c 100644
--- a/src/mesa/pipe/i915simple/i915_state_emit.c
+++ b/src/mesa/pipe/i915simple/i915_state_emit.c
@@ -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 */
diff --git a/src/mesa/pipe/i965simple/brw_misc_state.c b/src/mesa/pipe/i965simple/brw_misc_state.c
index 13b3b1671d..3b7f36dd1d 100644
--- a/src/mesa/pipe/i965simple/brw_misc_state.c
+++ b/src/mesa/pipe/i965simple/brw_misc_state.c
@@ -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));
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 46328d2a8f..146a479cf3 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -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 */
};
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index 5b3857145d..571f64b38d 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -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
}
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 81436c6d79..8dadd9aa74 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -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();
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 4ce0410075..daf7dd5acc 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -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];
diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/mesa/pipe/softpipe/sp_flush.c
index 47b11803ce..ec6bb4a0dc 100644
--- a/src/mesa/pipe/softpipe/sp_flush.c
+++ b/src/mesa/pipe/softpipe/sp_flush.c
@@ -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.
*
diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c
index a10c9c3e02..6bd468a51c 100644
--- a/src/mesa/pipe/softpipe/sp_quad.c
+++ b/src/mesa/pipe/softpipe/sp_quad.c
@@ -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;
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index 1b8a2960af..a9a0754f27 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -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 */
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c
index 33740883d3..92a0da0083 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c
@@ -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;
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index 4a9a28cc4d..e2c6893e9f 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -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;
}
diff --git a/src/mesa/pipe/xlib/fakeglx.c b/src/mesa/pipe/xlib/fakeglx.c
index 6965ee0794..902a755075 100644
--- a/src/mesa/pipe/xlib/fakeglx.c
+++ b/src/mesa/pipe/xlib/fakeglx.c
@@ -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;
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index aec51f5eed..3e58d49f1f 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -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,
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index eaa88d3c6c..6b44cba2e4 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -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;
}