nVidia's CUDA - Not quite as friendly as I'd like.

Xengeance

Bananarama Supremo
I had an issue recently regarding CUDA and texture compression in TS2009 SP3 (I don't know if any other Trainz versions are affected) that I thought I'd share since the fix itself was way out in left field and I feel it's likely someone may encounter the problem at some point in the future.

I recently upgraded my old, charred, and crispy EVGA 275 GTX for a PNY GTX 465 (both of nVidia make and chipset, obviously) and was fiddling around with textures on a few of my works in progress in CMP the other day. I recommitted them for the first time after installing the new vid card and loaded up surveyor to see how they looked in Trainz, and to my horror, the textures had become garbled abominations of semi-transparent, pixelated grey and magenta confetti vomit like someone went ape crazy with a glue stick, some glitter and a Be-Dazzler all over model, rather than displaying the actual textures.

Fearing a possible corruption of the actual asset files themselves (or Great Engineer in the Sky forbid, faulty hardware.... again) I jumped back into CMP and immediately re-opened the assets for edit to make sure the textures weren't turned into digital swiss cheese. To my surprise, they appeared to be completely unharmed when opened in any odd image editor. So I just chauked it up to a random fluke with the compression code and recommitted them to take another look. After loading them up in game for a second time, again the textures of only just the re-committed assets had turned into Fruity-Pebbles-in-cement-mix and left me baffled as they should have either a) not exibited the problem again since the files were fine when I checked them in multiple image editing programs to verify their file integrity, or b) had corrupted the texture files themselves as is often the case with these sorts of symptoms. So I played around with all manner of DXT compression settings, texture filter types, and mipmap settings in their configs to see if anything caused a change in the pattern, yet every time in Trainz the model would look like Purple Rain and the textures would look perfectly normal when I opened the asset for edit.

While I was pondering why the texture compression in CMP itself would cause them to corrupt, and them seemingly 'uncorrupt' them whenever I opened the files up from CMP - as logically it was one of only a handful of possible causes by that point that hadn't been ruled out by testing - I was fiddling around with the settings in the nVidia control panel for the graphics card and noticed there was a new entry I hadn't seen before in the 3d management settings: CUDA Enabled GPUs (all my previous cards had not had full CUDA support apparently until my 465). Simply out of curiosity I disabled CUDA extensions from being used with the graphics card and loaded up Trainz, yet the problem persisted. Then it occured to me that maybe I had to re-commit them with CUDA disabled since the texture compression seemed to be involved and textures would only be compressed when their assets were committed in CMP. A quick Ctrl+E, Ctrl+M, Ctrl+L later I was back in surveyor, and *poof* the texture compression had somehow magically rectified itself no longer having CUDA dipping its hands into the chili.

I then went and repeatedly tested the process with both CUDA enabled and disabled just to make sure it wasn't a fluke. It seems to be a genuinely replicable issue, but I don't know if it's a bug with Trainz or the CUDA API itself - and therefore out of Auran's hands, so I provide this little story for those who may have the same problem spring up in the future as a workaround fix until such a time arises where CUDA and Trainz can coexist together, peacefully.

So the moral of this story is - if your textures look like a purple sharpie marker was put through a meat grinder and sprinkled liberally over a slab of concrete and you have a CUDA-enabled graphics card, CUDA conflicting with Trainz's Texture Compression may be likely to blame. Disable that sucker in the NVControlPanel and recommit those borked assets should clear that case of spotted purple flu right up!
 
Err, I think you need to check what CUDA actually does. CUDA is nothing related to textures, its a way of accessing the graphics card and its individual cores (which there are funny enough, much, much, much more than your average intel processor.). Basically put, without CUDA, you have to program in Shader Language, which is a bit more difficult I believe, although I haven't done much shader language programming. Because of the amount of power you have on your graphics card that sits there and does nothing, some programs are better off written in nVidia's C like language (which is part of CUDA) and therefore, a developer and user can speed up a program. Although I could do with one of the developers at Auran to give an explanation to exactly how CUDA works.

http://en.wikipedia.org/wiki/CUDA (That might help explain a bit more)

Texture compression is completely different and in your case, could well be a driver issue. Do you know what drivers you are using?
 
it could be, but most of the time i think the answer for most ppl is to turn off hardware compression in the CMP options rather than mess with settings they may not know how to use.

i had this problem once with my old computer and the 8700mgtx, but it disappeared in an update to my drivers.

the list of CUDA GPUs is quite large http://www.nvidia.com/object/cuda_gpus.html

i dont have this problem currently but i am also pretty sure i dont know of anywhere to disable CUDA on my nvdia controls. you may be opening a lot more questions than giving any tips here. the way i see it, if the problem persists for some users, they need to disable it in CMP alone.
 
Last edited:
i dont have this problem currently but i am also pretty sure i dont know of anywhere to disable CUDA on my nvdia controls. you may be opening a lot more questions than giving any tips here. the way i see it, if the problem persists for some users, they need to disable it in CMP alone.

Err, why are we thinking its CUDA when CUDA is programming on nVidia GPUs? CUDA is completely different and really, unrelated to texture compression in this sense. Well, you could write a texture compressor in C for CUDA, but thats not the point.
 
That doesn't explain why disabling CUDA would outright fix the problem, CMP settings notwithstanding. CUDA is essentially a low-level API interface to allow programmers to directly access the hardware without the need to go through DirectX or some kind of pseudo-Assembly code wrapper. I think because it exists on such a low-level that it interferes directly with the textures as they're being cached to be compressed by the GPU, somehow confusing a few bits that cause the compressed versions to go bonkers.

Update - It may very well have simply been a driver issue (no surprise there, nVidia... *scowl*). I had installed the new release candidate for their drivers (258.96) that came out on Tuesday and now apparently the issue seems to have resolved itself. For the record, though the previous drivers I had were the 257.21 WHQL ones, so if anyone else who happens to be using those drivers mind trying to verify if they can reproduce the problem with their system?

For those curious, CUDA, along with many other features, can be turned on/off from the nVidia Control Panel, accessible from right clicking the desktop or from the icon in the Control Panel in Windows:

cudasettings.png
 
Err, why are we thinking its CUDA when CUDA is programming on nVidia GPUs? CUDA is completely different and really, unrelated to texture compression in this sense. Well, you could write a texture compressor in C for CUDA, but thats not the point.


er, i didnt say i thought it was CUDA, i said that i dont see the connection and i dont even see a way to turn it off, not that i have to bc i dont have this problem.


also i dont have the CUDA option in my controls, others may not have it either, this is the point i was making. if there are problems using the hardware compression turn it off in CMP...
 
Last edited:
Update - It may very well have simply been a driver issue (no surprise there, nVidia... *scowl*). I had installed the new release candidate for their drivers (258.96) that came out on Tuesday and now apparently the issue seems to have resolved itself.

There's your answer, but by the way you are making it sound like, you were implying that CUDA was the problem because it affects the texture compression (which is why I tried to correct you). It could be the way the driver interacts with the rest of the cores in the GPU that could be the problem, where there is a program in the background, written for CUDA is affecting the GPU time because the driver hasn't been written properly to handle CUDA apps and geometry/textures at the same time. Thats my guess anyway.

EDIT: Although in theory, that shouldn't happen on most users PCs, because there is very little software written in CUDA, unless you are using some. I think you will find that the driver written to work with DX is the problem.
 
Last edited:
I know I have a problem with the texture compression on the current Nvidia drivers where for some reason it messes up the textures when importing content into trainz. My solution like NS37's was to turn of texture compression. Its is certainly a bug with the 257.21 drivers as earlier drivers didn't cause this issue. Just going to wait here for the stable release of the latest drivers, I know the new beta's solve it but I've seen knock on effects of beta drivers on other games I use so I'll avoid for now.

Rob
 
I just had the same thing but textures were all black and that's with the 258.96 drivers. This bug will happen with downloads.
 
Content Manager uses CUDA for performing texture compression unless the "hardware acceleration" option is turned off.

kind regards,

chris
 
but still, the answer is to disable it in CMP, not search for some place in the drivers that may or may not exist depending on your version.
 
Just tried opening and recommiting my test asset with 2048x2048 diffuse and normal maps, both with alpha channels, and no obvious problems. I'm running the 258.96 drivers on a GT330M, Windows 7 64 bit, Cuda and hardware accelerated texture compression turned on, TS2010 SP3 installed (this isn't one of the things fixed in SP3, by any chance?)

