pass WindowProperties to GraphicsEngine::open_buffer and to related constructors

This commit is contained in:
David Rose 2006-06-15 14:02:40 +00:00
parent e7d62baf9b
commit 1940682af9
56 changed files with 264 additions and 198 deletions

View File

@ -30,11 +30,11 @@ TypeHandle GraphicsBuffer::_type_handle;
GraphicsBuffer::
GraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsOutput(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsOutput(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
#ifdef DO_MEMORY_USAGE
MemoryUsage::update_type(this, this);

View File

@ -35,8 +35,9 @@ class EXPCL_PANDA GraphicsBuffer : public GraphicsOutput {
protected:
GraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);

View File

@ -99,15 +99,16 @@ close_gsg(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) {
INLINE GraphicsOutput *GraphicsEngine::
make_buffer(GraphicsStateGuardian *gsg, const string &name,
int sort, int x_size, int y_size) {
FrameBufferProperties props = FrameBufferProperties::get_default();
props.set_back_buffers(0);
props.set_stereo(0);
props.set_accum_bits(0);
props.set_multisamples(0);
props.set_force_hardware(0);
props.set_force_software(0);
FrameBufferProperties fb_props = FrameBufferProperties::get_default();
fb_props.set_back_buffers(0);
fb_props.set_stereo(0);
fb_props.set_accum_bits(0);
fb_props.set_multisamples(0);
fb_props.set_force_hardware(0);
fb_props.set_force_software(0);
GraphicsOutput *result = make_output(gsg->get_pipe(), name, sort,
props, x_size, y_size,
fb_props,
WindowProperties::size(x_size, y_size),
GraphicsPipe::BF_refuse_window |
GraphicsPipe::BF_fb_props_optional,
gsg, NULL);
@ -122,9 +123,9 @@ make_buffer(GraphicsStateGuardian *gsg, const string &name,
INLINE GraphicsOutput *GraphicsEngine::
make_parasite(GraphicsOutput *host, const string &name,
int sort, int x_size, int y_size) {
FrameBufferProperties props;
GraphicsOutput *result = make_output(host->get_pipe(), name, sort,
props, x_size, y_size,
FrameBufferProperties(),
WindowProperties::size(x_size, y_size),
GraphicsPipe::BF_require_parasite |
GraphicsPipe::BF_fb_props_optional,
host->get_gsg(), host);

View File

@ -205,8 +205,9 @@ get_threading_model() const {
GraphicsOutput *GraphicsEngine::
make_output(GraphicsPipe *pipe,
const string &name, int sort,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) {
@ -243,12 +244,13 @@ make_output(GraphicsPipe *pipe,
// Simplify the input parameters.
if ((x_size==0) || (y_size == 0)) {
int x_size = 0, y_size = 0;
if (win_prop.has_size()) {
x_size = win_prop.get_x_size();
y_size = win_prop.get_y_size();
} else {
flags |= GraphicsPipe::BF_size_track_host;
}
if (flags & GraphicsPipe::BF_size_square) {
x_size = y_size = min(x_size, y_size);
}
if (host != 0) {
host = host->get_host();
}
@ -305,7 +307,7 @@ make_output(GraphicsPipe *pipe,
((flags&GraphicsPipe::BF_can_bind_every)==0)&&
((flags&GraphicsPipe::BF_rtt_cumulative)==0)) {
if ((flags&GraphicsPipe::BF_fb_props_optional) ||
(host->get_fb_properties().subsumes(prop))) {
(host->get_fb_properties().subsumes(fb_prop))) {
can_use_parasite = true;
}
}
@ -319,7 +321,7 @@ make_output(GraphicsPipe *pipe,
(can_use_parasite) &&
(x_size <= host->get_x_size())&&
(y_size <= host->get_y_size())&&
(host->get_fb_properties().subsumes(prop))) {
(host->get_fb_properties().subsumes(fb_prop))) {
ParasiteBuffer *buffer = new ParasiteBuffer(host, name, x_size, y_size, flags);
buffer->_sort = sort;
do_add_window(buffer, threading_model);
@ -332,7 +334,7 @@ make_output(GraphicsPipe *pipe,
for (int retry=0; retry<10; retry++) {
bool precertify = false;
PT(GraphicsOutput) window =
pipe->make_output(name, prop, x_size, y_size, flags, gsg, host, retry, precertify);
pipe->make_output(name, fb_prop, win_prop, flags, gsg, host, retry, precertify);
if (window != (GraphicsOutput *)NULL) {
window->_sort = sort;
if ((precertify) && (gsg != 0) && (window->get_gsg()==gsg)) {
@ -344,7 +346,7 @@ make_output(GraphicsPipe *pipe,
open_windows();
if (window->is_valid()) {
do_add_gsg(window->get_gsg(), pipe, threading_model);
if (window->get_fb_properties().subsumes(prop)) {
if (window->get_fb_properties().subsumes(fb_prop)) {
return window;
} else {
if (flags & GraphicsPipe::BF_fb_props_optional) {

View File

@ -71,10 +71,10 @@ PUBLISHED:
GraphicsOutput *make_output(GraphicsPipe *pipe,
const string &name, int sort,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
GraphicsStateGuardian *gsg = 0,
GraphicsOutput *host = 0);
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags, GraphicsStateGuardian *gsg = NULL,
GraphicsOutput *host = NULL);
// Syntactic shorthand versions of make_output
INLINE GraphicsOutput *make_buffer(GraphicsStateGuardian *gsg,

View File

@ -73,8 +73,9 @@ static CubeFaceDef cube_faces[6] = {
GraphicsOutput::
GraphicsOutput(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
_lock("GraphicsOutput"),
@ -87,12 +88,15 @@ GraphicsOutput(GraphicsPipe *pipe,
_pipe = pipe;
_gsg = gsg;
_host = host;
_fb_properties = properties;
_fb_properties = fb_prop;
_name = name;
_creation_flags = flags;
_x_size = x_size;
_y_size = y_size;
_has_size = false; // Need to look into what this does.
_x_size = _y_size = 0;
_has_size = win_prop.has_size();
if (_has_size) {
_x_size = win_prop.get_x_size();
_y_size = win_prop.get_y_size();
}
_is_valid = false;
_flip_ready = false;
_cube_map_index = -1;
@ -738,7 +742,8 @@ make_texture_buffer(const string &name, int x_size, int y_size,
GraphicsOutput *buffer = get_gsg()->get_engine()->
make_output(get_gsg()->get_pipe(),
name, get_sort()-1,
props, x_size, y_size, GraphicsPipe::BF_refuse_window,
props, WindowProperties::size(x_size, y_size),
GraphicsPipe::BF_refuse_window,
get_gsg(), get_host());
if (buffer != (GraphicsOutput *)NULL) {

View File

@ -64,8 +64,8 @@ class EXPCL_PANDA GraphicsOutput : public TypedWritableReferenceCount, public Dr
protected:
GraphicsOutput(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop, int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);

View File

@ -143,8 +143,9 @@ close_gsg(GraphicsStateGuardian *gsg) {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) GraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -32,6 +32,7 @@ class GraphicsWindow;
class GraphicsBuffer;
class GraphicsStateGuardian;
class FrameBufferProperties;
class WindowProperties;
class Texture;
////////////////////////////////////////////////////////////////////
@ -109,8 +110,9 @@ protected:
virtual void close_gsg(GraphicsStateGuardian *gsg);
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -38,11 +38,12 @@ TypeHandle GraphicsWindow::_type_handle;
GraphicsWindow::
GraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsOutput(pipe, name, properties, x_size, y_size, flags, gsg, host),
GraphicsOutput(pipe, name, fb_prop, win_prop, flags, gsg, host),
_input_lock("GraphicsWindow::_input_lock")
{
#ifdef DO_MEMORY_USAGE
@ -54,7 +55,7 @@ GraphicsWindow(GraphicsPipe *pipe,
<< "Creating new window " << get_name() << "\n";
}
_red_blue_stereo = red_blue_stereo && !properties.is_stereo();
_red_blue_stereo = red_blue_stereo && !fb_prop.is_stereo();
if (_red_blue_stereo) {
_left_eye_color_mask = parse_color_mask(red_blue_stereo_colors.get_word(0)); _right_eye_color_mask = parse_color_mask(red_blue_stereo_colors.get_word(1));
}
@ -66,6 +67,7 @@ GraphicsWindow(GraphicsPipe *pipe,
_properties.set_cursor_hidden(false);
request_properties(WindowProperties::get_default());
request_properties(win_prop);
_window_event = "window-event";
}

View File

@ -42,8 +42,9 @@ class EXPCL_PANDA GraphicsWindow : public GraphicsOutput {
protected:
GraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);

View File

@ -32,7 +32,8 @@ ParasiteBuffer::
ParasiteBuffer(GraphicsOutput *host, const string &name,
int x_size, int y_size, int flags) :
GraphicsOutput(host->get_pipe(), name, host->get_fb_properties(),
x_size, y_size, flags, host->get_gsg(), host)
WindowProperties::size(x_size, y_size), flags,
host->get_gsg(), host)
{
#ifdef DO_MEMORY_USAGE
MemoryUsage::update_type(this, this);

View File

@ -89,6 +89,20 @@ get_default() {
return props;
}
////////////////////////////////////////////////////////////////////
// Function: WindowProperties::size
// Access: Published, Static
// Description: Returns a WindowProperties structure with only the
// size specified. The size is the only property that
// matters to buffers.
////////////////////////////////////////////////////////////////////
WindowProperties WindowProperties::
size(int x_size, int y_size) {
WindowProperties props;
props.set_size(x_size, y_size);
return props;
}
////////////////////////////////////////////////////////////////////
// Function: WindowProperties::operator ==
// Access: Published

View File

@ -44,6 +44,7 @@ PUBLISHED:
INLINE ~WindowProperties();
static WindowProperties get_default();
static WindowProperties size(int x_size, int y_size);
bool operator == (const WindowProperties &other) const;
INLINE bool operator != (const WindowProperties &other) const;

View File

@ -57,10 +57,6 @@ DXTextureContext8(PreparedGraphicsObjects *pgo, Texture *tex) :
////////////////////////////////////////////////////////////////////
DXTextureContext8::
~DXTextureContext8() {
if (dxgsg8_cat.is_spam()) {
dxgsg8_cat.spam()
<< "Deleting texture context for " << get_texture()->get_name() << "\n";
}
delete_texture();
}

View File

@ -43,11 +43,12 @@ TypeHandle wdxGraphicsBuffer8::_type_handle;
wdxGraphicsBuffer8::
wdxGraphicsBuffer8(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host):
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
// initialize all class members
_cube_map_index = -1;

View File

@ -38,8 +38,9 @@ class EXPCL_PANDADX wdxGraphicsBuffer8 : public GraphicsBuffer {
public:
wdxGraphicsBuffer8(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wdxGraphicsBuffer8();

View File

@ -87,8 +87,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) wdxGraphicsPipe8::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -114,8 +115,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new wdxGraphicsWindow8(this, name, properties,
x_size, y_size, flags, gsg, host);
return new wdxGraphicsWindow8(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Second thing to try: a wdxGraphicsBuffer8
@ -135,8 +136,8 @@ make_output(const string &name,
(gsg->get_supports_render_texture())) {
precertify = true;
}
return new wdxGraphicsBuffer8(this, name, properties,
x_size, y_size, flags, gsg, host);
return new wdxGraphicsBuffer8(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Nothing else left to try.

View File

@ -57,8 +57,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -41,11 +41,12 @@ TypeHandle wdxGraphicsWindow8::_type_handle;
wdxGraphicsWindow8::
wdxGraphicsWindow8(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host):
WinGraphicsWindow(pipe, name, properties, x_size, y_size, flags, gsg, host)
WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
// dont actually create the window in the constructor. reason:
// multi-threading requires panda C++ window object to exist in

View File

@ -36,8 +36,9 @@ class EXPCL_PANDADX wdxGraphicsWindow8 : public WinGraphicsWindow {
public:
wdxGraphicsWindow8(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wdxGraphicsWindow8();

View File

@ -61,11 +61,6 @@ DXTextureContext9(PreparedGraphicsObjects *pgo, Texture *tex) :
////////////////////////////////////////////////////////////////////
DXTextureContext9::
~DXTextureContext9() {
if (dxgsg9_cat.is_spam()) {
dxgsg9_cat.spam()
<< "Deleting texture context for " << get_texture()->get_name() << "\n";
}
if (_lru_page)
{
_lru_page -> _m.lru -> remove_page (_lru_page);

View File

@ -43,11 +43,12 @@ TypeHandle wdxGraphicsBuffer9::_type_handle;
wdxGraphicsBuffer9::
wdxGraphicsBuffer9(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host):
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
// initialize all class members
_cube_map_index = -1;

View File

@ -38,8 +38,9 @@ class EXPCL_PANDADX wdxGraphicsBuffer9 : public GraphicsBuffer {
public:
wdxGraphicsBuffer9(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wdxGraphicsBuffer9();

View File

@ -87,8 +87,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) wdxGraphicsPipe9::
make_output(const string &name,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -114,8 +115,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new wdxGraphicsWindow9(this, name, prop,
x_size, y_size, flags, gsg, host);
return new wdxGraphicsWindow9(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Second thing to try: a wdxGraphicsBuffer9
@ -135,8 +136,8 @@ make_output(const string &name,
(gsg->get_supports_render_texture())) {
precertify = true;
}
return new wdxGraphicsBuffer9(this, name, prop,
x_size, y_size, flags, gsg, host);
return new wdxGraphicsBuffer9(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Nothing else left to try.

View File

@ -57,8 +57,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -41,11 +41,12 @@ TypeHandle wdxGraphicsWindow9::_type_handle;
wdxGraphicsWindow9::
wdxGraphicsWindow9(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host):
WinGraphicsWindow(pipe, name, prop, x_size, y_size, flags, gsg, host)
WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
// dont actually create the window in the constructor. reason:
// multi-threading requires panda C++ window object to exist in

View File

@ -36,8 +36,9 @@ class EXPCL_PANDADX wdxGraphicsWindow9 : public WinGraphicsWindow {
public:
wdxGraphicsWindow9(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &prop,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wdxGraphicsWindow9();

View File

@ -161,7 +161,7 @@ open_window(const WindowProperties &props, GraphicsEngine *engine,
GraphicsOutput *winout =
engine->make_output(pipe, name, 0,
FrameBufferProperties::get_default(),
100, 100, GraphicsPipe::BF_require_window,
props, GraphicsPipe::BF_require_window,
gsg, NULL);
if (winout != (GraphicsOutput *)NULL) {

View File

@ -26,11 +26,12 @@ TypeHandle CLP(GraphicsBuffer)::_type_handle;
CLP(GraphicsBuffer)::
CLP(GraphicsBuffer)(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
// An FBO doesn't have a back buffer.
_draw_buffer_type = RenderBuffer::T_front;

View File

@ -58,8 +58,9 @@ class EXPCL_GL CLP(GraphicsBuffer) : public GraphicsBuffer {
public:
CLP(GraphicsBuffer)(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~CLP(GraphicsBuffer)();

View File

@ -39,11 +39,12 @@ TypeHandle glxGraphicsBuffer::_type_handle;
glxGraphicsBuffer::
glxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
glxGraphicsPipe *glx_pipe;
DCAST_INTO_V(glx_pipe, _pipe);

View File

@ -37,8 +37,9 @@ class glxGraphicsBuffer : public GraphicsBuffer {
public:
glxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~glxGraphicsBuffer();

View File

@ -173,8 +173,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) glxGraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -200,8 +201,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new glxGraphicsWindow(this, name, properties,
x_size, y_size, flags, gsg, host);
return new glxGraphicsWindow(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Second thing to try: a GLGraphicsBuffer
@ -217,10 +218,10 @@ make_output(const string &name,
// Early failure - if we are sure that this buffer WONT
// meet specs, we can bail out early.
if ((flags & BF_fb_props_optional)==0) {
if ((properties.get_indexed_color() > 0)||
(properties.get_back_buffers() > 0)||
(properties.get_accum_bits() > 0)||
(properties.get_multisamples() > 0)) {
if ((fb_prop.get_indexed_color() > 0)||
(fb_prop.get_back_buffers() > 0)||
(fb_prop.get_accum_bits() > 0)||
(fb_prop.get_multisamples() > 0)) {
return NULL;
}
}
@ -231,11 +232,11 @@ make_output(const string &name,
(!glxgsg->needs_reset()) &&
(glxgsg->_supports_framebuffer_object) &&
(glxgsg->_glDrawBuffers != 0)&&
(properties.is_basic())) {
(fb_prop.is_basic())) {
precertify = true;
}
return new GLGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new GLGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
#ifdef HAVE_GLXFBCONFIG
@ -250,8 +251,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new glxGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new glxGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
#endif // HAVE_GLXFBCONFIG

View File

@ -114,8 +114,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -47,11 +47,12 @@ TypeHandle glxGraphicsWindow::_type_handle;
glxGraphicsWindow::
glxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsWindow(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
glxGraphicsPipe *glx_pipe;
DCAST_INTO_V(glx_pipe, _pipe);

View File

@ -34,8 +34,9 @@ class glxGraphicsWindow : public GraphicsWindow {
public:
glxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~glxGraphicsWindow();

View File

@ -839,12 +839,18 @@ begin_frame(GraphicsStateGuardianBase *gsg, Thread *current_thread) {
// First, release all the textures, geoms, and buffers awaiting
// release.
Textures::iterator tci;
for (tci = _released_textures.begin();
tci != _released_textures.end();
++tci) {
TextureContext *tc = (*tci);
gsg->release_texture(tc);
if (!_released_textures.empty()) {
cerr << "releasing " << _released_textures.size()
<< " textures, gsg = " << gsg << "\n";
Textures::iterator tci;
for (tci = _released_textures.begin();
tci != _released_textures.end();
++tci) {
TextureContext *tc = (*tci);
cerr << "releasing texture " << tc << ": " << tc->_texture << "\n";
gsg->release_texture(tc);
}
cerr << "done releasing textures\n";
}
_released_textures.clear();

View File

@ -31,11 +31,12 @@ TypeHandle OsMesaGraphicsBuffer::_type_handle;
OsMesaGraphicsBuffer::
OsMesaGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
_type = GL_UNSIGNED_BYTE;
_draw_buffer_type = RenderBuffer::T_front;

View File

@ -34,8 +34,9 @@ class EXPCL_PANDAMESA OsMesaGraphicsBuffer : public GraphicsBuffer {
public:
OsMesaGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~OsMesaGraphicsBuffer();

View File

@ -79,8 +79,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) OsMesaGraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -101,8 +102,8 @@ make_output(const string &name,
((flags&BF_rtt_cumulative)!=0)) {
return NULL;
}
return new OsMesaGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new OsMesaGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Nothing else left to try.

View File

@ -47,8 +47,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -32,11 +32,12 @@ TypeHandle osxGraphicsBuffer::_type_handle;
osxGraphicsBuffer::
osxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
osxGraphicsPipe *osx_pipe;
DCAST_INTO_V(osx_pipe, _pipe);

View File

@ -36,8 +36,9 @@ class EXPCL_PANDAGL osxGraphicsBuffer : public GraphicsBuffer {
public:
osxGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~osxGraphicsBuffer();

View File

@ -74,8 +74,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) osxGraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -100,8 +101,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new osxGraphicsWindow(this, name, properties,
x_size, y_size, flags, gsg, host);
return new osxGraphicsWindow(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// // Second thing to try: a glGraphicsBuffer
@ -117,7 +118,7 @@ make_output(const string &name,
// return NULL;
// }
// }
// return new glGraphicsBuffer(this, name, x_size, y_size, flags, gsg, host);
// return new glGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
// }
// Third thing to try: an osxGraphicsBuffer
@ -130,8 +131,8 @@ make_output(const string &name,
((flags&BF_can_bind_every)!=0)) {
return NULL;
}
return new osxGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new osxGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
*/
// Nothing else left to try.

View File

@ -37,8 +37,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -435,11 +435,12 @@ static int id_seed = 100;
osxGraphicsWindow::
osxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsWindow(pipe, name, properties, x_size, y_size, flags, gsg, host),
GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host),
_osx_window(NULL),
_is_fullsreen(false),
#ifdef HACK_SCREEN_HASH_CONTEXT

View File

@ -41,8 +41,9 @@ class osxGraphicsWindow : public GraphicsWindow {
public:
osxGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~osxGraphicsWindow();

View File

@ -35,11 +35,12 @@ TypeHandle wglGraphicsBuffer::_type_handle;
wglGraphicsBuffer::
wglGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsBuffer(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsBuffer(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
_pbuffer = (HPBUFFERARB)0;
_pbuffer_dc = (HDC)0;

View File

@ -43,8 +43,9 @@ class EXPCL_PANDAGL wglGraphicsBuffer : public GraphicsBuffer {
public:
wglGraphicsBuffer(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wglGraphicsBuffer();

View File

@ -108,8 +108,9 @@ pipe_constructor() {
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) wglGraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
@ -136,14 +137,14 @@ make_output(const string &name,
return NULL;
}
if ((flags & BF_fb_props_optional)==0) {
if ((properties.get_aux_rgba() > 0)||
(properties.get_aux_hrgba() > 0)||
(properties.get_aux_float() > 0)) {
if ((fb_prop.get_aux_rgba() > 0)||
(fb_prop.get_aux_hrgba() > 0)||
(fb_prop.get_aux_float() > 0)) {
return NULL;
}
}
return new wglGraphicsWindow(this, name, properties,
x_size, y_size, flags, gsg, host);
return new wglGraphicsWindow(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Second thing to try: a GLGraphicsBuffer
@ -159,10 +160,10 @@ make_output(const string &name,
// Early failure - if we are sure that this buffer WONT
// meet specs, we can bail out early.
if ((flags & BF_fb_props_optional)==0) {
if ((properties.get_indexed_color() > 0)||
(properties.get_back_buffers() > 0)||
(properties.get_accum_bits() > 0)||
(properties.get_multisamples() > 0)) {
if ((fb_prop.get_indexed_color() > 0)||
(fb_prop.get_back_buffers() > 0)||
(fb_prop.get_accum_bits() > 0)||
(fb_prop.get_multisamples() > 0)) {
return NULL;
}
}
@ -173,11 +174,11 @@ make_output(const string &name,
(!wglgsg->needs_reset()) &&
(wglgsg->_supports_framebuffer_object) &&
(wglgsg->_glDrawBuffers != 0)&&
(properties.is_basic())) {
(fb_prop.is_basic())) {
precertify = true;
}
return new GLGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new GLGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Third thing to try: a wglGraphicsBuffer
@ -193,9 +194,9 @@ make_output(const string &name,
// Early failure - if we are sure that this buffer WONT
// meet specs, we can bail out early.
if ((flags & BF_fb_props_optional) == 0) {
if ((properties.get_aux_rgba() > 0)||
(properties.get_aux_rgba() > 0)||
(properties.get_aux_float() > 0)) {
if ((fb_prop.get_aux_rgba() > 0)||
(fb_prop.get_aux_rgba() > 0)||
(fb_prop.get_aux_float() > 0)) {
return NULL;
}
}
@ -205,12 +206,12 @@ make_output(const string &name,
(wglgsg->is_valid()) &&
(!wglgsg->needs_reset()) &&
(wglgsg->pfnum_supports_pbuffer()) &&
(wglgsg->get_fb_properties().subsumes(properties))&&
(wglgsg->get_fb_properties().subsumes(fb_prop))&&
(wglgsg->get_fb_properties().is_single_buffered())) {
precertify = true;
}
return new wglGraphicsBuffer(this, name, properties,
x_size, y_size, flags, gsg, host);
return new wglGraphicsBuffer(this, name, fb_prop, win_prop,
flags, gsg, host);
}
// Nothing else left to try.

View File

@ -40,8 +40,9 @@ public:
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,

View File

@ -133,11 +133,12 @@ GetAvailVidMem() {
wglGraphicsWindow::
wglGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
WinGraphicsWindow(pipe, name, properties, x_size, y_size, flags, gsg, host)
WinGraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
_hdc = (HDC)0;
}

View File

@ -31,8 +31,9 @@ class EXPCL_PANDAGL wglGraphicsWindow : public WinGraphicsWindow {
public:
wglGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~wglGraphicsWindow();

View File

@ -82,11 +82,12 @@ static tRegisterRawInputDevices pRegisterRawInputDevices;
WinGraphicsWindow::
WinGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host) :
GraphicsWindow(pipe, name, properties, x_size, y_size, flags, gsg, host)
GraphicsWindow(pipe, name, fb_prop, win_prop, flags, gsg, host)
{
initialize_input_devices();
_hWnd = (HWND)0;

View File

@ -43,8 +43,9 @@ class EXPCL_PANDAWIN WinGraphicsWindow : public GraphicsWindow {
public:
WinGraphicsWindow(GraphicsPipe *pipe,
const string &name,
const FrameBufferProperties &properties,
int x_size, int y_size, int flags,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host);
virtual ~WinGraphicsWindow();