*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 {
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);
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 */
*/
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));
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 */
};
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
}
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);
}
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);
}
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]);
*/
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();
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];
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.
*
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 );
}
}
{
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;
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 */
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;
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? */
sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf);
}
}
+#endif
sp->dirty |= SP_NEW_FRAMEBUFFER;
}
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;
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??? */
}
* 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;
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,
{
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;
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;
}