return reply.retval;
}
+static NOINLINE void
+read_pixel_reply( Display *dpy, __GLXcontext * gc, unsigned max_dim,
+ GLint width, GLint height, GLint depth, GLenum format, GLenum type,
+ void * dest, GLboolean dimensions_in_reply )
+{
+ xGLXSingleReply reply;
+ GLint size;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ if ( dimensions_in_reply ) {
+ width = reply.pad3;
+ height = reply.pad4;
+ depth = reply.pad5;
+
+ if ((height == 0) || (max_dim < 2)) { height = 1; }
+ if ((depth == 0) || (max_dim < 3)) { depth = 1; }
+ }
+
+ size = reply.length * 4;
+ if (size != 0) {
+ void * buf = Xmalloc( size );
+
+ if ( buf == NULL ) {
+ _XEatData(dpy, size);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ }
+ else {
+ const GLint extra = 4 - (size & 3);
+
+ _XRead(dpy, buf, size);
+ if ( extra < 4 ) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 3, width, height, depth, format, type,
+ buf, dest);
+ Xfree(buf);
+ }
+ }
+}
+
#define X_GLXSingle 0
static NOINLINE FASTCALL GLubyte *
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
}
+#define X_GLsop_ReadPixels 111
+void
+__indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 28;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_ReadPixels, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&x), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&y), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&width), 4);
+ (void) memcpy((void *)(pc + 12), (void *)(&height), 4);
+ (void) memcpy((void *)(pc + 16), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 20), (void *)(&type), 4);
+ *(int32_t *)(pc + 24) = 0;
+ * (int8_t *)(pc + 24) = state->storePack.swapEndian;
+ read_pixel_reply(dpy, gc, 2, width, height, 1, format, type, pixels, GL_FALSE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLrop_DrawPixels 173
void
__indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
return;
}
+#define X_GLsop_GetPolygonStipple 128
+void
+__indirect_glGetPolygonStipple(GLubyte * mask)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 4;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetPolygonStipple, cmdlen);
+ *(int32_t *)(pc + 0) = 0;
+ read_pixel_reply(dpy, gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask, GL_FALSE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetTexEnvfv 130
void
__indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params)
return;
}
+#define X_GLsop_GetTexImage 135
+void
+__indirect_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 20;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetTexImage, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&level), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 12), (void *)(&type), 4);
+ *(int32_t *)(pc + 16) = 0;
+ * (int8_t *)(pc + 16) = state->storePack.swapEndian;
+ read_pixel_reply(dpy, gc, 3, 0, 0, 0, format, type, pixels, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetTexParameterfv 136
void
__indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params)
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
}
+#define X_GLsop_GetColorTable 147
+void
+__indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid * table)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetColorTable, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&type), 4);
+ *(int32_t *)(pc + 12) = 0;
+ * (int8_t *)(pc + 12) = state->storePack.swapEndian;
+ read_pixel_reply(dpy, gc, 1, 0, 0, 0, format, type, table, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetColorTableParameterfv 148
void
__indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, GLfloat * params)
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
}
+#define X_GLsop_GetConvolutionFilter 150
+void
+__indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid * image)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetConvolutionFilter, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&type), 4);
+ *(int32_t *)(pc + 12) = 0;
+ * (int8_t *)(pc + 12) = state->storePack.swapEndian;
+ read_pixel_reply(dpy, gc, 2, 0, 0, 0, format, type, image, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetConvolutionParameterfv 151
void
__indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat * params)
return;
}
+#define X_GLsop_GetHistogram 154
+void
+__indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetHistogram, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&type), 4);
+ *(int32_t *)(pc + 12) = 0;
+ * (int8_t *)(pc + 12) = state->storePack.swapEndian;
+ * (int8_t *)(pc + 13) = reset;
+ read_pixel_reply(dpy, gc, 1, 0, 0, 0, format, type, values, GL_TRUE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetHistogramParameterfv 155
void
__indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, GLfloat * params)
return;
}
+#define X_GLsop_GetMinmax 157
+void
+__indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values)
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const __GLXattribute * const state = gc->client_state_private;
+ Display * const dpy = gc->currentDpy;
+ const GLuint cmdlen = 16;
+ if (__builtin_expect(dpy != NULL, 1)) {
+ GLubyte const * pc = setup_single_request(gc, X_GLsop_GetMinmax, cmdlen);
+ (void) memcpy((void *)(pc + 0), (void *)(&target), 4);
+ (void) memcpy((void *)(pc + 4), (void *)(&format), 4);
+ (void) memcpy((void *)(pc + 8), (void *)(&type), 4);
+ *(int32_t *)(pc + 12) = 0;
+ * (int8_t *)(pc + 12) = state->storePack.swapEndian;
+ * (int8_t *)(pc + 13) = reset;
+ read_pixel_reply(dpy, gc, 1, 2, 1, 1, format, type, values, GL_FALSE);
+ UnlockDisplay(dpy); SyncHandle();
+ }
+ return;
+}
+
#define X_GLsop_GetMinmaxParameterfv 158
void
__indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat * params)
#include "packsingle.h"
-void __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXReadPixelsReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_ReadPixels,__GLX_PAD(26));
- __GLX_SINGLE_PUT_LONG(0,x);
- __GLX_SINGLE_PUT_LONG(4,y);
- __GLX_SINGLE_PUT_LONG(8,width);
- __GLX_SINGLE_PUT_LONG(12,height);
- __GLX_SINGLE_PUT_LONG(16,format);
- __GLX_SINGLE_PUT_LONG(20,type);
- __GLX_SINGLE_PUT_CHAR(24,state->storePack.swapEndian);
- __GLX_SINGLE_PUT_CHAR(25,GL_FALSE);
- __GLX_SINGLE_READ_XREPLY();
- compsize = reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*) Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
- __glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occurred; don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
-
-void __indirect_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type,
- GLvoid *texels)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetTexImageReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetTexImage,__GLX_PAD(17));
- __GLX_SINGLE_PUT_LONG(0,target);
- __GLX_SINGLE_PUT_LONG(4,level);
- __GLX_SINGLE_PUT_LONG(8,format);
- __GLX_SINGLE_PUT_LONG(12,type);
- __GLX_SINGLE_PUT_CHAR(16,state->storePack.swapEndian);
- __GLX_SINGLE_READ_XREPLY();
- compsize = reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*) Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- GLint width, height, depth;
-
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- width = reply.width;
- height = reply.height;
- depth = reply.depth;
- __GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
- __glEmptyImage(gc, 2, width, height, depth, format, type, buf,
- texels);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occured, don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
-
-void __indirect_glGetPolygonStipple(GLubyte *mask)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- xGLXSingleReply reply;
- GLubyte buf[128];
-
- if (!dpy) return;
-
- __GLX_SINGLE_LOAD_VARIABLES();
- __GLX_SINGLE_BEGIN(X_GLsop_GetPolygonStipple,__GLX_PAD(1));
- __GLX_SINGLE_PUT_CHAR(0,GL_FALSE);
- __GLX_SINGLE_READ_XREPLY();
- if (reply.length == 32) {
- __GLX_SINGLE_GET_CHAR_ARRAY(buf,128);
- __glEmptyImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, buf, mask);
- }
- __GLX_SINGLE_END();
-}
-
-void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetColorTableReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetColorTable,__GLX_PAD(13));
- __GLX_SINGLE_PUT_LONG(0,(long)target);
- __GLX_SINGLE_PUT_LONG(4,(long)format);
- __GLX_SINGLE_PUT_LONG(8,(long)type);
- __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
- __GLX_SINGLE_READ_XREPLY();
- compsize = (long)reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*)Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- GLint width;
-
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- width = (int)reply.width;
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
- __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, table);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occured, don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
-
-void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
- GLvoid *image)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetConvolutionFilterReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13));
- __GLX_SINGLE_PUT_LONG(0,target);
- __GLX_SINGLE_PUT_LONG(4,format);
- __GLX_SINGLE_PUT_LONG(8,type);
- __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
- __GLX_SINGLE_READ_XREPLY();
- compsize = reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*) Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- GLint width, height;
-
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- width = reply.width;
- height = reply.height;
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize);
- __glEmptyImage(gc, 2, width, height, 1, format, type, buf, image);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occured, don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
-
void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span)
{
__GLX_SINGLE_END();
}
-
-void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
- GLenum type, GLvoid *values)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetHistogramReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14));
- __GLX_SINGLE_PUT_LONG(0,(long)target);
- __GLX_SINGLE_PUT_LONG(4,(long)format);
- __GLX_SINGLE_PUT_LONG(8,(long)type);
- __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
- __GLX_SINGLE_PUT_CHAR(13,reset);
- __GLX_SINGLE_READ_XREPLY();
- compsize = (long)reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*)Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- GLint width;
-
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- width = (int)reply.width;
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
- __glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occured, don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
-
-void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type,
- GLvoid *values)
-{
- __GLX_SINGLE_DECLARE_VARIABLES();
- const __GLXattribute * state;
- xGLXGetMinmaxReply reply;
- GLubyte *buf;
-
- if (!dpy) return;
- __GLX_SINGLE_LOAD_VARIABLES();
- state = gc->client_state_private;
-
- /* Send request */
- __GLX_SINGLE_BEGIN(X_GLsop_GetMinmax,__GLX_PAD(14));
- __GLX_SINGLE_PUT_LONG(0,(long)target);
- __GLX_SINGLE_PUT_LONG(4,(long)format);
- __GLX_SINGLE_PUT_LONG(8,(long)type);
- __GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
- __GLX_SINGLE_PUT_CHAR(13,reset);
- __GLX_SINGLE_READ_XREPLY();
- compsize = (long)reply.length << 2;
-
- if (compsize != 0) {
- /* Allocate a holding buffer to transform the data from */
- buf = (GLubyte*)Xmalloc(compsize);
- if (!buf) {
- /* Throw data away */
- _XEatData(dpy, compsize);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- } else {
- /*
- ** Fetch data into holding buffer. Apply pixel store pack modes
- ** to put data back into client memory
- */
- __GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
- __glEmptyImage(gc, 1, 2, 1, 1, format, type, buf, values);
- Xfree((char*) buf);
- }
- } else {
- /*
- ** GL error occured, don't modify user's buffer.
- */
- }
- __GLX_SINGLE_END();
-}
self.output = None
self.can_be_large = 0
self.reply_always_array = 0
+ self.dimensions_in_reply = 0
+ self.img_reset = None
self.server_handcode = 0
self.client_handcode = 0
self.glx_rop = int(attrs.get('rop', "0"))
self.glx_sop = int(attrs.get('sop', "0"))
self.glx_vendorpriv = int(attrs.get('vendorpriv', "0"))
+ self.img_reset = attrs.get('img_reset', None)
# The 'handcode' attribute can be one of 'true',
# 'false', 'client', or 'server'.
else:
self.reply_always_array = 0
+ if attrs.get('dimensions_in_reply', "false") == "true":
+ self.dimensions_in_reply = 1
+ else:
+ self.dimensions_in_reply = 0
else:
gl_XML.glFunction.startElement(self, name, attrs)
pixel commends is zero. The offset for pixel commands depends
on the number of dimensions of the pixel data."""
- if self.image:
+ if self.image and not self.image.is_output:
[dim, junk, junk, junk, junk] = self.dimensions()
# The base size is the size of the pixel pack info
size = self.offset_of_first_parameter()
for p in gl_XML.glFunction.parameterIterator(self):
- if not p.is_output:
+ if not p.is_output and p.name != self.img_reset:
size += p.size()
if self.pad_after(p):
size += 4
- if self.image and self.image.img_null_flag:
+ if self.image and (self.image.img_null_flag or self.image.is_output):
size += 4
return size
self.can_be_large = func.can_be_large
self.count_parameter_list = func.count_parameter_list
self.counter = func.counter
+ self.img_reset = None
return
return reply.retval;
}
+static NOINLINE void
+read_pixel_reply( Display *dpy, __GLXcontext * gc, unsigned max_dim,
+ GLint width, GLint height, GLint depth, GLenum format, GLenum type,
+ void * dest, GLboolean dimensions_in_reply )
+{
+ xGLXSingleReply reply;
+ GLint size;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ if ( dimensions_in_reply ) {
+ width = reply.pad3;
+ height = reply.pad4;
+ depth = reply.pad5;
+
+ if ((height == 0) || (max_dim < 2)) { height = 1; }
+ if ((depth == 0) || (max_dim < 3)) { depth = 1; }
+ }
+
+ size = reply.length * 4;
+ if (size != 0) {
+ void * buf = Xmalloc( size );
+
+ if ( buf == NULL ) {
+ _XEatData(dpy, size);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ }
+ else {
+ const GLint extra = 4 - (size & 3);
+
+ _XRead(dpy, buf, size);
+ if ( extra < 4 ) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 3, width, height, depth, format, type,
+ buf, dest);
+ Xfree(buf);
+ }
+ }
+}
+
#define X_GLXSingle 0
static NOINLINE FASTCALL GLubyte *
r = 2
for p in f.parameterIterator(1, r):
- self.common_emit_one_arg(p, offset, pc, indent, adjust)
- offset += p.size()
+ if p.name != f.img_reset:
+ self.common_emit_one_arg(p, offset, pc, indent, adjust)
+ offset += p.size()
return offset
# parameter.
if not f.glx_rop:
+ if f.image and f.image.is_output:
+ print ' const __GLXattribute * const state = gc->client_state_private;'
+
print ' Display * const dpy = gc->currentDpy;'
skip_condition = "dpy != NULL"
elif f.can_be_large:
print ' %s setup_single_request(gc, %s, cmdlen);' % (pc_decl, f.opcode_name())
self.common_emit_args(f, "pc", " ", 0, 0)
+ if f.image and f.image.is_output:
+ o = f.command_fixed_length() - 4
+ print ' *(int32_t *)(pc + %u) = 0;' % (o)
+ if f.image.img_format != "GL_COLOR_INDEX" or f.image.img_type != "GL_BITMAP":
+ print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o)
+
+ if f.img_reset:
+ print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
+
if f.needs_reply():
- if f.output != None:
- output_size = f.output.p_type.size
- output_str = f.output.name
+ if f.image and f.image.is_output:
+ [dim, w, h, d, junk] = f.dimensions()
+ if f.dimensions_in_reply:
+ print " read_pixel_reply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, f.image.img_format, f.image.img_type, f.image.name)
+ else:
+ print " read_pixel_reply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, f.image.img_format, f.image.img_type, f.image.name)
else:
- output_size = 0
- output_str = "NULL"
+ if f.output != None:
+ output_size = f.output.p_type.size
+ output_str = f.output.name
+ else:
+ output_size = 0
+ output_str = "NULL"
- if f.fn_return_type != 'void':
- return_str = " retval = (%s)" % (f.fn_return_type)
- else:
- return_str = " (void)"
+ if f.fn_return_type != 'void':
+ return_str = " retval = (%s)" % (f.fn_return_type)
+ else:
+ return_str = " (void)"
- if f.reply_always_array:
- aa = "GL_TRUE"
- else:
- aa = "GL_FALSE"
+ if f.reply_always_array:
+ aa = "GL_TRUE"
+ else:
+ aa = "GL_FALSE"
+
+ print " %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
- print " %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
elif self.debug:
# Only emit the extra glFinish call for functions
# that don't already require a reply from the server.
doubles_in_order CDATA #IMPLIED
always_array CDATA #IMPLIED
handcode CDATA #IMPLIED
+ img_reset CDATA #IMPLIED
+ dimensions_in_reply CDATA #IMPLIED
ignore CDATA #IMPLIED>
]>
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true"/>
- <glx sop="111" handcode="true"/>
+ <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/>
+ <glx sop="111"/>
</function>
<function name="DrawPixels" offset="257">
</function>
<function name="GetPolygonStipple" offset="274">
- <param name="mask" type="GLubyte *" output="true"/>
- <glx sop="128" handcode="true"/>
+ <param name="mask" type="GLubyte *" output="true" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP"/>
+ <glx sop="128"/>
</function>
<function name="GetString" offset="275">
<param name="level" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true"/>
- <glx sop="135" handcode="true"/>
+ <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type"/>
+ <glx sop="135" dimensions_in_reply="true"/>
</function>
<function name="GetTexParameterfv" offset="282">
<param name="target" type="GLenum"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="table" type="GLvoid *" output="true"/>
- <glx sop="147" handcode="true"/>
+ <param name="table" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
+ <glx sop="147" dimensions_in_reply="true"/>
</function>
<function name="GetColorTableParameterfv" offset="344">
<param name="target" type="GLenum"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="image" type="GLvoid *" output="true"/>
- <glx sop="150" handcode="true"/>
+ <param name="image" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type"/>
+ <glx sop="150" dimensions_in_reply="true"/>
</function>
<function name="GetConvolutionParameterfv" offset="357">
<param name="reset" type="GLboolean"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx sop="154" handcode="true"/>
+ <param name="values" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
+ <glx sop="154" dimensions_in_reply="true" img_reset="reset"/>
</function>
<function name="GetHistogramParameterfv" offset="362">
<param name="reset" type="GLboolean"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx sop="157" handcode="true"/>
+ <param name="values" type="GLvoid *" output="true" img_width="2" img_format="format" img_type="type"/>
+ <glx sop="157" img_reset="reset"/>
</function>
<function name="GetMinmaxParameterfv" offset="365">