Com C++ or and assembler

Started by
10 comments, last by spawn_thang 11 years, 11 months ago
Hello,

This post is to check what I understand is right or not and is about COM. I have understood that COM objects / interfaces are written in C++ and COM was created for C++ and that is what is used to create a COM object / COM interface.

So, my question is really this : Would it be possible to create a COM object or a function that the interface called using Assembler ?

MY guess is that it would not be possible and is not done but on the other hand, it might be possible and if it is possible does Direct X use any assembler driven functionality ?

Thanks,

Robert.
Advertisement
Hello,

If I understand you correctly, you want to know if it's possible to call COM objects from assembler code.

The layout of COM objects is not C++ specific, and with a little trickery it should be possible to call and COM objects from assembler. Here is a little article about the memory layout to get you started: http://blogs.msdn.com/b/oldnewthing/archive/2004/02/05/68017.aspx
COM very accurately specifies the binary structure of its objects (= what the C++ compiler spews out, eg. that classes must use a vtable, where this vtable is located, etc.). That is one of COM's purposes: to allow multiple programming languages to work together.

You can use as well as create COM objects in assembly, C++, Visual Basic 6, .NET, Delphi and many other languages.
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Ah HA, Thanks.
Anything that can be done on your CPU can be done in assembler. After all - your computer only executes machine code, and assembler is just machine code for humans.

One of the moderators was doing this just the other day:


I wouldn't recommend it, it looks rather tedious.


... does Direct X use any assembler driven functionality?
[/quote]
Direct X doesn't (intentionally) expose anything interesting to clients written directly in assembly that isn't available to clients in high level languages.

Just in case you are not aware, high performance in modern graphics programming is not achieved by hand-coding assembly. Your research time would be better dedicated to ensuring you are efficiently batching the data to be drawn rather than wasted wondering about assembly. Unless you are bored and looking for a coding challenge like Washu, I don't think it is worth it.
Hello again,

Yeah, reading through the replies, especially the last one, I have a question because for a long time I got stuck on a problem and I figure it has something to do with Opengl having better maths libraries than Direct X. For, in an article that compares direct X to Opengl it mentioned that no one uses Direct X to create Scientifically precise applications. And since a 3D Modeler comes under the heading of a scientifically precise application. I was led to believe that it was not possible to create a 3d editor using Direct X unless a math library that included for instance, a more precise rotation matrix was created by the developer. So, that when a calculation needed a better result than Direct X could provide, the developers math library could be uses to calculate the required result which would then pass the results back to the Direct X object.

And this is why, I was wondering if any of the interfaces were written in assembler, for I had seemed to me that it might be possible to get better results if rotation math were performed in assembler and then passed back to the object. For, the level of error in the Direct X rotation matrix seem to be fairly serious.

Anyhow's, those are the lines I have been thinking along.

Hello again,

Yeah, reading through the replies, especially the last one, I have a question because for a long time I got stuck on a problem and I figure it has something to do with Opengl having better maths libraries than Direct X. For, in an article that compares direct X to Opengl it mentioned that no one uses Direct X to create Scientifically precise applications. And since a 3D Modeler comes under the heading of a scientifically precise application. I was led to believe that it was not possible to create a 3d editor using Direct X unless a math library that included for instance, a more precise rotation matrix was created by the developer. So, that when a calculation needed a better result than Direct X could provide, the developers math library could be uses to calculate the required result which would then pass the results back to the Direct X object.

No. OpenGL does not have better "math" than DirectX. They do pretty much IDENTICAL work as far as the graphics pipeline goes. The primary reason why OpenGL was the main goto thing for "scientific" computing has pretty much NOTHING to do with accuracy (accuracy is achieved through the use of bignum libraries. Not through graphics APIs). It has to do with a scientists limited knowledge set. Most scientists can program in C, or C++, or Delphi or similar languages. But they're not very good at it. When you're trying to visualize the data output from an n-body simulation the easiest thing in the world to do is simply use OpenGL immediate mode. Not to mention, some of these folks aren't running on Windows machines.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.


... it might be possible to get better results if rotation math were performed in assembler.
[/quote]
Nope.
Ah, okay. So how can the accuracy of the rotation matrices be improved ?
Okay, from reading back through this today, I see two options to improve the accuracy of matrix rotations :
1) Pass the matrix data to a big num library.
2) Use Quaternions instead of matrices.


Also, it has to be said, there is nothing out there written in Direct X that can touch Blender which is written in Opengl and there must be a good reason for that, one I guess is that Opengl has a huge and very accurate Math library.

This topic is closed to new replies.

Advertisement