Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GhostfromTexas

Member Since 11 Jul 2010
Offline Last Active May 18 2011 08:31 PM

Posts I've Made

In Topic: [C++, VS 2010 Ultimate] Advanced memory leak detection

15 May 2011 - 04:32 PM

The quick answer is use another tool, like Visual Leak Detector and it will give you the location of all your leaks in the output window when the program exists.


I looked into VLD but couldn't get it to give me anymore information than I already knew...

But however I did figure out a way to make CRT work better for me thanks from some help from someone..

global header. either a forced header in visual studio or one that's included everywhere in the project by some sort of method. In Visual Studio it's under Project Settings -> c++ -> Advanced -> Forced Include File (just list the file there without quotes. This assumes you own file, not a standard library include)
//--- CRT debug header (must be last)
#if defined(DEBUG) | defined(_DEBUG)
#include <crtdbg.h>
#define new new( _NORMAL_BLOCK, __FILE__, __LINE__)
#pragma warning(disable : 4345) //this warning is when using empty () when allocating a new object. Only happens when allocating memory with this debug option, so disabling it
#endif


first line in main:
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)|_CRTDBG_LEAK_CHECK_DF);
//_CrtSetBreakAlloc(100); //break on a specific memory allocation
#endif


This allowed visual studio to output file and line number for the leaked allocation. The output looks something like this now:

c:\users\user\desktop\project-folder\files\file.cpp(392) : {487594} normal block at 0x087F1500, 456 bytes long.
Data: < fff?o : > CD CD CD CD 66 66 66 3F 6F 12 03 3A CD CD CD CD
{487590} normal block at 0x087F14B8, 8 bytes long.
Data: < > 1C 13 7F 08 00 00 00 00
c:\users\user\desktop\project-folder\files\file.cpp(275) : {487585} normal block at 0x087F12E0, 100 bytes long.
Data: < { > 20 14 7B 08 00 00 00 00 00 00 00 00 00 00 00 00
c:\users\user\desktop\project-folder\files\file.cpp(133) : {487578} normal block at 0x087E5038, 96 bytes long.
Data: < ;& > B8 3B 26 02 01 00 00 00 00 00 00 00 02 00 00 00

So even though i was getting random leaks, this method allow me to figured out how to track them down much easier.

Hopefully this helps some others in the future on how to fix it.

Thanks to Ghaleon from #gamedev on the #efnet IRC for this. He's the one that came up with the code

In Topic: [DX9, c++] Is there a good book that explains quaternians for gamedev?

03 October 2010 - 06:03 AM

Quote:
Original post by Corefanatic
3D Math Primer for Graphics and Game Development by Fletcher Dunn and Ian Parberry

has a good chapter on Quaternions.


Yeah you are the 2nd person that's recommended that book... problem is that I have to order it... was hoping for something I could run out and grab today.. but it's looking like I might have to order it.

In Topic: [DX9, C++] Lag issue when drawing models for the first frame

17 August 2010 - 12:13 AM

Quote:
Original post by Adam_42
It's possible you're running out of video memory. Perfhud can tell you for sure.

As a simple test you could try using D3DXCreateTextureFromFileEx() to load your textures and pass D3DFMT_DXT5 as the format of your textures. That will cut their size in video ram down significantly at the cost of extra load time. Ideally you'd want to use D3DFMT_DXT1 for textures with no alpha channel, and also convert them offline with the texture tool that comes with the SDK into .dds files.

Even if you aren't running out of memory, the smaller textures will be quicker to upload to video ram which could help.


Ok i converted over to use this function and low and behold, the lag problem is gone! I do notice, however, it does take longer to load up initially (about an extra 5-6 seconds) but it's worth the improvement that I am seeing in game...

could you possibly explain to me exactly what the format does, and what are the other similar formats like D3DFMT_DXT3, D3DFMT_DXT4, etc?

In Topic: [DX9, C++] Lag issue when drawing models for the first frame

16 August 2010 - 10:20 PM

Quote:
Original post by mhagain
Are you using Windows Vista or 7 (with a WDDM driver) and does this happen when you run it in the debugger?


This problem is happening across the board on several systems.. ranging from Windows XP 32bit to Windows 7 64bit.. and pretty much everything in between. So it's not just Windows Vista or Windows 7 Related


@ ET3D:

I decided to take what you said a step further, and I simply commented out the call where I set the texture to a my shader handle when I updated the models. Obviously now my models are black and not textured, but the problem is now gone when I do that. Is 1mb too large for a texture? Could it be something in my shader? Is there like an allocated amount of video memory that I might be filling up when I do this?

In Topic: [DX9, C++] Lag issue when drawing models for the first frame

16 August 2010 - 10:08 PM

Thanks for your response. I have to admit when I first read your possibility for the solution I got kind of excited because that made 100% total sense for what I was doing... My models have around 1mb textures each for them and the models have quite the UV layout on them for these textures.

I did call PreLoad() on all the textures for the models after I loaded them, but alas the problem didn't correct itself.

best guess I've had so far.. so again thanks for the response. Got any other ideas?

PARTNERS