VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.c@ 20467

最後變更 在這個檔案從20467是 20467,由 vboxsync 提交於 16 年 前

crOpenGL: aliases for pre opengl2.0 arb extensions

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 7.2 KB
 
1/* $Id: unpack_shaders.c 20467 2009-06-10 16:09:27Z 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 "unpacker.h"
15#include "cr_error.h"
16#include "cr_protocol.h"
17#include "cr_mem.h"
18#include "cr_string.h"
19#include "cr_version.h"
20
21void crUnpackExtendBindAttribLocation(void)
22{
23 GLuint program = READ_DATA(8, GLuint);
24 GLuint index = READ_DATA(12, GLuint);
25 const char *name = DATA_POINTER(16, const char);
26
27 cr_unpackDispatch.BindAttribLocation(program, index, name);
28}
29
30void crUnpackExtendShaderSource(void)
31{
32 GLint *length = NULL;
33 GLuint shader = READ_DATA(8, GLuint);
34 GLsizei count = READ_DATA(12, GLsizei);
35 GLint hasNonLocalLen = READ_DATA(16, GLsizei);
36 GLint *pLocalLength = DATA_POINTER(20, GLint);
37 char **ppStrings = NULL;
38 GLsizei i;
39 int pos=20+count*sizeof(*pLocalLength);
40
41 if (hasNonLocalLen>0)
42 {
43 length = DATA_POINTER(pos, GLint);
44 pos += count*sizeof(*length);
45 }
46
47 ppStrings = crAlloc(count*sizeof(char*));
48 if (!ppStrings) return;
49
50 for (i=0; i<count; ++i)
51 {
52 ppStrings[i] = DATA_POINTER(pos, char);
53 pos += pLocalLength[i];
54 if (!length)
55 {
56 pLocalLength[i] -= 1;
57 }
58 }
59
60 cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
61 crFree(ppStrings);
62}
63
64void crUnpackExtendUniform1fv(void)
65{
66 GLint location = READ_DATA(8, GLint);
67 GLsizei count = READ_DATA(12, GLsizei);
68 const GLfloat *value = DATA_POINTER(16, const GLfloat);
69 cr_unpackDispatch.Uniform1fv(location, count, value);
70}
71
72void crUnpackExtendUniform1iv(void)
73{
74 GLint location = READ_DATA(8, GLint);
75 GLsizei count = READ_DATA(12, GLsizei);
76 const GLint *value = DATA_POINTER(16, const GLint);
77 cr_unpackDispatch.Uniform1iv(location, count, value);
78}
79
80void crUnpackExtendUniform2fv(void)
81{
82 GLint location = READ_DATA(8, GLint);
83 GLsizei count = READ_DATA(12, GLsizei);
84 const GLfloat *value = DATA_POINTER(16, const GLfloat);
85 cr_unpackDispatch.Uniform2fv(location, count, value);
86}
87
88void crUnpackExtendUniform2iv(void)
89{
90 GLint location = READ_DATA(8, GLint);
91 GLsizei count = READ_DATA(12, GLsizei);
92 const GLint *value = DATA_POINTER(16, const GLint);
93 cr_unpackDispatch.Uniform2iv(location, count, value);
94}
95
96void crUnpackExtendUniform3fv(void)
97{
98 GLint location = READ_DATA(8, GLint);
99 GLsizei count = READ_DATA(12, GLsizei);
100 const GLfloat *value = DATA_POINTER(16, const GLfloat);
101 cr_unpackDispatch.Uniform3fv(location, count, value);
102}
103
104void crUnpackExtendUniform3iv(void)
105{
106 GLint location = READ_DATA(8, GLint);
107 GLsizei count = READ_DATA(12, GLsizei);
108 const GLint *value = DATA_POINTER(16, const GLint);
109 cr_unpackDispatch.Uniform3iv(location, count, value);
110}
111
112void crUnpackExtendUniform4fv(void)
113{
114 GLint location = READ_DATA(8, GLint);
115 GLsizei count = READ_DATA(12, GLsizei);
116 const GLfloat *value = DATA_POINTER(16, const GLfloat);
117 cr_unpackDispatch.Uniform4fv(location, count, value);
118}
119
120void crUnpackExtendUniform4iv(void)
121{
122 GLint location = READ_DATA(8, GLint);
123 GLsizei count = READ_DATA(12, GLsizei);
124 const GLint *value = DATA_POINTER(16, const GLint);
125 cr_unpackDispatch.Uniform4iv(location, count, value);
126}
127
128void crUnpackExtendUniformMatrix2fv(void)
129{
130 GLint location = READ_DATA(8, GLint);
131 GLsizei count = READ_DATA(12, GLsizei);
132 GLboolean transpose = READ_DATA(16, GLboolean);
133 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
134 cr_unpackDispatch.UniformMatrix2fv(location, count, transpose, value);
135}
136
137void crUnpackExtendUniformMatrix3fv(void)
138{
139 GLint location = READ_DATA(8, GLint);
140 GLsizei count = READ_DATA(12, GLsizei);
141 GLboolean transpose = READ_DATA(16, GLboolean);
142 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
143 cr_unpackDispatch.UniformMatrix3fv(location, count, transpose, value);
144}
145
146void crUnpackExtendUniformMatrix4fv(void)
147{
148 GLint location = READ_DATA(8, GLint);
149 GLsizei count = READ_DATA(12, GLsizei);
150 GLboolean transpose = READ_DATA(16, GLboolean);
151 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
152 cr_unpackDispatch.UniformMatrix4fv(location, count, transpose, value);
153}
154
155void crUnpackExtendDrawBuffers(void)
156{
157 GLsizei n = READ_DATA(8, GLsizei);
158 const GLenum *bufs = DATA_POINTER(8+sizeof(GLsizei), const GLenum);
159 cr_unpackDispatch.DrawBuffers(n, bufs);
160}
161
162void crUnpackExtendGetActiveAttrib(void)
163{
164 GLuint program = READ_DATA(8, GLuint);
165 GLuint index = READ_DATA(12, GLuint);
166 GLsizei bufSize = READ_DATA(16, GLsizei);
167 SET_RETURN_PTR(20);
168 SET_WRITEBACK_PTR(28);
169 cr_unpackDispatch.GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
170}
171
172void crUnpackExtendGetActiveUniform(void)
173{
174 GLuint program = READ_DATA(8, GLuint);
175 GLuint index = READ_DATA(12, GLuint);
176 GLsizei bufSize = READ_DATA(16, GLsizei);
177 SET_RETURN_PTR(20);
178 SET_WRITEBACK_PTR(28);
179 cr_unpackDispatch.GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
180}
181
182void crUnpackExtendGetAttachedShaders(void)
183{
184 GLuint program = READ_DATA(8, GLuint);
185 GLsizei maxCount = READ_DATA(12, GLsizei);
186 SET_RETURN_PTR(16);
187 SET_WRITEBACK_PTR(24);
188 cr_unpackDispatch.GetAttachedShaders(program, maxCount, NULL, NULL);
189}
190
191void crUnpackExtendGetAttachedObjectsARB(void)
192{
193 GLhandleARB containerObj = READ_DATA(8, GLhandleARB);
194 GLsizei maxCount = READ_DATA(12, GLsizei);
195 SET_RETURN_PTR(16);
196 SET_WRITEBACK_PTR(24);
197 cr_unpackDispatch.GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
198}
199
200void crUnpackExtendGetInfoLogARB(void)
201{
202 GLhandleARB obj = READ_DATA(8, GLhandleARB);
203 GLsizei maxLength = READ_DATA(12, GLsizei);
204 SET_RETURN_PTR(16);
205 SET_WRITEBACK_PTR(24);
206 cr_unpackDispatch.GetInfoLogARB(obj, maxLength, NULL, NULL);
207}
208
209void crUnpackExtendGetProgramInfoLog(void)
210{
211 GLuint program = READ_DATA(8, GLuint);
212 GLsizei bufSize = READ_DATA(12, GLsizei);
213 SET_RETURN_PTR(16);
214 SET_WRITEBACK_PTR(24);
215 cr_unpackDispatch.GetProgramInfoLog(program, bufSize, NULL, NULL);
216}
217
218void crUnpackExtendGetShaderInfoLog(void)
219{
220 GLuint shader = READ_DATA(8, GLuint);
221 GLsizei bufSize = READ_DATA(12, GLsizei);
222 SET_RETURN_PTR(16);
223 SET_WRITEBACK_PTR(24);
224 cr_unpackDispatch.GetShaderInfoLog(shader, bufSize, NULL, NULL);
225}
226
227void crUnpackExtendGetShaderSource(void)
228{
229 GLuint shader = READ_DATA(8, GLuint);
230 GLsizei bufSize = READ_DATA(12, GLsizei);
231 SET_RETURN_PTR(16);
232 SET_WRITEBACK_PTR(24);
233 cr_unpackDispatch.GetShaderSource(shader, bufSize, NULL, NULL);
234}
235
236void crUnpackExtendGetAttribLocation(void)
237{
238 int packet_length = READ_DATA(0, int);
239 GLuint program = READ_DATA(8, GLuint);
240 const char *name = DATA_POINTER(12, const char);
241 SET_RETURN_PTR(packet_length-16);
242 SET_WRITEBACK_PTR(packet_length-8);
243 cr_unpackDispatch.GetAttribLocation(program, name);
244}
245
246void crUnpackExtendGetUniformLocation(void)
247{
248 int packet_length = READ_DATA(0, int);
249 GLuint program = READ_DATA(8, GLuint);
250 const char *name = DATA_POINTER(12, const char);
251 SET_RETURN_PTR(packet_length-16);
252 SET_WRITEBACK_PTR(packet_length-8);
253 cr_unpackDispatch.GetUniformLocation(program, name);
254}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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