mesa/src/hgl/GLDispatcher.h
Alexander von Gluck IV 61ef697afc haiku libGL: Move from gallium target to src/hgl
* The Haiku renderers need to link to libGL to function properly
  in all usage contexts. As mesa drivers build before gallium
  targets, we couldn't properly link the mesa swrast driver to
  the gallium libGL target for Haiku.
* This is likely better as it mimics how glx is laid out ensuring
  the Haiku libGL is better understood.
* All renderers properly link in libGL now.

Acked-by: Brian Paul <brianp@vmware.com>
2014-01-06 15:50:21 -06:00

109 lines
2 KiB
C++

/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Brian Paul <brian.e.paul@gmail.com>
* Philippe Houdoin <philippe.houdoin@free.fr>
*/
#ifndef GLDISPATCHER_H
#define GLDISPATCHER_H
#include <BeBuild.h>
#include <GL/gl.h>
#include <SupportDefs.h>
#include "glheader.h"
extern "C" {
#include "glapi/glapi.h"
}
class BGLDispatcher
{
// Private unimplemented copy constructors
BGLDispatcher(const BGLDispatcher &);
BGLDispatcher & operator=(const BGLDispatcher &);
public:
BGLDispatcher();
~BGLDispatcher();
void SetCurrentContext(void* context);
void* CurrentContext();
struct _glapi_table* Table();
status_t CheckTable(
const struct _glapi_table* dispatch = NULL);
status_t SetTable(struct _glapi_table* dispatch);
uint32 TableSize();
const _glapi_proc operator[](const char* functionName);
const char* operator[](uint32 offset);
const _glapi_proc AddressOf(const char* functionName);
uint32 OffsetOf(const char* functionName);
};
// Inlines methods
inline void
BGLDispatcher::SetCurrentContext(void* context)
{
_glapi_set_context(context);
}
inline void*
BGLDispatcher::CurrentContext()
{
return _glapi_get_context();
}
inline struct _glapi_table*
BGLDispatcher::Table()
{
return _glapi_get_dispatch();
}
inline uint32
BGLDispatcher::TableSize()
{
return _glapi_get_dispatch_table_size();
}
inline const _glapi_proc
BGLDispatcher::operator[](const char* functionName)
{
return _glapi_get_proc_address(functionName);
}
inline const char*
BGLDispatcher::operator[](uint32 offset)
{
return _glapi_get_proc_name((GLuint) offset);
}
inline const _glapi_proc
BGLDispatcher::AddressOf(const char* functionName)
{
return _glapi_get_proc_address(functionName);
}
inline uint32
BGLDispatcher::OffsetOf(const char* functionName)
{
return (uint32) _glapi_get_proc_offset(functionName);
}
#endif // GLDISPATCHER_H