Jump to content

OpenGL and Assembler ?


ParaToxic
 Share

Recommended Posts

I had an idea a few minutes ago.When you are programming in C++ it is (I heard) 100 times slower than in the same in assembler.

 

So does it make sense to make a 3D engin in assembler (not all) ?

Imagine your application could render not 1 mio triangles at 60 FPS but with 600 or 6000 FPS ??!!

Link to comment
Share on other sites

Whoever told you this is in denial. It wasn't even close to "100 times slower" when the first C compiler was released.

 

On the whole, few programmers are going to produce assembly code more optimzed than your average compiler. Even then, it's rare to shave off more than a few pico seconds in any particular function.

There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?"

Let's make things happen.

Link to comment
Share on other sites

it takes long enough to write a game engine in c++.I tried to learn assembly years ago on a Commodore 64. Took me a whole evening to print my name on the screen.It was needed then for 2d games but surely not now.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Many developers are using assembly in their game engines' code.

But it's not "100 times" faster or anything near that.

But it's a must to get some parts of the engine done.

Ali Salehi | Programmer

 

Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64

LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17

 

 

76561198023085627.png

Link to comment
Share on other sites

If you know what you're doing, sure go ahead, use inline ASM. (It would probably make it unreadable to other programmers though.)

I have a bit of reverse-engineering background, so I use IDA/OllyDbg frequently to investigate calls & gain understanding of what's happening. (But I never use inline ASM to actually code stuff.)

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

There is some benefit in using inlined assember code where the application really requires as Lord Hippo points out but you really need to know what you are doing as Brent indicated. Also, assembler is directly tied to your CPU family so you would need seperate code for each CPU family you intend running it on.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

ASM is ok if you are writing an engine, but for a game...i guess you would be the only one using it.

Even the microchips in todays consumer electronics are written in C, just because it's much faster to write and easier to understand.

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

The best advise I can give is don't worry about such things just now. Most people will struggle to even complete the coding of their game engine and game using a high level language. If you are worrying about which bits should be optimised using assembler at this early stage then you are either a genius or have possibly lost sight of the bigger picture :)

 

Write good quality high level code and If sections of your code need optimising you can do that later once all the other obstacles have been overcome.

  • Upvote 1

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Ok the "100 times faster" was unreasonably but it think it is usefull to use ASM for stuff like vertex/matrix/vector calculation.Some functions in CPU "extras" like 3DNow! use that too.

 

Do keep in mind, you can have your compiler take full advantage of any feature your processor supports. Though, in most cases, compilers default to featuresets that are common amoung most chipsets of it's type (AMD and Intel for example).

There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?"

Let's make things happen.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...