pass GraphicsEngine to constructors

This commit is contained in:
David Rose 2009-02-25 23:08:10 +00:00
parent 7af1350e4e
commit 62096c99a4
12 changed files with 34 additions and 30 deletions

View File

@ -26,14 +26,14 @@ TypeHandle osxGraphicsBuffer::_type_handle;
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
osxGraphicsBuffer:: osxGraphicsBuffer::
osxGraphicsBuffer(GraphicsPipe *pipe, osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host) : GraphicsOutput *host) :
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host) GraphicsBuffer(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
{ {
osxGraphicsPipe *osx_pipe; osxGraphicsPipe *osx_pipe;
DCAST_INTO_V(osx_pipe, _pipe); DCAST_INTO_V(osx_pipe, _pipe);
@ -142,7 +142,7 @@ bool osxGraphicsBuffer::
open_buffer() { open_buffer() {
if (_gsg == 0) { if (_gsg == 0) {
_gsg = new osxGraphicsStateGuardian(_pipe, NULL); _gsg = new osxGraphicsStateGuardian(_engine, _pipe, NULL);
} }
return false; return false;

View File

@ -30,7 +30,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer { class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
public: public:
osxGraphicsBuffer(GraphicsPipe *pipe, osxGraphicsBuffer(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,

View File

@ -207,6 +207,7 @@ make_output(const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsEngine *engine,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host, GraphicsOutput *host,
int retry, int retry,
@ -232,7 +233,7 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) { ((flags&BF_can_bind_every)!=0)) {
return NULL; return NULL;
} }
return new osxGraphicsWindow(this, name, fb_prop, win_prop, return new osxGraphicsWindow(engine, this, name, fb_prop, win_prop,
flags, gsg, host); flags, gsg, host);
} }

View File

@ -45,6 +45,7 @@ protected:
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsEngine *engine,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host, GraphicsOutput *host,
int retry, int retry,

View File

@ -61,9 +61,9 @@ void *osxGraphicsStateGuardian::get_extension_func(const char *prefix, const cha
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
osxGraphicsStateGuardian:: osxGraphicsStateGuardian::
osxGraphicsStateGuardian(GraphicsPipe *pipe, osxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
osxGraphicsStateGuardian *share_with) : osxGraphicsStateGuardian *share_with) :
GLGraphicsStateGuardian(pipe), GLGraphicsStateGuardian(engine, pipe),
_share_with(share_with), _share_with(share_with),
_aglPixFmt(NULL), _aglPixFmt(NULL),
_aglcontext(NULL) _aglcontext(NULL)

View File

@ -33,7 +33,7 @@ class osxGraphicsWindow;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class osxGraphicsStateGuardian : public GLGraphicsStateGuardian { class osxGraphicsStateGuardian : public GLGraphicsStateGuardian {
public: public:
osxGraphicsStateGuardian(GraphicsPipe *pipe, osxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
osxGraphicsStateGuardian *share_with); osxGraphicsStateGuardian *share_with);
virtual ~osxGraphicsStateGuardian(); virtual ~osxGraphicsStateGuardian();
virtual void reset(); virtual void reset();

View File

@ -33,7 +33,7 @@ OSStatus aglReportError (const std::string &);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class osxGraphicsWindow : public GraphicsWindow { class osxGraphicsWindow : public GraphicsWindow {
public: public:
osxGraphicsWindow(GraphicsPipe *pipe, osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,

View File

@ -600,14 +600,14 @@ static int id_seed = 100;
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
osxGraphicsWindow::osxGraphicsWindow(GraphicsPipe *pipe, osxGraphicsWindow::osxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host) : GraphicsOutput *host) :
GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host), GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host),
_osx_window(NULL), _osx_window(NULL),
_is_fullscreen(false), _is_fullscreen(false),
_pending_icon(NULL), _pending_icon(NULL),
@ -1020,7 +1020,7 @@ bool osxGraphicsWindow::open_window()
if (_gsg == 0) if (_gsg == 0)
{ {
_gsg = new osxGraphicsStateGuardian(_pipe, NULL); _gsg = new osxGraphicsStateGuardian(_engine, _pipe, NULL);
} }
//OSXGloablMutex().lock(); //OSXGloablMutex().lock();

View File

@ -200,6 +200,7 @@ make_output(const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsEngine *engine,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host, GraphicsOutput *host,
int retry, int retry,
@ -233,7 +234,7 @@ make_output(const string &name,
return NULL; return NULL;
} }
} }
return new TinyOsxGraphicsWindow(this, name, fb_prop, win_prop, return new TinyOsxGraphicsWindow(engine, this, name, fb_prop, win_prop,
flags, gsg, host); flags, gsg, host);
} }
@ -243,7 +244,7 @@ make_output(const string &name,
((flags&BF_require_window)!=0)) { ((flags&BF_require_window)!=0)) {
return NULL; return NULL;
} }
return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host); return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
} }
// Nothing else left to try. // Nothing else left to try.

View File

@ -50,6 +50,7 @@ protected:
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsEngine *engine,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host, GraphicsOutput *host,
int retry, int retry,

View File

@ -32,7 +32,7 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
class TinyOsxGraphicsWindow : public GraphicsWindow { class TinyOsxGraphicsWindow : public GraphicsWindow {
public: public:
TinyOsxGraphicsWindow(GraphicsPipe *pipe, TinyOsxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,

View File

@ -480,14 +480,14 @@ static int id_seed = 100;
// Access: Public // Access: Public
// Description: // Description:
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
TinyOsxGraphicsWindow::TinyOsxGraphicsWindow(GraphicsPipe *pipe, TinyOsxGraphicsWindow::TinyOsxGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
const string &name, const string &name,
const FrameBufferProperties &fb_prop, const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, const WindowProperties &win_prop,
int flags, int flags,
GraphicsStateGuardian *gsg, GraphicsStateGuardian *gsg,
GraphicsOutput *host) : GraphicsOutput *host) :
GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host), GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host),
_osx_window(NULL), _osx_window(NULL),
_is_fullscreen(false), _is_fullscreen(false),
_pending_icon(NULL), _pending_icon(NULL),
@ -801,7 +801,7 @@ bool TinyOsxGraphicsWindow::open_window()
TinyGraphicsStateGuardian *tinygsg; TinyGraphicsStateGuardian *tinygsg;
if (_gsg == 0) { if (_gsg == 0) {
// There is no old gsg. Create a new one. // There is no old gsg. Create a new one.
tinygsg = new TinyGraphicsStateGuardian(_pipe, NULL); tinygsg = new TinyGraphicsStateGuardian(_engine, _pipe, NULL);
_gsg = tinygsg; _gsg = tinygsg;
} else { } else {
DCAST_INTO_R(tinygsg, _gsg, false); DCAST_INTO_R(tinygsg, _gsg, false);