Buffer overhaul phase one

This commit is contained in:
Josh Yelon 2006-03-20 22:04:24 +00:00
parent b82652aaaa
commit b665a3707d
6 changed files with 94 additions and 31 deletions

View File

@ -30,10 +30,12 @@ TypeHandle osxGraphicsBuffer::_type_handle;
// Description:
////////////////////////////////////////////////////////////////////
osxGraphicsBuffer::
osxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
osxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
int x_size, int y_size) :
GraphicsBuffer(pipe, gsg, name, x_size, y_size)
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, x_size, y_size, flags, gsg, host)
{
osxGraphicsPipe *osx_pipe;
DCAST_INTO_V(osx_pipe, _pipe);

View File

@ -34,9 +34,11 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
public:
osxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
osxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
int x_size, int y_size);
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~osxGraphicsBuffer();

View File

@ -109,24 +109,74 @@ make_gsg(const FrameBufferProperties &properties,
}
////////////////////////////////////////////////////////////////////
// Function: osxGraphicsPipe::make_window
// Function: osxGraphicsPipe::make_output
// Access: Protected, Virtual
// Description: Creates a new window on the pipe, if possible.
////////////////////////////////////////////////////////////////////
PT(GraphicsWindow) osxGraphicsPipe::
make_window(GraphicsStateGuardian *gsg, const string &name) {
return new osxGraphicsWindow(this, gsg, name);
PT(GraphicsOutput) osxGraphicsPipe::
make_output(const string &name,
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
bool precertify) {
if (!_is_valid) {
return NULL;
}
osxGraphicsStateGuardian *osxgsg;
DCAST_INTO_R(osxgsg, gsg, NULL);
// First thing to try: a osxGraphicsWindow
if (retry == 0) {
if (((flags&BF_require_parasite)!=0)||
((flags&BF_refuse_window)!=0)||
((flags&BF_need_aux_rgba_MASK)!=0)||
((flags&BF_need_aux_hrgba_MASK)!=0)||
((flags&BF_need_aux_float_MASK)!=0)||
((flags&BF_size_track_host)!=0)||
((flags&BF_can_bind_color)!=0)||
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new osxGraphicsWindow(this, name, x_size, y_size, flags, gsg, host);
}
// // Second thing to try: a glGraphicsBuffer
//
// if (retry == 1) {
// if ((!support_render_texture)||
// ((flags&BF_require_parasite)!=0)||
// ((flags&BF_require_window)!=0)) {
// return NULL;
// }
// if (precertify) {
// if (!osxgsg->_supports_framebuffer_object) {
// return NULL;
// }
// }
// return new glGraphicsBuffer(this, name, x_size, y_size, flags, gsg, host);
// }
// Third thing to try: an osxGraphicsBuffer
if (retry == 2) {
if ((!support_render_texture)||
((flags&BF_require_parasite)!=0)||
((flags&BF_require_window)!=0)||
((flags&BF_need_aux_rgba_MASK)!=0)||
((flags&BF_need_aux_hrgba_MASK)!=0)||
((flags&BF_need_aux_float_MASK)!=0)||
((flags&BF_size_track_host)!=0)||
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new osxGraphicsBuffer(this, name, x_size, y_size, flags, gsg, host);
}
// Nothing else left to try.
return NULL;
}
////////////////////////////////////////////////////////////////////
// Function: osxGraphicsPipe::make_buffer
// Access: Protected, Virtual
// Description: Creates a new offscreen buffer on the pipe, if possible.
////////////////////////////////////////////////////////////////////
PT(GraphicsBuffer) osxGraphicsPipe::
make_buffer(GraphicsStateGuardian *gsg, const string &name,
int x_size, int y_size) {
return new osxGraphicsBuffer(this, gsg, name, x_size, y_size);
}

View File

@ -38,11 +38,13 @@ public:
protected:
virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties,
GraphicsStateGuardian *share_with);
virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg,
const string &name);
virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg,
const string &name,
int x_size, int y_size);
virtual PT(GraphicsOutput) make_output(const string &name,
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
bool precertify);
private:
public:
static TypeHandle get_class_type() {

View File

@ -391,9 +391,13 @@ OSStatus osxGraphicsWindow::handleTextInput (EventHandlerCallRef myHandler, Even
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
osxGraphicsWindow::osxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
const string &name) :
GraphicsWindow(pipe, gsg, name) ,
osxGraphicsWindow::
osxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsWindow(pipe, name, x_size, y_size, flags, gsg, host),
_osx_window(NULL),
_is_fullsreen(false),
#ifdef HACK_SCREEN_HASH_CONTEXT

View File

@ -39,8 +39,11 @@ OSStatus aglReportError (void);
////////////////////////////////////////////////////////////////////
class osxGraphicsWindow : public GraphicsWindow {
public:
osxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
const string &name);
osxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~osxGraphicsWindow();
virtual bool move_pointer(int device, int x, int y);