diff options
author | Francisco Jerez <[email protected]> | 2010-02-03 03:21:04 -0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-02-03 08:30:09 -0700 |
commit | 2ec50d256d49ff3b987459ed42a5dc66f02a6b9d (patch) | |
tree | 6793b5d2593136120e5ee8716aaf20e52663f372 /src/mesa/main | |
parent | 64da2aeebc04a98c999e4dac9290999d03c1e3d5 (diff) |
mesa: Factor out the fb initialization details from _mesa_new_framebuffer.
This should make things easier for drivers wanting to work with a
"subclass" of gl_framebuffer.
The complementary "_mesa_initialize_framebuffer" function is now
called "_mesa_initialize_window_framebuffer" for the sake of
symmetry.
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/framebuffer.c | 41 | ||||
-rw-r--r-- | src/mesa/main/framebuffer.h | 6 |
2 files changed, 34 insertions, 13 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index d958dbf7d48..96e53443836 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -88,7 +88,7 @@ _mesa_create_framebuffer(const GLvisual *visual) struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer); assert(visual); if (fb) { - _mesa_initialize_framebuffer(fb, visual); + _mesa_initialize_window_framebuffer(fb, visual); } return fb; } @@ -109,15 +109,7 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name) assert(name != 0); fb = CALLOC_STRUCT(gl_framebuffer); if (fb) { - fb->Name = name; - fb->RefCount = 1; - fb->_NumColorDrawBuffers = 1; - fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT; - fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0; - fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT; - fb->_ColorReadBufferIndex = BUFFER_COLOR0; - fb->Delete = _mesa_destroy_framebuffer; - _glthread_INIT_MUTEX(fb->Mutex); + _mesa_initialize_user_framebuffer(fb, name); } return fb; } @@ -126,10 +118,11 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name) /** * Initialize a gl_framebuffer object. Typically used to initialize * window system-created framebuffers, not user-created framebuffers. - * \sa _mesa_create_framebuffer + * \sa _mesa_initialize_user_framebuffer */ void -_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual) +_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, + const GLvisual *visual) { assert(fb); assert(visual); @@ -167,6 +160,30 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual) /** + * Initialize a user-created gl_framebuffer object. + * \sa _mesa_initialize_window_framebuffer + */ +void +_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name) +{ + assert(fb); + assert(name); + + _mesa_bzero(fb, sizeof(struct gl_framebuffer)); + + fb->Name = name; + fb->RefCount = 1; + fb->_NumColorDrawBuffers = 1; + fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT; + fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0; + fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT; + fb->_ColorReadBufferIndex = BUFFER_COLOR0; + fb->Delete = _mesa_destroy_framebuffer; + _glthread_INIT_MUTEX(fb->Mutex); +} + + +/** * Deallocate buffer and everything attached to it. * Typically called via the gl_framebuffer->Delete() method. */ diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index ef21dd98e83..960513812cf 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -34,7 +34,11 @@ extern struct gl_framebuffer * _mesa_new_framebuffer(GLcontext *ctx, GLuint name); extern void -_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual); +_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, + const GLvisual *visual); + +extern void +_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name); extern void _mesa_destroy_framebuffer(struct gl_framebuffer *buffer); |