third_party/virtualbox/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
/**
 * Save texture packing parameters and loads those appropriate for the given
 * surface.
 *
 * @param   pState              The VMSVGA3D state structure.
 * @param   pContext            The active context.
 * @param   pSurface            The surface.
 * @param   pSave               Where to save stuff.
 */
Save texture packing parameters and loads those appropriate for the given
surface.

@param   pState              The VMSVGA3D state structure.
@param   pContext            The active context.
@param   pSurface            The surface.
@param   pSave               Where to save stuff.
Save texture packing parameters and loads those appropriate for the given surface . @param pState The VMSVGA3D state structure . @param pContext The active context . @param pSurface The surface . @param pSave Where to save stuff .
void vmsvga3dOglSetPackParams(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, PVMSVGA3DSURFACE pSurface,
                              PVMSVGAPACKPARAMS pSave)
{
    RT_NOREF(pState);
    pSave->iAlignment = 1;
    VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_UNPACK_ALIGNMENT, &pSave->iAlignment), pState, pContext);
    pSave->cxRow = 0;
    VMSVGA3D_ASSERT_GL_CALL(glGetIntegerv(GL_UNPACK_ROW_LENGTH, &pSave->cxRow), pState, pContext);
#ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING
    pSave->cyImage = 0;
    glGetIntegerv(GL_PACK_IMAGE_HEIGHT, &pSave->cyImage);
    Assert(pSave->cyImage == 0);
    pSave->fSwapBytes = GL_FALSE;
    glGetBooleanv(GL_PACK_SWAP_BYTES, &pSave->fSwapBytes);
    Assert(pSave->fSwapBytes == GL_FALSE);
    pSave->fLsbFirst = GL_FALSE;
    glGetBooleanv(GL_PACK_LSB_FIRST, &pSave->fLsbFirst);
    Assert(pSave->fLsbFirst == GL_FALSE);
    pSave->cSkipRows = 0;
    glGetIntegerv(GL_PACK_SKIP_ROWS, &pSave->cSkipRows);
    Assert(pSave->cSkipRows == 0);
    pSave->cSkipPixels = 0;
    glGetIntegerv(GL_PACK_SKIP_PIXELS, &pSave->cSkipPixels);
    Assert(pSave->cSkipPixels == 0);
    pSave->cSkipImages = 0;
    glGetIntegerv(GL_PACK_SKIP_IMAGES, &pSave->cSkipImages);
    Assert(pSave->cSkipImages == 0);
    VMSVGA3D_CLEAR_GL_ERRORS();
#endif
    NOREF(pSurface);
    if (pSave->iAlignment != 1)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_ALIGNMENT, 1), pState, pContext);
    if (pSave->cxRow != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_ROW_LENGTH, 0), pState, pContext);
#ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING
    if (pSave->cyImage != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0), pState, pContext);
    if (pSave->fSwapBytes != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE), pState, pContext);
    if (pSave->fLsbFirst != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_LSB_FIRST, GL_FALSE), pState, pContext);
    if (pSave->cSkipRows != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_SKIP_ROWS, 0), pState, pContext);
    if (pSave->cSkipPixels != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_SKIP_PIXELS, 0), pState, pContext);
    if (pSave->cSkipImages != 0)
        VMSVGA3D_ASSERT_GL_CALL(glPixelStorei(GL_PACK_SKIP_IMAGES, 0), pState, pContext);
#endif
}
void vmsvga3dOglSetPackParams ( PVMSVGA3DSTATE pState , PVMSVGA3DCONTEXT pContext , PVMSVGA3DSURFACE pSurface , PVMSVGAPACKPARAMS pSave ) { RT_NOREF ( pState ) ; pSave -> iAlignment = 1 ; VMSVGA3D_ASSERT_GL_CALL ( glGetIntegerv ( GL_UNPACK_ALIGNMENT , & pSave -> iAlignment ) , pState , pContext ) ; pSave -> cxRow = 0 ; VMSVGA3D_ASSERT_GL_CALL ( glGetIntegerv ( GL_UNPACK_ROW_LENGTH , & pSave -> cxRow ) , pState , pContext ) ; #ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING pSave -> cyImage = 0 ; glGetIntegerv ( GL_PACK_IMAGE_HEIGHT , & pSave -> cyImage ) ; Assert ( pSave -> cyImage == 0 ) ; pSave -> fSwapBytes = GL_FALSE ; glGetBooleanv ( GL_PACK_SWAP_BYTES , & pSave -> fSwapBytes ) ; Assert ( pSave -> fSwapBytes == GL_FALSE ) ; pSave -> fLsbFirst = GL_FALSE ; glGetBooleanv ( GL_PACK_LSB_FIRST , & pSave -> fLsbFirst ) ; Assert ( pSave -> fLsbFirst == GL_FALSE ) ; pSave -> cSkipRows = 0 ; glGetIntegerv ( GL_PACK_SKIP_ROWS , & pSave -> cSkipRows ) ; Assert ( pSave -> cSkipRows == 0 ) ; pSave -> cSkipPixels = 0 ; glGetIntegerv ( GL_PACK_SKIP_PIXELS , & pSave -> cSkipPixels ) ; Assert ( pSave -> cSkipPixels == 0 ) ; pSave -> cSkipImages = 0 ; glGetIntegerv ( GL_PACK_SKIP_IMAGES , & pSave -> cSkipImages ) ; Assert ( pSave -> cSkipImages == 0 ) ; VMSVGA3D_CLEAR_GL_ERRORS ( ) ; #endif NOREF ( pSurface ) ; if ( pSave -> iAlignment != 1 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_ALIGNMENT , 1 ) , pState , pContext ) ; if ( pSave -> cxRow != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_ROW_LENGTH , 0 ) , pState , pContext ) ; #ifdef VMSVGA3D_PARANOID_TEXTURE_PACKING if ( pSave -> cyImage != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_IMAGE_HEIGHT , 0 ) , pState , pContext ) ; if ( pSave -> fSwapBytes != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_SWAP_BYTES , GL_FALSE ) , pState , pContext ) ; if ( pSave -> fLsbFirst != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_LSB_FIRST , GL_FALSE ) , pState , pContext ) ; if ( pSave -> cSkipRows != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_SKIP_ROWS , 0 ) , pState , pContext ) ; if ( pSave -> cSkipPixels != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_SKIP_PIXELS , 0 ) , pState , pContext ) ; if ( pSave -> cSkipImages != 0 ) VMSVGA3D_ASSERT_GL_CALL ( glPixelStorei ( GL_PACK_SKIP_IMAGES , 0 ) , pState , pContext ) ; #endif }
Save texture packing parameters and loads those appropriate for the given
 surface.
Save texture packing parameters and loads those appropriate for the given surface .
/*
     * Save (ignore errors, setting the defaults we want and avoids restore).
     */ /*
     * Setup unpack.
     *
     * Note! We use 1 as alignment here because we currently don't do any
     *       aligning of line pitches anywhere.
     */