Jump to content
  • Advertisement
Sign in to follow this  
gharen2

OpenGL Device dependent resource management.

This topic is 4164 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For some time now I've been working on a platform independent graphics engine capable of using opengl, direct3d, or xna. At the moment I'm thinking about how exactly to handle resource management when the display mode changes or the device is lost. In direct3d and xna, when the device is lost you can tell the api to automatically reload the resource from a copy it stores in system memory, or tell it that you'll reload the resource yourself. I've already implemented the equivalent for opengl: when the texture is loaded, a copy is stored in a byte array, and when a display mode changes the texture is recreated from that copy without the user having to do anything. The user can also tell it not to create that copy in memory, which means they have to dispose and reload it manually (in fact, on my geforce 7600, SDL causes my computer to reboot if I try to change to full screen while any opengl resources are still alive). So my question is, is there a compelling reason to allow the user to specify the management mode, rather than just making it always automatic? Obviously automatic management creates a footprint in system memory, but to me the benefits outweigh that (in particular, not having to reload a ton of resources from the hard drive, just because you alt-tabbed out for a moment). The downside I see is that a program running on the xbox 360 has a smaller amount of memory to work with, so that footprint may be undesirable. Plus, as near as I can tell, console games don't ever change display mode while running, so the automatic recreation may be unnecessary. And there's added complications, such as the fact that on the 360, video and system memory is shared, so selecting automatic resource management may be totally ignored. Ideally, I'd like to hide all this from the user. Essentially, on a pc, automatic resource management will always be used, whether with direct3d, xna, or opengl. On the xbox 360, it won't be used, to save memory. Does anyone think this is unreasonable, or foresee any potential problems I may run into later?

Share this post


Link to post
Share on other sites
Advertisement
I would make it automatic, hide the setting from the user. The extra copy that you have to keep around to handle lost devices won't be part of your game's working memory set, which is what has to fit in physical memory for good performance. It just takes up virtual address space so as long as you're below the 2Gb standard limit then you're fine.

You shouldn't have to keep a backup on 360 at all.

Share this post


Link to post
Share on other sites
Yeah, unless someone jumps in with a really good objection, that's what I'll do.

In fact, now that I think of it, I'm not sure that loading the texture through the content pipeline on the 360 even allows me to specify a management mode.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!