Changeset 20183 in vbox for trunk/src/VBox/GuestHost/OpenGL/packer
- Timestamp:
- Jun 2, 2009 10:38:57 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 48017
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c
r20177 r20183 21 21 unsigned char *data_ptr; 22 22 int cbName = crStrlen(name)+1; 23 int packet_length = sizeof(int)+sizeof(program)+sizeof(index) + cbName*sizeof(*name); 24 25 GET_BUFFERED_POINTER(pc, packet_length); 26 WRITE_DATA(0, int, packet_length); 27 WRITE_DATA(sizeof(int), GLuint, program); 28 WRITE_DATA(sizeof(int) + sizeof(program), GLuint, index); 29 crMemcpy(data_ptr + sizeof(int)+sizeof(program)+sizeof(index), name, cbName*sizeof(*name)); 30 WRITE_OPCODE(pc, CR_BINDATTRIBLOCATION_EXTEND_OPCODE); 23 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(program)+sizeof(index) + cbName*sizeof(*name); 24 25 GET_BUFFERED_POINTER(pc, packet_length); 26 WRITE_DATA_AI(int, packet_length); 27 WRITE_DATA_AI(GLenum, CR_BINDATTRIBLOCATION_EXTEND_OPCODE); 28 WRITE_DATA_AI(GLuint, program); 29 WRITE_DATA_AI(GLuint, index); 30 crMemcpy(data_ptr, name, cbName*sizeof(*name)); 31 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 31 32 } 32 33 … … 36 37 unsigned char *data_ptr; 37 38 GLint *pLocalLength; 38 int packet_length = sizeof(int)+sizeof( shader)+sizeof(count)+sizeof(GLint)+count*sizeof(*pLocalLength);39 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(shader)+sizeof(count)+sizeof(GLint)+count*sizeof(*pLocalLength); 39 40 GLsizei i; 40 41 … … 56 57 57 58 GET_BUFFERED_POINTER(pc, packet_length); 58 WRITE_DATA(0, int, packet_length); 59 data_ptr += sizeof(int); 60 WRITE_DATA(0, GLuint, shader); 61 data_ptr += sizeof(GLuint); 62 WRITE_DATA(0, GLsizei, count); 63 data_ptr += sizeof(GLsizei); 64 WRITE_DATA(0, GLint, (GLint)(length ? 1:0)); 65 data_ptr += sizeof(GLint); 59 WRITE_DATA_AI(int, packet_length); 60 WRITE_DATA_AI(GLenum, CR_SHADERSOURCE_EXTEND_OPCODE); 61 WRITE_DATA_AI(GLuint, shader); 62 WRITE_DATA_AI(GLsizei, count); 63 WRITE_DATA_AI(GLint, (GLint)(length ? 1:0)); 66 64 crMemcpy(data_ptr, pLocalLength, count*sizeof(*pLocalLength)); 67 65 data_ptr += count*sizeof(*pLocalLength); … … 78 76 data_ptr += pLocalLength[i]; 79 77 } 80 WRITE_OPCODE(pc, CR_ SHADERSOURCE_EXTEND_OPCODE);78 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 81 79 82 80 crFree(pLocalLength); … … 87 85 GET_PACKER_CONTEXT(pc); 88 86 unsigned char *data_ptr; 89 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + count*sizeof(*value); 90 91 GET_BUFFERED_POINTER(pc, packet_length); 92 WRITE_DATA(0, int, packet_length); 93 WRITE_DATA(sizeof(int), GLint, location); 94 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 95 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, count*sizeof(*value)); 96 WRITE_OPCODE(pc, CR_UNIFORM1FV_EXTEND_OPCODE); 87 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value); 88 89 GET_BUFFERED_POINTER(pc, packet_length); 90 WRITE_DATA_AI(int, packet_length); 91 WRITE_DATA_AI(GLenum, CR_UNIFORM1FV_EXTEND_OPCODE); 92 WRITE_DATA_AI(GLint, location); 93 WRITE_DATA_AI(GLsizei, count); 94 crMemcpy(data_ptr, value, count*sizeof(*value)); 95 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 97 96 } 98 97 … … 101 100 GET_PACKER_CONTEXT(pc); 102 101 unsigned char *data_ptr; 103 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + count*sizeof(*value); 104 105 GET_BUFFERED_POINTER(pc, packet_length); 106 WRITE_DATA(0, int, packet_length); 107 WRITE_DATA(sizeof(int), GLint, location); 108 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 109 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, count*sizeof(*value)); 110 WRITE_OPCODE(pc, CR_UNIFORM1IV_EXTEND_OPCODE); 102 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + count*sizeof(*value); 103 104 GET_BUFFERED_POINTER(pc, packet_length); 105 WRITE_DATA_AI(int, packet_length); 106 WRITE_DATA_AI(GLenum, CR_UNIFORM1IV_EXTEND_OPCODE); 107 WRITE_DATA_AI(GLint, location); 108 WRITE_DATA_AI(GLsizei, count); 109 crMemcpy(data_ptr, value, count*sizeof(*value)); 110 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 111 111 } 112 112 … … 115 115 GET_PACKER_CONTEXT(pc); 116 116 unsigned char *data_ptr; 117 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value); 118 119 GET_BUFFERED_POINTER(pc, packet_length); 120 WRITE_DATA(0, int, packet_length); 121 WRITE_DATA(sizeof(int), GLint, location); 122 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 123 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 2*count*sizeof(*value)); 124 WRITE_OPCODE(pc, CR_UNIFORM2FV_EXTEND_OPCODE); 117 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value); 118 119 GET_BUFFERED_POINTER(pc, packet_length); 120 WRITE_DATA_AI(int, packet_length); 121 WRITE_DATA_AI(GLenum, CR_UNIFORM2FV_EXTEND_OPCODE); 122 WRITE_DATA_AI(GLint, location); 123 WRITE_DATA_AI(GLsizei, count); 124 crMemcpy(data_ptr, value, 2*count*sizeof(*value)); 125 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 125 126 } 126 127 … … 129 130 GET_PACKER_CONTEXT(pc); 130 131 unsigned char *data_ptr; 131 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value); 132 133 GET_BUFFERED_POINTER(pc, packet_length); 134 WRITE_DATA(0, int, packet_length); 135 WRITE_DATA(sizeof(int), GLint, location); 136 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 137 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 2*count*sizeof(*value)); 138 WRITE_OPCODE(pc, CR_UNIFORM2IV_EXTEND_OPCODE); 132 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 2*count*sizeof(*value); 133 134 GET_BUFFERED_POINTER(pc, packet_length); 135 WRITE_DATA_AI(int, packet_length); 136 WRITE_DATA_AI(GLenum, CR_UNIFORM2IV_EXTEND_OPCODE); 137 WRITE_DATA_AI(GLint, location); 138 WRITE_DATA_AI(GLsizei, count); 139 crMemcpy(data_ptr, value, 2*count*sizeof(*value)); 140 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 139 141 } 140 142 … … 143 145 GET_PACKER_CONTEXT(pc); 144 146 unsigned char *data_ptr; 145 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value); 146 147 GET_BUFFERED_POINTER(pc, packet_length); 148 WRITE_DATA(0, int, packet_length); 149 WRITE_DATA(sizeof(int), GLint, location); 150 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 151 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 3*count*sizeof(*value)); 152 WRITE_OPCODE(pc, CR_UNIFORM3FV_EXTEND_OPCODE); 147 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value); 148 149 GET_BUFFERED_POINTER(pc, packet_length); 150 WRITE_DATA_AI(int, packet_length); 151 WRITE_DATA_AI(GLenum, CR_UNIFORM3FV_EXTEND_OPCODE); 152 WRITE_DATA_AI(GLint, location); 153 WRITE_DATA_AI(GLsizei, count); 154 crMemcpy(data_ptr, value, 3*count*sizeof(*value)); 155 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 153 156 } 154 157 … … 157 160 GET_PACKER_CONTEXT(pc); 158 161 unsigned char *data_ptr; 159 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value); 160 161 GET_BUFFERED_POINTER(pc, packet_length); 162 WRITE_DATA(0, int, packet_length); 163 WRITE_DATA(sizeof(int), GLint, location); 164 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 165 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 3*count*sizeof(*value)); 166 WRITE_OPCODE(pc, CR_UNIFORM3IV_EXTEND_OPCODE); 162 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 3*count*sizeof(*value); 163 164 GET_BUFFERED_POINTER(pc, packet_length); 165 WRITE_DATA_AI(int, packet_length); 166 WRITE_DATA_AI(GLenum, CR_UNIFORM3IV_EXTEND_OPCODE); 167 WRITE_DATA_AI(GLint, location); 168 WRITE_DATA_AI(GLsizei, count); 169 crMemcpy(data_ptr, value, 3*count*sizeof(*value)); 170 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 167 171 } 168 172 … … 171 175 GET_PACKER_CONTEXT(pc); 172 176 unsigned char *data_ptr; 173 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value); 174 175 GET_BUFFERED_POINTER(pc, packet_length); 176 WRITE_DATA(0, int, packet_length); 177 WRITE_DATA(sizeof(int), GLint, location); 178 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 179 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 4*count*sizeof(*value)); 180 WRITE_OPCODE(pc, CR_UNIFORM4FV_EXTEND_OPCODE); 177 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value); 178 179 GET_BUFFERED_POINTER(pc, packet_length); 180 WRITE_DATA_AI(int, packet_length); 181 WRITE_DATA_AI(GLenum, CR_UNIFORM4FV_EXTEND_OPCODE); 182 WRITE_DATA_AI(GLint, location); 183 WRITE_DATA_AI(GLsizei, count); 184 crMemcpy(data_ptr, value, 4*count*sizeof(*value)); 185 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 181 186 } 182 187 … … 185 190 GET_PACKER_CONTEXT(pc); 186 191 unsigned char *data_ptr; 187 int packet_length = sizeof(int)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value); 188 189 GET_BUFFERED_POINTER(pc, packet_length); 190 WRITE_DATA(0, int, packet_length); 191 WRITE_DATA(sizeof(int), GLint, location); 192 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 193 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count), value, 4*count*sizeof(*value)); 194 WRITE_OPCODE(pc, CR_UNIFORM4IV_EXTEND_OPCODE); 192 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count) + 4*count*sizeof(*value); 193 194 GET_BUFFERED_POINTER(pc, packet_length); 195 WRITE_DATA_AI(int, packet_length); 196 WRITE_DATA_AI(GLenum, CR_UNIFORM4IV_EXTEND_OPCODE); 197 WRITE_DATA_AI(GLint, location); 198 WRITE_DATA_AI(GLsizei, count); 199 crMemcpy(data_ptr, value, 4*count*sizeof(*value)); 200 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 195 201 } 196 202 … … 199 205 GET_PACKER_CONTEXT(pc); 200 206 unsigned char *data_ptr; 201 int packet_length = sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose) + 2*2*count*sizeof(*value); 202 203 GET_BUFFERED_POINTER(pc, packet_length); 204 WRITE_DATA(0, int, packet_length); 205 WRITE_DATA(sizeof(int), GLint, location); 206 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 207 WRITE_DATA(sizeof(int) + sizeof(location) + sizeof(count), GLboolean, transpose); 208 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose), value, 2*2*count*sizeof(*value)); 209 WRITE_OPCODE(pc, CR_UNIFORMMATRIX2FV_EXTEND_OPCODE); 207 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 2*2*count*sizeof(*value); 208 209 GET_BUFFERED_POINTER(pc, packet_length); 210 WRITE_DATA_AI(int, packet_length); 211 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX2FV_EXTEND_OPCODE); 212 WRITE_DATA_AI(GLint, location); 213 WRITE_DATA_AI(GLsizei, count); 214 WRITE_DATA_AI(GLboolean, transpose); 215 crMemcpy(data_ptr, value, 2*2*count*sizeof(*value)); 216 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 210 217 } 211 218 … … 214 221 GET_PACKER_CONTEXT(pc); 215 222 unsigned char *data_ptr; 216 int packet_length = sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose) + 3*3*count*sizeof(*value); 217 218 GET_BUFFERED_POINTER(pc, packet_length); 219 WRITE_DATA(0, int, packet_length); 220 WRITE_DATA(sizeof(int), GLint, location); 221 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 222 WRITE_DATA(sizeof(int) + sizeof(location) + sizeof(count), GLboolean, transpose); 223 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose), value, 3*3*count*sizeof(*value)); 224 WRITE_OPCODE(pc, CR_UNIFORMMATRIX3FV_EXTEND_OPCODE); 223 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 3*3*count*sizeof(*value); 224 225 GET_BUFFERED_POINTER(pc, packet_length); 226 WRITE_DATA_AI(int, packet_length); 227 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX3FV_EXTEND_OPCODE); 228 WRITE_DATA_AI(GLint, location); 229 WRITE_DATA_AI(GLsizei, count); 230 WRITE_DATA_AI(GLboolean, transpose); 231 crMemcpy(data_ptr, value, 3*3*count*sizeof(*value)); 232 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 225 233 } 226 234 … … 229 237 GET_PACKER_CONTEXT(pc); 230 238 unsigned char *data_ptr; 231 int packet_length = sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose) + 4*4*count*sizeof(*value); 232 233 GET_BUFFERED_POINTER(pc, packet_length); 234 WRITE_DATA(0, int, packet_length); 235 WRITE_DATA(sizeof(int), GLint, location); 236 WRITE_DATA(sizeof(int) + sizeof(location), GLsizei, count); 237 WRITE_DATA(sizeof(int) + sizeof(location) + sizeof(count), GLboolean, transpose); 238 crMemcpy(data_ptr + sizeof(int)+sizeof(location)+sizeof(count)+sizeof(transpose), value, 4*4*count*sizeof(*value)); 239 WRITE_OPCODE(pc, CR_UNIFORMMATRIX4FV_EXTEND_OPCODE); 239 int packet_length = sizeof(int)+sizeof(GLenum)+sizeof(location)+sizeof(count)+sizeof(transpose) + 4*4*count*sizeof(*value); 240 241 GET_BUFFERED_POINTER(pc, packet_length); 242 WRITE_DATA_AI(int, packet_length); 243 WRITE_DATA_AI(GLenum, CR_UNIFORMMATRIX4FV_EXTEND_OPCODE); 244 WRITE_DATA_AI(GLint, location); 245 WRITE_DATA_AI(GLsizei, count); 246 WRITE_DATA_AI(GLboolean, transpose); 247 crMemcpy(data_ptr, value, 4*4*count*sizeof(*value)); 248 WRITE_OPCODE(pc, CR_EXTEND_OPCODE); 240 249 } 241 250
Note:
See TracChangeset
for help on using the changeset viewer.