VirtualBox

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

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

crOpenGL: packing/unpacking of part of opengl 2.0 functions

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1/* $Id: unpack_shaders.c 20174 2009-06-02 07:35:01Z 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
21#ifdef CR_OPENGL_VERSION_2_0
22
23void crUnpackExtendBindAttribLocation(void)
24{
25 GLuint program = READ_DATA(8, GLuint);
26 GLuint index = READ_DATA(12, GLuint);
27 const char *name = DATA_POINTER(16, const char);
28
29 cr_unpackDispatch.BindAttribLocation(program, index, name);
30}
31
32void crUnpackExtendShaderSource(void)
33{
34 GLint *length = NULL;
35 GLuint shader = READ_DATA(8, GLuint);
36 GLsizei count = READ_DATA(12, GLsizei);
37 GLint hasNonLocalLen = READ_DATA(16, GLsizei);
38 GLint *pLocalLength = DATA_POINTER(20, GLint);
39 char **ppStrings = NULL;
40 GLsizei i;
41 int pos=20+count*sizeof(*pLocalLength);
42
43 if (hasNonLocalLen>0)
44 {
45 length = DATA_POINTER(pos, GLint);
46 pos += count*sizeof(*length);
47 }
48
49 ppStrings = crAlloc(count*sizeof(char*));
50 if (!ppStrings) return;
51
52 for (i=0; i<count; ++i)
53 {
54 ppStrings[i] = DATA_POINTER(pos, char);
55 pos += pLocalLength[i];
56 if (!length)
57 {
58 pLocalLength[i] -= 1;
59 }
60 }
61
62 cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
63 crFree(ppStrings);
64}
65
66void crUnpackExtendUniform1fv(void)
67{
68 GLint location = READ_DATA(8, GLint);
69 GLsizei count = READ_DATA(12, GLsizei);
70 const GLfloat *value = DATA_POINTER(16, const GLfloat);
71 cr_unpackDispatch.Uniform1fv(location, count, value);
72}
73
74void crUnpackExtendUniform1iv(void)
75{
76 GLint location = READ_DATA(8, GLint);
77 GLsizei count = READ_DATA(12, GLsizei);
78 const GLint *value = DATA_POINTER(16, const GLint);
79 cr_unpackDispatch.Uniform1iv(location, count, value);
80}
81
82void crUnpackExtendUniform2fv(void)
83{
84 GLint location = READ_DATA(8, GLint);
85 GLsizei count = READ_DATA(12, GLsizei);
86 const GLfloat *value = DATA_POINTER(16, const GLfloat);
87 cr_unpackDispatch.Uniform2fv(location, count, value);
88}
89
90void crUnpackExtendUniform2iv(void)
91{
92 GLint location = READ_DATA(8, GLint);
93 GLsizei count = READ_DATA(12, GLsizei);
94 const GLint *value = DATA_POINTER(16, const GLint);
95 cr_unpackDispatch.Uniform2iv(location, count, value);
96}
97
98void crUnpackExtendUniform3fv(void)
99{
100 GLint location = READ_DATA(8, GLint);
101 GLsizei count = READ_DATA(12, GLsizei);
102 const GLfloat *value = DATA_POINTER(16, const GLfloat);
103 cr_unpackDispatch.Uniform3fv(location, count, value);
104}
105
106void crUnpackExtendUniform3iv(void)
107{
108 GLint location = READ_DATA(8, GLint);
109 GLsizei count = READ_DATA(12, GLsizei);
110 const GLint *value = DATA_POINTER(16, const GLint);
111 cr_unpackDispatch.Uniform3iv(location, count, value);
112}
113
114void crUnpackExtendUniform4fv(void)
115{
116 GLint location = READ_DATA(8, GLint);
117 GLsizei count = READ_DATA(12, GLsizei);
118 const GLfloat *value = DATA_POINTER(16, const GLfloat);
119 cr_unpackDispatch.Uniform4fv(location, count, value);
120}
121
122void crUnpackExtendUniform4iv(void)
123{
124 GLint location = READ_DATA(8, GLint);
125 GLsizei count = READ_DATA(12, GLsizei);
126 const GLint *value = DATA_POINTER(16, const GLint);
127 cr_unpackDispatch.Uniform4iv(location, count, value);
128}
129
130void crUnpackExtendUniformMatrix2fv(void)
131{
132 GLint location = READ_DATA(8, GLint);
133 GLsizei count = READ_DATA(12, GLsizei);
134 GLboolean transpose = READ_DATA(16, GLboolean);
135 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
136 cr_unpackDispatch.UniformMatrix2fv(location, count, transpose, value);
137}
138
139void crUnpackExtendUniformMatrix3fv(void)
140{
141 GLint location = READ_DATA(8, GLint);
142 GLsizei count = READ_DATA(12, GLsizei);
143 GLboolean transpose = READ_DATA(16, GLboolean);
144 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
145 cr_unpackDispatch.UniformMatrix3fv(location, count, transpose, value);
146}
147
148void crUnpackExtendUniformMatrix4fv(void)
149{
150 GLint location = READ_DATA(8, GLint);
151 GLsizei count = READ_DATA(12, GLsizei);
152 GLboolean transpose = READ_DATA(16, GLboolean);
153 const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
154 cr_unpackDispatch.UniformMatrix4fv(location, count, transpose, value);
155}
156
157#endif /* #ifdef CR_OPENGL_VERSION_2_0 */
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