#include "main/teximage.h"
#include "main/texstate.h"
#include "main/texfetch.h"
-#include "main/fbobject.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "st_texture.h"
struct pipe_fence_handle **fence);
/**
+ * Cast wrapper to convert a GLframebuffer to an st_framebuffer.
+ * Return NULL if the GLframebuffer is a user-created framebuffer.
+ * We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
static INLINE struct st_framebuffer *
-st_framebuffer(GLframebuffer *fb)
+st_ws_framebuffer(GLframebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
}
if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
- mode->haveDepthBuffer = GL_TRUE;
- mode->haveStencilBuffer = GL_TRUE;
-
mode->depthBits =
util_format_get_component_bits(visual->depth_stencil_format,
UTIL_FORMAT_COLORSPACE_ZS, 0);
mode->stencilBits =
util_format_get_component_bits(visual->depth_stencil_format,
UTIL_FORMAT_COLORSPACE_ZS, 1);
+
+ mode->haveDepthBuffer = mode->depthBits > 0;
+ mode->haveStencilBuffer = mode->stencilBits > 0;
}
if (visual->accum_format != PIPE_FORMAT_NONE) {
struct st_framebuffer *stfb;
/* either draw or read winsys fb */
- stfb = st_framebuffer(st->ctx->WinSysDrawBuffer);
+ stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
if (!stfb || stfb->iface != stfbi)
- stfb = st_framebuffer(st->ctx->WinSysReadBuffer);
+ stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
assert(stfb && stfb->iface == stfbi);
p_atomic_set(&stfb->revalidate, TRUE);
if (st) {
/* reuse/create the draw fb */
- stfb = st_framebuffer(st->ctx->WinSysDrawBuffer);
+ stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
if (stfb && stfb->iface == stdrawi) {
stdraw = NULL;
st_framebuffer_reference(&stdraw, stfb);
}
/* reuse/create the read fb */
- stfb = st_framebuffer(st->ctx->WinSysReadBuffer);
+ stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
if (!stfb || stfb->iface != streadi)
stfb = stdraw;
if (stfb && stfb->iface == streadi) {
void
st_manager_flush_frontbuffer(struct st_context *st)
{
- struct st_framebuffer *stfb = st_framebuffer(st->ctx->DrawBuffer);
+ struct st_framebuffer *stfb = st_ws_framebuffer(st->ctx->DrawBuffer);
struct st_renderbuffer *strb = NULL;
if (stfb)
void
st_manager_validate_framebuffers(struct st_context *st)
{
- struct st_framebuffer *stdraw = st_framebuffer(st->ctx->DrawBuffer);
- struct st_framebuffer *stread = st_framebuffer(st->ctx->ReadBuffer);
+ struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
+ struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer);
/* st_public.h */
if ((stdraw && !stdraw->iface) || (stread && !stread->iface)) {
st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
gl_buffer_index idx)
{
- struct st_framebuffer *stfb = st_framebuffer(fb);
+ struct st_framebuffer *stfb = st_ws_framebuffer(fb);
/* FBO or st_public.h */
if (!stfb || !stfb->iface)