summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/beos/GLView.cpp61
-rw-r--r--src/mesa/drivers/beos/GLView.h196
2 files changed, 231 insertions, 26 deletions
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
+
+
+
+
+