summaryrefslogtreecommitdiffstats
path: root/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_pixelmap.c
blob: 9d0eb1a6fbeb5737312ec0e061004ad0086a732a (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
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "unpacker.h"
#include "state/cr_bufferobject.h"

void crUnpackPixelMapfv( void  )
{
    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    int nodata = READ_DATA( sizeof(int) + 8, int);
    GLfloat *values;

    if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
        return;

    if (nodata)
        values = (GLfloat*) (uintptr_t) READ_DATA(sizeof(int) + 12, GLint);
    else
        values = DATA_POINTER( sizeof( int ) + 16, GLfloat );

    cr_unpackDispatch.PixelMapfv( map, mapsize, values );
    INCR_VAR_PTR();
}

void crUnpackPixelMapuiv( void  )
{
    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    int nodata = READ_DATA( sizeof(int) + 8, int);
    GLuint *values;

    if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
        return;

    if (nodata)
        values = (GLuint*) (uintptr_t) READ_DATA(sizeof(int) + 12, GLint);
    else
        values = DATA_POINTER( sizeof( int ) + 16, GLuint );
        
    cr_unpackDispatch.PixelMapuiv( map, mapsize, values );
    INCR_VAR_PTR();
}

void crUnpackPixelMapusv( void  )
{
    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    int nodata = READ_DATA( sizeof(int) + 8, int);
    GLushort *values;

    if (nodata && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
        return;

    if (nodata)
        values = (GLushort*) (uintptr_t) READ_DATA(sizeof(int) + 12, GLint);
    else
        values = DATA_POINTER( sizeof( int ) + 16, GLushort );

    cr_unpackDispatch.PixelMapusv( map, mapsize, values );
    INCR_VAR_PTR();
}