PDA

View Full Version : Yet another multithreading issue...



Zeno
01-11-2002, 03:22 PM
I know there are a zillion posts on multithreading issues, but none of them seemed to apply to my problem. I'll try to be as specific as possible.

I'm working on a large simulator that suddenly needs to go multi-threaded.

Using Visual C++ 6.0, I changed the settings under code generation to use multi-threaded instead of single-threaded runtime libraries. This is the only change I made. No threads are actually created within my program.

Most everything still worked fine, except that now my procedural water texture always comes out flat (totally blue bump map).

This texture works a lot like nvidia's interactive reflection map demo (looks like a liquid sheet of metal with nvidia logo). That is, it renders a lot to the backbuffer and does a lot of copyTexSubImages.

To make it more interesting, I tried changing my standalone water texture demo to multithreaded, and it still worked fine.

I have basically zero experience with multithreading, so I'm just hoping that some of you might have some suggestions as to why this one thing breaks when the change is made? I'm not even sure where to start looking for the problem.

Thanks,
-- Zeno

marcus256
01-14-2002, 12:21 AM
I may not be the right person to reply to this, since I have zero experience with MSVC (except for some simple command-line compiling), but I think it's some C run-time call that behaves slightly differently in MT mode than in ST mode. You should probably look for: 1) Documentation on the different runtime modes (what exactly is the difference - is there anything that can go wrong), and 2) If you use the runtime functions in a faulty way, or use illegal parameters (faulty memory pointers etc).

It can be something even more "trivial", such as the memory layout changes when you link with different runtime libraries, so that some memory pointer fault in your code is exposed.

By the way, changing a compilation flag does not make your application multithreaded. You need to explicitly create your own threads, and use synchronization to handle communication between the threads etc.