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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/* $Id$ */
/** @file
* VBox OpenGL: GLSL related functions
*/
/*
* Copyright (C) 2009-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "cr_spu.h"
#include "chromium.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "cr_net.h"
#include "server_dispatch.h"
#include "server.h"
#ifdef CR_OPENGL_VERSION_2_0
void SERVER_DISPATCH_APIENTRY crServerDispatchShaderSource(GLuint shader, GLsizei count, const char ** string, const GLint * length)
{
/*@todo?crStateShaderSource(shader...);*/
cr_server.head_spu->dispatch_table.ShaderSource(crStateGetShaderHWID(shader), count, string, length);
}
void SERVER_DISPATCH_APIENTRY crServerDispatchCompileShader(GLuint shader)
{
crStateCompileShader(shader);
cr_server.head_spu->dispatch_table.CompileShader(crStateGetShaderHWID(shader));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteShader(GLuint shader)
{
GLuint shaderHW = crStateGetShaderHWID(shader);
crStateDeleteShader(shader);
if (shaderHW)
cr_server.head_spu->dispatch_table.DeleteShader(shaderHW);
else
crWarning("crServerDispatchDeleteShader: hwid not found for shader(%d)", shader);
}
void SERVER_DISPATCH_APIENTRY crServerDispatchAttachShader(GLuint program, GLuint shader)
{
crStateAttachShader(program, shader);
cr_server.head_spu->dispatch_table.AttachShader(crStateGetProgramHWID(program), crStateGetShaderHWID(shader));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchDetachShader(GLuint program, GLuint shader)
{
crStateDetachShader(program, shader);
cr_server.head_spu->dispatch_table.DetachShader(crStateGetProgramHWID(program), crStateGetShaderHWID(shader));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchLinkProgram(GLuint program)
{
crStateLinkProgram(program);
cr_server.head_spu->dispatch_table.LinkProgram(crStateGetProgramHWID(program));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchUseProgram(GLuint program)
{
crStateUseProgram(program);
cr_server.head_spu->dispatch_table.UseProgram(crStateGetProgramHWID(program));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteProgram(GLuint program)
{
GLuint hwId = crStateGetProgramHWID(program);
crStateDeleteProgram(program);
if (hwId)
cr_server.head_spu->dispatch_table.DeleteProgram(hwId);
else
crWarning("crServerDispatchDeleteProgram: hwid not found for program(%d)", program);
}
void SERVER_DISPATCH_APIENTRY crServerDispatchValidateProgram(GLuint program)
{
crStateValidateProgram(program);
cr_server.head_spu->dispatch_table.ValidateProgram(crStateGetProgramHWID(program));
}
void SERVER_DISPATCH_APIENTRY crServerDispatchBindAttribLocation(GLuint program, GLuint index, const char * name)
{
crStateBindAttribLocation(program, index, name);
cr_server.head_spu->dispatch_table.BindAttribLocation(crStateGetProgramHWID(program), index, name);
}
void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteObjectARB(GLhandleARB obj)
{
GLuint hwid = crStateGetProgramHWID(obj);
if (!hwid)
{
hwid = crStateGetShaderHWID(obj);
CRASSERT(hwid);
crStateDeleteShader(obj);
}
else
{
crStateDeleteProgram(obj);
}
if (hwid)
cr_server.head_spu->dispatch_table.DeleteObjectARB(hwid);
}
GLint SERVER_DISPATCH_APIENTRY crServerDispatchGetAttribLocation( GLuint program, const char * name )
{
GLint retval;
retval = cr_server.head_spu->dispatch_table.GetAttribLocation(crStateGetProgramHWID(program), name );
crServerReturnValue( &retval, sizeof(retval) );
return retval; /* WILL PROBABLY BE IGNORED */
}
GLhandleARB SERVER_DISPATCH_APIENTRY crServerDispatchGetHandleARB( GLenum pname )
{
GLhandleARB retval;
retval = cr_server.head_spu->dispatch_table.GetHandleARB(pname);
if (pname==GL_PROGRAM_OBJECT_ARB)
{
retval = crStateGLSLProgramHWIDtoID(retval);
}
crServerReturnValue( &retval, sizeof(retval) );
return retval; /* WILL PROBABLY BE IGNORED */
}
GLint SERVER_DISPATCH_APIENTRY crServerDispatchGetUniformLocation(GLuint program, const char * name)
{
GLint retval;
retval = cr_server.head_spu->dispatch_table.GetUniformLocation(crStateGetProgramHWID(program), name);
crServerReturnValue( &retval, sizeof(retval) );
return retval; /* WILL PROBABLY BE IGNORED */
}
#endif /* #ifdef CR_OPENGL_VERSION_2_0 */
|