News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Directx 9 last shot (at least for now)

Started by felipe, April 17, 2018, 04:50:01 AM

Previous topic - Next topic

daydreamer

Quote from: Siekmanski on April 20, 2018, 05:18:08 AM
Hi daydreamer,
You have to set up the screen first and it delivers you the interface address in return.
Setting up the video device, same story etc.
No need to use CoCreateInstance in DX.
For the function Direct3DCreate9 there is no GUID available to get the interface address with CoCreateInstance.

QuoteI have seen Hitchhikers 1k demos in old forum, so to be able to save size I could make a minimum .inc file like that, so I could be able to post some real d3d9-11 game, so instead of having large lib files included in 512kb I have place for textures instead
but what about you initialize dx adresses to your .data section with most used first and least used last, the 20 most used

We don't use static libs anymore.
Do you trust Microsoft the addresses will be the same in next operating systems?
when and how often the adresses change is exactly what I want to know, if its possible to initalize d3d9 and the most used calls adresses stored easy,maybe the 3 registers that are kept untouched by could hold the 3 most used dxadresses?
and few others pushed on stack
so if I keep adresses on the stack, could those calls simple be called by a RET?

1:do they change on the fly suddenly when running a game?I dont know
2:do they change when user installs a newer GFX and/or GFX driver?probably why it can change
3:do they change when a different dx9 version gets installed?probably can do
4:if I have directx caps on older version than newest ,I wonder if it is because I have a old legacy game installed on newest computer, like Baldurs Gate, is that the reason I can run ancient ddraw code, but others with win10 can't?
but sometimes democoders dont care about it runs on every computer, like RGBA elevated 4k demo is so specialized it only run on one graphics card


my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Siekmanski

1: No, once initialized, they stay the same.
2: Don't know how DX internally communicates with all different GPU drivers, do the COM interfaces gives us the same address values of all interfaces from all different GPU drivers? I don't know.
3: Never checked it.

Demo coders use all the tricks known to get the smallest and fastest demos.
Before entering the competition, they know on what system their demos will run.
Probably also what monitor resolutions are available.
Also for DX they know before, which DX wrapper lib is installed on the demo party sytem.

This is why there often are different release versions of the same demo:
- party release
- final release, should run at least on more sytems.

My philosophy on this is, if you don't enter a demo competition, stay away from all the trickery.
I always "try" to get my proggys running from XP up to Win10.
This is the reason I use Direct3D9 and not the higher versions.
Creative coders use backward thinking techniques as a strategy.

LordAdef

Quote from: jj2007 on April 19, 2018, 10:19:21 AM
Quote from: Siekmanski on April 19, 2018, 06:38:34 AM
    push    FLT4(1.0)

Remember felipe is allergic against macros :eusa_naughty:

Hi Felipe, I understand your style is bound to a more straight asm coding. Just allow me to suggest you have a look at how macros work so you get the barebones of it.

It's a very powerful feature of MASM and it's there for many reasons, and they are all for our benefit.

Since this is the Game forum, I believe it would be very very very hard to make a medium-large game without macros (as it would be for C without inline functions). It would be insane and actually slower..

My game has already more than 6.000 lines. Without macros where suitable... I'd say I couldn't clean any of my own mess.

Again, it's solely a friend's suggestion for reflection.


felipe

Just as a introductory recall:
In relation with we were talking, about why we needed to push the object address before calling some Directx 9 functions, even if in the sdk documentation didn't appear that parameter...

Quote from: felipe on April 20, 2018, 02:26:25 AM
Is something related to the headers file from the sdk? I'm not well versed in that idiom, but i have found lines like this (probably for every method):
Quote#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f)
So that p is the pointer defined implicitly?

Quote from: aw27 on April 20, 2018, 02:55:01 AM
You need pass a "THIS" pointer, so you need as a minimum (according to my example, 2nd call):
push    edi                 ; push it
call    dword ptr[ebx+IDirect3DDevice9_BeginScene] ; call the com interface method

Have a look here and see if it makes some light. If not, keep trying this is not easy at all.

aw27 you were right and me too. I was reading another book for develop games using directx 9. This book uses c++ and in related to functions of some classes says this:
Quote...and WndProc is now a static function
cWindow::WndProc. The function is static because non-static class functions have a hidden first variable passed in (the
this pointer) that is not compatible with the WndProc function declaration.

This high level languages, they just love to hide things... :biggrin: