VBoxGL2D.h revision 8f22303f06a6aeb6f4e186f9db1492ec13d9fcec
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* OpenGL support info used for 2D support detection
*/
/*
* Copyright (C) 2009 Sun Microsystems, Inc.
*
* 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef __VBoxGLSupportInfo_h__
#define __VBoxGLSupportInfo_h__
typedef char GLchar;
#ifndef GL_COMPILE_STATUS
# define GL_COMPILE_STATUS 0x8b81
#endif
#ifndef GL_LINK_STATUS
# define GL_LINK_STATUS 0x8b82
#endif
#ifndef GL_FRAGMENT_SHADER
# define GL_FRAGMENT_SHADER 0x8b30
#endif
#ifndef GL_VERTEX_SHADER
# define GL_VERTEX_SHADER 0x8b31
#endif
/* GL_ARB_multitexture */
#ifndef GL_TEXTURE0
# define GL_TEXTURE0 0x84c0
#endif
#ifndef GL_TEXTURE1
# define GL_TEXTURE1 0x84c1
#endif
#ifndef GL_MAX_TEXTURE_COORDS
# define GL_MAX_TEXTURE_COORDS 0x8871
#endif
#ifndef GL_MAX_TEXTURE_IMAGE_UNITS
# define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#endif
#ifndef APIENTRY
# define APIENTRY
#endif
typedef GLvoid (APIENTRY *PFNVBOXVHWA_MULTI_TEX_COORD2D) (GLenum texture, GLdouble v0, GLdouble v1);
/* GL_ARB_texture_rectangle */
#ifndef GL_TEXTURE_RECTANGLE
# define GL_TEXTURE_RECTANGLE 0x84F5
#endif
/* GL_ARB_shader_objects */
/* GL_ARB_fragment_shader */
typedef GLvoid (APIENTRY *PFNVBOXVHWA_SHADER_SOURCE) (GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_ATTACHED_SHADERS) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_SHADER_INFO_LOG) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_GET_PROGRAM_INFO_LOG) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM3F)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM4F)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef GLvoid (APIENTRY *PFNVBOXVHWA_UNIFORM4I)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
/* GL_ARB_pixel_buffer_object*/
#ifndef Q_WS_MAC
/* apears to be defined on mac */
typedef ptrdiff_t GLsizeiptr;
#endif
#ifndef GL_READ_ONLY
# define GL_READ_ONLY 0x88B8
#endif
#ifndef GL_WRITE_ONLY
# define GL_WRITE_ONLY 0x88B9
#endif
#ifndef GL_READ_WRITE
# define GL_READ_WRITE 0x88BA
#endif
#ifndef GL_STREAM_DRAW
# define GL_STREAM_DRAW 0x88E0
#endif
#ifndef GL_STREAM_READ
# define GL_STREAM_READ 0x88E1
#endif
#ifndef GL_STREAM_COPY
# define GL_STREAM_COPY 0x88E2
#endif
#ifndef GL_PIXEL_PACK_BUFFER
# define GL_PIXEL_PACK_BUFFER 0x88EB
#endif
#ifndef GL_PIXEL_UNPACK_BUFFER
# define GL_PIXEL_UNPACK_BUFFER 0x88EC
#endif
#ifndef GL_PIXEL_PACK_BUFFER_BINDING
# define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
#endif
#ifndef GL_PIXEL_UNPACK_BUFFER_BINDING
# define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
#endif
typedef GLvoid (APIENTRY *PFNVBOXVHWA_BUFFER_DATA)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
/*****************/
/* functions */
/* @todo: move those to VBoxGLInfo class instance members ??? */
extern PFNVBOXVHWA_IS_SHADER vboxglIsShader;
extern PFNVBOXVHWA_UNIFORM1F vboxglUniform1f;
extern PFNVBOXVHWA_UNIFORM2F vboxglUniform2f;
extern PFNVBOXVHWA_UNIFORM3F vboxglUniform3f;
extern PFNVBOXVHWA_UNIFORM4F vboxglUniform4f;
extern PFNVBOXVHWA_UNIFORM1I vboxglUniform1i;
extern PFNVBOXVHWA_UNIFORM2I vboxglUniform2i;
extern PFNVBOXVHWA_UNIFORM3I vboxglUniform3i;
extern PFNVBOXVHWA_UNIFORM4I vboxglUniform4i;
{
VBoxGLInfo() :
mGLVersion(0),
mFragmentShaderSupported(false),
mTextureRectangleSupported(false),
mTextureNP2Supported(false),
mPBOSupported(false),
m_GL_ARB_multitexture(false),
m_GL_ARB_shader_objects(false),
m_GL_ARB_fragment_shader(false),
m_GL_ARB_pixel_buffer_object(false),
m_GL_ARB_texture_rectangle(false),
m_GL_EXT_texture_rectangle(false),
m_GL_NV_texture_rectangle(false),
mInitialized(false)
{}
bool isInitialized() const { return mInitialized; }
int getGLVersion() const { return mGLVersion; }
bool isFragmentShaderSupported() const { return mFragmentShaderSupported; }
bool isTextureRectangleSupported() const { return mTextureRectangleSupported; }
bool isTextureNP2Supported() const { return mTextureNP2Supported; }
bool isPBOSupported() const { return mPBOSupported; }
/* 1 would mean it is not supported */
int getMultiTexNumSupported() const { return mMultiTexNumSupported; }
int mGLVersion;
bool mFragmentShaderSupported;
bool mTextureNP2Supported;
bool mPBOSupported;
int mMultiTexNumSupported; /* 1 would mean it is not supported */
bool m_GL_ARB_multitexture;
bool m_GL_ARB_shader_objects;
bool m_GL_ARB_fragment_shader;
bool mInitialized;
};
{
~VBoxGLTmpContext();
};
#define VBOXVHWA_NUMFOURCC 4
{
VBoxVHWAInfo() :
mInitialized(false)
{}
mInitialized(false)
{}
bool isInitialized() const { return mInitialized; }
bool isVHWASupported() const;
int getFourccSupportedCount() const { return mFourccSupportedCount; }
static bool checkVHWASupport();
bool mInitialized;
};
#endif /* #ifndef __VBoxGLSupportInfo_h__ */