#include "indirect.h"
#include "glxclient.h"
#include "indirect_size.h"
-#include "glapidispatch.h"
#include "glapi.h"
#include "glthread.h"
#include <GL/glxproto.h>
#define __GLX_PAD(n) (((n) + 3) & ~3)
-# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-# define FASTCALL __attribute__((fastcall))
-# else
-# define FASTCALL
-# endif
-# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define NOINLINE __attribute__((noinline))
-# else
-# define NOINLINE
-# endif
+#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#define FASTCALL __attribute__((fastcall))
+#else
+#define FASTCALL
+#endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define NOINLINE __attribute__((noinline))
+#else
+#define NOINLINE
+#endif
#ifndef __GNUC__
-# define __builtin_expect(x, y) x
+#define __builtin_expect(x, y) x
#endif
/* If the size and opcode values are known at compile-time, this will, on
}
NOINLINE void
-__glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
+__glXReadPixelReply(Display * dpy, struct glx_context *gc, unsigned max_dim,
GLint width, GLint height, GLint depth, GLenum format,
GLenum type, void *dest, GLboolean dimensions_in_reply)
{
#define X_GLXSingle 0
NOINLINE FASTCALL GLubyte *
-__glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen)
+__glXSetupSingleRequest(struct glx_context *gc, GLint sop, GLint cmdlen)
{
xGLXSingleReq *req;
Display *const dpy = gc->currentDpy;
}
NOINLINE FASTCALL GLubyte *
-__glXSetupVendorRequest(struct glx_context * gc, GLint code, GLint vop,
+__glXSetupVendorRequest(struct glx_context *gc, GLint code, GLint vop,
GLint cmdlen)
{
xGLXVendorPrivateReq *req;
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
+ GET_DISPATCH()->DeleteTextures(n, textures);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GenTextures(GET_DISPATCH(), (n, textures));
+ GET_DISPATCH()->GenTextures(n, textures);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- return CALL_IsTexture(GET_DISPATCH(), (texture));
+ return GET_DISPATCH()->IsTexture(texture);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
+ GET_DISPATCH()->GetColorTable(target, format, type, table);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetColorTableParameterfv(GET_DISPATCH(),
- (target, pname, params));
+ GET_DISPATCH()->GetColorTableParameterfv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetColorTableParameteriv(GET_DISPATCH(),
- (target, pname, params));
+ GET_DISPATCH()->GetColorTableParameteriv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetConvolutionFilter(GET_DISPATCH(),
- (target, format, type, image));
+ GET_DISPATCH()->GetConvolutionFilter(target, format, type, image);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetConvolutionParameterfv(GET_DISPATCH(),
- (target, pname, params));
+ GET_DISPATCH()->GetConvolutionParameterfv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetConvolutionParameteriv(GET_DISPATCH(),
- (target, pname, params));
+ GET_DISPATCH()->GetConvolutionParameteriv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetHistogram(GET_DISPATCH(),
- (target, reset, format, type, values));
+ GET_DISPATCH()->GetHistogram(target, reset, format, type, values);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
+ GET_DISPATCH()->GetHistogramParameterfv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
+ GET_DISPATCH()->GetHistogramParameteriv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
+ GET_DISPATCH()->GetMinmax(target, reset, format, type, values);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
+ GET_DISPATCH()->GetMinmaxParameterfv(target, pname, params);
} else
#endif
{
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
if (gc->isDirect) {
- CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
+ GET_DISPATCH()->GetMinmaxParameteriv(target, pname, params);
} else
#endif
{
}
}
+#define X_GLrop_ClampColorARB 234
+void
+__indirect_glClampColorARB(GLenum target, GLenum clamp)
+{
+ struct glx_context *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 12;
+ emit_header(gc->pc, X_GLrop_ClampColorARB, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&clamp), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
#define X_GLrop_RenderbufferStorageMultisample 4331
void
__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples,
#define X_GLrop_ProgramParameters4dvNV 4187
void
-__indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
+__indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLsizei num,
const GLdouble * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
#define X_GLrop_ProgramParameters4fvNV 4186
void
-__indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num,
+__indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLsizei num,
const GLfloat * params)
{
struct glx_context *const gc = __glXGetCurrentContext();
}
-# undef FASTCALL
-# undef NOINLINE
+#ifdef GLX_SHARED_GLAPI
+
+static const struct proc_pair {
+ const char *name;
+ _glapi_proc proc;
+} proc_pairs[20] = {
+ {
+ "AreTexturesResidentEXT", (_glapi_proc) glAreTexturesResidentEXT}, {
+ "DeleteTexturesEXT", (_glapi_proc) glDeleteTexturesEXT}, {
+ "GenTexturesEXT", (_glapi_proc) glGenTexturesEXT}, {
+ "GetColorTableEXT", (_glapi_proc) glGetColorTableEXT}, {
+ "GetColorTableParameterfvEXT",
+ (_glapi_proc) glGetColorTableParameterfvEXT}, {
+ "GetColorTableParameterfvSGI",
+ (_glapi_proc) glGetColorTableParameterfvEXT}, {
+ "GetColorTableParameterivEXT",
+ (_glapi_proc) glGetColorTableParameterivEXT}, {
+ "GetColorTableParameterivSGI",
+ (_glapi_proc) glGetColorTableParameterivEXT}, {
+ "GetColorTableSGI", (_glapi_proc) glGetColorTableEXT}, {
+ "GetConvolutionFilterEXT", (_glapi_proc) gl_dispatch_stub_356}, {
+ "GetConvolutionParameterfvEXT", (_glapi_proc) gl_dispatch_stub_357}, {
+ "GetConvolutionParameterivEXT", (_glapi_proc) gl_dispatch_stub_358}, {
+ "GetHistogramEXT", (_glapi_proc) gl_dispatch_stub_361}, {
+ "GetHistogramParameterfvEXT", (_glapi_proc) gl_dispatch_stub_362}, {
+ "GetHistogramParameterivEXT", (_glapi_proc) gl_dispatch_stub_363}, {
+ "GetMinmaxEXT", (_glapi_proc) gl_dispatch_stub_364}, {
+ "GetMinmaxParameterfvEXT", (_glapi_proc) gl_dispatch_stub_365}, {
+ "GetMinmaxParameterivEXT", (_glapi_proc) gl_dispatch_stub_366}, {
+ "GetSeparableFilterEXT", (_glapi_proc) gl_dispatch_stub_359}, {
+ "IsTextureEXT", (_glapi_proc) glIsTextureEXT}
+};
+
+static int
+__indirect_get_proc_compare(const void *key, const void *memb)
+{
+ const struct proc_pair *pair = (const struct proc_pair *) memb;
+ return strcmp((const char *) key, pair->name);
+}
+
+_glapi_proc
+__indirect_get_proc_address(const char *name)
+{
+ const struct proc_pair *pair;
+
+ /* skip "gl" */
+ name += 2;
+
+ pair = (const struct proc_pair *) bsearch((const void *) name,
+ (const void *) proc_pairs,
+ ARRAY_SIZE(proc_pairs),
+ sizeof(proc_pairs[0]),
+ __indirect_get_proc_compare);
+
+ return (pair) ? pair->proc : NULL;
+}
+
+#endif /* GLX_SHARED_GLAPI */
+
+
+#undef FASTCALL
+#undef NOINLINE