packspu_pixel.c revision b61972bc3b0f843a974c038ce2e54d604af64f5a
/* Copyright (c) 2001, Stanford University
All rights reserved.
See the file LICENSE.txt for information on redistributing this software. */
#include "cr_packfunctions.h"
#include "cr_glstate.h"
#include "cr_pixeldata.h"
#include "cr_version.h"
#include "packspu.h"
#include "packspu_proto.h"
{
if (format!=GL_COLOR_INDEX
&& format!=GL_LUMINANCE
&& format!=GL_DEPTH_COMPONENT)
{
/*crWarning("crPackCheckTexImageFormat FAILED format 0x%x isn't valid", format);*/
return GL_FALSE;
}
return GL_TRUE;
}
{
if (type!=GL_UNSIGNED_BYTE
&& type!=GL_UNSIGNED_INT
{
/*crWarning("crPackCheckTexImageType FAILED type 0x%x isn't valid", type);*/
return GL_FALSE;
}
return GL_TRUE;
}
{
if (internalformat!=1
&& internalformat!=2
&& internalformat!=3
&& internalformat!=4
&& internalformat!=GL_RGB
# ifdef CR_EXT_texture_sRGB
# endif
#endif
/*@todo ARB_texture_float*/
)
{
/*crWarning("crPackCheckTexImageInternalFormat FAILED internalformat 0x%x isn't valid", internalformat);*/
return GL_FALSE;
}
return GL_TRUE;
}
{
return packspu_CheckTexImageFormat(format)
}
{
return packspu_CheckTexImageFormat(format)
}
{
/* NOTE: we do not send pixel store parameters to the server!
* When we pack a glDrawPixels or glTexImage2D image we interpret
* the user's pixel store parameters at that time and pack the
*/
}
{
}
void PACKSPU_APIENTRY packspu_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
{
else
}
void PACKSPU_APIENTRY packspu_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
{
int writeback;
{
}
else
{
}
#ifdef CR_ARB_pixel_buffer_object
#endif
{
packspuFlush((void *) thread);
while (pack_spu.ReadPixels)
crNetRecv();
}
}
void PACKSPU_APIENTRY packspu_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type )
{
else
/* XXX why flush here? */
packspuFlush( (void *) thread );
}
void PACKSPU_APIENTRY packspu_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap )
{
else
}
void PACKSPU_APIENTRY packspu_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
{
{
{
crWarning("packspu_TexImage1D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
return;
}
}
crPackTexImage1DSWAP( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
else
crPackTexImage1D( target, level, internalformat, width, border, format, type, pixels, &(clientState->unpack) );
}
void PACKSPU_APIENTRY packspu_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
{
{
{
crWarning("packspu_TexImage2D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
return;
}
}
crPackTexImage2DSWAP( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
else
crPackTexImage2D( target, level, internalformat, width, height, border, format, type, pixels, &(clientState->unpack) );
}
#ifdef GL_EXT_texture3D
void PACKSPU_APIENTRY packspu_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
{
crPackTexImage3DEXTSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
else
crPackTexImage3DEXT( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
}
#endif
#ifdef CR_OPENGL_VERSION_1_2
void PACKSPU_APIENTRY packspu_TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
{
crPackTexImage3DSWAP( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
else
crPackTexImage3D( target, level, internalformat, width, height, depth, border, format, type, pixels, &(clientState->unpack) );
}
#endif /* CR_OPENGL_VERSION_1_2 */
void PACKSPU_APIENTRY packspu_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels )
{
{
return;
}
crPackTexSubImage1DSWAP( target, level, xoffset, width, format, type, pixels, &(clientState->unpack) );
else
}
void PACKSPU_APIENTRY packspu_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
{
{
return;
}
crPackTexSubImage2DSWAP( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
else
crPackTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels, &(clientState->unpack) );
}
#ifdef CR_OPENGL_VERSION_1_2
void PACKSPU_APIENTRY packspu_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels )
{
crPackTexSubImage3DSWAP( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
else
crPackTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &(clientState->unpack) );
}
#endif /* CR_OPENGL_VERSION_1_2 */
void PACKSPU_APIENTRY packspu_ZPixCR( GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum ztype, GLint zparm, GLint length, const GLvoid *pixels )
{
crPackZPixCRSWAP( width, height, format, type, ztype, zparm, length, pixels, &(clientState->unpack) );
else
}
void PACKSPU_APIENTRY packspu_GetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
{
int writeback = 1;
/* XXX note: we're not observing the pixel pack parameters here.
* To do so, we'd have to allocate a temporary image buffer (how large???)
* and copy the image to the user's buffer using the pixel pack params.
*/
else
#ifdef CR_ARB_pixel_buffer_object
#endif
{
packspuFlush( (void *) thread );
while (writeback)
crNetRecv();
}
}
{
int writeback = 1;
{
}
else
{
}
#ifdef CR_ARB_pixel_buffer_object
#endif
{
packspuFlush( (void *) thread );
while (writeback)
crNetRecv();
}
}