/* setup the hardware-based renderbuffers */
rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
if (mesaVis->doubleBufferMode) {
rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT,
- &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
}
/*
* attached to two attachment points.
*/
rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
}
else if (mesaVis->depthBits == 16) {
assert(mesaVis->stencilBits == 0);
rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
}
else {
assert(mesaVis->depthBits == 0);
/* setup the hardware-based renderbuffers */
rb = intel_create_renderbuffer(rgbFormat, num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
if (mesaVis->doubleBufferMode) {
rb = intel_create_renderbuffer(rgbFormat, num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
}
/*
if (screen->devinfo.has_hiz_and_separate_stencil) {
rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_X8_UINT,
num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
rb = intel_create_private_renderbuffer(MESA_FORMAT_S_UINT8,
num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL,
- &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
} else {
/*
* Use combined depth/stencil. Note that the renderbuffer is
*/
rb = intel_create_private_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT,
num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, &rb->Base.Base);
}
}
else if (mesaVis->depthBits == 16) {
assert(mesaVis->stencilBits == 0);
rb = intel_create_private_renderbuffer(MESA_FORMAT_Z_UNORM16,
num_samples);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, &rb->Base.Base);
}
else {
assert(mesaVis->depthBits == 0);
/* Front buffer. */
rb = nouveau_renderbuffer_dri_new(color_format, drawable);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, rb);
/* Back buffer */
if (visual->doubleBufferMode) {
rb = nouveau_renderbuffer_dri_new(color_format, drawable);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, rb);
}
/* Depth/stencil buffer. */
if (visual->depthBits == 24 && visual->stencilBits == 8) {
rb = nouveau_renderbuffer_dri_new(GL_DEPTH24_STENCIL8_EXT, drawable);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
+ _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, rb);
} else if (visual->depthBits == 24) {
rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT24, drawable);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
} else if (visual->depthBits == 16) {
rb = nouveau_renderbuffer_dri_new(GL_DEPTH_COMPONENT16, drawable);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
}
/* Software renderbuffers. */
/* front color renderbuffer */
rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
- _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_FRONT_LEFT, &rfb->color_rb[0]->base.Base);
+ _mesa_attach_and_own_rb(&rfb->base, BUFFER_FRONT_LEFT, &rfb->color_rb[0]->base.Base);
rfb->color_rb[0]->has_surface = 1;
/* back color renderbuffer */
if (mesaVis->doubleBufferMode) {
rfb->color_rb[1] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
- _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_BACK_LEFT, &rfb->color_rb[1]->base.Base);
+ _mesa_attach_and_own_rb(&rfb->base, BUFFER_BACK_LEFT, &rfb->color_rb[1]->base.Base);
rfb->color_rb[1]->has_surface = 1;
}
if (mesaVis->stencilBits == 8) {
struct radeon_renderbuffer *depthStencilRb =
radeon_create_renderbuffer(MESA_FORMAT_Z24_UNORM_S8_UINT, driDrawPriv);
- _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base.Base);
- _mesa_add_renderbuffer(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base.Base);
+ _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base.Base);
+ _mesa_attach_and_reference_rb(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base.Base);
depthStencilRb->has_surface = screen->depthHasSurface;
} else {
/* depth renderbuffer */
struct radeon_renderbuffer *depth =
radeon_create_renderbuffer(MESA_FORMAT_Z24_UNORM_X8_UINT, driDrawPriv);
- _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
+ _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
depth->has_surface = screen->depthHasSurface;
}
} else if (mesaVis->depthBits == 16) {
/* just 16-bit depth buffer, no hw stencil */
struct radeon_renderbuffer *depth =
radeon_create_renderbuffer(MESA_FORMAT_Z_UNORM16, driDrawPriv);
- _mesa_add_renderbuffer_without_ref(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
+ _mesa_attach_and_own_rb(&rfb->base, BUFFER_DEPTH, &depth->base.Base);
depth->has_surface = screen->depthHasSurface;
}
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(visual, dPriv, GL_TRUE);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_FRONT_LEFT,
- &frontrb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_FRONT_LEFT, &frontrb->Base.Base);
/* add back renderbuffer */
if (visual->doubleBufferMode) {
backrb = swrast_new_renderbuffer(visual, dPriv, GL_FALSE);
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_BACK_LEFT,
- &backrb->Base.Base);
+ _mesa_attach_and_own_rb(fb, BUFFER_BACK_LEFT, &backrb->Base.Base);
}
/* add software renderbuffers */
* There is no back color buffer.
* If the user tries to use a 8, 16 or 32-bit/channel buffer that
* doesn't match what Mesa was compiled for (CHAN_BITS) the
- * _mesa_add_renderbuffer() function will create a "wrapper" renderbuffer
- * that converts rendering from CHAN_BITS to the user-requested channel
- * size.
+ * _mesa_attach_and_reference_rb() function will create a "wrapper"
+ * renderbuffer that converts rendering from CHAN_BITS to the
+ * user-requested channel size.
*/
if (!osmesa->srb) {
osmesa->srb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
_mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
- _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
- &osmesa->srb->Base);
+ _mesa_attach_and_reference_rb(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
+ &osmesa->srb->Base);
assert(osmesa->srb->Base.RefCount == 2);
}
* renderbuffer adaptor/wrapper if needed (for bpp conversion).
*/
_mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
- _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
- &osmesa->srb->Base);
+ _mesa_attach_and_reference_rb(osmesa->gl_buffer, BUFFER_FRONT_LEFT,
+ &osmesa->srb->Base);
/* this updates the visual's red/green/blue/alphaBits fields */
b->frontxrb->Parent = b;
b->frontxrb->drawable = d;
b->frontxrb->pixmap = (XMesaPixmap) d;
- _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_FRONT_LEFT,
- &b->frontxrb->Base.Base);
+ _mesa_attach_and_own_rb(&b->mesa_buffer, BUFFER_FRONT_LEFT,
+ &b->frontxrb->Base.Base);
/*
* Back renderbuffer
/* determine back buffer implementation */
b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP;
- _mesa_add_renderbuffer_without_ref(&b->mesa_buffer, BUFFER_BACK_LEFT,
- &b->backxrb->Base.Base);
+ _mesa_attach_and_own_rb(&b->mesa_buffer, BUFFER_BACK_LEFT,
+ &b->backxrb->Base.Base);
}
/*
* used with a freshly created renderbuffer.
*/
void
-_mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
- gl_buffer_index bufferName,
- struct gl_renderbuffer *rb)
+_mesa_attach_and_own_rb(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName,
+ struct gl_renderbuffer *rb)
{
assert(rb->RefCount == 1);
* \param bufferName one of the BUFFER_x tokens
*/
void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- gl_buffer_index bufferName, struct gl_renderbuffer *rb)
+_mesa_attach_and_reference_rb(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName,
+ struct gl_renderbuffer *rb)
{
validate_and_init_renderbuffer_attachment(fb, bufferName, rb);
_mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer, rb);
_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
extern void
-_mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
- gl_buffer_index bufferName,
- struct gl_renderbuffer *rb);
+_mesa_attach_and_own_rb(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName,
+ struct gl_renderbuffer *rb);
extern void
-_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- gl_buffer_index bufferName, struct gl_renderbuffer *rb);
+_mesa_attach_and_reference_rb(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName,
+ struct gl_renderbuffer *rb);
extern void
_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
return FALSE;
if (idx != BUFFER_DEPTH) {
- _mesa_add_renderbuffer_without_ref(&stfb->Base, idx, rb);
+ _mesa_attach_and_own_rb(&stfb->Base, idx, rb);
return TRUE;
}
bool rb_ownership_taken = false;
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0)) {
- _mesa_add_renderbuffer_without_ref(&stfb->Base, BUFFER_DEPTH, rb);
+ _mesa_attach_and_own_rb(&stfb->Base, BUFFER_DEPTH, rb);
rb_ownership_taken = true;
}
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
if (rb_ownership_taken)
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, rb);
+ _mesa_attach_and_reference_rb(&stfb->Base, BUFFER_STENCIL, rb);
else
- _mesa_add_renderbuffer_without_ref(&stfb->Base, BUFFER_STENCIL, rb);
+ _mesa_attach_and_own_rb(&stfb->Base, BUFFER_STENCIL, rb);
}
return TRUE;
rb->InternalFormat = GL_RGBA;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, b, rb);
+ _mesa_attach_and_own_rb(fb, b, rb);
}
return GL_TRUE;
}
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
return GL_TRUE;
}
rb->InternalFormat = GL_STENCIL_INDEX8;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_STENCIL, rb);
return GL_TRUE;
}
rb->InternalFormat = GL_DEPTH_STENCIL;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_DEPTH, rb);
+ _mesa_attach_and_reference_rb(fb, BUFFER_STENCIL, rb);
return GL_TRUE;
}
rb->InternalFormat = GL_RGBA16_SNORM;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_ACCUM, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_ACCUM, rb);
return GL_TRUE;
}
rb->InternalFormat = GL_RGBA;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer_without_ref(fb, BUFFER_AUX0 + i, rb);
+ _mesa_attach_and_own_rb(fb, BUFFER_AUX0 + i, rb);
}
return GL_TRUE;
}