opengl: Header / whitespace cleanup
* I received the ok via email from Brain Paul at mesa to relicense the GLDispatcher sources to MIT + him as the author. * Update include ordering * Remove HAIKU_TARGET_PLATFORM_HAIKU ifdefs for boot options
This commit is contained in:
parent
24b921a0ca
commit
a42877a6e4
@ -1,39 +1,13 @@
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Brian Paul <brian@precisioninsight.com>
|
||||
* Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Brian Paul <brian.e.paul@gmail.com>
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern "C" {
|
||||
#include "glapi.h"
|
||||
#if __GNUC__ > 2
|
||||
// New Mesa
|
||||
@ -41,36 +15,33 @@ extern "C" {
|
||||
#include "glapitable.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: this file portion implements C-based dispatch of the OpenGL entrypoints
|
||||
* (glAccum, glBegin, etc).
|
||||
* This code IS NOT USED if we're compiling on an x86 system and using
|
||||
* the glapi_x86.S assembly code.
|
||||
*/
|
||||
|
||||
#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
|
||||
|
||||
#define KEYWORD1 PUBLIC
|
||||
|
||||
#define KEYWORD2
|
||||
|
||||
#define NAME(func) gl##func
|
||||
|
||||
#define DISPATCH(func, args, msg) \
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
(dispatch->func) args
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
(dispatch->func) args
|
||||
|
||||
#define RETURN_DISPATCH(func, args, msg) \
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
return (dispatch->func) args
|
||||
|
||||
|
||||
#endif /* USE_X86_ASM */
|
||||
const struct _glapi_table *dispatch; \
|
||||
dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
|
||||
return (dispatch->func) args
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* NOTE: this file portion implement a thin OpenGL entrypoints dispatching
|
||||
C++ wrapper class
|
||||
*/
|
||||
@ -81,10 +52,12 @@ BGLDispatcher::BGLDispatcher()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BGLDispatcher::~BGLDispatcher()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BGLDispatcher::CheckTable(const struct _glapi_table *table)
|
||||
{
|
||||
@ -92,12 +65,10 @@ BGLDispatcher::CheckTable(const struct _glapi_table *table)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BGLDispatcher::SetTable(struct _glapi_table *table)
|
||||
{
|
||||
_glapi_set_dispatch(table);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Brian Paul <brian.e.paul@gmail.com>
|
||||
*/
|
||||
#ifndef GLDISPATCHER_H
|
||||
#define GLDISPATCHER_H
|
||||
|
||||
@ -12,6 +19,7 @@ extern "C" {
|
||||
#include "glapi.h"
|
||||
}
|
||||
|
||||
|
||||
class BGLDispatcher
|
||||
{
|
||||
// Private unimplemented copy constructors
|
||||
@ -26,7 +34,8 @@ class BGLDispatcher
|
||||
void * CurrentContext();
|
||||
|
||||
struct _glapi_table * Table();
|
||||
status_t CheckTable(const struct _glapi_table *dispatch = NULL);
|
||||
status_t CheckTable(
|
||||
const struct _glapi_table *dispatch = NULL);
|
||||
status_t SetTable(struct _glapi_table *dispatch);
|
||||
uint32 TableSize();
|
||||
|
||||
@ -37,6 +46,7 @@ class BGLDispatcher
|
||||
uint32 OffsetOf(const char *functionName);
|
||||
};
|
||||
|
||||
|
||||
// Inlines methods
|
||||
inline void BGLDispatcher::SetCurrentContext(void * context)
|
||||
{
|
||||
@ -87,8 +97,3 @@ inline uint32 BGLDispatcher::OffsetOf(const char *functionName)
|
||||
|
||||
|
||||
#endif // GLDISPATCHER_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4,13 +4,15 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "GLDispatcher.h"
|
||||
#include "GLRenderer.h"
|
||||
|
||||
#include "GLDispatcher.h"
|
||||
|
||||
|
||||
BGLRenderer::BGLRenderer(BGLView *view, ulong glOptions,
|
||||
BGLDispatcher *dispatcher)
|
||||
: fRefCount(1),
|
||||
BGLDispatcher *dispatcher)
|
||||
:
|
||||
fRefCount(1),
|
||||
fView(view),
|
||||
fOptions(glOptions),
|
||||
fDispatcher(dispatcher)
|
||||
@ -24,7 +26,7 @@ BGLRenderer::~BGLRenderer()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BGLRenderer::Acquire()
|
||||
{
|
||||
atomic_add(&fRefCount, 1);
|
||||
@ -39,13 +41,13 @@ BGLRenderer::Release()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BGLRenderer::LockGL()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BGLRenderer::UnlockGL()
|
||||
{
|
||||
}
|
||||
@ -77,20 +79,19 @@ BGLRenderer::CopyPixelsIn(BBitmap *source, BPoint dest)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
BGLRenderer::FrameResized(float width, float height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BGLRenderer::DirectConnected(direct_buffer_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BGLRenderer::EnableDirectMode(bool enabled)
|
||||
{
|
||||
}
|
||||
@ -101,4 +102,3 @@ status_t BGLRenderer::_Reserved_Renderer_1(int32 n, void *p) { return B_ERROR; }
|
||||
status_t BGLRenderer::_Reserved_Renderer_2(int32 n, void *p) { return B_ERROR; }
|
||||
status_t BGLRenderer::_Reserved_Renderer_3(int32 n, void *p) { return B_ERROR; }
|
||||
status_t BGLRenderer::_Reserved_Renderer_4(int32 n, void *p) { return B_ERROR; }
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2012 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
*/
|
||||
|
||||
|
||||
#include <driver_settings.h>
|
||||
#include <image.h>
|
||||
#include <safemode_defs.h>
|
||||
@ -20,13 +21,8 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
extern "C" status_t _kern_get_safemode_option(const char *parameter,
|
||||
char *buffer, size_t *_bufferSize);
|
||||
#else
|
||||
extern "C" status_t _kget_safemode_option_(const char *parameter,
|
||||
char *buffer, size_t *_bufferSize);
|
||||
#endif
|
||||
char *buffer, size_t *_bufferSize);
|
||||
|
||||
|
||||
GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
|
||||
@ -39,24 +35,16 @@ GLRendererRoster::GLRendererRoster(BGLView *view, ulong options)
|
||||
char parameter[32];
|
||||
size_t parameterLength = sizeof(parameter);
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||
#else
|
||||
if (_kget_safemode_option_(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||
#endif
|
||||
{
|
||||
if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE,
|
||||
parameter, ¶meterLength) == B_OK) {
|
||||
if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on")
|
||||
|| !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes")
|
||||
|| !strcasecmp(parameter, "enable") || !strcmp(parameter, "1"))
|
||||
fSafeMode = true;
|
||||
}
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK)
|
||||
#else
|
||||
if (_kget_safemode_option_(B_SAFEMODE_DISABLE_USER_ADD_ONS, parameter, ¶meterLength) == B_OK)
|
||||
#endif
|
||||
{
|
||||
if (_kern_get_safemode_option(B_SAFEMODE_DISABLE_USER_ADD_ONS,
|
||||
parameter, ¶meterLength) == B_OK) {
|
||||
if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on")
|
||||
|| !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes")
|
||||
|| !strcasecmp(parameter, "enable") || !strcmp(parameter, "1"))
|
||||
@ -112,7 +100,8 @@ GLRendererRoster::AddDefaultPaths()
|
||||
B_SYSTEM_ADDONS_DIRECTORY,
|
||||
};
|
||||
|
||||
for (uint32 i = fSafeMode ? 4 : 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
||||
for (uint32 i = fSafeMode ? 4 : 0;
|
||||
i < sizeof(paths) / sizeof(paths[0]); i++) {
|
||||
BPath path;
|
||||
status_t status = find_directory(paths[i], &path, true);
|
||||
if (status == B_OK && path.Append("opengl") == B_OK)
|
||||
@ -204,12 +193,14 @@ GLRendererRoster::CreateRenderer(const entry_ref& ref)
|
||||
if (image < B_OK)
|
||||
return image;
|
||||
|
||||
BGLRenderer *(*instantiate_renderer)(BGLView *view, ulong options, BGLDispatcher *dispatcher);
|
||||
BGLRenderer *(*instantiate_renderer)
|
||||
(BGLView *view, ulong options, BGLDispatcher *dispatcher);
|
||||
|
||||
status = get_image_symbol(image, "instantiate_gl_renderer",
|
||||
B_SYMBOL_TYPE_TEXT, (void**)&instantiate_renderer);
|
||||
if (status == B_OK) {
|
||||
BGLRenderer *renderer = instantiate_renderer(fView, fOptions, new BGLDispatcher());
|
||||
BGLRenderer *renderer
|
||||
= instantiate_renderer(fView, fOptions, new BGLDispatcher());
|
||||
if (!renderer) {
|
||||
unload_add_on(image);
|
||||
return B_UNSUPPORTED;
|
||||
@ -226,4 +217,3 @@ GLRendererRoster::CreateRenderer(const entry_ref& ref)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2012, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _GLRENDERER_ROSTER_H
|
||||
#define _GLRENDERER_ROSTER_H
|
||||
|
||||
|
||||
#include <GLRenderer.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
struct renderer_item {
|
||||
BGLRenderer *renderer;
|
||||
entry_ref ref;
|
||||
@ -17,6 +20,7 @@ struct renderer_item {
|
||||
|
||||
typedef std::map<renderer_id, renderer_item> RendererMap;
|
||||
|
||||
|
||||
class GLRendererRoster {
|
||||
public:
|
||||
GLRendererRoster(BGLView *view, ulong options);
|
||||
@ -40,4 +44,5 @@ class GLRendererRoster {
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* _GLRENDERER_ROSTER_H */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2009, Haiku. All rights reserved.
|
||||
* Copyright 2006-2012, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -23,6 +23,7 @@
|
||||
#include "GLDispatcher.h"
|
||||
#include "GLRendererRoster.h"
|
||||
|
||||
|
||||
struct glview_direct_info {
|
||||
direct_buffer_info *direct_info;
|
||||
bool direct_connected;
|
||||
|
Loading…
Reference in New Issue
Block a user