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 "unpacker.h"
|
---|
8 | #include "state/cr_bufferobject.h"
|
---|
9 |
|
---|
10 | void crUnpackPixelMapfv(PCrUnpackerState pState)
|
---|
11 | {
|
---|
12 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, sizeof(int) + 8, int);
|
---|
13 |
|
---|
14 | GLenum map = READ_DATA(pState, sizeof( int ) + 0, GLenum );
|
---|
15 | GLsizei mapsize = READ_DATA(pState, sizeof( int ) + 4, GLsizei );
|
---|
16 | int nodata = READ_DATA(pState, sizeof(int) + 8, int);
|
---|
17 | GLfloat *values;
|
---|
18 |
|
---|
19 | if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
|
---|
20 | return;
|
---|
21 |
|
---|
22 | if (nodata)
|
---|
23 | {
|
---|
24 | /* This is valid, see glPixelMap description for GL_PIXEL_UNPACK_BUFFER values is treated as a byte offset. */
|
---|
25 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 12, GLfloat);
|
---|
26 | values = (GLfloat*) (uintptr_t) READ_DATA(pState,sizeof(int) + 12, GLint);
|
---|
27 | }
|
---|
28 | else
|
---|
29 | {
|
---|
30 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 16, GLfloat);
|
---|
31 |
|
---|
32 | values = DATA_POINTER(pState, sizeof( int ) + 16, GLfloat );
|
---|
33 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, values, mapsize, GLfloat);
|
---|
34 | }
|
---|
35 |
|
---|
36 | pState->pDispatchTbl->PixelMapfv( map, mapsize, values );
|
---|
37 | INCR_VAR_PTR(pState);
|
---|
38 | }
|
---|
39 |
|
---|
40 | void crUnpackPixelMapuiv(PCrUnpackerState pState)
|
---|
41 | {
|
---|
42 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, sizeof(int) + 8, int);
|
---|
43 |
|
---|
44 | GLenum map = READ_DATA(pState, sizeof( int ) + 0, GLenum );
|
---|
45 | GLsizei mapsize = READ_DATA(pState, sizeof( int ) + 4, GLsizei );
|
---|
46 | int nodata = READ_DATA(pState, sizeof(int) + 8, int);
|
---|
47 | GLuint *values;
|
---|
48 |
|
---|
49 | if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
|
---|
50 | return;
|
---|
51 |
|
---|
52 | if (nodata)
|
---|
53 | {
|
---|
54 | /* This is valid, see glPixelMap description for GL_PIXEL_UNPACK_BUFFER values is treated as a byte offset. */
|
---|
55 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 12, GLfloat);
|
---|
56 | values = (GLuint*) (uintptr_t) READ_DATA(pState,sizeof(int) + 12, GLint);
|
---|
57 | }
|
---|
58 | else
|
---|
59 | {
|
---|
60 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 16, GLfloat);
|
---|
61 |
|
---|
62 | values = DATA_POINTER(pState, sizeof( int ) + 16, GLuint );
|
---|
63 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, values, mapsize, GLuint);
|
---|
64 | }
|
---|
65 |
|
---|
66 | pState->pDispatchTbl->PixelMapuiv( map, mapsize, values );
|
---|
67 | INCR_VAR_PTR(pState);
|
---|
68 | }
|
---|
69 |
|
---|
70 | void crUnpackPixelMapusv(PCrUnpackerState pState)
|
---|
71 | {
|
---|
72 | CHECK_BUFFER_SIZE_STATIC_LAST(pState, sizeof(int) + 8, int);
|
---|
73 |
|
---|
74 | GLenum map = READ_DATA(pState, sizeof( int ) + 0, GLenum );
|
---|
75 | GLsizei mapsize = READ_DATA(pState, sizeof( int ) + 4, GLsizei );
|
---|
76 | int nodata = READ_DATA(pState, sizeof(int) + 8, int);
|
---|
77 | GLushort *values;
|
---|
78 |
|
---|
79 | if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
|
---|
80 | return;
|
---|
81 |
|
---|
82 | if (nodata)
|
---|
83 | {
|
---|
84 | /* This is valid, see glPixelMap description for GL_PIXEL_UNPACK_BUFFER values is treated as a byte offset. */
|
---|
85 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 12, GLfloat);
|
---|
86 | values = (GLushort*) (uintptr_t) READ_DATA(pState, sizeof(int) + 12, GLint);
|
---|
87 | }
|
---|
88 | else
|
---|
89 | {
|
---|
90 | CHECK_BUFFER_SIZE_STATIC_UPDATE_LAST(pState, sizeof( int ) + 16, GLfloat);
|
---|
91 |
|
---|
92 | values = DATA_POINTER(pState, sizeof( int ) + 16, GLushort );
|
---|
93 | CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, values, mapsize, GLushort);
|
---|
94 | }
|
---|
95 |
|
---|
96 | pState->pDispatchTbl->PixelMapusv( map, mapsize, values );
|
---|
97 | INCR_VAR_PTR(pState);
|
---|
98 | }
|
---|