diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 4e21e5012..339fbe04e 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -54,12 +54,14 @@ libglx_la_SOURCES = \ indirect_dispatch.c \ indirect_dispatch.h \ indirect_dispatch_swap.c \ + indirect_program.c \ indirect_reqsize.c \ indirect_reqsize.h \ indirect_size_get.c \ indirect_size_get.h \ indirect_table.c \ indirect_table.h \ + indirect_texture_compression.c \ indirect_util.c \ indirect_util.h \ render2.c \ diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 763e55ed7..43447a4e4 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -45,10 +45,12 @@ #include "glxutil.h" #include "glxext.h" -const char GLServerVersion[] = "1.2"; +const char GLServerVersion[] = "1.4"; static const char GLServerExtensions[] = "GL_ARB_depth_texture " "GL_ARB_draw_buffers " + "GL_ARB_fragment_program " + "GL_ARB_fragment_program_shadow " "GL_ARB_imaging " "GL_ARB_multisample " "GL_ARB_multitexture " @@ -58,6 +60,7 @@ static const char GLServerExtensions[] = "GL_ARB_shadow " "GL_ARB_shadow_ambient " "GL_ARB_texture_border_clamp " + "GL_ARB_texture_compression " "GL_ARB_texture_cube_map " "GL_ARB_texture_env_add " "GL_ARB_texture_env_combine " @@ -66,10 +69,12 @@ static const char GLServerExtensions[] = "GL_ARB_texture_mirrored_repeat " "GL_ARB_texture_non_power_of_two " "GL_ARB_transpose_matrix " + "GL_ARB_vertex_program " "GL_ARB_window_pos " "GL_EXT_abgr " "GL_EXT_bgra " "GL_EXT_blend_color " + "GL_EXT_blend_equation_separate " "GL_EXT_blend_func_separate " "GL_EXT_blend_logic_op " "GL_EXT_blend_minmax " @@ -94,16 +99,20 @@ static const char GLServerExtensions[] = "GL_EXT_subtexture " "GL_EXT_texture " "GL_EXT_texture3D " + "GL_EXT_texture_compression_dxt1 " + "GL_EXT_texture_compression_s3tc " "GL_EXT_texture_edge_clamp " "GL_EXT_texture_env_add " "GL_EXT_texture_env_combine " "GL_EXT_texture_env_dot3 " + "GL_EXT_texture_filter_ansiotropic " "GL_EXT_texture_lod " "GL_EXT_texture_lod_bias " "GL_EXT_texture_mirror_clamp " "GL_EXT_texture_object " "GL_EXT_texture_rectangle " "GL_EXT_vertex_array " + "GL_3DFX_texture_compression_FXT1 " "GL_APPLE_packed_pixels " "GL_ATI_draw_buffers " "GL_ATI_texture_env_combine3 " @@ -116,13 +125,23 @@ static const char GLServerExtensions[] = "GL_NV_blend_square " "GL_NV_depth_clamp " "GL_NV_fog_distance " + "GL_NV_fragment_program " + "GL_NV_fragment_program_option " + "GL_NV_fragment_program2 " "GL_NV_light_max_exponent " "GL_NV_multisample_filter_hint " "GL_NV_point_sprite " "GL_NV_texgen_reflection " + "GL_NV_texture_compression_vtc " "GL_NV_texture_env_combine4 " "GL_NV_texture_expand_normal " "GL_NV_texture_rectangle " + "GL_NV_vertex_program " + "GL_NV_vertex_program1_1 " + "GL_NV_vertex_program2 " + "GL_NV_vertex_program2_option " + "GL_NV_vertex_program3 " + "GL_OES_compressed_paletted_texture " "GL_SGI_color_matrix " "GL_SGI_color_table " "GL_SGIS_generate_mipmap " diff --git a/GL/glx/indirect_dispatch.c b/GL/glx/indirect_dispatch.c index 9c2b7b12b..04bb2049e 100644 --- a/GL/glx/indirect_dispatch.c +++ b/GL/glx/indirect_dispatch.c @@ -5466,6 +5466,14 @@ void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc) ) ); } +void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc) +{ + CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( + *(GLenum *)(pc + 0), + *(GLenum *)(pc + 4) + ) ); +} + void __glXDisp_BindFramebufferEXT(GLbyte * pc) { CALL_BindFramebufferEXT( GET_DISPATCH(), ( diff --git a/GL/glx/indirect_dispatch.h b/GL/glx/indirect_dispatch.h index a0da3e505..2a2fd27c6 100644 --- a/GL/glx/indirect_dispatch.h +++ b/GL/glx/indirect_dispatch.h @@ -73,6 +73,8 @@ extern HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc); extern HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc); extern HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc); extern HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc); +extern HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc); +extern HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc); extern HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN void __glXDisp_Color3uiv(GLbyte * pc); @@ -247,8 +249,6 @@ extern HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc); extern HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc); extern HIDDEN void __glXDisp_Color3usv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); -extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc); extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); @@ -891,6 +891,8 @@ extern HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc); +extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc); extern HIDDEN void __glXDisp_LoadName(GLbyte * pc); extern HIDDEN void __glXDispSwap_LoadName(GLbyte * pc); extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc); diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index 06c1d0363..9a06cceb4 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -5631,6 +5631,14 @@ void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc) ) ); } +void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc) +{ + CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( + (GLenum )bswap_ENUM ( pc + 0 ), + (GLenum )bswap_ENUM ( pc + 4 ) + ) ); +} + void __glXDispSwap_BindFramebufferEXT(GLbyte * pc) { CALL_BindFramebufferEXT( GET_DISPATCH(), ( diff --git a/GL/glx/indirect_program.c b/GL/glx/indirect_program.c new file mode 100644 index 000000000..d0fd3d135 --- /dev/null +++ b/GL/glx/indirect_program.c @@ -0,0 +1,163 @@ +/* + * (C) Copyright IBM Corporation 2005, 2006 + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file indirect_program.c + * Hand-coded routines needed to support programmable pipeline extensions. + * + * \author Ian Romanick + */ + +#define NEED_REPLIES +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "glxserver.h" +#include "glxext.h" +#include "singlesize.h" +#include "unpack.h" +#include "indirect_size_get.h" +#include "indirect_dispatch.h" +#include "glapitable.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" +#include "glapioffsets.h" + +#ifdef __linux__ +#include +#elif defined(__OpenBSD__) +#include +#define bswap_16 __swap16 +#define bswap_32 __swap32 +#define bswap_64 __swap64 +#else +#include +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 +#endif + +static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, + unsigned get_programiv_offset, unsigned get_program_string_offset, + Bool do_swap); + +/** + * Handle both types of glGetProgramString calls. + * + * This single function handles both \c glGetProgramStringARB and + * \c glGetProgramStringNV. The dispatch offsets for the functions to use + * for \c glGetProgramivARB and \c glGetProgramStringARB are passed in by the + * caller. These can be the offsets of either the ARB versions or the NV + * versions. + */ +int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, + unsigned get_programiv_offset, + unsigned get_program_string_offset, + Bool do_swap) +{ + xGLXVendorPrivateWithReplyReq * const req = + (xGLXVendorPrivateWithReplyReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, & error); + ClientPtr client = cl->client; + + + pc += __GLX_VENDPRIV_HDR_SIZE; + if (cx != NULL) { + GLenum target; + GLenum pname; + GLint compsize = 0; + char *answer = NULL, answerBuffer[200]; + + if (do_swap) { + target = (GLenum) bswap_32(*(int *)(pc + 0)); + pname = (GLenum) bswap_32(*(int *)(pc + 4)); + } + else { + target = *(GLenum *)(pc + 0); + pname = *(GLuint *)(pc + 4); + } + + /* The value of the GL_PROGRAM_LENGTH_ARB and GL_PROGRAM_LENGTH_NV + * enumerants is the same. + */ + CALL_by_offset(GET_DISPATCH(), + (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), + get_programiv_offset, + (target, GL_PROGRAM_LENGTH_ARB, &compsize)); + + if (compsize != 0) { + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + + CALL_by_offset(GET_DISPATCH(), + (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), + get_program_string_offset, + (target, pname, answer)); + } + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetTexImageReply *)&__glXReply)->width = compsize; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + error = Success; + } + + return error; +} + +int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB, + _gloffset_GetProgramStringARB, False); +} + + +int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + return DoGetProgramString(cl, pc, _gloffset_GetProgramivARB, + _gloffset_GetProgramStringARB, True); +} + + +int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV, + _gloffset_GetProgramStringNV, False); +} + + +int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + return DoGetProgramString(cl, pc, _gloffset_GetProgramivNV, + _gloffset_GetProgramStringNV, True); +} diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c index c16b29a89..6ca9a3505 100644 --- a/GL/glx/indirect_size_get.c +++ b/GL/glx/indirect_size_get.c @@ -609,6 +609,7 @@ __glGetBooleanv_size( GLenum e ) case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: /* case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:*/ case GL_MAX_TEXTURE_LOD_BIAS: + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: case GL_MAX_SHININESS_NV: case GL_MAX_SPOT_EXPONENT_NV: case GL_TEXTURE_CUBE_MAP: diff --git a/GL/glx/indirect_table.c b/GL/glx/indirect_table.c index 8671a8475..3e294ad5e 100644 --- a/GL/glx/indirect_table.c +++ b/GL/glx/indirect_table.c @@ -703,7 +703,7 @@ static const void *Render_function_table[384][2] = { /* [ 353] = 4225 */ {NULL, NULL}, /* [ 354] = 4226 */ {NULL, NULL}, /* [ 355] = 4227 */ {NULL, NULL}, - /* [ 356] = 4228 */ {NULL, NULL}, + /* [ 356] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT}, /* [ 357] = 4229 */ {NULL, NULL}, /* [ 358] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB}, /* [ 359] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB}, @@ -1090,7 +1090,7 @@ static const int_fast16_t Render_size_table[384][2] = { /* [353] = 4225 */ { 0, ~0}, /* [354] = 4226 */ { 0, ~0}, /* [355] = 4227 */ { 0, ~0}, - /* [356] = 4228 */ { 0, ~0}, + /* [356] = 4228 */ { 12, ~0}, /* [357] = 4229 */ { 0, ~0}, /* [358] = 4230 */ { 12, ~0}, /* [359] = 4231 */ { 24, ~0}, diff --git a/GL/glx/indirect_texture_compression.c b/GL/glx/indirect_texture_compression.c new file mode 100644 index 000000000..0c42ea034 --- /dev/null +++ b/GL/glx/indirect_texture_compression.c @@ -0,0 +1,133 @@ +/* + * (C) Copyright IBM Corporation 2005, 2006 + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#define NEED_REPLIES +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "glxserver.h" +#include "glxext.h" +#include "singlesize.h" +#include "unpack.h" +#include "indirect_size_get.h" +#include "indirect_dispatch.h" +#include "glapitable.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" + +#ifdef __linux__ +#include +#elif defined(__OpenBSD__) +#include +#define bswap_16 __swap16 +#define bswap_32 __swap32 +#define bswap_64 __swap64 +#else +#include +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 +#endif + +int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent( cl, req->contextTag, & error ); + ClientPtr client = cl->client; + + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = *(GLenum *)(pc + 0); + const GLint level = *(GLint *)(pc + 4); + GLint compsize = 0; + char *answer, answerBuffer[200]; + + CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); + + if ( compsize != 0 ) { + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + CALL_GetCompressedTexImageARB(GET_DISPATCH(), (target, level, answer)); + } + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetTexImageReply *)&__glXReply)->width = compsize; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + error = Success; + } + + return error; +} + + +int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) +{ + xGLXSingleReq * const req = (xGLXSingleReq *) pc; + int error; + __GLXcontext * const cx = __glXForceCurrent( cl, bswap_32( req->contextTag ), & error ); + ClientPtr client = cl->client; + + + pc += __GLX_SINGLE_HDR_SIZE; + if ( cx != NULL ) { + const GLenum target = (GLenum) bswap_32( *(int *)(pc + 0) ); + const GLint level = (GLint ) bswap_32( *(int *)(pc + 4) ); + GLint compsize = 0; + char *answer, answerBuffer[200]; + + CALL_GetTexLevelParameteriv(GET_DISPATCH(), (target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compsize)); + + if ( compsize != 0 ) { + __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); + __glXClearErrorOccured(); + CALL_GetCompressedTexImageARB(GET_DISPATCH(), (target, level, answer)); + } + + if (__glXErrorOccured()) { + __GLX_BEGIN_REPLY(0); + __GLX_SEND_HEADER(); + } else { + __GLX_BEGIN_REPLY(compsize); + ((xGLXGetTexImageReply *)&__glXReply)->width = compsize; + __GLX_SEND_HEADER(); + __GLX_SEND_VOID_ARRAY(compsize); + } + + error = Success; + } + + return error; +} diff --git a/GL/glx/single2.c b/GL/glx/single2.c index 357cd317e..3387af2a2 100644 --- a/GL/glx/single2.c +++ b/GL/glx/single2.c @@ -392,13 +392,3 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) { return DoGetString(cl, pc, GL_FALSE); } - -int __glXDisp_GetProgramStringARB(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -} - -int __glXDisp_GetProgramStringNV(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -} diff --git a/GL/glx/single2swap.c b/GL/glx/single2swap.c index 6d5e5ce0d..41a42bb0f 100644 --- a/GL/glx/single2swap.c +++ b/GL/glx/single2swap.c @@ -270,13 +270,3 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) { return DoGetString(cl, pc, GL_TRUE); } - -int __glXDispSwap_GetProgramStringARB(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -} - -int __glXDispSwap_GetProgramStringNV(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -} diff --git a/GL/glx/singlepix.c b/GL/glx/singlepix.c index 62588b0d0..3f76e5e62 100644 --- a/GL/glx/singlepix.c +++ b/GL/glx/singlepix.c @@ -515,8 +515,3 @@ int __glXDisp_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc) return Success; } - -int __glXDisp_GetCompressedTexImageARB(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -} diff --git a/GL/glx/singlepixswap.c b/GL/glx/singlepixswap.c index d5510b9c0..c2e06d13d 100644 --- a/GL/glx/singlepixswap.c +++ b/GL/glx/singlepixswap.c @@ -576,8 +576,3 @@ int __glXDispSwap_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc) return Success; } - -int __glXDispSwap_GetCompressedTexImageARB(__GLXclientState *cl, GLbyte *pc) -{ - return BadRequest; -}