Enable vertex and fragment programs.
Implement glGetProgramStringARB and glGetProgramStringNV. With these functions implemented, GL_ARB_{vertex,fragment}_program, GL_NV_{vertex,fragment}_program, and related extensions can be enabled.
This commit is contained in:
parent
c33e39c86b
commit
e2d529963e
|
@ -54,6 +54,7 @@ libglx_la_SOURCES = \
|
||||||
indirect_dispatch.c \
|
indirect_dispatch.c \
|
||||||
indirect_dispatch.h \
|
indirect_dispatch.h \
|
||||||
indirect_dispatch_swap.c \
|
indirect_dispatch_swap.c \
|
||||||
|
indirect_program.c \
|
||||||
indirect_reqsize.c \
|
indirect_reqsize.c \
|
||||||
indirect_reqsize.h \
|
indirect_reqsize.h \
|
||||||
indirect_size_get.c \
|
indirect_size_get.c \
|
||||||
|
|
|
@ -49,6 +49,8 @@ const char GLServerVersion[] = "1.4";
|
||||||
static const char GLServerExtensions[] =
|
static const char GLServerExtensions[] =
|
||||||
"GL_ARB_depth_texture "
|
"GL_ARB_depth_texture "
|
||||||
"GL_ARB_draw_buffers "
|
"GL_ARB_draw_buffers "
|
||||||
|
"GL_ARB_fragment_program "
|
||||||
|
"GL_ARB_fragment_program_shadow "
|
||||||
"GL_ARB_imaging "
|
"GL_ARB_imaging "
|
||||||
"GL_ARB_multisample "
|
"GL_ARB_multisample "
|
||||||
"GL_ARB_multitexture "
|
"GL_ARB_multitexture "
|
||||||
|
@ -58,8 +60,8 @@ static const char GLServerExtensions[] =
|
||||||
"GL_ARB_shadow "
|
"GL_ARB_shadow "
|
||||||
"GL_ARB_shadow_ambient "
|
"GL_ARB_shadow_ambient "
|
||||||
"GL_ARB_texture_border_clamp "
|
"GL_ARB_texture_border_clamp "
|
||||||
"GL_ARB_texture_cube_map "
|
|
||||||
"GL_ARB_texture_compression "
|
"GL_ARB_texture_compression "
|
||||||
|
"GL_ARB_texture_cube_map "
|
||||||
"GL_ARB_texture_env_add "
|
"GL_ARB_texture_env_add "
|
||||||
"GL_ARB_texture_env_combine "
|
"GL_ARB_texture_env_combine "
|
||||||
"GL_ARB_texture_env_crossbar "
|
"GL_ARB_texture_env_crossbar "
|
||||||
|
@ -67,6 +69,7 @@ static const char GLServerExtensions[] =
|
||||||
"GL_ARB_texture_mirrored_repeat "
|
"GL_ARB_texture_mirrored_repeat "
|
||||||
"GL_ARB_texture_non_power_of_two "
|
"GL_ARB_texture_non_power_of_two "
|
||||||
"GL_ARB_transpose_matrix "
|
"GL_ARB_transpose_matrix "
|
||||||
|
"GL_ARB_vertex_program "
|
||||||
"GL_ARB_window_pos "
|
"GL_ARB_window_pos "
|
||||||
"GL_EXT_abgr "
|
"GL_EXT_abgr "
|
||||||
"GL_EXT_bgra "
|
"GL_EXT_bgra "
|
||||||
|
@ -120,6 +123,9 @@ static const char GLServerExtensions[] =
|
||||||
"GL_NV_blend_square "
|
"GL_NV_blend_square "
|
||||||
"GL_NV_depth_clamp "
|
"GL_NV_depth_clamp "
|
||||||
"GL_NV_fog_distance "
|
"GL_NV_fog_distance "
|
||||||
|
"GL_NV_fragment_program "
|
||||||
|
"GL_NV_fragment_program_option "
|
||||||
|
"GL_NV_fragment_program2 "
|
||||||
"GL_NV_light_max_exponent "
|
"GL_NV_light_max_exponent "
|
||||||
"GL_NV_multisample_filter_hint "
|
"GL_NV_multisample_filter_hint "
|
||||||
"GL_NV_point_sprite "
|
"GL_NV_point_sprite "
|
||||||
|
@ -128,6 +134,11 @@ static const char GLServerExtensions[] =
|
||||||
"GL_NV_texture_env_combine4 "
|
"GL_NV_texture_env_combine4 "
|
||||||
"GL_NV_texture_expand_normal "
|
"GL_NV_texture_expand_normal "
|
||||||
"GL_NV_texture_rectangle "
|
"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_OES_compressed_paletted_texture "
|
||||||
"GL_SGI_color_matrix "
|
"GL_SGI_color_matrix "
|
||||||
"GL_SGI_color_table "
|
"GL_SGI_color_table "
|
||||||
|
|
163
GL/glx/indirect_program.c
Normal file
163
GL/glx/indirect_program.c
Normal file
|
@ -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 <idr@us.ibm.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NEED_REPLIES
|
||||||
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
#include <dix-config.h>
|
||||||
|
#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 <byteswap.h>
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#define bswap_16 __swap16
|
||||||
|
#define bswap_32 __swap32
|
||||||
|
#define bswap_64 __swap64
|
||||||
|
#else
|
||||||
|
#include <sys/endian.h>
|
||||||
|
#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);
|
||||||
|
}
|
|
@ -392,13 +392,3 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
|
||||||
{
|
{
|
||||||
return DoGetString(cl, pc, GL_FALSE);
|
return DoGetString(cl, pc, GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __glXDisp_GetProgramStringARB(__GLXclientState *cl, GLbyte *pc)
|
|
||||||
{
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __glXDisp_GetProgramStringNV(__GLXclientState *cl, GLbyte *pc)
|
|
||||||
{
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
|
@ -270,13 +270,3 @@ int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc)
|
||||||
{
|
{
|
||||||
return DoGetString(cl, pc, GL_TRUE);
|
return DoGetString(cl, pc, GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __glXDispSwap_GetProgramStringARB(__GLXclientState *cl, GLbyte *pc)
|
|
||||||
{
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __glXDispSwap_GetProgramStringNV(__GLXclientState *cl, GLbyte *pc)
|
|
||||||
{
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user