diff options
-rw-r--r-- | docs/README.BEOS | 26 | ||||
-rw-r--r-- | src/glut/beos/Makefile | 37 | ||||
-rw-r--r-- | src/mesa/Makefile.BeOS | 303 | ||||
-rw-r--r-- | src/mesa/drivers/beos/GLView.cpp | 61 | ||||
-rw-r--r-- | src/mesa/drivers/beos/GLView.h | 196 |
5 files changed, 577 insertions, 46 deletions
diff --git a/docs/README.BEOS b/docs/README.BEOS index 6d1e1f0e41b..c08d6d864fd 100644 --- a/docs/README.BEOS +++ b/docs/README.BEOS @@ -5,10 +5,11 @@ * Introduction -Mesa 4.1 features a driver for the BeOS. The driver implements -a clone of the BGLView class. This class, derived from BView, allows -OpenGL rendering into a BeOS window. -The 4.1 BeOS driver is an update of Brian Paul's BeOS driver released in Mesa 3.1. +Brian Paul added in Mesa 3.1 a driver for BeOS R4.5 operating system. +This driver implements a clone of the BGLView class. This class, derived from BView, allows +OpenGL rendering into any BeOS window. +His driver was updated in Mesa 4.1 by Philippe Houdoin, +who's maintaining this driver since. Any application which uses the BGLView should be able to use Mesa instead of Be's OpenGL without changing any code. @@ -18,10 +19,9 @@ SGI sample implementation, it's pretty slow. You'll see that Mesa is considerably faster. - * Source Code -The source code for the driver is in Mesa-4.1/src/BeOS/ directory. +The source code for the driver is in src/mesa/drivers/beos/ directory. It's not 100% finished at this time but many GLUT-based demos are working. No optimizations have been made at this time. @@ -33,22 +33,22 @@ Requirements: - gcc version 2.95.3 for BeOS You can find it here: http://www.bebits.com/app/2157 -Move to the Mesa-4.x src sub-directory and then type "make -f Makefile.BeOS-R5". +Move to the src/mesa sub-directory and then type "make -f Makefile.BeOS". When it finishes the Mesa based libGL.so library for -BeOS will be in the Mesa-4.x/src/obj.{x86|ppc}/ directory. +BeOS will be in the src/mesa/src/obj.{x86|ppc}/ directory. To install it as Be's default libGL.so replacement, put it in your -/boot/home/config/lib/ directory. All your GL/GLUTapps will use +/boot/home/config/lib/ directory. All your GL/GLUT apps will use the Mesa based then. By default, it build a non-debug version library. The x86 (MMX, SSE and 3DNOW) optimizations are also supported for x86 target. -Sorry, Mesa don't have ppc (Altivec) optimizations yet. +For PowerPC BeOS flavor, sorry, Mesa don't have ppc (Altivec) optimizations yet. * Example Programs -Look in the Mesa-4.x/BeOS/ directory for one or two BGLView demo +Look in the progs/beos/ directory for one or two BGLView demo programs. They should have been compiled along with the Mesa library. @@ -106,9 +106,9 @@ Mesa 3.0 supported the 3Dfx/Glide library on Beos. Download Mesa 3.0 if interested. Ideally, the 3Dfx/Glide support should be updated to work with the new Mesa 3.1 BGLView implementation. -The Glide library hasn't been updated for BeOS R4, to my knowledge, as +The Glide library hasn't been updated for BeOS R4 and newer, to my knowledge, as of February, 1999. ---------------------------------------------------------------------- -$Id: README.BEOS,v 1.7 2002/09/19 16:19:44 brianp Exp $ +$Id: README.BEOS,v 1.8 2003/12/13 01:26:14 brianp Exp $ diff --git a/src/glut/beos/Makefile b/src/glut/beos/Makefile index 5ce53541916..1c740d0aa67 100644 --- a/src/glut/beos/Makefile +++ b/src/glut/beos/Makefile @@ -26,12 +26,35 @@ TYPE= SHARED # if two source files with the same name (source.c or source.cpp) # are included from different directories. Also note that spaces # in folder names do not work well with this makefile. -SRCS= glut_util.cpp glutBlocker.cpp glutInit.cpp glutWindow.cpp \ -glutEvent.cpp glutCallback.cpp glutOverlay.cpp glutGet.cpp glutColor.cpp \ -glutCursor.cpp glutMenu.cpp glutDstr.cpp glut_bitmap.cpp glut_bwidth.cpp \ -glut_8x13.cpp glut_9x15.cpp glut_hel10.cpp glut_hel12.cpp glut_hel18.cpp \ -glut_tr10.cpp glut_tr24.cpp glut_mroman.cpp glut_roman.cpp glut_stroke.cpp \ -glut_swidth.cpp glut_shapes.cpp glut_teapot.cpp beos_x11.cpp +SRCS= \ + glut_util.cpp \ + glutBlocker.cpp \ + glutInit.cpp \ + glutWindow.cpp \ + glutEvent.cpp \ + glutCallback.cpp \ + glutOverlay.cpp \ + glutGet.cpp \ + glutColor.cpp \ + glutCursor.cpp \ + glutMenu.cpp \ + glutDstr.cpp \ + glut_bitmap.cpp \ + glut_bwidth.cpp \ + glut_8x13.cpp \ + glut_9x15.cpp \ + glut_hel10.cpp \ + glut_hel12.cpp \ + glut_hel18.cpp \ + glut_tr10.cpp \ + glut_tr24.cpp \ + glut_mroman.cpp \ + glut_roman.cpp \ + glut_stroke.cpp \ + glut_swidth.cpp \ + glut_shapes.cpp \ + glut_teapot.cpp \ + beos_x11.cpp # specify the resource files to use # full path or a relative path to the resource file can be used. @@ -60,7 +83,7 @@ LIBPATHS= ../lib # additional paths to look for system headers # thes use the form: #include <header> # source file directories are NOT auto-included here -SYSTEM_INCLUDE_PATHS = ../../include /boot/develop/headers/be/opengl +SYSTEM_INCLUDE_PATHS = ../../../include /boot/develop/headers/be/opengl # additional paths to look for local headers # thes use the form: #include "header" diff --git a/src/mesa/Makefile.BeOS b/src/mesa/Makefile.BeOS new file mode 100644 index 00000000000..d1ebaee2207 --- /dev/null +++ b/src/mesa/Makefile.BeOS @@ -0,0 +1,303 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1995-2003 Brian Paul 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, sublicense, +# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL 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. +# +# BeOS driver makefile v1.0 for Mesa 5.1.x +# +# Copyright (C) 2002-2003 - Philippe Houdoin +# Email : [email protected] +# Web : http://philippe.houdoin.free.fr/phil/beos/index-en.html +# +# ------------------------------------------------------------------- + +## BeOS Generic Makefile v2.0 ## + +## Fill in this file to specify the project being created, and the referenced +## makefile-engine will do all of the hard work for you. This handles both +## Intel and PowerPC builds of the BeOS. + +## Application Specific Settings --------------------------------------------- + +# specify the name of the binary +NAME= libGL.so + +# specify the type of binary +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel Driver +TYPE= SHARED + +# specify the source files to use +# full paths or paths relative to the makefile can be included +# all files, regardless of directory, will have their object +# files created in the common object directory. +# Note that this means this makefile will not work correctly +# if two source files with the same name (source.c or source.cpp) +# are included from different directories. Also note that spaces +# in folder names do not work well with this makefile. + + +include sources + + +BEOS_DRIVER_SOURCES = \ + drivers/beos/GLView.cpp + +MESA_DEFINES = +ASM_SOURCES = + +# To use GAS assembler, uncomment this line instead: +MESA_DEFINES += GNU_ASSEMBLER +# To use NASM assembler, uncomment this line instead: +# MESA_DEFINES += NASM_ASSEMBLER +# To build a DEBUG version of Mesa, uncomment this line instead: +# MESA_DEFINES += DEBUG + +# x86-optimized code +MACHINE=$(shell uname -m) +ifeq ($(MACHINE), BePC) + MESA_DEFINES += USE_X86_ASM USE_SSE_ASM USE_MMX_ASM + MESA_DEFINES += USE_3DNOW_ASM + ASM_SOURCES = $(X86_SOURCES) +else + # No assembly optimization for PowerPC... + # HAVE_ALTIVEC=1 +endif + +# FIXME: SI-GLU version support currently broken +# USE_SI_GLU=1 +ifdef USE_SI_GLU + GLU_SOURCES = \ + ../si-glu/libutil/error.c \ + ../si-glu/libutil/glue.c \ + ../si-glu/libutil/mipmap.c \ + ../si-glu/libutil/project.c \ + ../si-glu/libutil/quad.c \ + ../si-glu/libutil/registry.c \ + ../si-glu/libtess/dict.c \ + ../si-glu/libtess/geom.c \ + ../si-glu/libtess/memalloc.c \ + ../si-glu/libtess/mesh.c \ + ../si-glu/libtess/normal.c \ + ../si-glu/libtess/priorityq.c \ + ../si-glu/libtess/render.c \ + ../si-glu/libtess/sweep.c \ + ../si-glu/libtess/tess.c \ + ../si-glu/libtess/tessmono.c \ + ../si-glu/libnurbs/interface/bezierEval.cc \ + ../si-glu/libnurbs/interface/bezierPatch.cc \ + ../si-glu/libnurbs/interface/bezierPatchMesh.cc \ + ../si-glu/libnurbs/interface/glcurveval.cc \ + ../si-glu/libnurbs/interface/glinterface.cc \ + ../si-glu/libnurbs/interface/glrenderer.cc \ + ../si-glu/libnurbs/interface/glsurfeval.cc \ + ../si-glu/libnurbs/interface/incurveeval.cc \ + ../si-glu/libnurbs/interface/insurfeval.cc \ + ../si-glu/libnurbs/internals/arc.cc \ + ../si-glu/libnurbs/internals/arcsorter.cc \ + ../si-glu/libnurbs/internals/arctess.cc \ + ../si-glu/libnurbs/internals/backend.cc \ + ../si-glu/libnurbs/internals/basiccrveval.cc \ + ../si-glu/libnurbs/internals/basicsurfeval.cc \ + ../si-glu/libnurbs/internals/bin.cc \ + ../si-glu/libnurbs/internals/bufpool.cc \ + ../si-glu/libnurbs/internals/cachingeval.cc \ + ../si-glu/libnurbs/internals/ccw.cc \ + ../si-glu/libnurbs/internals/coveandtiler.cc \ + ../si-glu/libnurbs/internals/curve.cc \ + ../si-glu/libnurbs/internals/curvelist.cc \ + ../si-glu/libnurbs/internals/curvesub.cc \ + ../si-glu/libnurbs/internals/dataTransform.cc \ + ../si-glu/libnurbs/internals/displaylist.cc \ + ../si-glu/libnurbs/internals/flist.cc \ + ../si-glu/libnurbs/internals/flistsorter.cc \ + ../si-glu/libnurbs/internals/hull.cc \ + ../si-glu/libnurbs/internals/intersect.cc \ + ../si-glu/libnurbs/internals/knotvector.cc \ + ../si-glu/libnurbs/internals/mapdesc.cc \ + ../si-glu/libnurbs/internals/mapdescv.cc \ + ../si-glu/libnurbs/internals/maplist.cc \ + ../si-glu/libnurbs/internals/mesher.cc \ + ../si-glu/libnurbs/internals/monoTriangulationBackend.cc \ + ../si-glu/libnurbs/internals/monotonizer.cc \ + ../si-glu/libnurbs/internals/mycode.cc \ + ../si-glu/libnurbs/internals/nurbsinterfac.cc \ + ../si-glu/libnurbs/internals/nurbstess.cc \ + ../si-glu/libnurbs/internals/patch.cc \ + ../si-glu/libnurbs/internals/patchlist.cc \ + ../si-glu/libnurbs/internals/quilt.cc \ + ../si-glu/libnurbs/internals/reader.cc \ + ../si-glu/libnurbs/internals/renderhints.cc \ + ../si-glu/libnurbs/internals/slicer.cc \ + ../si-glu/libnurbs/internals/sorter.cc \ + ../si-glu/libnurbs/internals/splitarcs.cc \ + ../si-glu/libnurbs/internals/subdivider.cc \ + ../si-glu/libnurbs/internals/tobezier.cc \ + ../si-glu/libnurbs/internals/trimline.cc \ + ../si-glu/libnurbs/internals/trimregion.cc \ + ../si-glu/libnurbs/internals/trimvertpool.cc \ + ../si-glu/libnurbs/internals/uarray.cc \ + ../si-glu/libnurbs/internals/varray.cc \ + ../si-glu/libnurbs/nurbtess/directedLine.cc \ + ../si-glu/libnurbs/nurbtess/gridWrap.cc \ + ../si-glu/libnurbs/nurbtess/monoChain.cc \ + ../si-glu/libnurbs/nurbtess/monoPolyPart.cc \ + ../si-glu/libnurbs/nurbtess/monoTriangulation.cc \ + ../si-glu/libnurbs/nurbtess/partitionX.cc \ + ../si-glu/libnurbs/nurbtess/partitionY.cc \ + ../si-glu/libnurbs/nurbtess/polyDBG.cc \ + ../si-glu/libnurbs/nurbtess/polyUtil.cc \ + ../si-glu/libnurbs/nurbtess/primitiveStream.cc \ + ../si-glu/libnurbs/nurbtess/quicksort.cc \ + ../si-glu/libnurbs/nurbtess/rectBlock.cc \ + ../si-glu/libnurbs/nurbtess/sampleComp.cc \ + ../si-glu/libnurbs/nurbtess/sampleCompBot.cc \ + ../si-glu/libnurbs/nurbtess/sampleCompRight.cc \ + ../si-glu/libnurbs/nurbtess/sampleCompTop.cc \ + ../si-glu/libnurbs/nurbtess/sampleMonoPoly.cc \ + ../si-glu/libnurbs/nurbtess/sampledLine.cc \ + ../si-glu/libnurbs/nurbtess/searchTree.cc +else + GLU_SOURCES = \ + ../glu/mesa/glu.c \ + ../glu/mesa/mipmap.c \ + ../glu/mesa/project.c \ + ../glu/mesa/quadric.c \ + ../glu/mesa/tess.c \ + ../glu/mesa/tesselat.c \ + ../glu/mesa/polytest.c \ + ../glu/mesa/nurbs.c \ + ../glu/mesa/nurbscrv.c \ + ../glu/mesa/nurbssrf.c \ + ../glu/mesa/nurbsutl.c +endif + +MESA_SOURCES = $(CORE_SOURCES) $(ASM_SOURCES) + +SRCS = $(MESA_SOURCES) $(GLU_SOURCES) $(BEOS_DRIVER_SOURCES) + +# specify the resource files to use +# full path or a relative path to the resource file can be used. +RSRCS = + +# specify additional libraries to link against +# there are two acceptable forms of library specifications +# - if your library follows the naming pattern of: +# libXXX.so or libXXX.a you can simply specify XXX +# library: libbe.so entry: be +# +# - if your library does not follow the standard library +# naming scheme you need to specify the path to the library +# and it's name +# library: my_lib.a entry: my_lib.a or path/my_lib.a +LIBS = be + +# specify additional paths to directories following the standard +# libXXX.so or libXXX.a naming scheme. You can specify full paths +# or paths relative to the makefile. The paths included may not +# be recursive, so include all of the paths where libraries can +# be found. Directories where source files are found are +# automatically included. +LIBPATHS = + +# additional paths to look for system headers +# thes use the form: #include <header> +# source file directories are NOT auto-included here +SYSTEM_INCLUDE_PATHS = ../../include + +ifdef USE_SI_GLU + SYSTEM_INCLUDE_PATHS += ../glu/sgi/include +endif + +# additional paths to look for local headers +# thes use the form: #include "header" +# source file directories are automatically included +LOCAL_INCLUDE_PATHS = \ + . \ + ./main \ + ./glapi \ + ./math \ + ./transform \ + ./swrast \ + ./swrast_setup \ + ./tnl \ + ./tnl_dd + +# specify the level of optimization that you desire +# NONE, SOME, FULL +OPTIMIZE = FULL + +# specify any preprocessor symbols to be defined. The symbols +# will be set to a value of 1. For example specify DEBUG if you want +# DEBUG=1 to be set when compiling. +DEFINES = $(MESA_DEFINES) + +# specify special warning levels +# if unspecified default warnings will be used +# NONE = suppress all warnings +# ALL = enable all warnings +WARNINGS = ALL + +# specify whether image symbols will be created +# so that stack crawls in the debugger are meaningful +# if TRUE symbols will be created +SYMBOLS = TRUE + +# specify debug settings +# if TRUE will allow application to be run from +# a source-level debugger +# DEBUGGER = TRUE +DEBUGGER = FALSE + +# specify additional compiler flags for all files +COMPILER_FLAGS = + +# specify additional linker flags +LINKER_FLAGS = + + + +## include the makefile-engine +include /boot/develop/etc/makefile-engine + + + +# x86/matypes.h include file is *generated*! +# Rules to (re)generate it as needed: + +x86/common_x86_asm.S : x86/matypes.h + +x86/matypes.h : x86/gen_matypes.c + @echo "(Re-)Generating $@ ..." + $(CC) $< $(INCLUDES) $(CFLAGS) -o x86/gen_matypes + x86/gen_matypes > $@ + rm -f x86/gen_matypes + +## Add NASM support for assembly code compilation... +# $(OBJ_DIR)/%.o : %.nasm +# nasm -f elf $(MESA_DEFINES) -o $@ $< + +$(OBJ_DIR)/%.o : %.S + gcc -c $< $(INCLUDES) $(CFLAGS) -o $@ +# gcc $(INCLUDES) $(CFLAGS) -E $< | grep -v '^$$' > $(addsuffix .nasm, $(basename $<)) +# nasm -f elf $(MESA_DEFINES) -o $@ $(addsuffix .nasm, $(basename $<)) + diff --git a/src/mesa/drivers/beos/GLView.cpp b/src/mesa/drivers/beos/GLView.cpp index b6b85159a20..0c24b0f29f3 100644 --- a/src/mesa/drivers/beos/GLView.cpp +++ b/src/mesa/drivers/beos/GLView.cpp @@ -1,4 +1,4 @@ -/* $Id: GLView.cpp,v 1.9 2003/03/30 15:49:01 brianp Exp $ */ +/* $Id: GLView.cpp,v 1.10 2003/12/13 01:26:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,22 +25,24 @@ */ -#include "glheader.h" - #include <assert.h> #include <stdio.h> extern "C" { +#include "glheader.h" +#include "buffers.h" +#include "bufferobj.h" #include "context.h" #include "colormac.h" #include "depth.h" #include "extensions.h" #include "macros.h" #include "matrix.h" -#include "mmath.h" #include "mtypes.h" #include "texformat.h" +#include "texobj.h" +#include "teximage.h" #include "texstore.h" #include "array_cache/acache.h" #include "swrast/swrast.h" @@ -56,7 +58,7 @@ extern "C" { } // extern "C" -#include <GLView.h> +#include "GLView.h" // BeOS component ordering for B_RGBA32 bitmap format #define BE_RCOMP 2 @@ -277,6 +279,17 @@ BGLView::BGLView(BRect rect, char *name, // create core context GLcontext * ctx = _mesa_create_context(visual, NULL, md, GL_FALSE); + ctx->Driver.NewTextureObject = _mesa_new_texture_object; + ctx->Driver.DeleteTexture = _mesa_delete_texture_object; + + _mesa_initialize_context(ctx, visual, NULL, md, GL_FALSE); + + _mesa_enable_sw_extensions(ctx); + _mesa_enable_1_3_extensions(ctx); + _mesa_enable_1_4_extensions(ctx); + _mesa_enable_1_5_extensions(ctx); + + // create core framebuffer GLframebuffer * buffer = _mesa_create_framebuffer(visual, @@ -286,10 +299,6 @@ BGLView::BGLView(BRect rect, char *name, alphaFlag ); - _mesa_enable_sw_extensions(ctx); - _mesa_enable_1_3_extensions(ctx); - _mesa_enable_1_4_extensions(ctx); - /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); @@ -578,19 +587,23 @@ void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLf assert(md->m_glcontext == ctx ); + // Use default TCL pipeline + tnl->Driver.RunPipeline = _tnl_run_pipeline; + ctx->Driver.GetString = MesaDriver::GetString; ctx->Driver.UpdateState = MesaDriver::UpdateState; - ctx->Driver.GetBufferSize = MesaDriver::GetBufferSize; ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; + ctx->Driver.GetBufferSize = MesaDriver::GetBufferSize; ctx->Driver.Accum = _swrast_Accum; ctx->Driver.Bitmap = _swrast_Bitmap; - ctx->Driver.ClearIndex = MesaDriver::ClearIndex; - ctx->Driver.ClearColor = MesaDriver::ClearColor; ctx->Driver.Clear = MesaDriver::Clear; + // ctx->Driver.ClearIndex = MesaDriver::ClearIndex; + // ctx->Driver.ClearColor = MesaDriver::ClearColor; ctx->Driver.CopyPixels = _swrast_CopyPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.ReadPixels = _swrast_ReadPixels; + ctx->Driver.DrawBuffer = _swrast_DrawBuffer; ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format; ctx->Driver.TexImage1D = _mesa_store_teximage1d; @@ -601,7 +614,14 @@ void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLf ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; + ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; + ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; + ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; + ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; @@ -610,19 +630,8 @@ void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLf ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; - - ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; - ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; - ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; - ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; - ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; - ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; - + swdd->SetBuffer = MesaDriver::SetBuffer; - - tnl->Driver.RunPipeline = _tnl_run_pipeline; - - _swsetup_Wakeup(ctx); } @@ -898,7 +907,7 @@ const GLubyte *MesaDriver::GetString(GLcontext *ctx, GLenum name) // Plot a pixel. (0,0) is upper-left corner // This is only used when drawing to the front buffer. -static void Plot(BGLView *bglview, int x, int y) +inline void Plot(BGLView *bglview, int x, int y) { // XXX There's got to be a better way! BPoint p(x, y), q(x+1, y); diff --git a/src/mesa/drivers/beos/GLView.h b/src/mesa/drivers/beos/GLView.h new file mode 100644 index 00000000000..595000bb56c --- /dev/null +++ b/src/mesa/drivers/beos/GLView.h @@ -0,0 +1,196 @@ +/******************************************************************************* +/ +/ File: GLView.h +/ +/ Copyright 1993-98, Be Incorporated, All Rights Reserved. +/ +*******************************************************************************/ + +#ifndef BGLVIEW_H +#define BGLVIEW_H + +// added by Brian Paul: +#ifndef BGL_RGB +#define BGL_RGB 0 +#define BGL_INDEX 1 +#define BGL_SINGLE 0 +#define BGL_DOUBLE 2 +#define BGL_DIRECT 0 +#define BGL_INDIRECT 4 +#define BGL_ACCUM 8 +#define BGL_ALPHA 16 +#define BGL_DEPTH 32 +#define BGL_OVERLAY 64 +#define BGL_UNDERLAY 128 +#define BGL_STENCIL 512 +#endif + + +#include <GL/gl.h> +#include <AppKit.h> +#include <interface/Window.h> +#include <interface/View.h> +#include <interface/Bitmap.h> +#include <game/WindowScreen.h> +#include <game/DirectWindow.h> + +class BGLView : public BView { +public: + + BGLView(BRect rect, char *name, + ulong resizingMode, ulong mode, + ulong options); + virtual ~BGLView(); + + void LockGL(); + void UnlockGL(); + void SwapBuffers(); + + // Added for Mesa (can't be virtual!) + void CopySubBufferMESA(GLint x, GLint y, GLuint width, GLuint height); + + BView * EmbeddedView(); + status_t CopyPixelsOut(BPoint source, BBitmap *dest); + status_t CopyPixelsIn(BBitmap *source, BPoint dest); + + virtual void ErrorCallback(unsigned long errorCode); // GLenum errorCode); + + virtual void Draw(BRect updateRect); + + virtual void AttachedToWindow(); + virtual void AllAttached(); + virtual void DetachedFromWindow(); + virtual void AllDetached(); + + virtual void FrameResized(float width, float height); + virtual status_t Perform(perform_code d, void *arg); + + /* The public methods below, for the moment, + are just pass-throughs to BView */ + + virtual status_t Archive(BMessage *data, bool deep = true) const; + + virtual void MessageReceived(BMessage *msg); + virtual void SetResizingMode(uint32 mode); + + virtual void Show(); + virtual void Hide(); + + virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index, + BMessage *specifier, int32 form, + const char *property); + virtual status_t GetSupportedSuites(BMessage *data); + + /* New public functions */ + void DirectConnected( direct_buffer_info *info ); + void EnableDirectMode( bool enabled ); + +private: + + virtual void _ReservedGLView1(); + virtual void _ReservedGLView2(); + virtual void _ReservedGLView3(); + virtual void _ReservedGLView4(); + virtual void _ReservedGLView5(); + virtual void _ReservedGLView6(); + virtual void _ReservedGLView7(); + virtual void _ReservedGLView8(); + + BGLView(const BGLView &); + BGLView &operator=(const BGLView &); + + void dither_front(); + bool confirm_dither(); + void draw(BRect r); + + void * m_gc; + uint32 m_options; + uint32 m_ditherCount; + BLocker m_drawLock; + BLocker m_displayLock; +#if OLD_GLVIEW + BView * m_embeddedFront; + BView * m_embeddedBack; +#else + void * m_clip_info; + void * _reserved1; +#endif + BBitmap * m_ditherMap; + BRect m_bounds; + int16 * m_errorBuffer[2]; + uint64 _reserved[8]; + + /* Direct Window stuff */ +private: + void drawScanline( int x1, int x2, int y, void *data ); + static void scanlineHandler(struct rasStateRec *state, GLint x1, GLint x2); + void lock_draw(); + void unlock_draw(); + bool validateView(); +}; + + + +class BGLScreen : public BWindowScreen { +public: + BGLScreen(char *name, + ulong screenMode, ulong options, + status_t *error, bool debug=false); + ~BGLScreen(); + + void LockGL(); + void UnlockGL(); + void SwapBuffers(); + virtual void ErrorCallback(GLenum errorCode); + + virtual void ScreenConnected(bool connected); + virtual void FrameResized(float width, float height); + virtual status_t Perform(perform_code d, void *arg); + + /* The public methods below, for the moment, + are just pass-throughs to BWindowScreen */ + + virtual status_t Archive(BMessage *data, bool deep = true) const; + virtual void MessageReceived(BMessage *msg); + + virtual void Show(); + virtual void Hide(); + + virtual BHandler *ResolveSpecifier(BMessage *msg, + int32 index, + BMessage *specifier, + int32 form, + const char *property); + virtual status_t GetSupportedSuites(BMessage *data); + +private: + + virtual void _ReservedGLScreen1(); + virtual void _ReservedGLScreen2(); + virtual void _ReservedGLScreen3(); + virtual void _ReservedGLScreen4(); + virtual void _ReservedGLScreen5(); + virtual void _ReservedGLScreen6(); + virtual void _ReservedGLScreen7(); + virtual void _ReservedGLScreen8(); + + BGLScreen(const BGLScreen &); + BGLScreen &operator=(const BGLScreen &); + + void * m_gc; + long m_options; + BLocker m_drawLock; + + int32 m_colorSpace; + uint32 m_screen_mode; + + uint64 _reserved[7]; +}; + + +#endif + + + + + |