Pixel oriented render functions are now generated by the
glX_proto_send.py script. This eliminates ~600 lines of non-generated code. With proper compiler optimization settings, it also decreases the size of libGL.so by about 3KB.
This commit is contained in:
parent
3385d7cec3
commit
5f1f229f8d
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include "size.h"
|
||||
#include "indirect_size.h"
|
||||
|
||||
/*
|
||||
** Return the number of elements per group of a specified format
|
||||
|
@ -147,14 +147,28 @@ GLint __glBytesPerElement(GLenum type)
|
|||
** and format.
|
||||
*/
|
||||
GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format, GLenum type)
|
||||
GLenum format, GLenum type, GLenum target)
|
||||
{
|
||||
int bytes_per_row;
|
||||
int components;
|
||||
|
||||
switch( target ) {
|
||||
case GL_PROXY_TEXTURE_1D:
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_4D_SGIS:
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP:
|
||||
case GL_PROXY_TEXTURE_RECTANGLE_ARB:
|
||||
case GL_PROXY_COLOR_TABLE:
|
||||
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
|
||||
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (width < 0 || height < 0 || depth < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Zero is returned if either format or type are invalid.
|
||||
*/
|
||||
|
@ -168,5 +182,6 @@ GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
|
|||
} else {
|
||||
bytes_per_row = __glBytesPerElement(type) * width;
|
||||
}
|
||||
|
||||
return bytes_per_row * height * depth * components;
|
||||
}
|
||||
|
|
|
@ -737,8 +737,15 @@ extern CARD8 __glXSetupForCommand(Display *dpy);
|
|||
** Data conversion and packing support.
|
||||
*/
|
||||
|
||||
extern const GLuint __glXDefaultPixelStore[9];
|
||||
|
||||
/* Send an image to the server using RenderLarge. */
|
||||
extern void __glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
||||
GLint width, GLint height, GLint depth, GLenum format, GLenum type,
|
||||
const GLvoid *src, GLubyte *pc, GLubyte *modes);
|
||||
|
||||
/* Return the size, in bytes, of some pixel data */
|
||||
extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum);
|
||||
extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
|
||||
|
||||
/* Return the number of elements per group of a specified format*/
|
||||
extern GLint __glElementsPerGroup(GLenum format, GLenum type);
|
||||
|
@ -748,9 +755,6 @@ extern GLint __glElementsPerGroup(GLenum format, GLenum type);
|
|||
*/
|
||||
extern GLint __glBytesPerElement(GLenum type);
|
||||
|
||||
/* Return the k value for a given map target */
|
||||
extern GLint __glEvalComputeK(GLenum);
|
||||
|
||||
/*
|
||||
** Fill the transport buffer with the data from the users buffer,
|
||||
** applying some of the pixel store modes (unpack modes) to the data
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* DO NOT EDIT - This file generated automatically by glX_proto_send.py (from Mesa) script */
|
||||
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2004
|
||||
* (C) Copyright IBM Corporation 2004, 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include <GL/gl.h>
|
||||
#include "indirect.h"
|
||||
#include "glxclient.h"
|
||||
#include "size.h"
|
||||
#include "indirect_size.h"
|
||||
#include <GL/glxproto.h>
|
||||
|
||||
#define __GLX_PAD(n) (((n) + 3) & ~3)
|
||||
|
@ -115,6 +115,19 @@ setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
|
|||
return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
|
||||
}
|
||||
|
||||
const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
|
||||
|
||||
#define zero (__glXDefaultPixelStore+0)
|
||||
#define one (__glXDefaultPixelStore+8)
|
||||
#define default_pixel_store_1D (__glXDefaultPixelStore+4)
|
||||
#define default_pixel_store_1D_size 20
|
||||
#define default_pixel_store_2D (__glXDefaultPixelStore+4)
|
||||
#define default_pixel_store_2D_size 20
|
||||
#define default_pixel_store_3D (__glXDefaultPixelStore+0)
|
||||
#define default_pixel_store_3D_size 36
|
||||
#define default_pixel_store_4D (__glXDefaultPixelStore+0)
|
||||
#define default_pixel_store_4D_size 36
|
||||
|
||||
static FASTCALL NOINLINE void
|
||||
generic_3_byte( GLint rop, const void * ptr )
|
||||
{
|
||||
|
@ -342,6 +355,51 @@ __indirect_glBegin(GLenum mode)
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
#define X_GLrop_Bitmap 5
|
||||
void
|
||||
__indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap)
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (bitmap != NULL) ? __glImageSize(width, height, 1, GL_COLOR_INDEX, GL_BITMAP, 0) : 0;
|
||||
const GLuint cmdlen = 48 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, X_GLrop_Bitmap, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&xorig), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&yorig), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&xmove), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&ymove), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 2, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, bitmap, gc->pc + 48, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = X_GLrop_Bitmap;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&xorig), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&yorig), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&xmove), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&ymove), 4);
|
||||
__glXSendLargeImage(gc, compsize, 2, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, bitmap, pc + 52, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_Color3bv 6
|
||||
void
|
||||
__indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue)
|
||||
|
@ -2193,6 +2251,24 @@ __indirect_glPolygonMode(GLenum face, GLenum mode)
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
#define X_GLrop_PolygonStipple 102
|
||||
void
|
||||
__indirect_glPolygonStipple(const GLubyte * mask)
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (mask != NULL) ? __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, 0) : 0;
|
||||
const GLuint cmdlen = 24 + __GLX_PAD(compsize);
|
||||
emit_header(gc->pc, X_GLrop_PolygonStipple, cmdlen);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, mask, gc->pc + 24, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
#define X_GLrop_Scissor 103
|
||||
void
|
||||
__indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
|
@ -2278,6 +2354,68 @@ __indirect_glTexParameteriv(GLenum target, GLenum pname, const GLint * params)
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
static void
|
||||
__glx_TexImage_1D2D( unsigned opcode, unsigned dim, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = __glImageSize(width, height, 1, format, type, target);
|
||||
const GLuint cmdlen = 56 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, opcode, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&border), 4);
|
||||
(void) memcpy((void *)(gc->pc + 48), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 52), (void *)(&type), 4);
|
||||
if ((compsize > 0) && (pixels != NULL)) {
|
||||
(*gc->fillImage)(gc, dim, width, height, 1, format, type, pixels, gc->pc + 56, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = opcode;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&border), 4);
|
||||
(void) memcpy((void *)(pc + 52), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 56), (void *)(&type), 4);
|
||||
__glXSendLargeImage(gc, compsize, dim, width, height, 1, format, type, pixels, pc + 60, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_TexImage1D 109
|
||||
void
|
||||
__indirect_glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexImage_1D2D(X_GLrop_TexImage1D, 1, target, level, internalformat, width, 1, border, format, type, pixels );
|
||||
}
|
||||
|
||||
#define X_GLrop_TexImage2D 110
|
||||
void
|
||||
__indirect_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexImage_1D2D(X_GLrop_TexImage2D, 2, target, level, internalformat, width, height, border, format, type, pixels );
|
||||
}
|
||||
|
||||
#define X_GLrop_TexEnvf 111
|
||||
void
|
||||
__indirect_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
|
||||
|
@ -3091,6 +3229,47 @@ __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
#define X_GLrop_DrawPixels 173
|
||||
void
|
||||
__indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (pixels != NULL) ? __glImageSize(width, height, 1, format, type, 0) : 0;
|
||||
const GLuint cmdlen = 40 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, X_GLrop_DrawPixels, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&type), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 2, width, height, 1, format, type, pixels, gc->pc + 40, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = X_GLrop_DrawPixels;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&type), 4);
|
||||
__glXSendLargeImage(gc, compsize, 2, width, height, 1, format, type, pixels, pc + 44, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLsop_GetClipPlane 113
|
||||
void
|
||||
__indirect_glGetClipPlane(GLenum plane, GLdouble * equation)
|
||||
|
@ -3893,6 +4072,70 @@ __indirect_glPrioritizeTextures(GLsizei n, const GLuint * textures, const GLclam
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
__glx_TexSubImage_1D2D( unsigned opcode, unsigned dim, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (pixels != NULL) ? __glImageSize(width, height, 1, format, type, target) : 0;
|
||||
const GLuint cmdlen = 60 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, opcode, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&xoffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&yoffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 48), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 52), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(gc->pc + 56), (void *)((pixels == NULL) ? one : zero), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, 1, format, type, pixels, gc->pc + 60, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = opcode;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&xoffset), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&yoffset), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 52), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 56), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(pc + 60), zero, 4);
|
||||
__glXSendLargeImage(gc, compsize, dim, width, height, 1, format, type, pixels, pc + 64, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_TexSubImage1D 4099
|
||||
void
|
||||
__indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexSubImage_1D2D(X_GLrop_TexSubImage1D, 1, target, level, xoffset, 1, width, 1, format, type, pixels );
|
||||
}
|
||||
|
||||
#define X_GLrop_TexSubImage2D 4100
|
||||
void
|
||||
__indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexSubImage_1D2D(X_GLrop_TexSubImage2D, 2, target, level, xoffset, yoffset, width, height, format, type, pixels );
|
||||
}
|
||||
|
||||
#define X_GLrop_BlendColor 4096
|
||||
void
|
||||
__indirect_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
|
||||
|
@ -3920,6 +4163,49 @@ __indirect_glBlendEquation(GLenum mode)
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
#define X_GLrop_ColorTable 2053
|
||||
void
|
||||
__indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table)
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (table != NULL) ? __glImageSize(width, 1, 1, format, type, target) : 0;
|
||||
const GLuint cmdlen = 44 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, X_GLrop_ColorTable, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&type), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 1, width, 1, 1, format, type, table, gc->pc + 44, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_1D, default_pixel_store_1D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = X_GLrop_ColorTable;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&type), 4);
|
||||
__glXSendLargeImage(gc, compsize, 1, width, 1, 1, format, type, table, pc + 48, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_ColorTableParameterfv 2054
|
||||
void
|
||||
__indirect_glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat * params)
|
||||
|
@ -4000,6 +4286,49 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, GLint * param
|
|||
return;
|
||||
}
|
||||
|
||||
#define X_GLrop_ColorSubTable 195
|
||||
void
|
||||
__indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data)
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (data != NULL) ? __glImageSize(count, 1, 1, format, type, target) : 0;
|
||||
const GLuint cmdlen = 44 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, X_GLrop_ColorSubTable, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&start), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&count), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&type), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 1, count, 1, 1, format, type, data, gc->pc + 44, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_1D, default_pixel_store_1D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = X_GLrop_ColorSubTable;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&start), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&count), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&type), 4);
|
||||
__glXSendLargeImage(gc, compsize, 1, count, 1, 1, format, type, data, pc + 48, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_CopyColorSubTable 196
|
||||
void
|
||||
__indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
|
||||
|
@ -4016,6 +4345,64 @@ __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, G
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
static void
|
||||
__glx_ConvolutionFilter_1D2D( unsigned opcode, unsigned dim, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (image != NULL) ? __glImageSize(width, height, 1, format, type, target) : 0;
|
||||
const GLuint cmdlen = 48 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, opcode, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 24), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 28), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(gc->pc + 32), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 36), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&type), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, 1, format, type, image, gc->pc + 48, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_2D, default_pixel_store_2D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = opcode;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 28), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 32), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(pc + 36), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 40), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&type), 4);
|
||||
__glXSendLargeImage(gc, compsize, dim, width, height, 1, format, type, image, pc + 52, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_ConvolutionFilter1D 4101
|
||||
void
|
||||
__indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image)
|
||||
{
|
||||
__glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter1D, 1, target, internalformat, width, 1, format, type, image );
|
||||
}
|
||||
|
||||
#define X_GLrop_ConvolutionFilter2D 4102
|
||||
void
|
||||
__indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image)
|
||||
{
|
||||
__glx_ConvolutionFilter_1D2D(X_GLrop_ConvolutionFilter2D, 2, target, internalformat, width, height, format, type, image );
|
||||
}
|
||||
|
||||
#define X_GLrop_ConvolutionParameterf 4103
|
||||
void
|
||||
__indirect_glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params)
|
||||
|
@ -4262,6 +4649,132 @@ __indirect_glResetMinmax(GLenum target)
|
|||
if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
|
||||
static void
|
||||
__glx_TexImage_3D4D( unsigned opcode, unsigned dim, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const GLvoid * pixels )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (pixels != NULL) ? __glImageSize(width, height, depth, format, type, target) : 0;
|
||||
const GLuint cmdlen = 84 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, opcode, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(gc->pc + 48), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(gc->pc + 52), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 56), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 60), (void *)(&depth), 4);
|
||||
(void) memcpy((void *)(gc->pc + 64), (void *)(&extent), 4);
|
||||
(void) memcpy((void *)(gc->pc + 68), (void *)(&border), 4);
|
||||
(void) memcpy((void *)(gc->pc + 72), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 76), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(gc->pc + 80), (void *)((pixels == NULL) ? one : zero), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, depth, format, type, pixels, gc->pc + 84, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_4D, default_pixel_store_4D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = opcode;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(pc + 52), (void *)(&internalformat), 4);
|
||||
(void) memcpy((void *)(pc + 56), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 60), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 64), (void *)(&depth), 4);
|
||||
(void) memcpy((void *)(pc + 68), (void *)(&extent), 4);
|
||||
(void) memcpy((void *)(pc + 72), (void *)(&border), 4);
|
||||
(void) memcpy((void *)(pc + 76), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 80), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(pc + 84), zero, 4);
|
||||
__glXSendLargeImage(gc, compsize, dim, width, height, depth, format, type, pixels, pc + 88, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_TexImage3D 4114
|
||||
void
|
||||
__indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexImage_3D4D(X_GLrop_TexImage3D, 3, target, level, internalformat, width, height, depth, 1, border, format, type, pixels );
|
||||
}
|
||||
|
||||
static void
|
||||
__glx_TexSubImage_3D4D( unsigned opcode, unsigned dim, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const GLvoid * pixels )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
const GLuint compsize = (pixels != NULL) ? __glImageSize(width, height, depth, format, type, target) : 0;
|
||||
const GLuint cmdlen = 92 + __GLX_PAD(compsize);
|
||||
if (__builtin_expect(gc->currentDpy != NULL, 1)) {
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
if ( (gc->pc + cmdlen) > gc->bufEnd ) {
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
}
|
||||
emit_header(gc->pc, opcode, cmdlen);
|
||||
(void) memcpy((void *)(gc->pc + 40), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(gc->pc + 44), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(gc->pc + 48), (void *)(&xoffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 52), (void *)(&yoffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 56), (void *)(&zoffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 60), (void *)(&woffset), 4);
|
||||
(void) memcpy((void *)(gc->pc + 64), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(gc->pc + 68), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(gc->pc + 72), (void *)(&depth), 4);
|
||||
(void) memcpy((void *)(gc->pc + 76), (void *)(&extent), 4);
|
||||
(void) memcpy((void *)(gc->pc + 80), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(gc->pc + 84), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(gc->pc + 88), (void *)((pixels == NULL) ? one : zero), 4);
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, depth, format, type, pixels, gc->pc + 92, gc->pc + 4);
|
||||
}
|
||||
else {
|
||||
(void) memcpy( gc->pc + 4, default_pixel_store_4D, default_pixel_store_4D_size );
|
||||
}
|
||||
gc->pc += cmdlen;
|
||||
if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
|
||||
}
|
||||
else {
|
||||
const GLint op = opcode;
|
||||
const GLuint cmdlenLarge = cmdlen + 4;
|
||||
GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);
|
||||
(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);
|
||||
(void) memcpy((void *)(pc + 4), (void *)(&op), 4);
|
||||
(void) memcpy((void *)(pc + 44), (void *)(&target), 4);
|
||||
(void) memcpy((void *)(pc + 48), (void *)(&level), 4);
|
||||
(void) memcpy((void *)(pc + 52), (void *)(&xoffset), 4);
|
||||
(void) memcpy((void *)(pc + 56), (void *)(&yoffset), 4);
|
||||
(void) memcpy((void *)(pc + 60), (void *)(&zoffset), 4);
|
||||
(void) memcpy((void *)(pc + 64), (void *)(&woffset), 4);
|
||||
(void) memcpy((void *)(pc + 68), (void *)(&width), 4);
|
||||
(void) memcpy((void *)(pc + 72), (void *)(&height), 4);
|
||||
(void) memcpy((void *)(pc + 76), (void *)(&depth), 4);
|
||||
(void) memcpy((void *)(pc + 80), (void *)(&extent), 4);
|
||||
(void) memcpy((void *)(pc + 84), (void *)(&format), 4);
|
||||
(void) memcpy((void *)(pc + 88), (void *)(&type), 4);
|
||||
(void) memcpy((void *)(pc + 92), zero, 4);
|
||||
__glXSendLargeImage(gc, compsize, dim, width, height, depth, format, type, pixels, pc + 96, pc + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define X_GLrop_TexSubImage3D 4115
|
||||
void
|
||||
__indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels)
|
||||
{
|
||||
__glx_TexSubImage_3D4D(X_GLrop_TexSubImage3D, 3, target, level, xoffset, yoffset, zoffset, 1, width, height, depth, 1, format, type, pixels );
|
||||
}
|
||||
|
||||
#define X_GLrop_CopyTexSubImage3D 4123
|
||||
void
|
||||
__indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
|
|
|
@ -249,31 +249,12 @@ void __glFillImage(__GLXcontext *gc, GLint dim, GLint width, GLint height,
|
|||
|
||||
/* Setup store modes that describe what we just did */
|
||||
if (modes) {
|
||||
if (dim == 3) {
|
||||
GLubyte *pc = modes;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,0);
|
||||
__GLX_PUT_LONG(20,0);
|
||||
__GLX_PUT_LONG(24,0);
|
||||
__GLX_PUT_LONG(28,0);
|
||||
__GLX_PUT_LONG(32,1);
|
||||
} else {
|
||||
GLubyte *pc = modes;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
if ( dim < 3 ) {
|
||||
(void) memcpy( modes, __glXDefaultPixelStore + 4, 20 );
|
||||
}
|
||||
else {
|
||||
(void) memcpy( modes, __glXDefaultPixelStore + 0, 36 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "packrender.h"
|
||||
#include "indirect.h"
|
||||
#include "size.h"
|
||||
#include "indirect_size.h"
|
||||
|
||||
/*
|
||||
** This file contains routines that might need to be transported as
|
||||
|
|
|
@ -34,32 +34,65 @@
|
|||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2005
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "packrender.h"
|
||||
|
||||
/*
|
||||
** This file contains routines that deal with unpacking data from client
|
||||
** memory using the pixel store unpack modes and then shipping it to
|
||||
** the server. For all of these routines (except glPolygonStipple) there
|
||||
** are two forms of the transport - small and large. Small commands are
|
||||
** the commands that fit into the "rendering" transport buffer. Large
|
||||
** commands are sent to the server in chunks by __glXSendLargeCommand.
|
||||
**
|
||||
** All of the commands send over a pixel header (see glxproto.h) which
|
||||
** describes the pixel store modes that the server must use to properly
|
||||
** handle the data. Any pixel store modes not done by the __glFillImage
|
||||
** routine are passed on to the server.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Send a large image to the server. If necessary, a buffer is allocated
|
||||
** to hold the unpacked data that is copied from the clients memory.
|
||||
*/
|
||||
static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const GLvoid *src,
|
||||
GLubyte *pc, GLubyte *modes)
|
||||
/**
|
||||
* Send a large image to the server. If necessary, a buffer is allocated
|
||||
* to hold the unpacked data that is copied from the clients memory.
|
||||
*
|
||||
* \param gc Current GLX context
|
||||
* \param compsize Size, in bytes, of the image portion
|
||||
* \param dim Number of dimensions of the image
|
||||
* \param width Width of the image
|
||||
* \param height Height of the image, must be 1 for 1D images
|
||||
* \param depth Depth of the image, must be 1 for 1D or 2D images
|
||||
* \param format Format of the image
|
||||
* \param type Data type of the image
|
||||
* \param src Pointer to the image data
|
||||
* \param pc Pointer to end of the command header
|
||||
* \param modes Pointer to the pixel unpack data
|
||||
*
|
||||
* \todo
|
||||
* Modify this function so that \c NULL images are sent using
|
||||
* \c __glXSendLargeChunk instead of __glXSendLargeCommand. Doing this
|
||||
* will eliminate the need to allocate a buffer for that case.
|
||||
*
|
||||
* \bugs
|
||||
* The \c fastImageUnpack path, which is thankfully never used, is completely
|
||||
* broken.
|
||||
*/
|
||||
void
|
||||
__glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const GLvoid *src,
|
||||
GLubyte *pc, GLubyte *modes)
|
||||
{
|
||||
if (!gc->fastImageUnpack) {
|
||||
if ( !gc->fastImageUnpack || (src == NULL) ) {
|
||||
/* Allocate a temporary holding buffer */
|
||||
GLubyte *buf = (GLubyte *) Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
|
@ -68,8 +101,18 @@ static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
|||
}
|
||||
|
||||
/* Apply pixel store unpack modes to copy data into buf */
|
||||
(*gc->fillImage)(gc, dim, width, height, depth, format, type, src, buf,
|
||||
modes);
|
||||
if ( src != NULL ) {
|
||||
(*gc->fillImage)(gc, dim, width, height, depth, format, type,
|
||||
src, buf, modes);
|
||||
}
|
||||
else {
|
||||
if ( dim < 3 ) {
|
||||
(void) memcpy( modes, __glXDefaultPixelStore + 4, 20 );
|
||||
}
|
||||
else {
|
||||
(void) memcpy( modes, __glXDefaultPixelStore + 0, 36 );
|
||||
}
|
||||
}
|
||||
|
||||
/* Send large command */
|
||||
__glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
|
||||
|
@ -82,578 +125,15 @@ static void SendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Send a large null image to the server. To be backwards compatible,
|
||||
** data must be sent to the server even when the application has passed
|
||||
** a null pointer into glTexImage1D, glTexImage2D or glTexImage3D.
|
||||
*/
|
||||
static void SendLargeNULLImage(__GLXcontext *gc, GLint compsize,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const GLvoid *src,
|
||||
GLubyte *pc, GLubyte *modes)
|
||||
{
|
||||
GLubyte *buf = (GLubyte *) Xmalloc(compsize);
|
||||
|
||||
/* Allocate a temporary holding buffer */
|
||||
if (!buf) {
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send large command */
|
||||
__glXSendLargeCommand(gc, gc->pc, pc - gc->pc, buf, compsize);
|
||||
|
||||
/* Free buffer */
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
void __indirect_glPolygonStipple(const GLubyte *mask)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(32, 32, 1, GL_COLOR_INDEX, GL_BITMAP);
|
||||
cmdlen = __GLX_PAD(__GLX_POLYGONSTIPPLE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
__GLX_BEGIN(X_GLrop_PolygonStipple,cmdlen);
|
||||
pc += __GLX_RENDER_HDR_SIZE;
|
||||
pixelHeaderPC = pc;
|
||||
pc += __GLX_PIXEL_HDR_SIZE;
|
||||
(*gc->fillImage)(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
|
||||
mask, pc, pixelHeaderPC);
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
}
|
||||
|
||||
void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig,
|
||||
GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(width, height, 1, GL_COLOR_INDEX, GL_BITMAP);
|
||||
cmdlen = __GLX_PAD(__GLX_BITMAP_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_Bitmap,cmdlen);
|
||||
__GLX_PUT_LONG(0,width);
|
||||
__GLX_PUT_LONG(4,height);
|
||||
__GLX_PUT_FLOAT(8,xorig);
|
||||
__GLX_PUT_FLOAT(12,yorig);
|
||||
__GLX_PUT_FLOAT(16,xmove);
|
||||
__GLX_PUT_FLOAT(20,ymove);
|
||||
pc += __GLX_BITMAP_HDR_SIZE;
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 2, width, height, 1, GL_COLOR_INDEX,
|
||||
GL_BITMAP, bitmap, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_Bitmap,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,width);
|
||||
__GLX_PUT_LONG(4,height);
|
||||
__GLX_PUT_FLOAT(8,xorig);
|
||||
__GLX_PUT_FLOAT(12,yorig);
|
||||
__GLX_PUT_FLOAT(16,xmove);
|
||||
__GLX_PUT_FLOAT(20,ymove);
|
||||
pc += __GLX_BITMAP_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 2, width, height, 1, GL_COLOR_INDEX,
|
||||
GL_BITMAP, bitmap, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexImage1D(GLenum target, GLint level, GLint components,
|
||||
GLsizei width, GLint border, GLenum format, GLenum type,
|
||||
const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
if (target == GL_PROXY_TEXTURE_1D) {
|
||||
compsize = 0;
|
||||
} else {
|
||||
compsize = __glImageSize(width, 1, 1, format, type);
|
||||
}
|
||||
cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_TexImage1D,cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,components);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(20,border);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
pc += __GLX_TEXIMAGE_HDR_SIZE;
|
||||
if (compsize > 0 && image != NULL) {
|
||||
(*gc->fillImage)(gc, 1, width, 1, 1, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_TexImage1D,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,components);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
__GLX_PUT_LONG(20,border);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
pc += __GLX_TEXIMAGE_HDR_SIZE;
|
||||
if (image != NULL) {
|
||||
SendLargeImage(gc, compsize, 1, width, 1, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
{
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
SendLargeNULLImage(gc, compsize, width, 1, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexImage2D(GLenum target, GLint level, GLint components,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format,
|
||||
GLenum type, const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
if (target == GL_PROXY_TEXTURE_2D ||
|
||||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
|
||||
compsize = 0;
|
||||
} else {
|
||||
compsize = __glImageSize(width, height, 1, format, type);
|
||||
}
|
||||
cmdlen = __GLX_PAD(__GLX_TEXIMAGE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_TexImage2D,cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,components);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(16,height);
|
||||
__GLX_PUT_LONG(20,border);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
pc += __GLX_TEXIMAGE_HDR_SIZE;
|
||||
if (compsize > 0 && image != NULL) {
|
||||
(*gc->fillImage)(gc, 2, width, height, 1, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_TexImage2D,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,components);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(16,height);
|
||||
__GLX_PUT_LONG(20,border);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
pc += __GLX_TEXIMAGE_HDR_SIZE;
|
||||
if (image != NULL) {
|
||||
SendLargeImage(gc, compsize, 2, width, height, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
{
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
SendLargeNULLImage(gc, compsize, width, height, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type,
|
||||
const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(width, height, 1, format, type);
|
||||
cmdlen = __GLX_PAD(__GLX_DRAWPIXELS_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_DrawPixels,cmdlen);
|
||||
__GLX_PUT_LONG(0,width);
|
||||
__GLX_PUT_LONG(4,height);
|
||||
__GLX_PUT_LONG(8,format);
|
||||
__GLX_PUT_LONG(12,type);
|
||||
pc += __GLX_DRAWPIXELS_HDR_SIZE;
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 2, width, height, 1, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_DrawPixels,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,width);
|
||||
__GLX_PUT_LONG(4,height);
|
||||
__GLX_PUT_LONG(8,format);
|
||||
__GLX_PUT_LONG(12,type);
|
||||
pc += __GLX_DRAWPIXELS_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 2, width, height, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
static void __glx_TexSubImage1D2D(GLshort opcode, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width,
|
||||
GLsizei height, GLenum format, GLenum type,
|
||||
const GLvoid *image, GLint dim)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
if (image == NULL) {
|
||||
compsize = 0;
|
||||
} else {
|
||||
compsize = __glImageSize(width, height, 1, format, type);
|
||||
}
|
||||
|
||||
cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode, cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,xoffset);
|
||||
__GLX_PUT_LONG(12,yoffset);
|
||||
__GLX_PUT_LONG(16,width);
|
||||
__GLX_PUT_LONG(20,height);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(32,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(32,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXSUBIMAGE_HDR_SIZE;
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, 1, format, type, image,
|
||||
pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,xoffset);
|
||||
__GLX_PUT_LONG(12,yoffset);
|
||||
__GLX_PUT_LONG(16,width);
|
||||
__GLX_PUT_LONG(20,height);
|
||||
__GLX_PUT_LONG(24,format);
|
||||
__GLX_PUT_LONG(28,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(32,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(32,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXSUBIMAGE_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, dim, width, height, 1,
|
||||
format, type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexSubImage1D(GLenum target, GLint level, GLint xoffset,
|
||||
GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *image)
|
||||
{
|
||||
__glx_TexSubImage1D2D(X_GLrop_TexSubImage1D, target, level, xoffset,
|
||||
0, width, 1, format, type, image, 1);
|
||||
}
|
||||
|
||||
void __indirect_glTexSubImage2D(GLenum target, GLint level, GLint xoffset,
|
||||
GLint yoffset, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *image)
|
||||
{
|
||||
__glx_TexSubImage1D2D(X_GLrop_TexSubImage2D, target, level, xoffset,
|
||||
yoffset, width, height, format, type, image, 2);
|
||||
}
|
||||
|
||||
void __indirect_glColorTable(GLenum target, GLenum internalformat, GLsizei width,
|
||||
GLenum format, GLenum type, const GLvoid *table)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
switch (target) {
|
||||
case GL_PROXY_TEXTURE_1D:
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
case GL_PROXY_COLOR_TABLE:
|
||||
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
|
||||
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||
compsize = 0;
|
||||
break;
|
||||
default:
|
||||
compsize = __glImageSize(width, 1, 1, format, type);
|
||||
break;
|
||||
}
|
||||
cmdlen = __GLX_PAD(__GLX_COLOR_TABLE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorTable, (short)cmdlen);
|
||||
__GLX_PUT_LONG(0, (long)target);
|
||||
__GLX_PUT_LONG(4, (long)internalformat);
|
||||
__GLX_PUT_LONG(8, width);
|
||||
__GLX_PUT_LONG(12, (long)format);
|
||||
__GLX_PUT_LONG(16, (long)type);
|
||||
pc += __GLX_COLOR_TABLE_HDR_SIZE;
|
||||
if (compsize > 0 && table != NULL) {
|
||||
(*gc->fillImage)(gc, 1, width, 1, 1, format, type, table, pc,
|
||||
pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0, GL_FALSE);
|
||||
__GLX_PUT_CHAR(1, GL_FALSE);
|
||||
__GLX_PUT_CHAR(2, 0);
|
||||
__GLX_PUT_CHAR(3, 0);
|
||||
__GLX_PUT_LONG(4, 0);
|
||||
__GLX_PUT_LONG(8, 0);
|
||||
__GLX_PUT_LONG(12, 0);
|
||||
__GLX_PUT_LONG(16, 1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorTable, cmdlen+4);
|
||||
__GLX_PUT_LONG(0, (long)target);
|
||||
__GLX_PUT_LONG(4, (long)internalformat);
|
||||
__GLX_PUT_LONG(8, width);
|
||||
__GLX_PUT_LONG(12, (long)format);
|
||||
__GLX_PUT_LONG(16, (long)type);
|
||||
pc += __GLX_COLOR_TABLE_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 1, width, 1, 1, format,
|
||||
type, table, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glColorSubTable(GLenum target, GLsizei start, GLsizei count,
|
||||
GLenum format, GLenum type, const GLvoid *table)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(count, 1, 1, format, type);
|
||||
cmdlen = __GLX_PAD(__GLX_COLOR_SUBTABLE_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(X_GLrop_ColorSubTable, (short)cmdlen);
|
||||
__GLX_PUT_LONG(0, (long)target);
|
||||
__GLX_PUT_LONG(4, start);
|
||||
__GLX_PUT_LONG(8, count);
|
||||
__GLX_PUT_LONG(12, (long)format);
|
||||
__GLX_PUT_LONG(16, (long)type);
|
||||
pc += __GLX_COLOR_SUBTABLE_HDR_SIZE;
|
||||
if (compsize > 0 && table != NULL) {
|
||||
(*gc->fillImage)(gc, 1, start+count, 1, 1, format, type, table, pc,
|
||||
pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0, GL_FALSE);
|
||||
__GLX_PUT_CHAR(1, GL_FALSE);
|
||||
__GLX_PUT_CHAR(2, 0);
|
||||
__GLX_PUT_CHAR(3, 0);
|
||||
__GLX_PUT_LONG(4, 0);
|
||||
__GLX_PUT_LONG(8, 0);
|
||||
__GLX_PUT_LONG(12, 0);
|
||||
__GLX_PUT_LONG(16, 1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_ColorSubTable, cmdlen+4);
|
||||
__GLX_PUT_LONG(0, (long)target);
|
||||
__GLX_PUT_LONG(4, start);
|
||||
__GLX_PUT_LONG(8, count);
|
||||
__GLX_PUT_LONG(12, (long)format);
|
||||
__GLX_PUT_LONG(16, (long)type);
|
||||
pc += __GLX_COLOR_SUBTABLE_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 1, start+count, 1, 1, format,
|
||||
type, table, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
static void __glx_ConvolutionFilter1D2D(GLshort opcode, GLint dim,
|
||||
GLenum target,
|
||||
GLenum internalformat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(width, height, 1, format, type);
|
||||
cmdlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL(opcode, cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,internalformat);
|
||||
__GLX_PUT_LONG(8,width);
|
||||
__GLX_PUT_LONG(12,height);
|
||||
__GLX_PUT_LONG(16,format);
|
||||
__GLX_PUT_LONG(20,type);
|
||||
pc += __GLX_CONV_FILT_HDR_SIZE;
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, dim, width, height, 1, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(opcode,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,internalformat);
|
||||
__GLX_PUT_LONG(8,width);
|
||||
__GLX_PUT_LONG(12,height);
|
||||
__GLX_PUT_LONG(16,format);
|
||||
__GLX_PUT_LONG(20,type);
|
||||
pc += __GLX_CONV_FILT_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, dim, width, height, 1, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glConvolutionFilter1D(GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLenum format,
|
||||
GLenum type, const GLvoid *image)
|
||||
{
|
||||
__glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter1D, 1, target,
|
||||
internalformat, width, 1, format, type,
|
||||
image);
|
||||
}
|
||||
|
||||
void __indirect_glConvolutionFilter2D(GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLenum format,
|
||||
GLenum type, const GLvoid *image)
|
||||
{
|
||||
__glx_ConvolutionFilter1D2D(X_GLrop_ConvolutionFilter2D, 2, target,
|
||||
internalformat, width, height, format, type,
|
||||
image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement GLX protocol for \c glSeparableFilter2D.
|
||||
*
|
||||
* \bugs
|
||||
* The \c fastImageUnpack path, which is thankfully never used, is completely
|
||||
* broken.
|
||||
*/
|
||||
void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLenum format,
|
||||
GLenum type, const GLvoid *row,
|
||||
|
@ -663,8 +143,8 @@ void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
|
|||
GLuint compsize2, hdrlen, totalhdrlen, image1len, image2len;
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
compsize = __glImageSize(width, 1, 1, format, type);
|
||||
compsize2 = __glImageSize(height, 1, 1, format, type);
|
||||
compsize = __glImageSize(width, 1, 1, format, type, 0);
|
||||
compsize2 = __glImageSize(height, 1, 1, format, type, 0);
|
||||
totalhdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
|
||||
hdrlen = __GLX_PAD(__GLX_CONV_FILT_HDR_SIZE);
|
||||
image1len = __GLX_PAD(compsize);
|
||||
|
@ -694,21 +174,11 @@ void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
|
|||
}
|
||||
if ((compsize == 0) && (compsize2 == 0)) {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,1);
|
||||
(void) memcpy( pixelHeaderPC, __glXDefaultPixelStore + 4, 20 );
|
||||
}
|
||||
__GLX_END(0);
|
||||
} else {
|
||||
GLint bufsize;
|
||||
|
||||
bufsize = image1len + image2len;
|
||||
const GLint bufsize = image1len + image2len;
|
||||
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL(X_GLrop_SeparableFilter2D,cmdlen+4);
|
||||
|
@ -742,165 +212,3 @@ void __indirect_glSeparableFilter2D(GLenum target, GLenum internalformat,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
if ((target == GL_PROXY_TEXTURE_3D) || (image == NULL)) {
|
||||
compsize = 0;
|
||||
} else {
|
||||
compsize = __glImageSize(width, height, depth, format, type);
|
||||
}
|
||||
cmdlen = __GLX_PAD(__GLX_TEXIMAGE_3D_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,internalformat);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(16,height);
|
||||
__GLX_PUT_LONG(20,depth);
|
||||
__GLX_PUT_LONG(24,0); /* size4d */
|
||||
__GLX_PUT_LONG(28,border);
|
||||
__GLX_PUT_LONG(32,format);
|
||||
__GLX_PUT_LONG(36,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(40,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(40,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXIMAGE_3D_HDR_SIZE;
|
||||
if (compsize > 0 && image != NULL) {
|
||||
(*gc->fillImage)(gc, 3, width, height, depth, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,0);
|
||||
__GLX_PUT_LONG(20,0);
|
||||
__GLX_PUT_LONG(24,0);
|
||||
__GLX_PUT_LONG(28,0);
|
||||
__GLX_PUT_LONG(32,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexImage3D,cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,internalformat);
|
||||
__GLX_PUT_LONG(12,width);
|
||||
__GLX_PUT_LONG(16,height);
|
||||
__GLX_PUT_LONG(20,depth);
|
||||
__GLX_PUT_LONG(24,0); /* size4d */
|
||||
__GLX_PUT_LONG(28,border);
|
||||
__GLX_PUT_LONG(32,format);
|
||||
__GLX_PUT_LONG(36,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(40,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(40,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXIMAGE_3D_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 3, width, height, depth, format,
|
||||
type, image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLint zoffset, GLsizei width, GLsizei height,
|
||||
GLsizei depth, GLenum format, GLenum type,
|
||||
const GLvoid *image)
|
||||
{
|
||||
__GLX_DECLARE_VARIABLES();
|
||||
|
||||
__GLX_LOAD_VARIABLES();
|
||||
if (image == NULL) {
|
||||
compsize = 0;
|
||||
} else {
|
||||
compsize = __glImageSize(width, height, depth, format, type);
|
||||
}
|
||||
cmdlen = __GLX_PAD(__GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE + compsize);
|
||||
if (!gc->currentDpy) return;
|
||||
|
||||
if (cmdlen <= gc->maxSmallRenderCommandSize) {
|
||||
/* Use GLXRender protocol to send small command */
|
||||
__GLX_BEGIN_VARIABLE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D,cmdlen);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,xoffset);
|
||||
__GLX_PUT_LONG(12,yoffset);
|
||||
__GLX_PUT_LONG(16,zoffset);
|
||||
__GLX_PUT_LONG(20,0); /* woffset */
|
||||
__GLX_PUT_LONG(24,width);
|
||||
__GLX_PUT_LONG(28,height);
|
||||
__GLX_PUT_LONG(32,depth);
|
||||
__GLX_PUT_LONG(36,0); /* size4d */
|
||||
__GLX_PUT_LONG(40,format);
|
||||
__GLX_PUT_LONG(44,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(48,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(48,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE;
|
||||
if (compsize > 0) {
|
||||
(*gc->fillImage)(gc, 3, width, height, depth, format, type, image,
|
||||
pc, pixelHeaderPC);
|
||||
} else {
|
||||
/* Setup default store modes */
|
||||
GLubyte *pc = pixelHeaderPC;
|
||||
__GLX_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_PUT_CHAR(1,GL_FALSE);
|
||||
__GLX_PUT_CHAR(2,0);
|
||||
__GLX_PUT_CHAR(3,0);
|
||||
__GLX_PUT_LONG(4,0);
|
||||
__GLX_PUT_LONG(8,0);
|
||||
__GLX_PUT_LONG(12,0);
|
||||
__GLX_PUT_LONG(16,0);
|
||||
__GLX_PUT_LONG(20,0);
|
||||
__GLX_PUT_LONG(24,0);
|
||||
__GLX_PUT_LONG(28,0);
|
||||
__GLX_PUT_LONG(32,1);
|
||||
}
|
||||
__GLX_END(__GLX_PAD(compsize));
|
||||
} else {
|
||||
/* Use GLXRenderLarge protocol to send command */
|
||||
__GLX_BEGIN_VARIABLE_LARGE_WITH_PIXEL_3D(X_GLrop_TexSubImage3D,
|
||||
cmdlen+4);
|
||||
__GLX_PUT_LONG(0,target);
|
||||
__GLX_PUT_LONG(4,level);
|
||||
__GLX_PUT_LONG(8,xoffset);
|
||||
__GLX_PUT_LONG(12,yoffset);
|
||||
__GLX_PUT_LONG(16,zoffset);
|
||||
__GLX_PUT_LONG(20,0); /* woffset */
|
||||
__GLX_PUT_LONG(24,width);
|
||||
__GLX_PUT_LONG(28,height);
|
||||
__GLX_PUT_LONG(32,depth);
|
||||
__GLX_PUT_LONG(36,0); /* size4d */
|
||||
__GLX_PUT_LONG(40,format);
|
||||
__GLX_PUT_LONG(44,type);
|
||||
if (image == NULL) {
|
||||
__GLX_PUT_LONG(48,GL_TRUE);
|
||||
} else {
|
||||
__GLX_PUT_LONG(48,GL_FALSE);
|
||||
}
|
||||
pc += __GLX_TEXSUBIMAGE_3D_HDR_SIZE;
|
||||
SendLargeImage(gc, compsize, 3, width, height, depth, format, type,
|
||||
image, pc, pixelHeaderPC);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,8 +280,8 @@ void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
|
|||
width = reply.width;
|
||||
height = reply.height;
|
||||
|
||||
widthsize = __glImageSize(width,1,1,format, type);
|
||||
heightsize = __glImageSize(height,1,1,format, type);
|
||||
widthsize = __glImageSize(width,1,1,format, type, 0);
|
||||
heightsize = __glImageSize(height,1,1,format, type, 0);
|
||||
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
rowBuf = (GLubyte*) Xmalloc(widthsize);
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* $XFree86: xc/lib/GL/glx/size.h,v 1.4 2003/09/28 20:15:04 alanh Exp $ */
|
||||
#ifndef _size_h_
|
||||
#define _size_h_
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
** These are _size functions that are needed to pack the arguments
|
||||
** into the protocol
|
||||
*/
|
||||
|
||||
#include "indirect_size.h"
|
||||
|
||||
extern GLint __glBitmap_size(GLsizei w, GLsizei h);
|
||||
extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h);
|
||||
extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w);
|
||||
extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h);
|
||||
extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d);
|
||||
|
||||
#endif /* _size_h_ */
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python2
|
||||
|
||||
# (C) Copyright IBM Corporation 2004
|
||||
# (C) Copyright IBM Corporation 2004, 2005
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -400,6 +400,36 @@ class glXFunction(gl_XML.glFunction):
|
|||
|
||||
def command_payload_length(self):
|
||||
size = 0
|
||||
|
||||
if self.image:
|
||||
[dim, junk, junk, junk, junk] = self.dimensions()
|
||||
|
||||
# The base size is the size of the pixel pack info
|
||||
# header used by images with the specified number
|
||||
# of dimensions.
|
||||
|
||||
if dim <= 2:
|
||||
size = 20
|
||||
elif dim <= 4:
|
||||
size = 36
|
||||
else:
|
||||
raise RuntimeError('Invalid number of dimensions %u for parameter "%s" in function "%s".' % (dim, self.image.name, self.name))
|
||||
|
||||
if self.image.img_null_flag:
|
||||
size += 4
|
||||
|
||||
if self.image.img_pad_dimensions:
|
||||
size += 4 * (dim & 1)
|
||||
|
||||
# If the image has offset parameters, like
|
||||
# TexSubImage1D or TexSubImage3D, they need to
|
||||
# be padded out as well.
|
||||
|
||||
if self.image.img_xoff:
|
||||
size += 4 * (dim & 1)
|
||||
|
||||
|
||||
|
||||
size_string = ""
|
||||
for p in gl_XML.glFunction.parameterIterator(self):
|
||||
if p.is_output: continue
|
||||
|
@ -507,6 +537,60 @@ class glXFunction(gl_XML.glFunction):
|
|||
return self.fn_return_type != 'void' or self.output != None
|
||||
|
||||
|
||||
def dimensions(self):
|
||||
"""Determine the dimensions of an image.
|
||||
|
||||
Returns a tuple representing the number of dimensions and the
|
||||
string name of each of the dimensions of an image, If the
|
||||
function is not a pixel function, the number of dimensions
|
||||
will be zero."""
|
||||
|
||||
if not self.image:
|
||||
return [0, "0", "0", "0", "0"]
|
||||
else:
|
||||
dim = 1
|
||||
w = self.image.width
|
||||
|
||||
if self.image.height:
|
||||
dim = 2
|
||||
h = self.image.height
|
||||
else:
|
||||
h = "1"
|
||||
|
||||
if self.image.depth:
|
||||
dim = 3
|
||||
d = self.image.depth
|
||||
else:
|
||||
d = "1"
|
||||
|
||||
if self.image.extent:
|
||||
dim = 4
|
||||
e = self.image.extent
|
||||
else:
|
||||
e = "1"
|
||||
|
||||
return [dim, w, h, d, e]
|
||||
|
||||
|
||||
def pad_after(self, p):
|
||||
"""Returns the name of the field inserted after the
|
||||
specified field to pad out the command header."""
|
||||
|
||||
if self.image and self.image.img_pad_dimensions:
|
||||
if not self.image.height:
|
||||
if p.name == self.image.width:
|
||||
return "height"
|
||||
elif p.name == self.image.img_xoff:
|
||||
return "yoffset"
|
||||
elif not self.image.extent:
|
||||
if p.name == self.image.depth:
|
||||
# Should this be "size4d"?
|
||||
return "extent"
|
||||
elif p.name == self.image.img_zoff:
|
||||
return "woffset"
|
||||
return None
|
||||
|
||||
|
||||
class GlxProto(gl_XML.FilterGLAPISpecBase):
|
||||
name = "glX_proto_send.py (from Mesa)"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python2
|
||||
|
||||
# (C) Copyright IBM Corporation 2004
|
||||
# (C) Copyright IBM Corporation 2004, 2005
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -32,15 +32,87 @@ from xml.sax.handler import feature_namespaces
|
|||
import gl_XML
|
||||
import glX_XML
|
||||
import license
|
||||
import sys, getopt
|
||||
import sys, getopt, copy
|
||||
|
||||
def hash_pixel_function(func):
|
||||
"""Generate a 'unique' key for a pixel function. The key is based on
|
||||
the parameters written in the command packet. This includes any
|
||||
padding that might be added for the original function and the 'NULL
|
||||
image' flag."""
|
||||
|
||||
[dim, junk, junk, junk, junk] = func.dimensions()
|
||||
|
||||
d = (dim + 1) & ~1
|
||||
h = "%uD%uD_" % (d - 1, d)
|
||||
|
||||
for p in func.parameterIterator(1, 1):
|
||||
h = "%s%u" % (h, p.size())
|
||||
|
||||
if func.pad_after(p):
|
||||
h += "4"
|
||||
|
||||
if func.image.img_null_flag:
|
||||
h += "_NF"
|
||||
|
||||
n = func.name.replace("%uD" % (dim), "")
|
||||
n = "__glx_%s_%uD%uD" % (n, d - 1, d)
|
||||
return [h, n]
|
||||
|
||||
|
||||
class glXPixelFunctionUtility(glX_XML.glXFunction):
|
||||
"""Dummy class used to generate pixel "utility" functions that are
|
||||
shared by multiple dimension image functions. For example, these
|
||||
objects are used to generate shared functions used to send GLX
|
||||
protocol for TexImage1D and TexImage2D, TexSubImage1D and
|
||||
TexSubImage2D, etc."""
|
||||
|
||||
def __init__(self, func, name):
|
||||
# The parameters to the utility function are the same as the
|
||||
# parameters to the real function except for the added "pad"
|
||||
# parameters.
|
||||
|
||||
self.name = name
|
||||
self.image = copy.copy(func.image)
|
||||
self.fn_parameters = []
|
||||
for p in gl_XML.glFunction.parameterIterator(func):
|
||||
self.fn_parameters.append(p)
|
||||
|
||||
pad_name = func.pad_after(p)
|
||||
if pad_name:
|
||||
pad = copy.copy(p)
|
||||
pad.name = pad_name
|
||||
self.fn_parameters.append(pad)
|
||||
|
||||
|
||||
if self.image.height == None:
|
||||
self.image.height = "height"
|
||||
|
||||
if self.image.img_yoff == None:
|
||||
self.image.img_yoff = "yoffset"
|
||||
|
||||
if func.image.depth:
|
||||
if self.image.extent == None:
|
||||
self.image.extent = "extent"
|
||||
|
||||
if self.image.img_woff == None:
|
||||
self.image.img_woff = "woffset"
|
||||
|
||||
|
||||
self.set_return_type( func.fn_return_type )
|
||||
self.glx_rop = ~0
|
||||
self.can_be_large = func.can_be_large
|
||||
self.count_parameters = func.count_parameters
|
||||
self.counter = func.counter
|
||||
return
|
||||
|
||||
|
||||
class PrintGlxProtoStubs(glX_XML.GlxProto):
|
||||
def __init__(self):
|
||||
glX_XML.GlxProto.__init__(self)
|
||||
self.last_category = ""
|
||||
self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004", "IBM")
|
||||
self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
|
||||
self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
|
||||
self.pixel_stubs = {}
|
||||
return
|
||||
|
||||
def printRealHeader(self):
|
||||
|
@ -48,7 +120,7 @@ class PrintGlxProtoStubs(glX_XML.GlxProto):
|
|||
print '#include <GL/gl.h>'
|
||||
print '#include "indirect.h"'
|
||||
print '#include "glxclient.h"'
|
||||
print '#include "size.h"'
|
||||
print '#include "indirect_size.h"'
|
||||
print '#include <GL/glxproto.h>'
|
||||
print ''
|
||||
print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
|
||||
|
@ -125,6 +197,19 @@ setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
|
|||
req->contextTag = gc->currentContextTag;
|
||||
return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
|
||||
}
|
||||
|
||||
const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
|
||||
|
||||
#define zero (__glXDefaultPixelStore+0)
|
||||
#define one (__glXDefaultPixelStore+8)
|
||||
#define default_pixel_store_1D (__glXDefaultPixelStore+4)
|
||||
#define default_pixel_store_1D_size 20
|
||||
#define default_pixel_store_2D (__glXDefaultPixelStore+4)
|
||||
#define default_pixel_store_2D_size 20
|
||||
#define default_pixel_store_3D (__glXDefaultPixelStore+0)
|
||||
#define default_pixel_store_3D_size 36
|
||||
#define default_pixel_store_4D (__glXDefaultPixelStore+0)
|
||||
#define default_pixel_store_4D_size 36
|
||||
"""
|
||||
|
||||
for size in self.generic_sizes:
|
||||
|
@ -135,7 +220,10 @@ setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
|
|||
if f.fn_offset < 0 or f.handcode or f.ignore: return
|
||||
|
||||
if f.glx_rop != 0 or f.vectorequiv != None:
|
||||
self.printRenderFunction(f)
|
||||
if f.image:
|
||||
self.printPixelFunction(f)
|
||||
else:
|
||||
self.printRenderFunction(f)
|
||||
elif f.glx_sop != 0 or f.glx_vendorpriv != 0:
|
||||
self.printSingleFunction(f)
|
||||
else:
|
||||
|
@ -182,8 +270,38 @@ generic_%u_byte( GLint rop, const void * ptr )
|
|||
return offset
|
||||
|
||||
|
||||
def large_emit_begin(self, indent, f):
|
||||
print '%s const GLint op = %s;' % (indent, f.opcode_real_name())
|
||||
def pixel_emit_args(self, f, pc, indent, adjust, dim, large):
|
||||
"""Emit the arguments for a pixel function. This differs from
|
||||
common_emit_args in that pixel functions may require padding
|
||||
be inserted (i.e., for the missing width field for
|
||||
TexImage1D), and they may also require a 'NULL image' flag
|
||||
be inserted before the image data."""
|
||||
|
||||
offset = 0
|
||||
for p in f.parameterIterator(1, 1):
|
||||
self.common_emit_one_arg(p, offset, pc, indent, adjust)
|
||||
offset += p.size()
|
||||
|
||||
if f.pad_after(p):
|
||||
print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent, pc, offset + adjust)
|
||||
offset += 4
|
||||
|
||||
if f.image.img_null_flag:
|
||||
if large:
|
||||
print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent, pc, offset + adjust)
|
||||
else:
|
||||
print '%s (void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (indent, pc, offset + adjust, f.image.name)
|
||||
|
||||
offset += 4
|
||||
|
||||
return offset
|
||||
|
||||
|
||||
def large_emit_begin(self, indent, f, op_name = None):
|
||||
if not op_name:
|
||||
op_name = f.opcode_real_name()
|
||||
|
||||
print '%s const GLint op = %s;' % (indent, op_name)
|
||||
print '%s const GLuint cmdlenLarge = cmdlen + 4;' % (indent)
|
||||
print '%s GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
|
||||
print '%s (void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' % (indent)
|
||||
|
@ -199,9 +317,7 @@ generic_%u_byte( GLint rop, const void * ptr )
|
|||
print '{'
|
||||
|
||||
|
||||
def common_func_print_header(self, f):
|
||||
self.common_func_print_just_header(f)
|
||||
|
||||
def common_func_print_just_start(self, f):
|
||||
print ' __GLXcontext * const gc = __glXGetCurrentContext();'
|
||||
|
||||
# The only reason that single and vendor private commands need
|
||||
|
@ -224,6 +340,15 @@ generic_%u_byte( GLint rop, const void * ptr )
|
|||
|
||||
if f.count_parameters != None:
|
||||
print ' const GLuint compsize = __gl%s_size(%s);' % (f.name, f.count_parameters)
|
||||
elif f.image:
|
||||
[dim, w, h, d, junk] = f.dimensions()
|
||||
|
||||
compsize = '__glImageSize(%s, %s, %s, %s, %s, %s)' % (w, h, d, f.image.img_format, f.image.img_type, f.image.img_target)
|
||||
if not f.image.img_send_null:
|
||||
compsize = '(%s != NULL) ? %s : 0' % (f.image.name, compsize)
|
||||
|
||||
print ' const GLuint compsize = %s;' % (compsize)
|
||||
|
||||
|
||||
print ' const GLuint cmdlen = %s;' % (f.command_length())
|
||||
|
||||
|
@ -241,6 +366,12 @@ generic_%u_byte( GLint rop, const void * ptr )
|
|||
return 0
|
||||
|
||||
|
||||
def common_func_print_header(self, f):
|
||||
self.common_func_print_just_header(f)
|
||||
return self.common_func_print_just_start(f)
|
||||
|
||||
|
||||
|
||||
def printSingleFunction(self, f):
|
||||
self.common_func_print_header(f)
|
||||
|
||||
|
@ -284,6 +415,203 @@ generic_%u_byte( GLint rop, const void * ptr )
|
|||
return
|
||||
|
||||
|
||||
def printPixelFunction(self, f):
|
||||
"""This function could use some major refactoring. :("""
|
||||
|
||||
# There is a code-space optimization that we can do here.
|
||||
# Functions that are marked img_pad_dimensions have a version
|
||||
# with an odd number of dimensions and an even number of
|
||||
# dimensions. TexSubImage1D and TexSubImage2D are examples.
|
||||
# We can emit a single function that does both, and have the
|
||||
# real functions call the utility function with the correct
|
||||
# parameters.
|
||||
#
|
||||
# The only quirk to this is that utility funcitons will be
|
||||
# generated for 3D and 4D functions, but 4D (e.g.,
|
||||
# GL_SGIS_texture4D) isn't typically supported. This is
|
||||
# probably not an issue. However, it would be possible to
|
||||
# look at the total set of functions and determine if there
|
||||
# is another function that would actually use the utility
|
||||
# function. If not, then fallback to the normal way of
|
||||
# generating code.
|
||||
|
||||
if f.image.img_pad_dimensions:
|
||||
# Determine the hash key and the name for the utility
|
||||
# function that is used to implement the real
|
||||
# function.
|
||||
|
||||
[h, n] = hash_pixel_function(f)
|
||||
|
||||
|
||||
# If the utility function is not yet known, generate
|
||||
# it.
|
||||
|
||||
if not self.pixel_stubs.has_key(h):
|
||||
self.pixel_stubs[h] = n
|
||||
pixel_func = glXPixelFunctionUtility(f, n)
|
||||
|
||||
print 'static void'
|
||||
print '%s( unsigned opcode, unsigned dim, %s )' % (n, pixel_func.get_parameter_string())
|
||||
print '{'
|
||||
|
||||
if self.common_func_print_just_start(pixel_func):
|
||||
indent = " "
|
||||
trailer = " }"
|
||||
else:
|
||||
indent = ""
|
||||
trailer = None
|
||||
|
||||
|
||||
if pixel_func.can_be_large:
|
||||
print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
|
||||
print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
|
||||
print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
|
||||
print '%s }' % (indent)
|
||||
indent += " "
|
||||
|
||||
[dim, width, height, depth, extent] = pixel_func.dimensions()
|
||||
|
||||
if dim < 3:
|
||||
adjust = 20 + 4
|
||||
else:
|
||||
adjust = 36 + 4
|
||||
|
||||
|
||||
print '%s emit_header(gc->pc, opcode, cmdlen);' % (indent)
|
||||
|
||||
offset = self.pixel_emit_args(pixel_func, "gc->pc", indent, adjust, dim, 0)
|
||||
|
||||
[s, junk] = pixel_func.command_payload_length()
|
||||
|
||||
pixHeaderPtr = "gc->pc + 4"
|
||||
pcPtr = "gc->pc + %u" % (s + 4)
|
||||
|
||||
if pixel_func.image.img_send_null:
|
||||
condition = '(compsize > 0) && (%s != NULL)' % (pixel_func.image.name)
|
||||
else:
|
||||
condition = 'compsize > 0'
|
||||
|
||||
print '%s if (%s) {' % (indent, condition)
|
||||
print '%s (*gc->fillImage)(gc, dim, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, width, height, depth, pixel_func.image.img_format, pixel_func.image.img_type, pixel_func.image.name, pcPtr, pixHeaderPtr)
|
||||
print '%s }' % (indent)
|
||||
print '%s else {' % (indent)
|
||||
print '%s (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (indent, pixHeaderPtr, dim, dim)
|
||||
print '%s }' % (indent)
|
||||
|
||||
print '%s gc->pc += cmdlen;' % (indent)
|
||||
print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
|
||||
|
||||
if f.can_be_large:
|
||||
adjust += 4
|
||||
|
||||
print '%s}' % (indent)
|
||||
print '%selse {' % (indent)
|
||||
|
||||
self.large_emit_begin(indent, pixel_func, "opcode")
|
||||
offset = self.pixel_emit_args(pixel_func, "pc", indent, adjust, dim, 1)
|
||||
|
||||
pixHeaderPtr = "pc + 8"
|
||||
pcPtr = "pc + %u" % (s + 8)
|
||||
|
||||
print '%s __glXSendLargeImage(gc, compsize, dim, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, width, height, depth, f.image.img_format, f.image.img_type, f.image.name, pcPtr, pixHeaderPtr)
|
||||
|
||||
print '%s}' % (indent)
|
||||
|
||||
if trailer: print trailer
|
||||
print '}'
|
||||
print ''
|
||||
|
||||
|
||||
|
||||
# Generate the real function as a call to the
|
||||
# utility function.
|
||||
|
||||
self.common_func_print_just_header(f)
|
||||
|
||||
[dim, junk, junk, junk, junk] = f.dimensions()
|
||||
|
||||
p_string = ""
|
||||
for p in gl_XML.glFunction.parameterIterator(f):
|
||||
p_string += ", " + p.name
|
||||
|
||||
if f.pad_after(p):
|
||||
p_string += ", 1"
|
||||
|
||||
print ' %s(%s, %u%s );' % (n, f.opcode_name(), dim, p_string)
|
||||
print '}'
|
||||
print ''
|
||||
return
|
||||
|
||||
|
||||
if self.common_func_print_header(f):
|
||||
indent = " "
|
||||
trailer = " }"
|
||||
else:
|
||||
indent = ""
|
||||
trailer = None
|
||||
|
||||
|
||||
if f.can_be_large:
|
||||
print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
|
||||
print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
|
||||
print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
|
||||
print '%s }' % (indent)
|
||||
indent += " "
|
||||
|
||||
[dim, width, height, depth, extent] = f.dimensions()
|
||||
|
||||
if dim < 3:
|
||||
adjust = 20 + 4
|
||||
else:
|
||||
adjust = 36 + 4
|
||||
|
||||
|
||||
print '%s emit_header(gc->pc, %s, cmdlen);' % (indent, f.opcode_real_name())
|
||||
|
||||
offset = self.pixel_emit_args(f, "gc->pc", indent, adjust, dim, 0)
|
||||
|
||||
[s, junk] = f.command_payload_length()
|
||||
|
||||
pixHeaderPtr = "gc->pc + 4"
|
||||
pcPtr = "gc->pc + %u" % (s + 4)
|
||||
|
||||
if f.image.img_send_null:
|
||||
condition = '(compsize > 0) && (%s != NULL)' % (f.image.name)
|
||||
else:
|
||||
condition = 'compsize > 0'
|
||||
|
||||
print '%s if (%s) {' % (indent, condition)
|
||||
print '%s (*gc->fillImage)(gc, %u, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, dim, width, height, depth, f.image.img_format, f.image.img_type, f.image.name, pcPtr, pixHeaderPtr)
|
||||
print '%s }' % (indent)
|
||||
print '%s else {' % (indent)
|
||||
print '%s (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (indent, pixHeaderPtr, dim, dim)
|
||||
print '%s }' % (indent)
|
||||
|
||||
print '%s gc->pc += cmdlen;' % (indent)
|
||||
print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
|
||||
|
||||
if f.can_be_large:
|
||||
adjust += 4
|
||||
|
||||
print '%s}' % (indent)
|
||||
print '%selse {' % (indent)
|
||||
|
||||
self.large_emit_begin(indent, f)
|
||||
offset = self.pixel_emit_args(f, "pc", indent, adjust, dim, 1)
|
||||
|
||||
pixHeaderPtr = "pc + 8"
|
||||
pcPtr = "pc + %u" % (s + 8)
|
||||
|
||||
print '%s __glXSendLargeImage(gc, compsize, %u, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, dim, width, height, depth, f.image.img_format, f.image.img_type, f.image.name, pcPtr, pixHeaderPtr)
|
||||
|
||||
print '%s}' % (indent)
|
||||
|
||||
if trailer: print trailer
|
||||
print '}'
|
||||
print ''
|
||||
return
|
||||
|
||||
|
||||
def printRenderFunction(self, f):
|
||||
# There is a class of GL functions that take a single pointer
|
||||
# as a parameter. This pointer points to a fixed-size chunk
|
||||
|
|
|
@ -24,6 +24,20 @@
|
|||
counter CDATA #IMPLIED
|
||||
count_scale CDATA #IMPLIED
|
||||
output CDATA #IMPLIED
|
||||
img_width CDATA #IMPLIED
|
||||
img_height CDATA #IMPLIED
|
||||
img_depth CDATA #IMPLIED
|
||||
img_extent CDATA #IMPLIED
|
||||
img_xoff CDATA #IMPLIED
|
||||
img_yoff CDATA #IMPLIED
|
||||
img_zoff CDATA #IMPLIED
|
||||
img_woff CDATA #IMPLIED
|
||||
img_format CDATA #IMPLIED
|
||||
img_type CDATA #IMPLIED
|
||||
img_target CDATA #IMPLIED
|
||||
img_send_null CDATA #IMPLIED
|
||||
img_null_flag CDATA #IMPLIED
|
||||
img_pad_dimensions CDATA #IMPLIED
|
||||
variable_param CDATA #IMPLIED>
|
||||
<!ATTLIST return type CDATA #REQUIRED>
|
||||
<!ATTLIST glx rop CDATA #IMPLIED
|
||||
|
@ -58,6 +72,24 @@ param:
|
|||
single enum parameter. Most of the gl*Parameter[if]v functions use
|
||||
this. Additionally, the enums that can be passed should be properly
|
||||
annotated.
|
||||
img_width / img_height / img_depth / img_extent - name of parameters
|
||||
(or hardcoded integer) used for the dimensions of pixel data.
|
||||
img_xoff / img_yoff / img_zoff / img_woff - name of parameters used
|
||||
for x, y, z, and w offsets of pixel data.
|
||||
img_format - name of parameter used as the pixel data format.
|
||||
img_type - name of parameter used as the pixel data type.
|
||||
img_target - name of parameter used as a texture target. Non-texture
|
||||
pixel data should hardcode 0.
|
||||
img_send_null - boolean flag to determine if blank pixel data should
|
||||
be sent when a NULL pointer is passed. This is only used by
|
||||
TexImage1D and TexImage2D.
|
||||
img_null_flag - boolean flag to determine if an extra flag is used to
|
||||
determine if a NULL pixel pointer was passed. This is used by
|
||||
TexSubImage1D, TexSubImage2D, TexImage3D and others.
|
||||
img_pad_dimensions - boolean flag to determine if dimension data and
|
||||
offset data should be padded to the next even number of dimensions.
|
||||
For example, this will insert an empty "height" field after the
|
||||
"width" field in the protocol for TexImage1D.
|
||||
|
||||
glx:
|
||||
rop - Opcode value for "render" commands
|
||||
|
@ -73,8 +105,8 @@ glx:
|
|||
return value data (e.g., glGetLightfv). Other single commands take
|
||||
reply data only as an array (e.g., glGetClipPlane).
|
||||
handcode - some functions are just too complicated to generate
|
||||
(e.g., glTexImage2D) or operate only on client-side data (e.g.,
|
||||
glVertexPointer) and must be handcoded.
|
||||
(e.g., glSeperableFilter2D) or operate only on client-side data
|
||||
(e.g., glVertexPointer) and must be handcoded.
|
||||
ignore - some functions have an entry in the dispatch table, but aren't
|
||||
suitable for protocol implementation (e.g., glLockArraysEXT). This
|
||||
also applies to functions that don't have any GLX protocol specified
|
||||
|
@ -775,8 +807,8 @@ glx:
|
|||
<param name="yorig" type="GLfloat"/>
|
||||
<param name="xmove" type="GLfloat"/>
|
||||
<param name="ymove" type="GLfloat"/>
|
||||
<param name="bitmap" type="const GLubyte *"/>
|
||||
<glx rop="5" handcode="true"/>
|
||||
<param name="bitmap" type="const GLubyte *" img_width="width" img_height="height" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/>
|
||||
<glx rop="5" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="Color3b" offset="9" vectorequiv="Color3bv">
|
||||
|
@ -1706,8 +1738,8 @@ glx:
|
|||
</function>
|
||||
|
||||
<function name="PolygonStipple" offset="175">
|
||||
<param name="mask" type="const GLubyte *"/>
|
||||
<glx rop="102" handcode="true"/>
|
||||
<param name="mask" type="const GLubyte *" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/>
|
||||
<glx rop="102"/>
|
||||
</function>
|
||||
|
||||
<function name="Scissor" offset="176">
|
||||
|
@ -1759,8 +1791,8 @@ glx:
|
|||
<param name="border" type="GLint"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="109" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/>
|
||||
<glx rop="109" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="TexImage2D" offset="183">
|
||||
|
@ -1772,8 +1804,8 @@ glx:
|
|||
<param name="border" type="GLint"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="110" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/>
|
||||
<glx rop="110" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="TexEnvf" offset="184">
|
||||
|
@ -2249,8 +2281,8 @@ glx:
|
|||
<param name="height" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="173" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0" img_pad_dimensions="false"/>
|
||||
<glx rop="173" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="GetBooleanv" offset="258">
|
||||
|
@ -2826,8 +2858,8 @@ glx:
|
|||
<param name="width" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="4099" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="4099" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="TexSubImage2D" offset="333">
|
||||
|
@ -2839,8 +2871,8 @@ glx:
|
|||
<param name="height" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="4100" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="4100" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="AreTexturesResident" offset="322">
|
||||
|
@ -3035,8 +3067,8 @@ glx:
|
|||
<param name="width" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="table" type="const GLvoid *"/>
|
||||
<glx rop="2053" handcode="true"/>
|
||||
<param name="table" type="const GLvoid *" img_width="width" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/>
|
||||
<glx rop="2053" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="ColorTableParameterfv" offset="340">
|
||||
|
@ -3090,8 +3122,8 @@ glx:
|
|||
<param name="count" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="data" type="const GLvoid *"/>
|
||||
<glx rop="195" handcode="true"/>
|
||||
<param name="data" type="const GLvoid *" img_width="count" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/>
|
||||
<glx rop="195" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="CopyColorSubTable" offset="347">
|
||||
|
@ -3109,8 +3141,8 @@ glx:
|
|||
<param name="width" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="image" type="const GLvoid *"/>
|
||||
<glx rop="4101" handcode="true"/>
|
||||
<param name="image" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
|
||||
<glx rop="4101" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="ConvolutionFilter2D" offset="349">
|
||||
|
@ -3120,8 +3152,8 @@ glx:
|
|||
<param name="height" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="image" type="const GLvoid *"/>
|
||||
<glx rop="4102" handcode="true"/>
|
||||
<param name="image" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
|
||||
<glx rop="4102" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="ConvolutionParameterf" offset="350">
|
||||
|
@ -3296,8 +3328,8 @@ glx:
|
|||
<param name="border" type="GLint"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="4114" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="4114" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="TexSubImage3D" offset="372">
|
||||
|
@ -3311,8 +3343,8 @@ glx:
|
|||
<param name="depth" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<glx rop="4115" handcode="true"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="4115" large="true"/>
|
||||
</function>
|
||||
|
||||
<function name="CopyTexSubImage3D" offset="373">
|
||||
|
@ -6545,7 +6577,7 @@ glx:
|
|||
<param name="border" type="GLint"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="2057" ignore="true"/>
|
||||
</function>
|
||||
|
||||
|
@ -6562,7 +6594,7 @@ glx:
|
|||
<param name="size4d" type="GLsizei"/>
|
||||
<param name="format" type="GLenum"/>
|
||||
<param name="type" type="GLenum"/>
|
||||
<param name="pixels" type="const GLvoid *"/>
|
||||
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
|
||||
<glx rop="2058" ignore="true"/>
|
||||
</function>
|
||||
</category>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python2
|
||||
|
||||
# (C) Copyright IBM Corporation 2004
|
||||
# (C) Copyright IBM Corporation 2004, 2005
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -154,7 +154,45 @@ class glParameter( glItem ):
|
|||
else:
|
||||
self.is_output = 0
|
||||
|
||||
if self.p_count > 0 or self.counter != None or self.p_count_parameters != None :
|
||||
|
||||
# Pixel data has special parameters.
|
||||
|
||||
self.width = attrs.get('img_width', None)
|
||||
self.height = attrs.get('img_height', None)
|
||||
self.depth = attrs.get('img_depth', None)
|
||||
self.extent = attrs.get('img_extent', None)
|
||||
|
||||
self.img_xoff = attrs.get('img_xoff', None)
|
||||
self.img_yoff = attrs.get('img_yoff', None)
|
||||
self.img_zoff = attrs.get('img_zoff', None)
|
||||
self.img_woff = attrs.get('img_woff', None)
|
||||
|
||||
self.img_format = attrs.get('img_format', None)
|
||||
self.img_type = attrs.get('img_type', None)
|
||||
self.img_target = attrs.get('img_target', None)
|
||||
|
||||
pad = attrs.get('img_pad_dimensions', "false")
|
||||
if pad == "true":
|
||||
self.img_pad_dimensions = 1
|
||||
else:
|
||||
self.img_pad_dimensions = 0
|
||||
|
||||
|
||||
null_flag = attrs.get('img_null_flag', "false")
|
||||
if null_flag == "true":
|
||||
self.img_null_flag = 1
|
||||
else:
|
||||
self.img_null_flag = 0
|
||||
|
||||
send_null = attrs.get('img_send_null', "false")
|
||||
if send_null == "true":
|
||||
self.img_send_null = 1
|
||||
else:
|
||||
self.img_send_null = 0
|
||||
|
||||
|
||||
|
||||
if self.p_count > 0 or self.counter or self.p_count_parameters:
|
||||
has_count = 1
|
||||
else:
|
||||
has_count = 0
|
||||
|
@ -193,7 +231,7 @@ class glParameter( glItem ):
|
|||
to glCallLists, are not variable length arrays in this
|
||||
sense."""
|
||||
|
||||
return (self.p_count_parameters != None) or (self.counter != None)
|
||||
return self.p_count_parameters or self.counter or self.width
|
||||
|
||||
|
||||
def is_array(self):
|
||||
|
@ -222,7 +260,7 @@ class glParameter( glItem ):
|
|||
|
||||
|
||||
def size(self):
|
||||
if self.p_count_parameters != None or self.counter != None or self.is_output:
|
||||
if self.p_count_parameters or self.counter or self.width or self.is_output:
|
||||
return 0
|
||||
elif self.p_count == 0:
|
||||
return self.p_type.size
|
||||
|
@ -241,6 +279,8 @@ class glParameter( glItem ):
|
|||
pass
|
||||
elif self.p_count_parameters != None and self.counter != None:
|
||||
b_prod = self.counter
|
||||
elif self.width:
|
||||
return "compsize"
|
||||
else:
|
||||
raise RuntimeError("Parameter '%s' to function '%s' has size 0." % (self.name, self.context.name))
|
||||
|
||||
|
@ -281,6 +321,7 @@ class glFunction( glItem ):
|
|||
def __init__(self, context, name, attrs):
|
||||
self.fn_alias = attrs.get('alias', None)
|
||||
self.fn_parameters = []
|
||||
self.image = None
|
||||
|
||||
temp = attrs.get('offset', None)
|
||||
if temp == None or temp == "?":
|
||||
|
@ -318,6 +359,9 @@ class glFunction( glItem ):
|
|||
if tag_name != "param":
|
||||
raise RuntimeError("Trying to append '%s' to parameter list of function '%s'." % (tag_name, self.name))
|
||||
|
||||
if p.width:
|
||||
self.image = p
|
||||
|
||||
self.fn_parameters.append(p)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue