server_misc.c revision 05e2d532b00db03e631595029308c4c621a11e43
/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "server_dispatch.h"
#include "server.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "cr_string.h"
#include "cr_pixeldata.h"
{
(void) size;
(void) buffer;
crError( "Unsupported network glSelectBuffer call." );
}
void SERVER_DISPATCH_APIENTRY crServerDispatchGetChromiumParametervCR(GLenum target, GLuint index, GLenum type, GLsizei count, GLvoid *values)
{
switch (type) {
case GL_BYTE:
case GL_UNSIGNED_BYTE:
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
break;
case GL_INT:
case GL_UNSIGNED_INT:
break;
case GL_FLOAT:
break;
case GL_DOUBLE:
break;
default:
crError("Bad type in crServerDispatchGetChromiumParametervCR");
}
cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage );
}
void SERVER_DISPATCH_APIENTRY crServerDispatchChromiumParametervCR(GLenum target, GLenum type, GLsizei count, const GLvoid *values)
{
static int gather_connect_count = 0;
switch (target) {
case GL_SET_MAX_VIEWPORT_CR:
{
}
break;
case GL_TILE_INFO_CR:
/* message from tilesort SPU to set new tile bounds */
{
server = tileBounds[0];
/*crServerNewMuralTiling(mural, muralWidth, muralHeight, numTiles, tileBounds);
mural->viewportValidated = GL_FALSE;*/
}
break;
case GL_GATHER_DRAWPIXELS_CR:
break;
break;
case GL_GATHER_CONNECT_CR:
/*
* We want the last connect to go through,
* otherwise we might deadlock in CheckWindowSize()
* in the readback spu
*/
{
break;
}
gather_connect_count = 0;
break;
case GL_SERVER_VIEW_MATRIX_CR:
/* Set this server's view matrix which will get premultiplied onto the
* modelview matrix. For non-planar tilesort and stereo.
*/
/* values[0] is the server index. Ignored here but used in tilesort SPU */
{
crDebug("Got GL_SERVER_VIEW_MATRIX_CR:\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f",
}
break;
/* Set this server's projection matrix which will get replace the user's
* projection matrix. For non-planar tilesort and stereo.
*/
/* values[0] is the server index. Ignored here but used in tilesort SPU */
{
crDebug("Got GL_SERVER_PROJECTION_MATRIX_CR:\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f",
float znear = -d / (1.0f - c);
crDebug("Frustum: left, right, bottom, top, near, far: %f, %f, %f, %f, %f, %f", left, right, bottom, top, znear, zfar);
}
else {
/* Todo: Add debug output for orthographic projection*/
}
}
break;
default:
/* Pass the parameter info to the head SPU */
break;
}
}
{
switch (target) {
break;
break;
break;
case GL_SHARED_PROGRAMS_CR:
break;
case GL_SERVER_CURRENT_EYE_CR:
break;
default:
/* Pass the parameter info to the head SPU */
}
}
{
switch (target) {
break;
break;
case GL_SHARED_PROGRAMS_CR:
break;
default:
/* Pass the parameter info to the head SPU */
}
}
void crServerCreateInfoDeleteCB(void *data)
{
if (pCreateInfo->pszDpyName)
}
{
return (*pCounter)++;
}
/*#define CR_DUMP_BLITS*/
#ifdef CR_DUMP_BLITS
static int blitnum=0;
static int copynum=0;
#endif
crServerDispatchCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
static int siHavePBO = 0;
static int siHaveFBO = 0;
{
cr_server.head_spu->dispatch_table.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
#ifdef CR_DUMP_BLITS
{
void *img;
GLint w, h;
char fname[200];
copynum++;
}
#endif
}
else /* negative height, means we have to Yinvert the source pixels while copying */
{
if (siHavePBO<0)
{
}
if (siHaveFBO<0)
{
}
{
#if 1
{
}
#else
{
GLint w, h, i;
for (i=0; i<-height; ++i)
{
sPtr += 4*w;
}
gl->TexSubImage2D(target, level, xoffset, yoffset, width, -height, GL_RGBA, GL_UNSIGNED_BYTE, img2);
}
#endif
}
{
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
{
}
gl->PushMatrix();
gl->LoadIdentity();
gl->PushMatrix();
gl->LoadIdentity();
gl->BindFramebufferEXT(GL_FRAMEBUFFER_EXT, ctx->framebufferobject.drawFB ? ctx->framebufferobject.drawFB->hwid:0);
#if 0
{
{
}
{
crDebug("MISMATCH! (%x, %i, ->%i,%i <-%i, %i [%ix%i])", target, level, xoffset, yoffset, x, y, width, height);
DebugBreak();
}
}
#endif
}
else
{
#if 1
{
gl->TexSubImage2D(target, level, xoffset, dRow, width, 1, GL_RGBA, GL_UNSIGNED_BYTE, (void*)((uintptr_t)sRow*width*4));
}
#else /*few times slower again*/
{
}
#endif
}
}
}
{
#ifdef CR_DUMP_BLITS
char fname[200];
void *img;
blitnum++;
crDebug("[%i]BlitFramebufferEXT(%i, %i, %i, %i, %i, %i, %i, %i, %x, %x)", blitnum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &dtex);
gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, &dlev);
crDebug("Src[rb 0x%x, fbo %i] Dst[db 0x%x, fbo %i(0x%x), tex %i.%i]", rb, rfb, db, dfb, status, dtex, dlev);
#endif
#ifdef CR_DUMP_BLITS
#endif
}