mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Buffer overhaul phase one
This commit is contained in:
parent
b82652aaaa
commit
b665a3707d
@ -30,10 +30,12 @@ TypeHandle osxGraphicsBuffer::_type_handle;
|
|||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
osxGraphicsBuffer::
|
osxGraphicsBuffer::
|
||||||
osxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
osxGraphicsBuffer(GraphicsPipe *pipe,
|
||||||
const string &name,
|
const string &name,
|
||||||
int x_size, int y_size) :
|
int x_size, int y_size, int flags,
|
||||||
GraphicsBuffer(pipe, gsg, name, x_size, y_size)
|
GraphicsStateGuardian *gsg,
|
||||||
|
GraphicsOutput *host) :
|
||||||
|
GraphicsBuffer(pipe, name, x_size, y_size, flags, gsg, host)
|
||||||
{
|
{
|
||||||
osxGraphicsPipe *osx_pipe;
|
osxGraphicsPipe *osx_pipe;
|
||||||
DCAST_INTO_V(osx_pipe, _pipe);
|
DCAST_INTO_V(osx_pipe, _pipe);
|
||||||
|
@ -34,9 +34,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
|
class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
|
||||||
public:
|
public:
|
||||||
osxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
osxGraphicsBuffer(GraphicsPipe *pipe,
|
||||||
const string &name,
|
const string &name,
|
||||||
int x_size, int y_size);
|
int x_size, int y_size, int flags,
|
||||||
|
GraphicsStateGuardian *gsg,
|
||||||
|
GraphicsOutput *host);
|
||||||
virtual ~osxGraphicsBuffer();
|
virtual ~osxGraphicsBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,24 +109,74 @@ make_gsg(const FrameBufferProperties &properties,
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: osxGraphicsPipe::make_window
|
// Function: osxGraphicsPipe::make_output
|
||||||
// Access: Protected, Virtual
|
// Access: Protected, Virtual
|
||||||
// Description: Creates a new window on the pipe, if possible.
|
// Description: Creates a new window on the pipe, if possible.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PT(GraphicsWindow) osxGraphicsPipe::
|
PT(GraphicsOutput) osxGraphicsPipe::
|
||||||
make_window(GraphicsStateGuardian *gsg, const string &name) {
|
make_output(const string &name,
|
||||||
return new osxGraphicsWindow(this, gsg, 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,11 +38,13 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties,
|
virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties,
|
||||||
GraphicsStateGuardian *share_with);
|
GraphicsStateGuardian *share_with);
|
||||||
virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg,
|
virtual PT(GraphicsOutput) make_output(const string &name,
|
||||||
const string &name);
|
int x_size, int y_size, int flags,
|
||||||
virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg,
|
GraphicsStateGuardian *gsg,
|
||||||
const string &name,
|
GraphicsOutput *host,
|
||||||
int x_size, int y_size);
|
int retry,
|
||||||
|
bool precertify);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
@ -391,9 +391,13 @@ OSStatus osxGraphicsWindow::handleTextInput (EventHandlerCallRef myHandler, Even
|
|||||||
// Access: Public
|
// Access: Public
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
osxGraphicsWindow::osxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
osxGraphicsWindow::
|
||||||
const string &name) :
|
osxGraphicsWindow(GraphicsPipe *pipe,
|
||||||
GraphicsWindow(pipe, gsg, name) ,
|
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),
|
_osx_window(NULL),
|
||||||
_is_fullsreen(false),
|
_is_fullsreen(false),
|
||||||
#ifdef HACK_SCREEN_HASH_CONTEXT
|
#ifdef HACK_SCREEN_HASH_CONTEXT
|
||||||
|
@ -39,8 +39,11 @@ OSStatus aglReportError (void);
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class osxGraphicsWindow : public GraphicsWindow {
|
class osxGraphicsWindow : public GraphicsWindow {
|
||||||
public:
|
public:
|
||||||
osxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
osxGraphicsWindow(GraphicsPipe *pipe,
|
||||||
const string &name);
|
const string &name,
|
||||||
|
int x_size, int y_size, int flags,
|
||||||
|
GraphicsStateGuardian *gsg,
|
||||||
|
GraphicsOutput *host);
|
||||||
virtual ~osxGraphicsWindow();
|
virtual ~osxGraphicsWindow();
|
||||||
|
|
||||||
virtual bool move_pointer(int device, int x, int y);
|
virtual bool move_pointer(int device, int x, int y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user