summaryrefslogtreecommitdiff
path: root/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_map.c
blob: 2e530b68308c211b89f05d38dd84ca5bed3ef2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "unpacker.h"
#include "cr_error.h"
#include "cr_mem.h"


void crUnpackMap2d( void  )
{
	GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
	GLdouble u1 = READ_DOUBLE( sizeof( int ) + 4 );
	GLdouble u2 = READ_DOUBLE( sizeof( int ) + 12 );
	GLint ustride = READ_DATA( sizeof( int ) + 20, GLint );
	GLint uorder = READ_DATA( sizeof( int ) + 24, GLint );
	GLdouble v1 = READ_DOUBLE( sizeof( int ) + 28 );
	GLdouble v2 = READ_DOUBLE( sizeof( int ) + 36 );
	GLint vstride = READ_DATA( sizeof( int ) + 44, GLint );
	GLint vorder = READ_DATA( sizeof( int ) + 48, GLint );

	int n_points = READ_DATA( 0, int ) - ( sizeof( int ) + 52 );
	GLdouble *points;

	if ( n_points & 0x7 )
		crError( "crUnpackMap2d: n_points=%d, expected multiple of 8\n", n_points );
	points = (GLdouble *) crAlloc( n_points );
	crMemcpy( points, DATA_POINTER( sizeof(int) + 52, GLdouble ), n_points );

	cr_unpackDispatch.Map2d( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, 
			 points );
	crFree( points );

	INCR_VAR_PTR();
}

void crUnpackMap2f( void  )
{
	GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
	GLfloat u1 = READ_DATA( sizeof( int ) + 4, GLfloat );
	GLfloat u2 = READ_DATA( sizeof( int ) + 8, GLfloat );
	GLint ustride = READ_DATA( sizeof( int ) + 12, GLint );
	GLint uorder = READ_DATA( sizeof( int ) + 16, GLint );
	GLfloat v1 = READ_DATA( sizeof( int ) + 20, GLfloat );
	GLfloat v2 = READ_DATA( sizeof( int ) + 24, GLfloat );
	GLint vstride = READ_DATA( sizeof( int ) + 28, GLint );
	GLint vorder = READ_DATA( sizeof( int ) + 32, GLint );
	GLfloat *points = DATA_POINTER( sizeof( int ) + 36 , GLfloat );

	cr_unpackDispatch.Map2f( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder,
			 points );
	INCR_VAR_PTR();
}

void crUnpackMap1d( void  )
{
	GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
	GLdouble u1 = READ_DOUBLE( sizeof( int ) + 4 );
	GLdouble u2 = READ_DOUBLE( sizeof( int ) + 12 );
	GLint stride = READ_DATA( sizeof( int ) + 20, GLint );
	GLint order = READ_DATA( sizeof( int ) + 24, GLint );

	int n_points = READ_DATA( 0, int ) - ( sizeof(int) + 28 );
	GLdouble *points;

	if ( n_points & 0x7 )
		crError( "crUnpackMap1d: n_points=%d, expected multiple of 8\n", n_points );
	points = (GLdouble *) crAlloc( n_points );
	crMemcpy( points, DATA_POINTER( sizeof(int) + 28, GLdouble ), n_points );
	
	cr_unpackDispatch.Map1d( target, u1, u2, stride, order, points );
	crFree( points );

	INCR_VAR_PTR();
}

void crUnpackMap1f( void  )
{
	GLenum target = READ_DATA( sizeof( int ) + 0, GLenum );
	GLfloat u1 = READ_DATA( sizeof( int ) + 4, GLfloat );
	GLfloat u2 = READ_DATA( sizeof( int ) + 8, GLfloat );
	GLint stride = READ_DATA( sizeof( int ) + 12, GLint );
	GLint order = READ_DATA( sizeof( int ) + 16, GLint );
	GLfloat *points = DATA_POINTER( sizeof( int ) + 20, GLfloat );

	cr_unpackDispatch.Map1f( target, u1, u2, stride, order, points );
	INCR_VAR_PTR();
}