VirtualBox

Ignore:
Timestamp:
May 6, 2014 5:21:16 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93582
Message:

crOpenGL: getAttribLocations

Location:
trunk/src/VBox/Additions/common/crOpenGL/pack
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h

    r49264 r51200  
    2323# include "cr_dump.h"
    2424#endif
     25
     26extern uint32_t g_u32VBoxHostCaps;
    2527
    2628typedef struct thread_info_t ThreadInfo;
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_glsl.c

    r50041 r51200  
    115115}
    116116
     117GLint PACKSPU_APIENTRY packspu_GetAttribLocationUnchached( GLuint program, const char * name )
     118{
     119    GET_THREAD(thread);
     120    int writeback = 1;
     121    GLint return_val = (GLint) 0;
     122    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
     123    {
     124        crError( "packspu_GetAttribLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
     125    }
     126    if (pack_spu.swap)
     127    {
     128        crPackGetAttribLocationSWAP( program, name, &return_val, &writeback );
     129    }
     130    else
     131    {
     132        crPackGetAttribLocation( program, name, &return_val, &writeback );
     133    }
     134    packspuFlush( (void *) thread );
     135    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
     136    if (pack_spu.swap)
     137    {
     138        return_val = (GLint) SWAP32(return_val);
     139    }
     140    return return_val;
     141}
     142
     143GLint PACKSPU_APIENTRY packspu_GetAttribLocation(GLuint program, const char * name)
     144{
     145    if (!(CR_VBOX_CAP_GETATTRIBSLOCATIONS & g_u32VBoxHostCaps))
     146        return packspu_GetAttribLocationUnchached(program, name);
     147
     148    if (!crStateIsProgramAttribsCached(program))
     149    {
     150        GET_THREAD(thread);
     151        int writeback = 1;
     152        GLsizei maxcbData;
     153        GLsizei *pData;
     154        GLint mu;
     155
     156        packspu_GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &mu);
     157        maxcbData = 4*32*mu*sizeof(char);
     158
     159        pData = (GLsizei *) crAlloc(maxcbData+sizeof(GLsizei));
     160        if (!pData)
     161        {
     162            crWarning("packspu_GetAttribLocation: not enough memory, fallback to single query");
     163            return packspu_GetAttribLocationUnchached(program, name);
     164        }
     165
     166        crPackGetAttribsLocations(program, maxcbData, pData, NULL, &writeback);
     167
     168        packspuFlush((void *) thread);
     169        CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
     170
     171        crStateGLSLProgramCacheAttribs(program, pData[0], &pData[1]);
     172
     173        CRASSERT(crStateIsProgramAttribsCached(program));
     174
     175        crFree(pData);
     176    }
     177
     178    /*crDebug("packspu_GetAttribLocation(%d, %s)=%i", program, name, crStateGetAttribLocation(program, name));*/
     179    return crStateGetAttribLocation(program, name);
     180}
     181
    117182void PACKSPU_APIENTRY packspu_GetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData)
    118183{
     
    121186    (void) cbData;
    122187    (void) pData;
    123     crWarning("packspu_GetUniformsLocations shouldn't be called directly");
     188    WARN(("packspu_GetUniformsLocations shouldn't be called directly"));
     189}
     190
     191void PACKSPU_APIENTRY packspu_GetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData)
     192{
     193    (void) program;
     194    (void) maxcbData;
     195    (void) cbData;
     196    (void) pData;
     197    WARN(("packspu_GetAttribsLocations shouldn't be called directly"));
    124198}
    125199
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_net.c

    r50984 r51200  
    1313#include "packspu.h"
    1414#include "packspu_proto.h"
     15
     16uint32_t g_u32VBoxHostCaps = 0;
    1517
    1618static void
     
    244246    if (server->conn)
    245247    {
    246         uint32_t u32HostCaps = crNetHostCapsGet();
    247         if (u32HostCaps & CR_VBOX_CAP_CMDBLOCKS)
     248        g_u32VBoxHostCaps = crNetHostCapsGet();
     249        if (g_u32VBoxHostCaps & CR_VBOX_CAP_CMDBLOCKS)
    248250            crPackCmdBlocksEnable();
    249251    }
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_special

    r49264 r51200  
    8484DeleteProgram
    8585GetUniformLocation
     86GetAttribLocation
    8687GetUniformsLocations
     88GetAttribsLocations
    8789BindFramebufferEXT
    8890DeleteObjectARB
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