icd_drv.c revision b8711e889bb1bf17cbb52133ea71f7bf38dd707e
/* $Id$ */
/** @file
* VBox OpenGL windows ICD driver functions
*/
/*
* Copyright (C) 2006-2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "cr_error.h"
#include "icd_drv.h"
#include "cr_gl.h"
#include "stub.h"
#include "cr_mem.h"
#include <windows.h>
//TODO: consider
/* We can modify chronium dispatch table functions order to match the one required by ICD,
* but it'd render us incompatible with other chromium SPUs and require more changes.
* In current state, we can use unmodified binary chromium SPUs. Question is do we need it?
*/
#include "VBoxICDList.h"
} };
/**
* Compute a mask of CR_*_BIT flags which reflects the attributes of
* the pixel format of the given hdc.
*/
{
int iPixelFormat;
GLuint b = 0;
if (pfd.cDepthBits > 0)
b |= CR_DEPTH_BIT;
if (pfd.cAccumBits > 0)
b |= CR_ACCUM_BIT;
b |= CR_RGB_BIT;
if (pfd.cStencilBits > 0)
b |= CR_STENCIL_BIT;
if (pfd.cAlphaBits > 0)
b |= CR_ALPHA_BIT;
b |= CR_DOUBLE_BIT;
b |= CR_STEREO_BIT;
return b;
}
{
/*crDebug( "DrvReleaseContext(0x%x) called", hglrc );*/
}
{
if (stubInit()) {
return TRUE;
}
return FALSE;
}
//we're not going to change icdTable at runtime, so callback is unused
{
/*crDebug( "DrvSetContext called(0x%x, 0x%x)", hdc, hglrc );*/
(void) (callback);
}
{
}
return 1;
}
{
char dpyName[MAX_DPY_NAME];
stubInit();
if (stub.haveNativeOpenGL)
if (!context)
return 0;
}
{
//We don't support more than 1 layers.
if (iLayerPlane == 0) {
return DrvCreateContext(hdc);
} else {
return NULL;
}
}
{
crWarning( "DrvDescribeLayerPlane: unimplemented" );
CRASSERT(false);
return 0;
}
{
crWarning( "DrvGetLayerPaletteEntries: unsupported" );
CRASSERT(false);
return 0;
}
int APIENTRY DrvDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR pfd)
{
if ( !pfd ) {
return 2;
}
return 2;
}
if (iPixelFormat==1)
{
pfd->cAlphaShift = 0;
pfd->cAccumBits = 0;
pfd->cAccumRedBits = 0;
pfd->cAccumGreenBits = 0;
pfd->cAccumBlueBits = 0;
pfd->cAccumAlphaBits = 0;
pfd->cAuxBuffers = 0;
pfd->dwLayerMask = 0;
pfd->dwVisibleMask = 0;
pfd->dwDamageMask = 0;
}
else
{
pfd->cBlueShift = 0;
pfd->cAlphaBits = 0;
pfd->cAlphaShift = 0;
pfd->cAccumAlphaBits = 0;
pfd->cAuxBuffers = 0;
pfd->dwLayerMask = 0;
pfd->dwVisibleMask = 0;
pfd->dwDamageMask = 0;
}
/* the max PFD index */
return 2;
}
{
/*crDebug( "DrvDeleteContext(0x%x) called", hglrc );*/
stubDestroyContext( (unsigned long) hglrc );
return 1;
}
{
crWarning( "DrvCopyContext: unsupported" );
return 0;
}
{
crWarning( "DrvShareLists: unsupported" );
return 1;
}
{
crWarning( "DrvSetLayerPaletteEntries: unsupported" );
return 0;
}
{
crWarning( "DrvRealizeLayerPalette: unsupported" );
return 0;
}
{
if (fuPlanes == 1)
{
return DrvSwapBuffers(hdc);
}
else
{
crWarning( "DrvSwapLayerBuffers: unsupported" );
CRASSERT(false);
return 0;
}
}
{
/*crDebug( "DrvSwapBuffers(0x%x) called", hdc );*/
stubSwapBuffers( window, 0 );
return 1;
}