VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getshaders.c@ 20438

Last change on this file since 20438 was 20438, checked in by vboxsync, 16 years ago

crOpenGL: typo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1/* $Id: packspu_getshaders.c 20438 2009-06-09 13:09:55Z vboxsync $ */
2
3/** @file
4 * VBox OpenGL DRI driver functions
5 */
6
7/*
8 * Copyright (C) 2009 Sun Microsystems, Inc.
9 *
10 * Sun Microsystems, Inc. confidential
11 * All rights reserved
12 */
13
14#include "packspu.h"
15#include "cr_packfunctions.h"
16#include "cr_net.h"
17#include "packspu_proto.h"
18#include "cr_mem.h"
19
20/*@todo combine with the one from server_getshaders.c*/
21typedef struct _crGetActive_t
22{
23 GLsizei length;
24 GLint size;
25 GLenum type;
26} crGetActive_t;
27
28void PACKSPU_APIENTRY packspu_GetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name)
29{
30 GET_THREAD(thread);
31 int writeback = 1;
32 crGetActive_t *pLocal;
33
34 if (!size || !type || !name) return;
35
36 pLocal = (crGetActive_t*) crAlloc(bufSize+sizeof(crGetActive_t));
37 if (!pLocal) return;
38
39 crPackGetActiveAttrib(program, index, bufSize, (GLsizei*)pLocal, NULL, NULL, NULL, &writeback);
40
41 packspuFlush((void *) thread);
42 while (writeback)
43 crNetRecv();
44
45 if (length) *length = pLocal->length;
46 *size = pLocal->size;
47 *type = pLocal->type;
48 crMemcpy(name, (char*)&pLocal[1], pLocal->length+1);
49 crFree(pLocal);
50}
51
52void PACKSPU_APIENTRY packspu_GetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name)
53{
54 GET_THREAD(thread);
55 int writeback = 1;
56 crGetActive_t *pLocal;
57
58 if (!size || !type || !name) return;
59
60 pLocal = (crGetActive_t*) crAlloc(bufSize+sizeof(crGetActive_t));
61 if (!pLocal) return;
62
63 crPackGetActiveUniform(program, index, bufSize, (GLsizei*)pLocal, NULL, NULL, NULL, &writeback);
64
65 packspuFlush((void *) thread);
66 while (writeback)
67 crNetRecv();
68
69 if (length) *length = pLocal->length;
70 *size = pLocal->size;
71 *type = pLocal->type;
72 crMemcpy(name, &pLocal[1], pLocal->length+1);
73 crFree(pLocal);
74}
75
76void PACKSPU_APIENTRY packspu_GetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders)
77{
78 GET_THREAD(thread);
79 int writeback = 1;
80 GLsizei *pLocal;
81
82 if (!shaders) return;
83
84 pLocal = (GLsizei*) crAlloc(maxCount*sizeof(GLuint)+sizeof(GLsizei));
85 if (!pLocal) return;
86
87 crPackGetAttachedShaders(program, maxCount, pLocal, NULL, &writeback);
88
89 packspuFlush((void *) thread);
90 while (writeback)
91 crNetRecv();
92
93 if (count) *count=*pLocal;
94 crMemcpy(shaders, &pLocal[1], *pLocal*sizeof(GLuint));
95 crFree(pLocal);
96}
97
98void PACKSPU_APIENTRY packspu_GetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog)
99{
100 GET_THREAD(thread);
101 int writeback = 1;
102 GLsizei *pLocal;
103
104 if (!infoLog) return;
105
106 pLocal = (GLsizei*) crAlloc(bufSize+sizeof(GLsizei));
107 if (!pLocal) return;
108
109 crPackGetProgramInfoLog(program, bufSize, pLocal, NULL, &writeback);
110
111 packspuFlush((void *) thread);
112 while (writeback)
113 crNetRecv();
114
115 if (length) *length=*pLocal;
116 crMemcpy(infoLog, &pLocal[1], (*pLocal)+1);
117 crFree(pLocal);
118}
119
120void PACKSPU_APIENTRY packspu_GetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, char * infoLog)
121{
122 GET_THREAD(thread);
123 int writeback = 1;
124 GLsizei *pLocal;
125
126 if (!infoLog) return;
127
128 pLocal = (GLsizei*) crAlloc(bufSize+sizeof(GLsizei));
129 if (!pLocal) return;
130
131 crPackGetShaderInfoLog(shader, bufSize, pLocal, NULL, &writeback);
132
133 packspuFlush((void *) thread);
134 while (writeback)
135 crNetRecv();
136
137 if (length) *length=*pLocal;
138 crMemcpy(infoLog, &pLocal[1], (*pLocal)+1);
139 crFree(pLocal);
140}
141
142void PACKSPU_APIENTRY packspu_GetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source)
143{
144 GET_THREAD(thread);
145 int writeback = 1;
146 GLsizei *pLocal;
147
148 if (!source) return;
149
150 pLocal = (GLsizei*) crAlloc(bufSize+sizeof(GLsizei));
151 if (!pLocal) return;
152
153 crPackGetShaderSource(shader, bufSize, pLocal, NULL, &writeback);
154
155 packspuFlush((void *) thread);
156 while (writeback)
157 crNetRecv();
158
159 if (length) *length=*pLocal;
160 crMemcpy(source, &pLocal[1], (*pLocal)+1);
161 crFree(pLocal);
162}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette