From 3c5bfac63bcbc4028c552fe74d904e6a3416ff36 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Jan 2003 04:49:07 +0000 Subject: [PATCH] initial code for render-to-texture --- src/mesa/drivers/x11/fakeglx.c | 37 +++++++++++++++++++++--- src/mesa/drivers/x11/glxapi.c | 53 ++++++++++++++++++++++++++++++++-- src/mesa/drivers/x11/glxapi.h | 11 +++++-- src/mesa/drivers/x11/realglx.c | 11 +++++-- 4 files changed, 100 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 3027c3bb60f..480bc0a5067 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.77 2002/11/18 15:11:49 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.78 2003/01/14 04:49:07 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -81,7 +81,8 @@ "GLX_EXT_visual_rating " \ "GLX_SGI_video_sync " \ "GLX_SGIX_fbconfig " \ - "GLX_SGIX_pbuffer" + "GLX_SGIX_pbuffer" \ + "GLX_ARB_render_texture" /* Silence compiler warnings */ @@ -2615,7 +2616,7 @@ Fake_glXSet3DfxModeMESA( int mode ) -/*** AGP memory allocation ***/ +/*** GLX_NV_vertex_array range ***/ static void * Fake_glXAllocateMemoryNV( GLsizei size, GLfloat readFrequency, @@ -2637,7 +2638,7 @@ Fake_glXFreeMemoryNV( GLvoid *pointer ) } -/*** GLX_MESA_agp_offset */ +/*** GLX_MESA_agp_offset ***/ static GLuint Fake_glXGetAGPOffsetMESA( const GLvoid *pointer ) @@ -2647,6 +2648,29 @@ Fake_glXGetAGPOffsetMESA( const GLvoid *pointer ) } +/*** GLX_ARB_render_texture ***/ + +static Bool +Fake_glXBindTexImageARB( Display *dpy, GLXPbuffer pbuffer, int buffer ) +{ + return False; +} + + +static Bool +Fake_glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer ) +{ + return False; +} + + +static Bool +Fake_glXDrawableAttribARB( Display *dpy, GLXDrawable draw, const int *attribList ) +{ + return False; +} + + extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) @@ -2792,5 +2816,10 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) /*** GLX_MESA_agp_offset ***/ glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA; + /*** GLX_ARB_render_texture ***/ + glx.BindTexImageARB = Fake_glXBindTexImageARB; + glx.ReleaseTexImageARB = Fake_glXReleaseTexImageARB; + glx.DrawableAttribARB = Fake_glXDrawableAttribARB; + return &glx; } diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 81170a7ef36..25653f8f6f2 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -1,4 +1,4 @@ -/* $Id: glxapi.c,v 1.31 2002/11/18 15:11:52 brianp Exp $ */ +/* $Id: glxapi.c,v 1.32 2003/01/14 04:49:07 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -988,7 +988,6 @@ Bool glXSet3DfxModeMESA(int mode) - /*** GLX_NV_vertex_array_range ***/ void * @@ -1032,6 +1031,42 @@ glXGetAGPOffsetMESA( const GLvoid *pointer ) } +/*** GLX_ARB_render_Texture ***/ + +Bool +glXBindTexImageARB( Display *dpy, GLXPbuffer pbuffer, int buffer ) +{ + struct _glxapi_table *t; + GET_DISPATCH(dpy, t); + if (!t) + return False; + return (t->BindTexImageARB)(dpy, pbuffer, buffer); +} + + +Bool +glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer ) +{ + struct _glxapi_table *t; + GET_DISPATCH(dpy, t); + if (!t) + return False; + return (t->ReleaseTexImageARB)(dpy, pbuffer, buffer); +} + + +Bool +glXDrawableAttribARB( Display *dpy, GLXDrawable draw, const int *attribList ) +{ + struct _glxapi_table *t; + GET_DISPATCH(dpy, t); + if (!t) + return False; + return (t->DrawableAttribARB)(dpy, draw, attribList); +} + + + /**********************************************************************/ /* GLX API management functions */ /**********************************************************************/ @@ -1068,6 +1103,15 @@ _glxapi_get_extensions(void) #endif #ifdef GLX_MESA_set_3dfx_mode "GLX_MESA_set_3dfx_mode", +#endif +#ifdef GLX_SGIX_fbconfig + "GLX_SGIX_fbconfig", +#endif +#ifdef GLX_SGIX_pbuffer + "GLX_SGIX_pbuffer", +#endif +#ifdef GLX_ARB_render_texture + "GLX_ARB_render_texture", #endif NULL }; @@ -1248,6 +1292,11 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_MESA_agp_offset ***/ { "glXGetAGPOffsetMESA", (GLvoid *) glXGetAGPOffsetMESA }, + /*** GLX_ARB_render_texture ***/ + { "glXBindTexImageARB", (GLvoid *) glXBindTexImageARB }, + { "glXReleaseTexImageARB", (GLvoid *) glXReleaseTexImageARB }, + { "glXDrawableAttribARB", (GLvoid *) glXDrawableAttribARB }, + { NULL, NULL } /* end of list */ }; diff --git a/src/mesa/drivers/x11/glxapi.h b/src/mesa/drivers/x11/glxapi.h index 2bb2ff5208d..2090d02d75d 100644 --- a/src/mesa/drivers/x11/glxapi.h +++ b/src/mesa/drivers/x11/glxapi.h @@ -1,10 +1,10 @@ -/* $Id: glxapi.h,v 1.14 2002/10/08 23:16:26 brianp Exp $ */ +/* $Id: glxapi.h,v 1.15 2003/01/14 04:49:07 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 5.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -205,6 +205,11 @@ struct _glxapi_table { /*** GLX_MESA_agp_offset ***/ GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer ); + + /*** GLX_ARB_render_texture ***/ + Bool (*BindTexImageARB)(Display *dpy, GLXPbuffer pbuffer, int buffer); + Bool (*ReleaseTexImageARB)(Display *dpy, GLXPbuffer pbuffer, int buffer); + Bool (*DrawableAttribARB)(Display *dpy, GLXDrawable draw, const int *attribList); }; diff --git a/src/mesa/drivers/x11/realglx.c b/src/mesa/drivers/x11/realglx.c index 74998433665..8ce9720a8b3 100644 --- a/src/mesa/drivers/x11/realglx.c +++ b/src/mesa/drivers/x11/realglx.c @@ -1,10 +1,10 @@ -/* $Id: realglx.c,v 1.6 2002/10/08 23:16:27 brianp Exp $ */ +/* $Id: realglx.c,v 1.7 2003/01/14 04:49:07 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -177,5 +177,10 @@ _real_GetGLXDispatchTable(void) /*** GLX_MESA_agp_offset ***/ glx.GetAGPOffsetMESA = _real_glXGetAGPOffsetMESA; + /*** GLX_ARB_render_texture ***/ + glx.BindTexImageARB = _real_glXBindTexImageARB; + glx.ReleaseTexImageARB = _real_glXReleaseTexImageARB; + glx.DrawableAttribARB = _real_glXDrawableAttribARB; + return &glx; } -- 2.30.2