summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/common/crOpenGL/pack/packspu_config.c
blob: 70d6f01c444224731f24d2cf1c9e7a5878b5d8cd (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
/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "packspu.h"
#include "cr_string.h"
#include "cr_error.h"
#include "cr_spu.h"
#include "cr_mem.h"

#include <stdio.h>

static void __setDefaults( void )
{
    crMemZero(pack_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo));
    pack_spu.numContexts = 0;

    crMemZero(pack_spu.thread, MAX_THREADS * sizeof(ThreadInfo));
    pack_spu.numThreads = 0;
}


static void set_emit( void *foo, const char *response )
{
    RT_NOREF(foo);
    sscanf( response, "%d", &(pack_spu.emit_GATHER_POST_SWAPBUFFERS) );
}

static void set_swapbuffer_sync( void *foo, const char *response )
{
    RT_NOREF(foo);
    sscanf( response, "%d", &(pack_spu.swapbuffer_sync) );
}



/* No SPU options yet. Well.. not really..
 */
SPUOptions packSPUOptions[] = {
    { "emit_GATHER_POST_SWAPBUFFERS", CR_BOOL, 1, "0", NULL, NULL,
      "Emit a parameter after SwapBuffers", (SPUOptionCB)set_emit },

    { "swapbuffer_sync", CR_BOOL, 1, "1", NULL, NULL,
        "Sync on SwapBuffers", (SPUOptionCB) set_swapbuffer_sync },

    { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
};


void packspuSetVBoxConfiguration( const SPU *child_spu )
{
    RT_NOREF(child_spu);
    __setDefaults();
    pack_spu.emit_GATHER_POST_SWAPBUFFERS = 0;
    pack_spu.swapbuffer_sync = 0;
    pack_spu.name = crStrdup("vboxhgcm://llp:7000");
    pack_spu.buffer_size = 5 * 1024 * 1024;
}