示例#1
0
void REPLICATESPU_APIENTRY replicatespu_End( void )
{
	GET_THREAD(thread);
	CRPackBuffer *buf = &thread->BeginEndBuffer;

	if ( thread->server.conn->Barf &&
		(thread->BeginEndMode == GL_LINES
		|| thread->BeginEndMode == GL_TRIANGLES
		|| thread->BeginEndMode == GL_QUADS
		|| thread->BeginEndMode == GL_POLYGON ) )
	{
		CRASSERT(buf->pack);

		crPackReleaseBuffer( thread->packer );
		crPackSetBuffer( thread->packer, &thread->normBuffer );
		if ( !crPackCanHoldBuffer( buf ) )
			replicatespuFlush( (void *) thread );

		crPackAppendBuffer( buf );
		crNetFree( thread->server.conn, buf->pack );
		buf->pack = NULL;
	}

	if (thread->currentContext->displayListMode != GL_FALSE) {
		crDLMCompileEnd();
	}
	if (replicate_spu.swap)
	{
		crPackEndSWAP();
	}
	else
	{
		crPackEnd();
	}
}
示例#2
0
void crPackAppendBuffer( const CRPackBuffer *src )
{
	CR_GET_PACKER_CONTEXT(pc);
	const int num_data = crPackNumData(src);
	const int num_opcode = crPackNumOpcodes(src);

	CRASSERT(num_data >= 0);
	CRASSERT(num_opcode >= 0);

    CR_LOCK_PACKER_CONTEXT(pc);

	/* don't append onto ourself! */
	CRASSERT(pc->currentBuffer);
	CRASSERT(pc->currentBuffer != src);

	if (!crPackCanHoldBuffer(src))
	{
		if (src->holds_BeginEnd)
		{
			crWarning( "crPackAppendBuffer: overflowed the destination!" );
            CR_UNLOCK_PACKER_CONTEXT(pc);
			return;
		}
		else
        {
			crError( "crPackAppendBuffer: overflowed the destination!" );
            CR_UNLOCK_PACKER_CONTEXT(pc);
        }
	}

	/* Copy the buffer data/operands which are at the head of the buffer */
	crMemcpy( pc->buffer.data_current, src->data_start, num_data );
	pc->buffer.data_current += num_data;

	/* Copy the buffer opcodes which are at the tail of the buffer */
	CRASSERT( pc->buffer.opcode_current - num_opcode >= pc->buffer.opcode_end );
	crMemcpy( pc->buffer.opcode_current + 1 - num_opcode, src->opcode_current + 1,
			num_opcode );
	pc->buffer.opcode_current -= num_opcode;
	pc->buffer.holds_BeginEnd |= src->holds_BeginEnd;
	pc->buffer.in_BeginEnd = src->in_BeginEnd;
	pc->buffer.holds_List |= src->holds_List;
    CR_UNLOCK_PACKER_CONTEXT(pc);
}
示例#3
0
static void DoVertex( void )
{
	GET_THREAD(thread);
	CRPackBuffer *buf = &thread->BeginEndBuffer;
	CRPackBuffer *gbuf = &thread->normBuffer;
	int num_data;
	int num_opcode;

	/*crDebug( "really doing Vertex" );*/
	crPackReleaseBuffer( thread->packer );
	num_data = buf->data_current - buf->data_start;
	num_opcode = buf->opcode_start - buf->opcode_current;
	crPackSetBuffer( thread->packer, gbuf );
	if ( !crPackCanHoldBuffer( buf ) )
		/* doesn't hold, first flush gbuf*/
		replicatespuFlush( (void *) thread );

	crPackAppendBuffer( buf );
	crPackReleaseBuffer( thread->packer );
	crPackSetBuffer( thread->packer, buf );
	crPackResetPointers(thread->packer);
}