VirtualBox

Ignore:
Timestamp:
Mar 30, 2015 5:03:12 PM (10 years ago)
Author:
vboxsync
Message:

Host 3D: crServer: move things in place: texture-related stuff -> server_texture.c.

File:
1 edited

Legend:

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

    r50041 r55013  
    2121#include "server_dispatch.h"
    2222#include "server.h"
     23#include "cr_mem.h"
    2324
    2425#define CR_NOTHING()
     
    190191    crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLint) );
    191192}
     193
     194void SERVER_DISPATCH_APIENTRY crServerDispatchBindTexture( GLenum target, GLuint texture )
     195{
     196    crStateBindTexture( target, texture );
     197    cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID(texture));
     198}
     199
     200
     201void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteTextures( GLsizei n, const GLuint *textures)
     202{
     203    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
     204    GLint i;
     205
     206    if (!newTextures)
     207    {
     208        crError("crServerDispatchDeleteTextures: out of memory");
     209        return;
     210    }
     211
     212    for (i = 0; i < n; i++)
     213    {
     214        newTextures[i] = crStateGetTextureHWID(textures[i]);
     215    }
     216
     217//    for (i = 0; i < n; ++i)
     218//    {
     219//        crDebug("DeleteTexture: %d, pid %d, ctx %d", textures[i], (uint32_t)cr_server.curClient->pid, cr_server.currentCtxInfo->pContext->id);
     220//    }
     221
     222
     223    crStateDeleteTextures(n, textures);
     224    cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures);
     225    crFree(newTextures);
     226}
     227
     228
     229void SERVER_DISPATCH_APIENTRY crServerDispatchPrioritizeTextures( GLsizei n, const GLuint * textures, const GLclampf * priorities )
     230{
     231    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
     232    GLint i;
     233
     234    if (!newTextures)
     235    {
     236        crError("crServerDispatchDeleteTextures: out of memory");
     237        return;
     238    }
     239
     240    crStatePrioritizeTextures(n, textures, priorities);
     241
     242    for (i = 0; i < n; i++)
     243    {
     244        newTextures[i] = crStateGetTextureHWID(textures[i]);
     245    }
     246
     247    cr_server.head_spu->dispatch_table.PrioritizeTextures(n, newTextures, priorities);
     248    crFree(newTextures);
     249}
     250
     251
     252/*@todo will fail for textures loaded from snapshot */
     253GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsTexture( GLuint texture )
     254{
     255    GLboolean retval;
     256    retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID(texture));
     257    crServerReturnValue( &retval, sizeof(retval) );
     258    return retval; /* WILL PROBABLY BE IGNORED */
     259}
     260
     261
     262GLboolean SERVER_DISPATCH_APIENTRY
     263crServerDispatchAreTexturesResident(GLsizei n, const GLuint *textures,
     264                                    GLboolean *residences)
     265{
     266    GLboolean retval;
     267    GLsizei i;
     268    GLboolean *res = (GLboolean *) crAlloc(n * sizeof(GLboolean));
     269    GLuint *textures2 = (GLuint *) crAlloc(n * sizeof(GLuint));
     270
     271    (void) residences;
     272
     273    for (i = 0; i < n; i++)
     274    {
     275        textures2[i] = crStateGetTextureHWID(textures[i]);
     276    }
     277    retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures2, res);
     278
     279    crFree(textures2);
     280
     281    crServerReturnValue(res, n * sizeof(GLboolean));
     282
     283    crFree(res);
     284
     285    return retval; /* WILL PROBABLY BE IGNORED */
     286}
     287
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