summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-14 13:33:32 +1000
committerTimothy Arceri <[email protected]>2017-04-18 10:01:55 +1000
commita63919f848d5cc97b20bb5afc4a6b2111a491707 (patch)
treec6c7d144b452dba2ae204d7d9cc598234c6fd891 /src
parentd9d793696bf54e970491302605a1efd0aa182d1b (diff)
mesa: rename _mesa_add_renderbuffer* functions
These names make it easier to understand what is going on in regards to references. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c11
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c15
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c12
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c12
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c6
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c14
-rw-r--r--src/mesa/drivers/x11/xm_api.c8
-rw-r--r--src/mesa/main/renderbuffer.c11
-rw-r--r--src/mesa/main/renderbuffer.h11
-rw-r--r--src/mesa/state_tracker/st_manager.c8
-rw-r--r--src/mesa/swrast/s_renderbuffer.c14
11 files changed, 60 insertions, 62 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 7e17e95ee4c..cba5434b5e1 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -875,12 +875,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
/* 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);
}
/*
@@ -896,13 +895,13 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
* 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);
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 39e463d264d..34a5f18af23 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1162,11 +1162,11 @@ intelCreateBuffer(__DRIscreen *dri_screen,
/* 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);
}
/*
@@ -1180,11 +1180,10 @@ intelCreateBuffer(__DRIscreen *dri_screen,
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
@@ -1192,15 +1191,15 @@ intelCreateBuffer(__DRIscreen *dri_screen,
*/
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);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 2dbd9d13b67..375f640f3d0 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -259,27 +259,27 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
/* 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. */
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index fab2eeab6c9..79e388988a0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -677,13 +677,13 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
/* 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;
}
@@ -691,21 +691,21 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
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;
}
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index f43ac608cf2..de1fe4c918c 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -569,14 +569,12 @@ dri_create_buffer(__DRIscreen * sPriv,
/* 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 */
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 68fca3e6326..a3d4facdea0 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1020,15 +1020,15 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
* 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);
}
@@ -1051,8 +1051,8 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
* 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 */
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 5be8aa95de1..b54900b2aeb 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -311,8 +311,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
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
@@ -328,8 +328,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
/* 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);
}
/*
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index b58b3f3e913..5046f9d5f42 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -144,9 +144,9 @@ validate_and_init_renderbuffer_attachment(struct gl_framebuffer *fb,
* 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);
@@ -162,8 +162,9 @@ _mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
* \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);
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index a6f14394982..f9a6462d536 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -47,13 +47,14 @@ extern void
_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,
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index b9e46fd07e6..86a82c2374c 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -315,21 +315,21 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
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;
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index 940c7b710c8..66a823def32 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -274,7 +274,7 @@ add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
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;
@@ -320,7 +320,7 @@ add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
}
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;
}
@@ -358,7 +358,7 @@ add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
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;
}
@@ -382,8 +382,8 @@ add_depth_stencil_renderbuffer(struct gl_context *ctx,
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;
}
@@ -420,7 +420,7 @@ add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
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;
}
@@ -465,7 +465,7 @@ add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
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;
}