Advertisement

Low level drawing on screen whit gpu some kind of secret knowladge

Started by August 07, 2022 09:17 AM
14 comments, last by Hodgman 2 years, 3 months ago

Yes, it is how the physical hardware works, and how it has worked for several decades.

It does not need to be DirectX, but the days of the display being a block of CPU available memory ended back around 1987. EGA displays were the last to do it, VGA displays emulated it for compatability. It has been about giving instructions to the card over the bus ever since.

I still recall $B0000 and $B8000 as the old addresses, and on VGA using a hardware mapped address at $A0000, but it was an eternity ago in computer time, back in 16-bit systems and memory pages rather than fully addressable flat memory models. Those days are long gone for PC development, good riddance.

foxo said:

@DirectX9 direct X just to display a bitmap ….

I would use GDI just to display a bitmap, and Direct X for games.

Advertisement

BitBlt function can display a bitmap with good performance.

If you want to learn more about displaying/manipulating Bitmaps with GDI, here are some references I suggest:

If you want something simpler to use, you can instead use GDI+ to display the Bitmap. https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-loading-and-displaying-bitmaps-use

Note that GDI+ is a C++ (object oriented) API. It also has a flat C API. More info about the flat api in general is here and the flat API functions for Bitmap are found here​.

Here's a video on how to draw lines and such at the Win32 HWND API level.

This is a good way to get started. It's not a good base to build on for anything elaborate.

It's not

foxo said:

I also realised that gpu drivers and extremely low level gpu programming are some kind a ‘secret’ knoladge that nobody know how to do except the elit at vulkan and other specialised company that won't tell us there ‘secrets’. that's why I am asking : How to draw from gpu to the screen or on a winuser window whiout any fancy specialised api ,only low level programming ?

It's not very secret – you can download the code for the open source Linux drivers for any GPU to learn how to program them directly…

But if you do that, you'll be writing code that programs one specific type of GPU hardware directly. Your program will not be portable to any other GPU… which is why we invented device drivers in the first place.

So, the OS will have a low-level GPU driver interface that you could program against instead… but that level is also extremely cumbersome (If you think Vulkan is hard, this is much worse…)… So you really don't want to try and use this layer directly.

The next layer of abstraction above that is… Direct3D11, Direct3D12, Vulkan and OpenGL 4. Really.

OpenGL may be “dead”, but if you have an NVidia GPU, the amount of translation that the driver does between GL4.x calls and it sending commands to the actual GPU driver is actually quite small, so it's still a pretty “low level” option in the end ?

This topic is closed to new replies.

Advertisement