VirtualBox

Ignore:
Timestamp:
Sep 24, 2009 9:31:32 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: snapshots support for GLSL shaders

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getshaders.c

    r22220 r23274  
    22
    33/** @file
    4  * VBox OpenGL GLSL related functions
     4 * VBox OpenGL GLSL related get functions
    55 */
    66
     
    4949        crServerReturnValue(&zero, sizeof(zero));
    5050    }
    51     cr_server.head_spu->dispatch_table.GetActiveAttrib(program, index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);
     51    cr_server.head_spu->dispatch_table.GetActiveAttrib(crStateGetProgramHWID(program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);
    5252    crServerReturnValue(pLocal, pLocal->length+1+sizeof(crGetActive_t));
    5353    crFree(pLocal);
     
    6565        crServerReturnValue(&zero, sizeof(zero));
    6666    }
    67     cr_server.head_spu->dispatch_table.GetActiveUniform(program, index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);
     67    cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID(program), index, bufSize, &pLocal->length, &pLocal->size, &pLocal->type, (char*)&pLocal[1]);
    6868    crServerReturnValue(pLocal, pLocal->length+1+sizeof(crGetActive_t));
    6969    crFree(pLocal);
     
    8080        crServerReturnValue(&zero, sizeof(zero));
    8181    }
    82     cr_server.head_spu->dispatch_table.GetAttachedShaders(program, maxCount, pLocal, (GLuint*)&pLocal[1]);
     82    cr_server.head_spu->dispatch_table.GetAttachedShaders(crStateGetProgramHWID(program), maxCount, pLocal, (GLuint*)&pLocal[1]);
     83
     84    {
     85        GLsizei i;
     86        GLuint *ids=(GLuint*)&pLocal[1];
     87
     88        for (i=0; i<*pLocal; ++i);
     89          ids[i] = crStateGLSLShaderHWIDtoID(ids[i]);
     90    }
     91
    8392    crServerReturnValue(pLocal, (*pLocal)*sizeof(GLuint)+sizeof(GLsizei));
    8493    crFree(pLocal);
     
    95104        crServerReturnValue(&zero, sizeof(zero));
    96105    }
    97     cr_server.head_spu->dispatch_table.GetAttachedObjectsARB(containerObj, maxCount, pLocal, (GLhandleARB*)&pLocal[1]);
     106    cr_server.head_spu->dispatch_table.GetAttachedObjectsARB(crStateGetProgramHWID(containerObj), maxCount, pLocal, (GLhandleARB*)&pLocal[1]);
     107
     108    {
     109        GLsizei i;
     110        GLuint *ids=(GLuint*)&pLocal[1];
     111
     112        for (i=0; i<*pLocal; ++i);
     113          ids[i] = crStateGLSLShaderHWIDtoID(ids[i]);
     114    }
     115
    98116    crServerReturnValue(pLocal, (*pLocal)*sizeof(GLhandleARB)+sizeof(GLsizei));
    99117    crFree(pLocal);
     
    103121{
    104122    GLsizei *pLocal;
     123    GLuint hwid;
    105124
    106125    pLocal = (GLsizei*) crAlloc(maxLength+sizeof(GLsizei));
     
    110129        crServerReturnValue(&zero, sizeof(zero));
    111130    }
    112     cr_server.head_spu->dispatch_table.GetInfoLogARB(obj, maxLength, pLocal, (char*)&pLocal[1]);
     131    /*@todo: recheck*/
     132    hwid = crStateGetProgramHWID(obj);
     133    if (!hwid) hwid = crStateGetShaderHWID(obj);
     134    cr_server.head_spu->dispatch_table.GetInfoLogARB(hwid, maxLength, pLocal, (char*)&pLocal[1]);
    113135    crServerReturnValue(pLocal, (*pLocal)+1+sizeof(GLsizei));
    114136    crFree(pLocal);
     
    125147        crServerReturnValue(&zero, sizeof(zero));
    126148    }
    127     cr_server.head_spu->dispatch_table.GetShaderInfoLog(shader, bufSize, pLocal, (char*)&pLocal[1]);
     149    cr_server.head_spu->dispatch_table.GetShaderInfoLog(crStateGetShaderHWID(shader), bufSize, pLocal, (char*)&pLocal[1]);
    128150    crServerReturnValue(pLocal, (*pLocal)+1+sizeof(GLsizei));
    129151    crFree(pLocal);
     
    140162        crServerReturnValue(&zero, sizeof(zero));
    141163    }
    142     cr_server.head_spu->dispatch_table.GetProgramInfoLog(program, bufSize, pLocal, (char*)&pLocal[1]);
     164    cr_server.head_spu->dispatch_table.GetProgramInfoLog(crStateGetProgramHWID(program), bufSize, pLocal, (char*)&pLocal[1]);
    143165    crServerReturnValue(pLocal, (*pLocal)+1+sizeof(GLsizei));
    144166    crFree(pLocal);
     
    155177        crServerReturnValue(&zero, sizeof(zero));
    156178    }
    157     cr_server.head_spu->dispatch_table.GetShaderSource(shader, bufSize, pLocal, (char*)pLocal+1);
     179    cr_server.head_spu->dispatch_table.GetShaderSource(crStateGetShaderHWID(shader), bufSize, pLocal, (char*)pLocal+1);
    158180    crServerReturnValue(pLocal, (*pLocal)+1+sizeof(GLsizei));
    159181    crFree(pLocal);
     
    166188
    167189    /*@todo: check if index and location is the same*/
    168     cr_server.head_spu->dispatch_table.GetActiveUniform(program, location, 0, NULL, &size, &type, NULL);
    169 
    170     switch (type)
    171     {
    172         case GL_FLOAT:
    173             size = 1;
    174             break;
    175         case GL_FLOAT_VEC2:
    176             size = 2;
    177             break;
    178         case GL_FLOAT_VEC3:
    179             size = 3;
    180             break;
    181         case GL_FLOAT_VEC4:
    182             size = 4;
    183             break;
    184         case GL_INT:
    185             size = 1;
    186             break;
    187         case GL_INT_VEC2:
    188             size = 2;
    189             break;
    190         case GL_INT_VEC3:
    191             size = 3;
    192             break;
    193         case GL_INT_VEC4:
    194             size = 4;
    195             break;
    196         case GL_BOOL:
    197             size = 1;
    198             break;
    199         case GL_BOOL_VEC2:
    200             size = 2;
    201             break;
    202         case GL_BOOL_VEC3:
    203             size = 3;
    204             break;
    205         case GL_BOOL_VEC4:
    206             size = 4;
    207             break;
    208         case GL_FLOAT_MAT2:
    209             size = 8;
    210             break;
    211         case GL_FLOAT_MAT3:
    212             size = 12;
    213             break;
    214         case GL_FLOAT_MAT4:
    215             size = 16;
    216             break;
    217         case GL_SAMPLER_1D:
    218         case GL_SAMPLER_2D:
    219         case GL_SAMPLER_3D:
    220         case GL_SAMPLER_CUBE:
    221         case GL_SAMPLER_1D_SHADOW:
    222         case GL_SAMPLER_2D_SHADOW:
    223             size = 1;
    224             break;
    225 #ifdef CR_OPENGL_VERSION_2_1
    226         case GL_FLOAT_MAT2x3:
    227             size = 8;
    228             break;
    229         case GL_FLOAT_MAT2x4:
    230             size = 8;
    231             break;
    232         case GL_FLOAT_MAT3x2:
    233             size = 12;
    234             break;
    235         case GL_FLOAT_MAT3x4:
    236             size = 12;
    237             break;
    238         case GL_FLOAT_MAT4x2:
    239             size = 16;
    240             break;
    241         case GL_FLOAT_MAT4x3:
    242             size = 16;
    243             break;
    244 #endif
    245         default:
    246             crWarning("__GetUniformSize: unknown uniform type 0x%x", (GLint)type);
    247             size = 16;
    248             break;
    249     }
    250 
    251     return size;
     190    cr_server.head_spu->dispatch_table.GetActiveUniform(crStateGetProgramHWID(program), location, 0, NULL, &size, &type, NULL);
     191
     192    return crStateGetUniformSize(type);
    252193}
    253194
     
    264205    }
    265206
    266     cr_server.head_spu->dispatch_table.GetUniformfv(program, location, pLocal);
     207    cr_server.head_spu->dispatch_table.GetUniformfv(crStateGetProgramHWID(program), location, pLocal);
    267208
    268209    crServerReturnValue(pLocal, size);
     
    282223    }
    283224
    284     cr_server.head_spu->dispatch_table.GetUniformiv(program, location, pLocal);
     225    cr_server.head_spu->dispatch_table.GetUniformiv(crStateGetProgramHWID(program), location, pLocal);
    285226
    286227    crServerReturnValue(pLocal, size);
     
    288229}
    289230
     231GLuint SERVER_DISPATCH_APIENTRY crServerDispatchCreateShader(GLenum type)
     232{
     233    GLuint retval;
     234    retval = cr_server.head_spu->dispatch_table.CreateShader(type);
     235    crStateCreateShader(retval, type);
     236    crServerReturnValue(&retval, sizeof(retval));
     237    return retval; /* ignored */
     238}
     239
     240GLuint SERVER_DISPATCH_APIENTRY crServerDispatchCreateProgram(void)
     241{
     242        GLuint retval;
     243        retval = cr_server.head_spu->dispatch_table.CreateProgram();
     244    crStateCreateProgram(retval);
     245        crServerReturnValue(&retval, sizeof(retval));
     246        return retval; /* ignored */
     247}
     248
     249GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsShader(GLuint shader)
     250{
     251        GLboolean retval;
     252        retval = cr_server.head_spu->dispatch_table.IsShader(crStateGetShaderHWID(shader));
     253        crServerReturnValue(&retval, sizeof(retval));
     254        return retval; /* ignored */
     255}
     256
     257GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsProgram(GLuint program)
     258{
     259        GLboolean retval;
     260        retval = cr_server.head_spu->dispatch_table.IsProgram(crStateGetProgramHWID(program));
     261        crServerReturnValue(&retval, sizeof(retval));
     262        return retval; /* ignored */
     263}
     264
    290265#endif /* #ifdef CR_OPENGL_VERSION_2_0 */
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py

    r21308 r23274  
    6161        CRASSERT(tablesize/sizeof(%s)==1);
    6262        texid = (GLuint) *get_values;
    63         *get_values = (%s) crServerTranslateTextureID(texid);
     63        *get_values = (%s) (texid - cr_server.curClient->number * 100000);
    6464    }
    65     """ % (types[index], types[index])
     65    else if (GL_CURRENT_PROGRAM==pname)
     66    {
     67        GLuint programid;
     68        CRASSERT(tablesize/sizeof(%s)==1);
     69        programid = (GLuint) *get_values;
     70        *get_values = (%s) crStateGLSLProgramHWIDtoID(programid);
     71    }
     72    """ % (types[index], types[index], types[index], types[index])
    6673    print '\tcrServerReturnValue( get_values, tablesize );'
    6774    print '\tcrFree(get_values);'
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special

    r23094 r23274  
    204204FramebufferRenderbufferEXT
    205205GetFramebufferAttachmentParameterivEXT
     206CreateShader
     207CreateProgram
     208ShaderSource
     209IsShader
     210IsProgram
     211CompileShader
     212DeleteShader
     213AttachShader
     214DetachShader
     215LinkProgram
     216UseProgram
     217DeleteProgram
     218ValidateProgram
     219BindAttribLocation
     220DeleteObjectARB
Note: See TracChangeset for help on using the changeset viewer.

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