Incidentally, the 258.96 drivers appear to have dramatically increased (nearly doubled in some areas) my frame rates in DirectX but they seem to be a bit slower than the previous drivers in OpenGL.

R3
 
hi all..i wanted to say i have a gtx 465 and i also have a problem with this cuda stuff..

i cannot even import anything in CMP unless i turn of the cuda's, disable hardware TL and dissable texture compression and change to opengl

after this i can import anything i want..this problem is with trainz 2009 and 2010
i read that i just have to turn off the hardware tl so that CMP doesnt use the Cuda's.for me this does not help..and i have to say this is a huge problem..not just for me but also auran, nvidia and many other users who have this problem..
 
its probably the driver. either turn off hardware compression in cmp or get a new driver, thats the answer. CUDA is not technically the problem here, but the use of it through some of the oem drivers.

hardware TL shouldn't have anything to do with the problem. the setting is in the CMP settings dialog under the miscellaneous tab.
 
its probably the driver. either turn off hardware compression in cmp or get a new driver, thats the answer. CUDA is not technically the problem here, but the use of it through some of the oem drivers.

hardware TL shouldn't have anything to do with the problem. the setting is in the CMP settings dialog under the miscellaneous tab.

i have tried to only disable the setting in de CMP under miscellaneous.but still all the textures are black and weird..

if someone can tell me wich driver i need..
i have tried more then 30 drivers from the nvidia site..from new to old..nothing helps..i am still getting the same problems..

but when i use my old gtx8800 with the latest drivers i have no problem at all..

so is it really a driver problem?? i dont know
 
You have to open for edit all the affected objects & then re commit them.


Dave

yes i know that i have to recommit..but my point was that with my old gtx8800 i have no problems with trainz..and with my new gtx265 i have alot of problems..so what is going on!!!!!!!
 
well if it makes you feel any better with my old 8600M GT i had this problem once with TS2009 beta, but it later corrected itself. and with my 280s i don't have this problem anymore. looks like i got the better deal.
 
Back
Top