- if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
- static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
- struct pipe_surface *ps = softpipe->framebuffer.zsbuf;
+ if (zs_buffers &&
+ util_format_is_depth_and_stencil(zsbuf->texture->format) &&
+ zs_buffers != PIPE_CLEAR_DEPTHSTENCIL) {
+ /* Clearing only depth or stencil in a combined depth-stencil buffer. */
+ util_clear_depth_stencil(pipe, zsbuf, zs_buffers, depth, stencil,
+ 0, 0, zsbuf->width, zsbuf->height);
+ }
+ else if (zs_buffers) {
+ static const union pipe_color_union zero;