summaryrefslogtreecommitdiff
path: root/src/glx/x11/singlepix.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2006-10-11 22:37:14 +0000
committerIan Romanick <idr@us.ibm.com>2006-10-11 22:37:14 +0000
commitf3f51bc844c8749250724d164722402cb9a07dc7 (patch)
tree68ccc40931c2d10f7a521d531609aeeb5b1637f9 /src/glx/x11/singlepix.c
parent8a5871a98c23ce1a1d893b681f59dc8c42228dd1 (diff)
Fix bug #4681.
glDeleteTextures and glDeleteTexturesEXT were erroneously listed as aliases of each other. For anything /except/ GLX protocol they are aliases. This set of changes allows functions that are functionally identical but have different GLX protocol to be listed as aliases. When building with GLX_INDIRECT_RENDERING set, different static functions are used. These functions determine whether the current context is direct rendering or not. If the context is direct rendering, the aliased function (e.g., glDeleteTextures in the case of glDeleteTexturesEXT) is called. If the context is not direct rendering, the correct GLX protocol is sent. For a deeper explanation of what is changed, please see: http://dri.freedesktop.org/wiki/PartiallyAliasedFunctions
Diffstat (limited to 'src/glx/x11/singlepix.c')
-rw-r--r--src/glx/x11/singlepix.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/glx/x11/singlepix.c b/src/glx/x11/singlepix.c
index 4a10083b8f..5eeb4cedab 100644
--- a/src/glx/x11/singlepix.c
+++ b/src/glx/x11/singlepix.c
@@ -36,6 +36,10 @@
#include "packsingle.h"
#include "indirect.h"
+#include "dispatch.h"
+#include "glthread.h"
+#include "glapioffsets.h"
+#include <GL/glxproto.h>
void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span)
@@ -103,3 +107,85 @@ void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
__GLX_SINGLE_END();
}
+
+
+#define CONCAT(a,b) a ## b
+#define NAME(o) CONCAT(gl_dispatch_stub_, o)
+
+void NAME(_gloffset_GetSeparableFilter)(GLenum target, GLenum format, GLenum type,
+ GLvoid *row, GLvoid *column, GLvoid *span)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+
+ if (gc->isDirect) {
+ CALL_GetSeparableFilter(GET_DISPATCH(),
+ (target, format, type, row, column, span));
+ return;
+ }
+ else {
+ Display *const dpy = gc->currentDpy;
+ const GLuint cmdlen = __GLX_PAD(13);
+
+ if (dpy != NULL) {
+ const __GLXattribute * const state = gc->client_state_private;
+ xGLXGetSeparableFilterReply reply;
+ GLubyte const *pc =
+ __glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
+ X_GLvop_GetSeparableFilterEXT, cmdlen);
+ unsigned compsize;
+
+
+ (void) memcpy((void *) (pc + 0), (void *) (&target), 4);
+ (void) memcpy((void *) (pc + 4), (void *) (&format), 4);
+ (void) memcpy((void *) (pc + 8), (void *) (&type), 4);
+ *(int8_t *) (pc + 12) = state->storePack.swapEndian;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ compsize = reply.length << 2;
+
+ if (compsize != 0) {
+ const GLint width = reply.width;
+ const GLint height = reply.height;
+ const GLint widthsize =
+ __glImageSize(width, 1, 1, format, type, 0);
+ const GLint heightsize =
+ __glImageSize(height, 1, 1, format, type, 0);
+ GLubyte * const buf =
+ (GLubyte*) Xmalloc((widthsize > heightsize) ? widthsize : heightsize);
+
+ if (buf == NULL) {
+ /* Throw data away */
+ _XEatData(dpy, compsize);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return;
+ } else {
+ int extra;
+
+ extra = 4 - (widthsize & 3);
+ _XRead(dpy, (char *)buf, widthsize);
+ if (extra < 4) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 1, width, 1, 1, format, type, buf,
+ row);
+
+ extra = 4 - (heightsize & 3);
+ _XRead(dpy, (char *)buf, heightsize);
+ if (extra < 4) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 1, height, 1, 1, format, type, buf,
+ column);
+
+ Xfree((char*) buf);
+ }
+ }
+ }
+ }
+}