• Advertisement
Sign in to follow this  

Question about Resource Management

This topic is 4334 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

Hey everyone, I was going to write a resource manager and came across some questions. first i thought i would load my resource and lets say make a texture out of it and then safe that in my manager thats going to be a singleton and thus accessable from everywhere. But then i thought about a lost device and i realized that i would have the reload the complete manager. so the plan for now is: load a resource into memory and save it then create a texture from file in memory my question now is: with this solution dont i need twice the space ? one for the safed file in memory and then when i create the texture from the file in memory? this is some code out of game coding complete:
Resource resource(m_textureFile);
int size = g_pApp->m_ResCache->Create(resource);
assert(size);
char* textureBuffer = (char*)g_pApp->m_ResCache->Get(resource);
if(FAILED(D3DXCreateTextureFromFileInMemory(....))

So with every call to D3DXCreateTextureFromFileInMemory(....) do i need more memory or am i just getting a pointer to the file in memory? sorry if this is a stupid question but i am still at the beginning:) thx a lot in advance for any hints or answers:)

Share this post


Link to post
Share on other sites
Advertisement
Losing a device is rare enough that you shouldn't have to worry about the cost of reloading your data. In any case, loading texture data from disk isn't that slow; you're right that storing an extra copy in memory is going to be a bit wasteful. In general, you should be fine just loading the texture data itself, and re-reading from disk in case of catastrophic failures (like a device becoming invalid).

Hope that helps clarify your plans a bit [smile]

Share this post


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

  • Advertisement