return 0;
}
}
+
+
+/**
+ * Note: it's assumed that z is in [0,1] and s in [0,255]
+ */
+static INLINE uint
+util_pack_z_stencil(enum pipe_format format, double z, uint s)
+{
+ switch (format) {
+ case PIPE_FORMAT_S8Z24_UNORM:
+ return util_pack_z(format, z) | s << 24;
+ case PIPE_FORMAT_Z24S8_UNORM:
+ return util_pack_z(format, z) | s;
+ default:
+ debug_print_format("gallium: unhandled format in util_pack_z_stencil()",
+ format);
+ assert(0);
+ return 0;
+ }
+}
/**
}
else {
/* clear whole buffer w/out masking */
- GLuint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear);
-
- switch (strb->surface->format) {
- case PIPE_FORMAT_S8Z24_UNORM:
- clearValue |= ctx->Stencil.Clear << 24;
- break;
- case PIPE_FORMAT_Z24S8_UNORM:
- clearValue |= ctx->Stencil.Clear;
- break;
- default:
- assert(0);
- }
-
+ GLuint clearValue = util_pack_z_stencil(strb->surface->format,
+ ctx->Depth.Clear,
+ ctx->Stencil.Clear);
ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
}
}