added a call to _mesa_make_current
not yet working but a bit better : GLTeapot display is now white instead of black :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18776 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fe86a04667
commit
1d08e70ac5
@ -9,6 +9,8 @@
|
|||||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
||||||
|
|
||||||
#include "MesaSoftRenderer.h"
|
#include "MesaSoftRenderer.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "array_cache/acache.h"
|
#include "array_cache/acache.h"
|
||||||
@ -156,6 +158,24 @@ MesaSoftRenderer::~MesaSoftRenderer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MesaSoftRenderer::LockGL()
|
||||||
|
{
|
||||||
|
BGLRenderer::LockGL();
|
||||||
|
|
||||||
|
UpdateState(fContext, 0);
|
||||||
|
_mesa_make_current(fContext, fFrameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MesaSoftRenderer::UnlockGL()
|
||||||
|
{
|
||||||
|
|
||||||
|
BGLRenderer::UnlockGL();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MesaSoftRenderer::SwapBuffers(bool VSync = false)
|
MesaSoftRenderer::SwapBuffers(bool VSync = false)
|
||||||
{
|
{
|
||||||
@ -172,6 +192,7 @@ MesaSoftRenderer::SwapBuffers(bool VSync = false)
|
|||||||
void
|
void
|
||||||
MesaSoftRenderer::Draw(BRect updateRect)
|
MesaSoftRenderer::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
if (fBitmap)
|
if (fBitmap)
|
||||||
GLView()->DrawBitmap(fBitmap, updateRect, updateRect);
|
GLView()->DrawBitmap(fBitmap, updateRect, updateRect);
|
||||||
}
|
}
|
||||||
@ -180,6 +201,7 @@ MesaSoftRenderer::Draw(BRect updateRect)
|
|||||||
status_t
|
status_t
|
||||||
MesaSoftRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
|
MesaSoftRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
color_space scs = fBitmap->ColorSpace();
|
color_space scs = fBitmap->ColorSpace();
|
||||||
color_space dcs = bitmap->ColorSpace();
|
color_space dcs = bitmap->ColorSpace();
|
||||||
|
|
||||||
@ -216,6 +238,7 @@ MesaSoftRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
|
|||||||
status_t
|
status_t
|
||||||
MesaSoftRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
|
MesaSoftRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
color_space scs = bitmap->ColorSpace();
|
color_space scs = bitmap->ColorSpace();
|
||||||
color_space dcs = fBitmap->ColorSpace();
|
color_space dcs = fBitmap->ColorSpace();
|
||||||
|
|
||||||
@ -252,6 +275,7 @@ MesaSoftRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
|
|||||||
void
|
void
|
||||||
MesaSoftRenderer::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
MesaSoftRenderer::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
/* poll for window size change and realloc software Z/stencil/etc if needed */
|
/* poll for window size change and realloc software Z/stencil/etc if needed */
|
||||||
_mesa_ResizeBuffersMESA();
|
_mesa_ResizeBuffersMESA();
|
||||||
}
|
}
|
||||||
@ -282,6 +306,8 @@ MesaSoftRenderer::Error(GLcontext *ctx)
|
|||||||
void
|
void
|
||||||
MesaSoftRenderer::ClearIndex(GLcontext *ctx, GLuint index)
|
MesaSoftRenderer::ClearIndex(GLcontext *ctx, GLuint index)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
mr->fClearIndex = index;
|
mr->fClearIndex = index;
|
||||||
}
|
}
|
||||||
@ -290,6 +316,8 @@ MesaSoftRenderer::ClearIndex(GLcontext *ctx, GLuint index)
|
|||||||
void
|
void
|
||||||
MesaSoftRenderer::ClearColor(GLcontext *ctx, const GLfloat color[4])
|
MesaSoftRenderer::ClearColor(GLcontext *ctx, const GLfloat color[4])
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_RCOMP], color[0]);
|
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_RCOMP], color[0]);
|
||||||
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_GCOMP], color[1]);
|
CLAMPED_FLOAT_TO_CHAN(mr->fClearColor[BE_GCOMP], color[1]);
|
||||||
@ -322,6 +350,8 @@ MesaSoftRenderer::ClearFront(GLcontext *ctx,
|
|||||||
GLboolean all, GLint x, GLint y,
|
GLboolean all, GLint x, GLint y,
|
||||||
GLint width, GLint height)
|
GLint width, GLint height)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
BGLView *bglview = mr->GLView();
|
BGLView *bglview = mr->GLView();
|
||||||
assert(bglview);
|
assert(bglview);
|
||||||
@ -367,6 +397,8 @@ MesaSoftRenderer::ClearBack(GLcontext *ctx,
|
|||||||
GLboolean all, GLint x, GLint y,
|
GLboolean all, GLint x, GLint y,
|
||||||
GLint width, GLint height)
|
GLint width, GLint height)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
BGLView *bglview = mr->GLView();
|
BGLView *bglview = mr->GLView();
|
||||||
assert(bglview);
|
assert(bglview);
|
||||||
@ -507,6 +539,8 @@ MesaSoftRenderer::WriteRGBASpanFront(const GLcontext *ctx, GLuint n,
|
|||||||
CONST GLubyte rgba[][4],
|
CONST GLubyte rgba[][4],
|
||||||
const GLubyte mask[])
|
const GLubyte mask[])
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
BGLView *bglview = mr->GLView();
|
BGLView *bglview = mr->GLView();
|
||||||
assert(bglview);
|
assert(bglview);
|
||||||
@ -533,6 +567,8 @@ MesaSoftRenderer::WriteRGBSpanFront(const GLcontext *ctx, GLuint n,
|
|||||||
CONST GLubyte rgba[][3],
|
CONST GLubyte rgba[][3],
|
||||||
const GLubyte mask[])
|
const GLubyte mask[])
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
BGLView *bglview = mr->GLView();
|
BGLView *bglview = mr->GLView();
|
||||||
assert(bglview);
|
assert(bglview);
|
||||||
@ -559,6 +595,8 @@ MesaSoftRenderer::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
|
|||||||
const GLchan color[4],
|
const GLchan color[4],
|
||||||
const GLubyte mask[])
|
const GLubyte mask[])
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
MesaSoftRenderer *mr = (MesaSoftRenderer *) ctx->DriverCtx;
|
||||||
BGLView *bglview = mr->GLView();
|
BGLView *bglview = mr->GLView();
|
||||||
assert(bglview);
|
assert(bglview);
|
||||||
|
@ -25,6 +25,9 @@ public:
|
|||||||
MesaSoftRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
|
MesaSoftRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher);
|
||||||
virtual ~MesaSoftRenderer();
|
virtual ~MesaSoftRenderer();
|
||||||
|
|
||||||
|
virtual void LockGL();
|
||||||
|
virtual void UnlockGL();
|
||||||
|
|
||||||
virtual void SwapBuffers(bool VSync = false);
|
virtual void SwapBuffers(bool VSync = false);
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
virtual status_t CopyPixelsOut(BPoint source, BBitmap *dest);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
BGLRenderer::BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher)
|
BGLRenderer::BGLRenderer(BGLView *view, ulong bgl_options, BGLDispatcher *dispatcher)
|
||||||
: fRefCount(1),
|
: fRefCount(1),
|
||||||
|
fView(view),
|
||||||
fOptions(bgl_options),
|
fOptions(bgl_options),
|
||||||
fDispatcher(dispatcher)
|
fDispatcher(dispatcher)
|
||||||
{
|
{
|
||||||
@ -39,12 +40,15 @@ BGLRenderer::Release()
|
|||||||
void
|
void
|
||||||
BGLRenderer::LockGL()
|
BGLRenderer::LockGL()
|
||||||
{
|
{
|
||||||
|
fView->LockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BGLRenderer::UnlockGL()
|
BGLRenderer::UnlockGL()
|
||||||
{
|
{
|
||||||
|
if (fView->Looper()->IsLocked())
|
||||||
|
fView->UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user