VirtualBox

Ignore:
Timestamp:
Jun 2, 2009 10:38:57 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48017
Message:

crOpenGL: fix wrong ext opcodes packing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_shaders.c

    r20177 r20183  
    2121    unsigned char *data_ptr;
    2222    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);
    3132}
    3233
     
    3637    unsigned char *data_ptr;
    3738    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);
    3940    GLsizei i;
    4041
     
    5657
    5758    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));
    6664    crMemcpy(data_ptr, pLocalLength, count*sizeof(*pLocalLength));
    6765    data_ptr += count*sizeof(*pLocalLength);
     
    7876        data_ptr += pLocalLength[i];
    7977    }
    80     WRITE_OPCODE(pc, CR_SHADERSOURCE_EXTEND_OPCODE);
     78    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    8179
    8280    crFree(pLocalLength);
     
    8785    GET_PACKER_CONTEXT(pc);
    8886    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);
    9796}
    9897
     
    101100    GET_PACKER_CONTEXT(pc);
    102101    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);
    111111}
    112112
     
    115115    GET_PACKER_CONTEXT(pc);
    116116    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);
    125126}
    126127
     
    129130    GET_PACKER_CONTEXT(pc);
    130131    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);
    139141}
    140142
     
    143145    GET_PACKER_CONTEXT(pc);
    144146    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);
    153156}
    154157
     
    157160    GET_PACKER_CONTEXT(pc);
    158161    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);
    167171}
    168172
     
    171175    GET_PACKER_CONTEXT(pc);
    172176    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);
    181186}
    182187
     
    185190    GET_PACKER_CONTEXT(pc);
    186191    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);
    195201}
    196202
     
    199205    GET_PACKER_CONTEXT(pc);
    200206    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);
    210217}
    211218
     
    214221    GET_PACKER_CONTEXT(pc);
    215222    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);
    225233}
    226234
     
    229237    GET_PACKER_CONTEXT(pc);
    230238    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);
    240249}
    241250
Note: See TracChangeset for help on using the changeset viewer.

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