I know C but am planning on using a 3d engine. Should I use C# or C++?

Started by
25 comments, last by Tom Sloper 1 year, 9 months ago

Juliean said:
(otherwise, 32 bit would still theoretically be faster than 64 bit because their pointers are also only half size, wouldn't it)?

Using 32 bits to store a reference to something instead of a full 64-bit pointer is one reason one might choose to use handles rather than pointers - because you can fit more 32-bit or even smaller indices or handles in the CPU cache than you can 64-bit pointers. If you're in a situation where cache utilization matters (like, say, updating one out of thousands of different objects) then this may be an important optimization. If you're in a situation that is space-constrained (happens more often than you'd think at AAA scale) it might be relevant, too.

shared_ptr is something I don't typically recommend for other reasons, though. The requirement that the reference counter be thread safe is wasteful in single-threaded contexts or contexts where the synchronization is done at a higher level (eg. fork/join model) and its use frequently indicates that little thought was devoted to what should actually own the object in question.

Advertisement

JoeJ said:

Anyone knows what's the plan regarding future GPU support? Afaik this should come with C++24, but i never found any detailed information.

It's my last hope.
OpenCL 3 is a step back from 2. CL 2 is still not supported by Nvidia. AMD has dropped CPU support, so i'm not sure if they may abandon CL entirely in the future.
Microsoft AMP did not really take off, and CUDA is vendor locked.

So compute shaders via gfx API is the only option, but it's too cumbersome to use in most cases.

Thus, GPU power remains accessible only to game engine experts or vendor locked enterprise software. That's unacceptable, and after decades, still no solution in sight.

Bryce presented this last CPPCon and it talks about parrallell execution of code that could be running on the GPU. You have controll of where it runs through the api, through a execution context. But this is more an extention on standard algorithms and ranges than anything else and is still in draft I believe. Thats the most I have recently seen about including the GPU into the processing loops of C++

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

I don't see GPU processing modes coming to the C++ core. I can see it easily as an extension.

The committee is protective about the language core, and for good reason.

It isn't for any specific machine, but for an abstract machine. Each group tends to think it was made for them, which is a good thing. It is made for desktop machines, it is made for supercomputers, it is made for minicomputers and microcomputers, it is made for microcontrollers found inside memory chips, hard drives, and wristwatches. It is made for satellite computers, for medical equipment, for microwaves and refrigerators. The language core needs to work just as well on an 8-bit 4 MHz processor with 2KB of RAM as it does on a 4096-node supercomputer with exabytes of collective RAM. The language core team tries their best to make it work EVERYWHERE, and provide functionality for ALL types of software.

The same is true about the C language core, with even stronger views than the C++ committee. Trying to bring it back toward the original subject, that's part of the reason for C's decrease in popularity. It still works, and you can still certainly use it for a 3D game and for virtually any type of software, but many features and implementations are more difficult to use for identical effect.

I plan to support C++, C#, and Lua programming. In most cases, all three of these language are fine for performance because the user's code operates on one thread running at a constant cycle speed. So unless your C# code is so complicated it takes more than 16 milliseconds to execute (a lifetime in CPU time) then it will be fine.

10x Faster Performance for VR: www.ultraengine.com

This topic is closed to new replies.

Advertisement