diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
commit | f8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch) | |
tree | 26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/Additions/common/crOpenGL/feedback | |
parent | Initial commit. (diff) | |
download | virtualbox-upstream.tar.xz virtualbox-upstream.zip |
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Additions/common/crOpenGL/feedback')
14 files changed, 959 insertions, 0 deletions
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/Makefile.kup b/src/VBox/Additions/common/crOpenGL/feedback/Makefile.kup new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/Makefile.kup diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback.def b/src/VBox/Additions/common/crOpenGL/feedback/feedback.def new file mode 100644 index 00000000..9edc7163 --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback.def @@ -0,0 +1,6 @@ +; Copyright (c) 2001, Stanford University +; All rights reserved. +; +; See the file LICENSE.txt for information on redistributing this software. +EXPORTS +SPULoad diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback.py new file mode 100755 index 00000000..181b23fd --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback.py @@ -0,0 +1,270 @@ +# Copyright (c) 2001, Stanford University +# All rights reserved. +# +# See the file LICENSE.txt for information on redistributing this software. + +from __future__ import print_function +import sys + +import apiutil + + +apiutil.CopyrightC() + +print(""" +/* DO NOT EDIT - generated by feedback.py */ +#include <stdio.h> +#include "cr_spu.h" +#include "feedbackspu.h" +#include "feedbackspu_proto.h" +#include "cr_packfunctions.h" +#include "cr_glstate.h" + +""") + +keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") + +for func_name in keys: + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + if apiutil.FindSpecial( "feedback", func_name ): + print('static %s FEEDBACKSPU_APIENTRY feedbackspu_%s(%s)' % ( return_type, func_name, apiutil.MakeDeclarationString(params) )) + print('{') + print('\tfeedback_spu.super.%s(%s);' % ( func_name, apiutil.MakeCallString(params) )) + print('}') + + + +print(""" +#define CHANGE(name, func) crSPUChangeInterface((void *)&(feedback_spu.self), (void *)feedback_spu.self.name, (void *)((SPUGenericFunction) func)) +#define CHANGESWAP(name, swapfunc, regfunc) crSPUChangeInterface( (void *)&(feedback_spu.self), (void *)feedback_spu.self.name, (void *)((SPUGenericFunction) (feedback_spu.swap ? swapfunc: regfunc ))) + +static void __loadFeedbackAPI( void ) +{ +""") +for func_name in keys: + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + if apiutil.FindSpecial( "feedback", func_name ): + print('\tCHANGE(%s, crStateFeedback%s);' % (func_name, func_name )) +print(""" +} + +static void __loadSelectAPI( void ) +{ +""") +for func_name in keys: + if apiutil.FindSpecial( "select", func_name ): + print('\tCHANGE(%s, crStateSelect%s);' % (func_name, func_name )) + elif apiutil.FindSpecial( "feedback", func_name ): + print('\tCHANGE(%s, feedbackspu_%s);' % (func_name, func_name )) +print(""" +} + +static void __loadRenderAPI( void ) +{ +""") + +for func_name in keys: + return_type = apiutil.ReturnType(func_name) + if apiutil.FindSpecial( "feedback", func_name ) or apiutil.FindSpecial( "select", func_name ): + print('\tCHANGE(%s, feedbackspu_%s);' % (func_name, func_name )) +print(""" +} +""") + +print(""" +static GLint FEEDBACKSPU_APIENTRY feedbackspu_RenderMode ( GLenum mode ) +{ + feedback_spu.render_mode = mode; + + switch (mode) { + case GL_FEEDBACK: + /*printf("Switching to Feedback API\\n");*/ + __loadFeedbackAPI( ); + break; + case GL_SELECT: + /*printf("Switching to Selection API\\n");*/ + __loadSelectAPI( ); + break; + case GL_RENDER: + /*printf("Switching to Render API\\n");*/ + __loadRenderAPI( ); + break; + } + + return crStateRenderMode( mode ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_Begin ( GLenum mode ) +{ + if (feedback_spu.render_mode == GL_FEEDBACK) + crStateFeedbackBegin( mode ); + else if (feedback_spu.render_mode == GL_SELECT) + crStateSelectBegin( mode ); + else + { + crStateBegin( mode ); + feedback_spu.super.Begin( mode ); + } +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_End ( void ) +{ + if (feedback_spu.render_mode == GL_FEEDBACK) + crStateFeedbackEnd( ); + else if (feedback_spu.render_mode == GL_SELECT) + crStateSelectEnd( ); + else + { + crStateEnd( ); + feedback_spu.super.End( ); + } +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_Bitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) +{ + crStateBitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); + + if (feedback_spu.render_mode == GL_FEEDBACK) + crStateFeedbackBitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); + else if (feedback_spu.render_mode == GL_SELECT) + crStateSelectBitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); + else + feedback_spu.super.Bitmap( width, height, xorig, yorig, xmove, ymove, bitmap ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) +{ + if (feedback_spu.render_mode == GL_FEEDBACK) + crStateFeedbackCopyPixels( x, y, width, height, type ); + else if (feedback_spu.render_mode == GL_SELECT) + crStateSelectCopyPixels( x, y, width, height, type ); + else + feedback_spu.super.CopyPixels( x, y, width, height, type ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) +{ + if (feedback_spu.render_mode == GL_FEEDBACK) + crStateFeedbackDrawPixels( width, height, format, type, pixels ); + else if (feedback_spu.render_mode == GL_SELECT) + crStateSelectDrawPixels( width, height, format, type, pixels ); + else + feedback_spu.super.DrawPixels( width, height, format, type, pixels ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_GetBooleanv( GLenum pname, GLboolean *params ) + +{ + if (pname == GL_FEEDBACK_BUFFER_SIZE || + pname == GL_FEEDBACK_BUFFER_TYPE || + pname == GL_SELECTION_BUFFER_SIZE) + crStateFeedbackGetBooleanv( pname, params ); + else + if (pname == GL_VIEWPORT && feedback_spu.default_viewport) + crStateGetBooleanv( pname, params ); + else + feedback_spu.super.GetBooleanv( pname, params ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_GetDoublev( GLenum pname, GLdouble *params ) + +{ + if (pname == GL_FEEDBACK_BUFFER_SIZE || + pname == GL_FEEDBACK_BUFFER_TYPE || + pname == GL_SELECTION_BUFFER_SIZE) + crStateFeedbackGetDoublev( pname, params ); + else + if (pname == GL_VIEWPORT && feedback_spu.default_viewport) + crStateGetDoublev( pname, params ); + else + feedback_spu.super.GetDoublev( pname, params ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_GetFloatv( GLenum pname, GLfloat *params ) + +{ + if (pname == GL_FEEDBACK_BUFFER_SIZE || + pname == GL_FEEDBACK_BUFFER_TYPE || + pname == GL_SELECTION_BUFFER_SIZE) + crStateFeedbackGetFloatv( pname, params ); + else + if (pname == GL_VIEWPORT && feedback_spu.default_viewport) + crStateGetFloatv( pname, params ); + else + feedback_spu.super.GetFloatv( pname, params ); +} + +static void FEEDBACKSPU_APIENTRY feedbackspu_GetIntegerv( GLenum pname, GLint *params ) + +{ + if (pname == GL_FEEDBACK_BUFFER_SIZE || + pname == GL_FEEDBACK_BUFFER_TYPE || + pname == GL_SELECTION_BUFFER_SIZE) + crStateFeedbackGetIntegerv( pname, params ); + else + if (pname == GL_VIEWPORT && feedback_spu.default_viewport) + crStateGetIntegerv( pname, params ); + else + feedback_spu.super.GetIntegerv( pname, params ); +} + +SPUNamedFunctionTable _cr_feedback_table[] = { +""") + +for func_name in keys: + if apiutil.FindSpecial( "feedback_state", func_name ): + print('\t{ "%s", (SPUGenericFunction) feedbackspu_%s }, ' % ( func_name, func_name )) +print(""" + { "GetBooleanv", (SPUGenericFunction) feedbackspu_GetBooleanv }, + { "GetDoublev", (SPUGenericFunction) feedbackspu_GetDoublev }, + { "GetFloatv", (SPUGenericFunction) feedbackspu_GetFloatv }, + { "GetIntegerv", (SPUGenericFunction) feedbackspu_GetIntegerv }, + { "FeedbackBuffer", (SPUGenericFunction) crStateFeedbackBuffer }, + { "SelectBuffer", (SPUGenericFunction) crStateSelectBuffer }, + { "InitNames", (SPUGenericFunction) crStateInitNames }, + { "LoadName", (SPUGenericFunction) crStateLoadName }, + { "PushName", (SPUGenericFunction) crStatePushName }, + { "PopName", (SPUGenericFunction) crStatePopName }, + { "Begin", (SPUGenericFunction) feedbackspu_Begin }, + { "End", (SPUGenericFunction) feedbackspu_End }, + { "Bitmap", (SPUGenericFunction) feedbackspu_Bitmap }, + { "CopyPixels", (SPUGenericFunction) feedbackspu_CopyPixels }, + { "DrawPixels", (SPUGenericFunction) feedbackspu_DrawPixels }, + { "TexCoord1d", (SPUGenericFunction) feedbackspu_TexCoord1d }, + { "TexCoord1dv", (SPUGenericFunction) feedbackspu_TexCoord1dv }, + { "TexCoord1f", (SPUGenericFunction) feedbackspu_TexCoord1f }, + { "TexCoord1fv", (SPUGenericFunction) feedbackspu_TexCoord1fv }, + { "TexCoord1s", (SPUGenericFunction) feedbackspu_TexCoord1s }, + { "TexCoord1sv", (SPUGenericFunction) feedbackspu_TexCoord1sv }, + { "TexCoord1i", (SPUGenericFunction) feedbackspu_TexCoord1i }, + { "TexCoord1iv", (SPUGenericFunction) feedbackspu_TexCoord1iv }, + { "TexCoord2d", (SPUGenericFunction) feedbackspu_TexCoord2d }, + { "TexCoord2dv", (SPUGenericFunction) feedbackspu_TexCoord2dv }, + { "TexCoord2f", (SPUGenericFunction) feedbackspu_TexCoord2f }, + { "TexCoord2fv", (SPUGenericFunction) feedbackspu_TexCoord2fv }, + { "TexCoord2s", (SPUGenericFunction) feedbackspu_TexCoord2s }, + { "TexCoord2sv", (SPUGenericFunction) feedbackspu_TexCoord2sv }, + { "TexCoord2i", (SPUGenericFunction) feedbackspu_TexCoord2i }, + { "TexCoord2iv", (SPUGenericFunction) feedbackspu_TexCoord2iv }, + { "TexCoord3d", (SPUGenericFunction) feedbackspu_TexCoord3d }, + { "TexCoord3dv", (SPUGenericFunction) feedbackspu_TexCoord3dv }, + { "TexCoord3f", (SPUGenericFunction) feedbackspu_TexCoord3f }, + { "TexCoord3fv", (SPUGenericFunction) feedbackspu_TexCoord3fv }, + { "TexCoord3s", (SPUGenericFunction) feedbackspu_TexCoord3s }, + { "TexCoord3sv", (SPUGenericFunction) feedbackspu_TexCoord3sv }, + { "TexCoord3i", (SPUGenericFunction) feedbackspu_TexCoord3i }, + { "TexCoord3iv", (SPUGenericFunction) feedbackspu_TexCoord3iv }, + { "TexCoord4d", (SPUGenericFunction) feedbackspu_TexCoord4d }, + { "TexCoord4dv", (SPUGenericFunction) feedbackspu_TexCoord4dv }, + { "TexCoord4f", (SPUGenericFunction) feedbackspu_TexCoord4f }, + { "TexCoord4fv", (SPUGenericFunction) feedbackspu_TexCoord4fv }, + { "TexCoord4s", (SPUGenericFunction) feedbackspu_TexCoord4s }, + { "TexCoord4sv", (SPUGenericFunction) feedbackspu_TexCoord4sv }, + { "TexCoord4i", (SPUGenericFunction) feedbackspu_TexCoord4i }, + { "TexCoord4iv", (SPUGenericFunction) feedbackspu_TexCoord4iv }, + { "RenderMode", (SPUGenericFunction) feedbackspu_RenderMode }, + { NULL, NULL } +}; +""") diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c new file mode 100644 index 00000000..11158b5a --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_context.c @@ -0,0 +1,131 @@ +/* $Id: feedback_context.c $ */ +/** @file + * VBox feedback spu, context tracking. + */ + +/* + * Copyright (C) 2009-2019 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * 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_spu.h" +#include "cr_error.h" +#include "feedbackspu.h" + +/** @todo r=bird: None of the code here is referenced externally, so I've + * just prototyped the function here at the top of the file to make + * the compiler happy. */ +GLint FEEDBACKSPU_APIENTRY feedbackspu_VBoxCreateContext( GLint con, const char *dpyName, GLint visual, GLint shareCtx ); +GLint FEEDBACKSPU_APIENTRY feedbackspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ); +void FEEDBACKSPU_APIENTRY feedbackspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx ); +void FEEDBACKSPU_APIENTRY feedbackspu_DestroyContext( GLint ctx ); + + +/** @todo Multithreading case. (See feedback_spu.self.RenderMode)*/ + +GLint FEEDBACKSPU_APIENTRY +feedbackspu_VBoxCreateContext( GLint con, const char *dpyName, GLint visual, GLint shareCtx ) +{ + GLint ctx, slot; + +#ifdef CHROMIUM_THREADSAFE + crLockMutex(&feedback_spu.mutex); +#endif + + ctx = feedback_spu.child.VBoxCreateContext(con, dpyName, visual, shareCtx); + + /* find an empty context slot */ + for (slot = 0; slot < feedback_spu.numContexts; slot++) { + if (!feedback_spu.context[slot].clientState) { + /* found empty slot */ + break; + } + } + if (slot == feedback_spu.numContexts) { + feedback_spu.numContexts++; + } + + feedback_spu.context[slot].clientState = crStateCreateContext(NULL, visual, NULL); + feedback_spu.context[slot].clientCtx = ctx; + +#ifdef CHROMIUM_THREADSAFE + crUnlockMutex(&feedback_spu.mutex); +#endif + + return ctx; +} + +GLint FEEDBACKSPU_APIENTRY +feedbackspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) +{ + return feedbackspu_VBoxCreateContext( 0, dpyName, visual, shareCtx ); +} + +void FEEDBACKSPU_APIENTRY +feedbackspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx ) +{ +#ifdef CHROMIUM_THREADSAFE + crLockMutex(&feedback_spu.mutex); +#endif + feedback_spu.child.MakeCurrent(window, nativeWindow, ctx); + + if (ctx) { + int slot; + GLint oldmode; + + for (slot=0; slot<feedback_spu.numContexts; ++slot) + if (feedback_spu.context[slot].clientCtx == ctx) break; + CRASSERT(slot < feedback_spu.numContexts); + + crStateMakeCurrent(feedback_spu.context[slot].clientState); + + crStateGetIntegerv(GL_RENDER_MODE, &oldmode); + + if (oldmode!=feedback_spu.render_mode) + { + feedback_spu.self.RenderMode(oldmode); + } + } + else + { + crStateMakeCurrent(NULL); + } + +#ifdef CHROMIUM_THREADSAFE + crUnlockMutex(&feedback_spu.mutex); +#endif +} + +void FEEDBACKSPU_APIENTRY +feedbackspu_DestroyContext( GLint ctx ) +{ +#ifdef CHROMIUM_THREADSAFE + crLockMutex(&feedback_spu.mutex); +#endif + feedback_spu.child.DestroyContext(ctx); + + if (ctx) { + int slot; + + for (slot=0; slot<feedback_spu.numContexts; ++slot) + if (feedback_spu.context[slot].clientCtx == ctx) break; + CRASSERT(slot < feedback_spu.numContexts); + + crStateDestroyContext(feedback_spu.context[slot].clientState); + + feedback_spu.context[slot].clientState = NULL; + feedback_spu.context[slot].clientCtx = 0; + } + +#ifdef CHROMIUM_THREADSAFE + crUnlockMutex(&feedback_spu.mutex); +#endif +} + diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py new file mode 100755 index 00000000..d3c40833 --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_funcs.py @@ -0,0 +1,40 @@ +# Copyright (c) 2001, Stanford University +# All rights reserved. +# +# See the file LICENSE.txt for information on redistributing this software. + +from __future__ import print_function +import sys + +import apiutil + + +apiutil.CopyrightC() + +print(""" +/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY feedback_funcs.py SCRIPT */ +#ifndef CR_STATE_FEEDBACK_FUNCS_H +#define CR_STATE_FEEDBACK_FUNCS_H + +#include "cr_error.h" + +#if defined(WINDOWS) +#define STATE_APIENTRY __stdcall +#else +#define STATE_APIENTRY +#endif + +#define STATE_UNUSED(x) ((void)x)""") + +keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") + +for func_name in apiutil.AllSpecials( "feedback" ): + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + print('%s STATE_APIENTRY crStateFeedback%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationString(params))) + +for func_name in apiutil.AllSpecials( "select" ): + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + print('%s STATE_APIENTRY crStateSelect%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationString(params))) +print('\n#endif /* CR_STATE_FEEDBACK_FUNCS_H */') diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_special b/src/VBox/Additions/common/crOpenGL/feedback/feedback_special new file mode 100644 index 00000000..75eb7f8f --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_special @@ -0,0 +1,64 @@ +Vertex2d +Vertex2dv +Vertex2f +Vertex2fv +Vertex2i +Vertex2iv +Vertex2s +Vertex2sv +Vertex3d +Vertex3dv +Vertex3f +Vertex3fv +Vertex3i +Vertex3iv +Vertex3s +Vertex3sv +Vertex4d +Vertex4dv +Vertex4f +Vertex4fv +Vertex4i +Vertex4iv +Vertex4s +Vertex4sv +Rectf +Recti +Rectd +Rects +Rectiv +Rectfv +Rectdv +Rectsv +TexCoord1d +TexCoord1dv +TexCoord1f +TexCoord1fv +TexCoord1i +TexCoord1iv +TexCoord1s +TexCoord1sv +TexCoord2d +TexCoord2dv +TexCoord2f +TexCoord2fv +TexCoord2i +TexCoord2iv +TexCoord2s +TexCoord2sv +TexCoord3d +TexCoord3dv +TexCoord3f +TexCoord3fv +TexCoord3i +TexCoord3iv +TexCoord3s +TexCoord3sv +TexCoord4d +TexCoord4dv +TexCoord4f +TexCoord4fv +TexCoord4i +TexCoord4iv +TexCoord4s +TexCoord4sv diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py b/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py new file mode 100755 index 00000000..01bab425 --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_state.py @@ -0,0 +1,34 @@ +# Copyright (c) 2001, Stanford University +# All rights reserved. +# +# See the file LICENSE.txt for information on redistributing this software. + +from __future__ import print_function +import sys + +import apiutil + + +apiutil.CopyrightC() + +print(""" +#include "cr_server.h" +#include "feedbackspu.h" +#include "feedbackspu_proto.h" +""") +custom = ["CreateContext", "VBoxCreateContext", "MakeCurrent", "DestroyContext"] + +keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") + +for func_name in keys: + if apiutil.FindSpecial( "feedback_state", func_name ): + if func_name in custom: + continue + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + print('%s FEEDBACKSPU_APIENTRY feedbackspu_%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))) + print('{') + print('\tcrState%s(%s);' % (func_name, apiutil.MakeCallString(params))) + print('') + print('\tfeedback_spu.super.%s(%s);' % (func_name, apiutil.MakeCallString(params))) + print('}') diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedback_state_special b/src/VBox/Additions/common/crOpenGL/feedback/feedback_state_special new file mode 100644 index 00000000..15bec65d --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedback_state_special @@ -0,0 +1,66 @@ +# Copyright (c) 2001, Stanford University +# All rights reserved. +# +# See the file LICENSE.txt for information on redistributing this software. +ClipPlane +MatrixMode +LoadIdentity +PopMatrix +PushMatrix +LoadMatrixf +LoadMatrixd +MultMatrixf +MultMatrixd +LoadTransposeMatrixfARB +LoadTransposeMatrixdARB +MultTransposeMatrixfARB +MultTransposeMatrixdARB +Translatef +Translated +Rotatef +Rotated +Scalef +Scaled +Frustum +Ortho +Viewport +DepthRange +Scissor +PushAttrib +PopAttrib +PassThrough +PolygonMode +Color4f +Color4fv +Color3f +Color3fv +RasterPos2d +RasterPos2dv +RasterPos2f +RasterPos2fv +RasterPos2i +RasterPos2iv +RasterPos2s +RasterPos2sv +RasterPos3d +RasterPos3dv +RasterPos3f +RasterPos3fv +RasterPos3i +RasterPos3iv +RasterPos3s +RasterPos3sv +RasterPos4d +RasterPos4dv +RasterPos4f +RasterPos4fv +RasterPos4i +RasterPos4iv +RasterPos4s +RasterPos4sv +CreateContext +MakeCurrent +DestroyContext +VBoxAttachThread +VBoxDetachThread +VBoxCreateContext diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h new file mode 100644 index 00000000..7d72a70b --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.h @@ -0,0 +1,58 @@ +/* Copyright (c) 2001, Stanford University + * All rights reserved. + * + * See the file LICENSE.txt for information on redistributing this software. + */ + +#ifndef GA_INCLUDED_SRC_common_crOpenGL_feedback_feedbackspu_h +#define GA_INCLUDED_SRC_common_crOpenGL_feedback_feedbackspu_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#ifdef WINDOWS +#define FEEDBACKSPU_APIENTRY __stdcall +#else +#define FEEDBACKSPU_APIENTRY +#endif + +#include "cr_spu.h" +#include "cr_timer.h" +#include "cr_glstate.h" + +typedef struct context_info_t ContextInfo; + +struct context_info_t { + CRContext *clientState; /* used to store client-side GL state */ + GLint clientCtx; /* client context ID */ +}; + +typedef struct { + int id; + int has_child; + SPUDispatchTable self, child, super; + + int render_mode; + + int default_viewport; + + CRCurrentStatePointers current; + + CRContext *defaultctx; + int numContexts; + ContextInfo context[CR_MAX_CONTEXTS]; + +#ifdef CHROMIUM_THREADSAFE + CRmutex mutex; +#endif +} feedbackSPU; + +extern feedbackSPU feedback_spu; + +extern SPUNamedFunctionTable _cr_feedback_table[]; + +extern SPUOptions feedbackSPUOptions[]; + +extern void feedbackspuGatherConfiguration( void ); + +#endif /* !GA_INCLUDED_SRC_common_crOpenGL_feedback_feedbackspu_h */ diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc new file mode 100644 index 00000000..b9db8122 --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc @@ -0,0 +1,69 @@ +/* $Id: feedbackspu.rc $ */ +/** @file + * VBoxOGLfeedbackspu - Resource file containing version info and icon. + */ + +/* + * Copyright (C) 2009-2019 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * 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 <windows.h> +#include <VBox/version.h> + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VBOX_RC_FILE_VERSION + PRODUCTVERSION VBOX_RC_FILE_VERSION + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS VBOX_RC_FILE_FLAGS + FILEOS VBOX_RC_FILE_OS + FILETYPE VBOX_RC_TYPE_DRV + FILESUBTYPE VFT2_DRV_DISPLAY +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "VirtualBox crOpenGL ICD\0" + VALUE "InternalName", "VBoxOGLfeedbackpu\0" +#ifdef VBOX_WDDM_WOW64 + VALUE "OriginalFilename", "VBoxOGLfeedbackpu-x86.dll\0" +#else + VALUE "OriginalFilename", "VBoxOGLfeedbackpu.dll\0" +#endif + VALUE "CompanyName", VBOX_RC_COMPANY_NAME + VALUE "FileVersion", VBOX_RC_FILE_VERSION_STR + VALUE "LegalCopyright", VBOX_RC_LEGAL_COPYRIGHT + VALUE "ProductName", VBOX_RC_PRODUCT_NAME_GA_STR + VALUE "ProductVersion", VBOX_RC_PRODUCT_VERSION_STR + VBOX_RC_MORE_STRINGS + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +1 RCDATA +BEGIN +// Machine dependent parameters + 17, // Height of vertical thumb + 17, // Width of horizontal thumb + 2, // Icon horiz compression factor + 2, // Icon vert compression factor + 1, // Cursor horz compression factor + 1, // Cursor vert compression factor + 0, // Kanji window height + 1, // cxBorder (thickness of vertical lines) + 1 // cyBorder (thickness of horizontal lines) +END diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c new file mode 100644 index 00000000..9449a2bb --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_config.c @@ -0,0 +1,44 @@ +/* Copyright (c) 2001, Stanford University + * All rights reserved + * + * See the file LICENSE.txt for information on redistributing this software. + */ + +#include "cr_string.h" +#include "cr_environment.h" +#include "cr_error.h" +#include "cr_mem.h" +#include "feedbackspu.h" + +#include <stdio.h> +#ifndef WINDOWS +#include <unistd.h> +#endif + +static void __setDefaults( void ) +{ + feedback_spu.render_mode = GL_RENDER; +} + +static void set_default_viewport( void *foo, const char *response ) +{ + (void) foo; + sscanf( response, "%d", &(feedback_spu.default_viewport) ); +} + +/* option, type, nr, default, min, max, title, callback + */ +SPUOptions feedbackSPUOptions[] = { + + { "default_viewport", CR_BOOL, 1, "0", "0", "1", + "Return default viewport parameters", (SPUOptionCB)set_default_viewport }, + + { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL }, + +}; + + +void feedbackspuGatherConfiguration( void ) +{ + __setDefaults(); +} diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c new file mode 100644 index 00000000..f264763c --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_init.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2001, Stanford University + * All rights reserved + * + * See the file LICENSE.txt for information on redistributing this software. + */ + +#include "cr_spu.h" +#include "cr_environment.h" +#include "cr_string.h" +#include "cr_error.h" +#include "cr_mem.h" +#include "cr_server.h" +#include "feedbackspu.h" +#include <fcntl.h> +#ifndef WINDOWS +#include <unistd.h> +#endif + +feedbackSPU feedback_spu; + +static SPUFunctions feedback_functions = { + NULL, /* CHILD COPY */ + NULL, /* DATA */ + _cr_feedback_table /* THE ACTUAL FUNCTIONS */ +}; + +static SPUFunctions *feedbackSPUInit( int id, SPU *child, SPU *self, + unsigned int context_id, + unsigned int num_contexts ) +{ + (void) context_id; + (void) num_contexts; + +#ifdef CHROMIUM_THREADSAFE + crInitMutex(&feedback_spu.mutex); +#endif + + feedback_spu.id = id; + feedback_spu.has_child = 0; + if (child) + { + crSPUInitDispatchTable( &(feedback_spu.child) ); + crSPUCopyDispatchTable( &(feedback_spu.child), &(child->dispatch_table) ); + feedback_spu.has_child = 1; + } + crSPUInitDispatchTable( &(feedback_spu.super) ); + crSPUCopyDispatchTable( &(feedback_spu.super), &(self->superSPU->dispatch_table) ); + feedbackspuGatherConfiguration(); + + /* create/init default state tracker */ + crStateInit(); + + feedback_spu.defaultctx = crStateCreateContext(NULL, 0, NULL); + crStateSetCurrent(feedback_spu.defaultctx); + + feedback_spu.numContexts = 0; + crMemZero(feedback_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo)); + + return &feedback_functions; +} + +static void feedbackSPUSelfDispatch(SPUDispatchTable *self) +{ + crSPUInitDispatchTable( &(feedback_spu.self) ); + crSPUCopyDispatchTable( &(feedback_spu.self), self ); +} + +static int feedbackSPUCleanup(void) +{ + return 1; +} + +int SPULoad( char **name, char **super, SPUInitFuncPtr *init, + SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup, + SPUOptionsPtr *options, int *flags ) +{ + *name = "feedback"; + *super = "passthrough"; + *init = feedbackSPUInit; + *self = feedbackSPUSelfDispatch; + *cleanup = feedbackSPUCleanup; + *options = feedbackSPUOptions; + *flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO); + + return 1; +} diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py new file mode 100755 index 00000000..92a5c1ce --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu_proto.py @@ -0,0 +1,35 @@ +# Copyright (c) 2001, Stanford University +# All rights reserved. +# +# See the file LICENSE.txt for information on redistributing this software. + +from __future__ import print_function +import sys + +import apiutil + + +apiutil.CopyrightC() + +print(""" +/* DO NOT EDIT - generated by feedback.py */ + +#ifndef FEEDBACKSPU_PROTO_H +#define FEEDBACKSPU_PROTO_H + +#include "feedbackspu.h" + +""") + +keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") + +for func_name in keys: + if apiutil.FindSpecial( "feedback_state", func_name ): + return_type = apiutil.ReturnType(func_name) + params = apiutil.Parameters(func_name) + print('extern %s FEEDBACKSPU_APIENTRY feedbackspu_%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationString(params))) + + +print(""" +#endif +""") diff --git a/src/VBox/Additions/common/crOpenGL/feedback/select_special b/src/VBox/Additions/common/crOpenGL/feedback/select_special new file mode 100644 index 00000000..f35dba0a --- /dev/null +++ b/src/VBox/Additions/common/crOpenGL/feedback/select_special @@ -0,0 +1,56 @@ +Vertex2d +Vertex2dv +Vertex2f +Vertex2fv +Vertex2i +Vertex2iv +Vertex2s +Vertex2sv +Vertex3d +Vertex3dv +Vertex3f +Vertex3fv +Vertex3i +Vertex3iv +Vertex3s +Vertex3sv +Vertex4d +Vertex4dv +Vertex4f +Vertex4fv +Vertex4i +Vertex4iv +Vertex4s +Vertex4sv +Rectf +Recti +Rectd +Rects +Rectiv +Rectfv +Rectdv +Rectsv +RasterPos2d +RasterPos2dv +RasterPos2f +RasterPos2fv +RasterPos2i +RasterPos2iv +RasterPos2s +RasterPos2sv +RasterPos3d +RasterPos3dv +RasterPos3f +RasterPos3fv +RasterPos3i +RasterPos3iv +RasterPos3s +RasterPos3sv +RasterPos4d +RasterPos4dv +RasterPos4f +RasterPos4fv +RasterPos4i +RasterPos4iv +RasterPos4s +RasterPos4sv |