_glapi_set_dispatch(newCtx->CurrentDispatch);
if (drawBuffer && readBuffer) {
- ASSERT(drawBuffer->Name == 0);
- ASSERT(readBuffer->Name == 0);
+ ASSERT(_mesa_is_winsys_fbo(drawBuffer));
+ ASSERT(_mesa_is_winsys_fbo(readBuffer));
_mesa_reference_framebuffer(&newCtx->WinSysDrawBuffer, drawBuffer);
_mesa_reference_framebuffer(&newCtx->WinSysReadBuffer, readBuffer);
* Only set the context's Draw/ReadBuffer fields if they're NULL
* or not bound to a user-created FBO.
*/
- if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
+ if (!newCtx->DrawBuffer || _mesa_is_winsys_fbo(newCtx->DrawBuffer)) {
_mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
/* Update the FBO's list of drawbuffers/renderbuffers.
* For winsys FBOs this comes from the GL state (which may have
*/
_mesa_update_draw_buffers(newCtx);
}
- if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
+ if (!newCtx->ReadBuffer || _mesa_is_winsys_fbo(newCtx->ReadBuffer)) {
_mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
}
#include "state.h"
#include "dispatch.h"
#include "glformats.h"
+#include "fbobject.h"
#if FEATURE_drawpix
goto end;
}
- if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+ if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
+ ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyPixels(multisample FBO)");
goto end;
GLuint newWidth, newHeight;
struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer;
- assert(buffer->Name == 0);
+ assert(_mesa_is_winsys_fbo(buffer));
/* ask device driver for size of output buffer */
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
GLuint newWidth, newHeight;
struct gl_framebuffer *buffer = ctx->WinSysReadBuffer;
- assert(buffer->Name == 0);
+ assert(_mesa_is_winsys_fbo(buffer));
/* ask device driver for size of read buffer */
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
if (!buffer)
return;
- if (buffer->Name) {
+ if (_mesa_is_user_fbo(buffer)) {
/* user-created framebuffer size depends on the renderbuffers */
update_framebuffer_size(ctx, buffer);
}
#include "pbo.h"
#include "state.h"
#include "glformats.h"
+#include "fbobject.h"
/**
}
}
- if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
+ if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
+ ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
return;
}
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
+#include "main/fbobject.h"
#include "prog_statevars.h"
#include "prog_parameter.h"
case STATE_FB_WPOS_Y_TRANSFORM:
/* A driver may negate this conditional by using ZW swizzle
* instead of XY (based on e.g. some other state). */
- if (ctx->DrawBuffer->Name != 0) {
+ if (_mesa_is_user_fbo(ctx->DrawBuffer)) {
/* Identity (XY) followed by flipping Y upside down (ZW). */
value[0] = 1.0F;
value[1] = 0.0F;
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
- return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
+ if (fb && _mesa_is_winsys_fbo(fb))
+ return (struct st_framebuffer *) fb;
+ return NULL;
}
static void st_viewport(struct gl_context * ctx, GLint x, GLint y,
#include "main/mtypes.h"
#include "pipe/p_state.h"
#include "state_tracker/st_api.h"
+#include "main/fbobject.h"
struct bitmap_cache;
struct blit_state;
static INLINE GLuint
st_fb_orientation(const struct gl_framebuffer *fb)
{
- if (fb && fb->Name == 0) {
+ if (fb && _mesa_is_winsys_fbo(fb)) {
/* Drawing into a window (on-screen buffer).
*
* Negate Y scale to flip image vertically.
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
- return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
+ if (fb && _mesa_is_winsys_fbo(fb))
+ return (struct st_framebuffer *) fb;
+ return NULL;
}
/**