From d3fd7ba8af15bead2f770d68a893449adeb11397 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Jan 2004 02:49:27 +0000 Subject: Before calling _mesa_create_context(), initialize a dd_function_table struct by calling _mesa_init_driver_functions() and then plugging in the driver- specific functions. In particular, make sure ctx->Driver.NewTextureObject points to the appropriate driver function so that _all_ texture objects are augmented with the driver-specific data. Put in a bunch of assertions in the texture-related driver functions that texObj->DriverData is valid. Remove old dead code in near future. --- src/mesa/main/dd.h | 99 ++++++++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 59 deletions(-) (limited to 'src/mesa/main/dd.h') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index e9826abd6d..60b16db10f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -58,6 +58,9 @@ struct gl_pixelstore_attrib; * * Vertex transformation/clipping/lighting is patched into the T&L module. * Rasterization functions are patched into the swrast module. + * + * Note: when new functions are added here, the drivers/common/driverfuncs.c + * file should be updated too!!! */ struct dd_function_table { /** @@ -76,36 +79,6 @@ struct dd_function_table { */ void (*UpdateState)( GLcontext *ctx, GLuint new_state ); - /** - * Clear the color/depth/stencil/accum buffer(s). - * - * \param mask a bitmask of the DD_*_BIT values defined above that indicates - * which buffers need to be cleared. - * \param all if true then clear the whole buffer, else clear only the - * region defined by (x, y, width, height). - * - * This function must obey the glColorMask(), glIndexMask() and glStencilMask() - * settings! - * Software Mesa can do masked clears if the device driver can't. - */ - void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, - GLint x, GLint y, GLint width, GLint height ); - - /** - * Specify the current buffer for writing. - * - * Called via glDrawBuffer(). Note the driver must organize fallbacks (e.g. - * with swrast) if it cannot implement the requested mode. - */ - void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); - - /** - * Specifies the current buffer for reading. - * - * Called via glReadBuffer(). - */ - void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); - /** * Get the width and height of the named buffer/window. * @@ -122,6 +95,13 @@ struct dd_function_table { */ void (*ResizeBuffers)( GLframebuffer *buffer ); + /** + * Called whenever an error is generated. + * + * __GLcontextRec::ErrorValue contains the error value. + */ + void (*Error)( GLcontext *ctx ); + /** * This is called whenever glFinish() is called. */ @@ -133,11 +113,19 @@ struct dd_function_table { void (*Flush)( GLcontext *ctx ); /** - * Called whenever an error is generated. + * Clear the color/depth/stencil/accum buffer(s). * - * __GLcontextRec::ErrorValue contains the error value. + * \param mask a bitmask of the DD_*_BIT values defined above that indicates + * which buffers need to be cleared. + * \param all if true then clear the whole buffer, else clear only the + * region defined by (x, y, width, height). + * + * This function must obey the glColorMask(), glIndexMask() and + * glStencilMask() settings! + * Software Mesa can do masked clears if the device driver can't. */ - void (*Error)( GLcontext *ctx ); + void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ); /** @@ -504,24 +492,18 @@ struct dd_function_table { void (*BindTexture)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ); - /** - * Called when a texture object is created. - */ - void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); - /** * Called to allocate a new texture object. - * - * \note This function pointer should be initialized by drivers \e before - * calling _mesa_initialize_context() since context initialization involves - * allocating some texture objects! + * A new gl_texture_object should be returned. The driver should + * attach to it any device-specific info it needs. */ struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name, GLenum target ); /** * Called when a texture object is about to be deallocated. * - * Driver should free anything attached to the DriverData pointers. + * Driver should delete the gl_texture_object object and anything + * hanging off of it. */ void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); @@ -627,6 +609,8 @@ struct dd_function_table { void (*DepthMask)(GLcontext *ctx, GLboolean flag); /** Specify mapping of depth values from normalized device coordinates to window coordinates */ void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); + /** Specify the current buffer for writing */ + void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); /** Enable or disable server-side gl capabilities */ void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state); /** Specify fog parameters */ @@ -656,6 +640,8 @@ struct dd_function_table { void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); /** Set the polygon stippling pattern */ void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); + /* Specifies the current buffer for reading */ + void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); /** Set rasterization mode */ void (*RenderMode)(GLcontext *ctx, GLenum mode ); /** Define the scissor box */ @@ -708,6 +694,11 @@ struct dd_function_table { void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); + void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); + void (*UnlockArraysEXT)( GLcontext *ctx ); + /*@}*/ + + /*@}*/ @@ -846,6 +837,12 @@ struct dd_function_table { */ void (*LightingSpaceChange)( GLcontext *ctx ); + /** + * Let the T&L component know when the context becomes current. + */ + void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); + /** * Called by glNewList(). * @@ -874,22 +871,6 @@ struct dd_function_table { */ void (*EndCallList)( GLcontext *ctx ); - /** - * Let the T&L component know when the context becomes current. - */ - void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ); - - /** - * Called by glLockArraysEXT(). - */ - void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); - /** - * Called by UnlockArraysEXT(). - */ - void (*UnlockArraysEXT)( GLcontext *ctx ); - /*@}*/ - }; -- cgit v1.2.3