boolean have_depth = FALSE;
int i, count;
- buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
- &dri_drawable->w,
- &dri_drawable->h,
- drawable->attachments,
- drawable->
- num_attachments, &count,
- dri_drawable->
- loaderPrivate);
+ if ((dri_screen->dri2.loader
+ && (dri_screen->dri2.loader->base.version > 2)
+ && (dri_screen->dri2.loader->getBuffersWithFormat != NULL)))
+ buffers = (*dri_screen->dri2.loader->getBuffersWithFormat)
+ (dri_drawable, &dri_drawable->w, &dri_drawable->h,
+ drawable->attachments, drawable->num_attachments,
+ &count, dri_drawable->loaderPrivate);
+ else
+ buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
+ &dri_drawable->w,
+ &dri_drawable->h,
+ drawable->attachments,
+ drawable->
+ num_attachments, &count,
+ dri_drawable->
+ loaderPrivate);
if (buffers == NULL) {
return;
case 24:
if (visual->stencilBits == 0) {
drawable->depth_stencil_format = (screen->d_depth_bits_last) ?
- PIPE_FORMAT_X8Z24_UNORM:
- PIPE_FORMAT_Z24X8_UNORM;
+ PIPE_FORMAT_X8Z24_UNORM:
+ PIPE_FORMAT_Z24X8_UNORM;
} else {
drawable->depth_stencil_format = (screen->sd_depth_bits_last) ?
- PIPE_FORMAT_S8Z24_UNORM:
- PIPE_FORMAT_Z24S8_UNORM;
+ PIPE_FORMAT_S8Z24_UNORM:
+ PIPE_FORMAT_Z24S8_UNORM;
}
break;
case 32:
/* setup dri2 buffers information */
/* TODO incase of double buffer visual, delay fake creation */
i = 0;
- drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
- if (!screen->auto_fake_front)
- drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
- if (visual->doubleBufferMode)
- drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
- if (visual->depthBits && visual->stencilBits)
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
- else if (visual->depthBits)
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
- else if (visual->stencilBits)
- drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
- drawable->num_attachments = i;
+ if (sPriv->dri2.loader
+ && (sPriv->dri2.loader->base.version > 2)
+ && (sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
+ drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+ drawable->attachments[i++] = visual->rgbBits;
+ if (!screen->auto_fake_front) {
+ drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
+ drawable->attachments[i++] = visual->rgbBits;
+ }
+ if (visual->doubleBufferMode) {
+ drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ drawable->attachments[i++] = visual->rgbBits;
+ }
+ if (visual->depthBits && visual->stencilBits) {
+ drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
+ drawable->attachments[i++] = visual->depthBits + visual->stencilBits;
+ } else if (visual->depthBits) {
+ drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
+ drawable->attachments[i++] = visual->depthBits;
+ } else if (visual->stencilBits) {
+ drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
+ drawable->attachments[i++] = visual->stencilBits;
+ }
+ drawable->num_attachments = i / 2;
+ } else {
+ drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+ if (!screen->auto_fake_front)
+ drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
+ if (visual->doubleBufferMode)
+ drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
+ if (visual->depthBits && visual->stencilBits)
+ drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
+ else if (visual->depthBits)
+ drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
+ else if (visual->stencilBits)
+ drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
+ drawable->num_attachments = i;
+ }
drawable->desired_fences = 2;
return GL_TRUE;
- fail:
+fail:
FREE(drawable);
return GL_FALSE;
}
pipe_texture_reference(&tex, exa_priv->depth_stencil_tex);
else {
struct pipe_texture template;
+ unsigned depthBits = (format != 0) ? format : pDraw->depth;
memset(&template, 0, sizeof(template));
template.target = PIPE_TEXTURE_2D;
- if (buffer->attachment == DRI2BufferDepth)
- template.format = ms->ds_depth_bits_last ?
- PIPE_FORMAT_X8Z24_UNORM : PIPE_FORMAT_Z24X8_UNORM;
- else
- template.format = ms->ds_depth_bits_last ?
- PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
+ if (buffer->attachment == DRI2BufferDepth) {
+ switch(depthBits) {
+ case 16:
+ template.format = PIPE_FORMAT_Z16_UNORM;
+ break;
+ case 32:
+ template.format = PIPE_FORMAT_Z32_UNORM;
+ break;
+ default:
+ template.format = ms->ds_depth_bits_last ?
+ PIPE_FORMAT_X8Z24_UNORM : PIPE_FORMAT_Z24X8_UNORM;
+ break;
+ }
+ } else {
+ template.format = ms->ds_depth_bits_last ?
+ PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM;
+ }
template.width0 = pDraw->width;
template.height0 = pDraw->height;
template.depth0 = 1;