1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include "cr_spu.h"
|
---|
8 | #include "chromium.h"
|
---|
9 | #include "cr_error.h"
|
---|
10 | #include "cr_mem.h"
|
---|
11 | #include "cr_net.h"
|
---|
12 | #include "server_dispatch.h"
|
---|
13 | #include "server.h"
|
---|
14 |
|
---|
15 | static GLint __sizeQuery( GLenum map )
|
---|
16 | {
|
---|
17 | GLint get_values;
|
---|
18 | /* Windows compiler gets mad if variables might be uninitialized */
|
---|
19 | GLenum newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
|
---|
20 |
|
---|
21 | switch( map )
|
---|
22 | {
|
---|
23 | case GL_PIXEL_MAP_I_TO_I:
|
---|
24 | newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
|
---|
25 | break;
|
---|
26 | case GL_PIXEL_MAP_S_TO_S:
|
---|
27 | newmap = GL_PIXEL_MAP_S_TO_S_SIZE;
|
---|
28 | break;
|
---|
29 | case GL_PIXEL_MAP_I_TO_R:
|
---|
30 | newmap = GL_PIXEL_MAP_I_TO_R_SIZE;
|
---|
31 | break;
|
---|
32 | case GL_PIXEL_MAP_I_TO_G:
|
---|
33 | newmap = GL_PIXEL_MAP_I_TO_G_SIZE;
|
---|
34 | break;
|
---|
35 | case GL_PIXEL_MAP_I_TO_B:
|
---|
36 | newmap = GL_PIXEL_MAP_I_TO_B_SIZE;
|
---|
37 | break;
|
---|
38 | case GL_PIXEL_MAP_I_TO_A:
|
---|
39 | newmap = GL_PIXEL_MAP_I_TO_A_SIZE;
|
---|
40 | break;
|
---|
41 | case GL_PIXEL_MAP_R_TO_R:
|
---|
42 | newmap = GL_PIXEL_MAP_R_TO_R_SIZE;
|
---|
43 | break;
|
---|
44 | case GL_PIXEL_MAP_G_TO_G:
|
---|
45 | newmap = GL_PIXEL_MAP_G_TO_G_SIZE;
|
---|
46 | break;
|
---|
47 | case GL_PIXEL_MAP_B_TO_B:
|
---|
48 | newmap = GL_PIXEL_MAP_B_TO_B_SIZE;
|
---|
49 | break;
|
---|
50 | case GL_PIXEL_MAP_A_TO_A:
|
---|
51 | newmap = GL_PIXEL_MAP_A_TO_A_SIZE;
|
---|
52 | break;
|
---|
53 | default:
|
---|
54 | crError( "Bad map in crServerDispatchGetPixelMap: %d", map );
|
---|
55 | break;
|
---|
56 | }
|
---|
57 |
|
---|
58 | cr_server.head_spu->dispatch_table.GetIntegerv( newmap, &get_values );
|
---|
59 |
|
---|
60 | return get_values;
|
---|
61 | }
|
---|
62 |
|
---|
63 | void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapfv( GLenum map, GLfloat *values )
|
---|
64 | {
|
---|
65 | int size = sizeof( GLfloat );
|
---|
66 | int tabsize = __sizeQuery( map );
|
---|
67 | GLfloat *local_values;
|
---|
68 |
|
---|
69 | (void) values;
|
---|
70 |
|
---|
71 | size *= tabsize;
|
---|
72 | local_values = (GLfloat*)crAlloc( size );
|
---|
73 |
|
---|
74 | cr_server.head_spu->dispatch_table.GetPixelMapfv( map, local_values );
|
---|
75 | crServerReturnValue( local_values, size );
|
---|
76 | crFree( local_values );
|
---|
77 | }
|
---|
78 |
|
---|
79 | void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapuiv( GLenum map, GLuint *values )
|
---|
80 | {
|
---|
81 | int size = sizeof( GLuint );
|
---|
82 | int tabsize = __sizeQuery( map );
|
---|
83 | GLuint *local_values;
|
---|
84 | (void) values;
|
---|
85 |
|
---|
86 | size *= tabsize;
|
---|
87 | local_values = (GLuint*)crAlloc( size );
|
---|
88 |
|
---|
89 | cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, local_values );
|
---|
90 | crServerReturnValue( local_values, size );
|
---|
91 | crFree( local_values );
|
---|
92 | }
|
---|
93 |
|
---|
94 | void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapusv( GLenum map, GLushort *values )
|
---|
95 | {
|
---|
96 | int size = sizeof( GLushort );
|
---|
97 | int tabsize = __sizeQuery( map );
|
---|
98 | GLushort *local_values;
|
---|
99 | (void) values;
|
---|
100 |
|
---|
101 | size *= tabsize;
|
---|
102 | local_values = (GLushort*)crAlloc( size );
|
---|
103 |
|
---|
104 | cr_server.head_spu->dispatch_table.GetPixelMapusv( map, local_values );
|
---|
105 | crServerReturnValue( local_values, size );
|
---|
106 | crFree( local_values );
|
---|
107 | }
|
---|