News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Fun with Pixel Shaders and maths

Started by Siekmanski, February 07, 2018, 09:23:15 AM

Previous topic - Next topic

TimoVJL

With 9 kB asm source can generate a 127 kB exe with simple trick, a big ICO  :thumbsup:
Size matters, sometimes not lives.
May the source be with you

Siekmanski

#61
Quote from: jj2007 on December 23, 2023, 01:08:35 AMIt hangs with its cpu core at 100%. My Win10 system has C:\Windows\System32\d3dxof.dll but no C:\Windows\System32\d3dx_??.dll, so LoadLibrary fails; and my *of* does not know about D3DXCompileShaderFromFileA :cool:

To avoid the hanging program, you should give up after the last attempt and shout at the user.

Apart from that minor glitch, it's a nice project :thumbsup:

Hi Jochen,

It's not a glitch, read the first post which explains it all.
This was exactly the reason why I coded the Pixel Shader Compiler so the end user wouldn't have this problem.

QuoteMy goal was to use pixel shaders in Direct3D9.
Unfortunately d3d9.dll ( which is standard present on all windows operating systems from 2003 till now ) doesn't have a shader compiler function.
The fully functional DirectX9 shader compiler function for shader version 3.0 is available in the wrapper libs D3DX9_32.dll up to D3DX9_43.dll.

So I programmed a small ShaderCompiler program that searches if one of the 12 D3DX9_xx.dlls is available on the developers computer and calls the compiler function by using "LoadLibrary" and "GetProcAddress".
The compiled pixel shader code can be saved as pre-compiled GPU code.

The pre-compiled GPU code can be included and executed from your program without the presence of one of the 12 D3DX9_xx.dlls on the end-users computer.
This way we don't bother the end-user with missing D3DX9_xx.dll messages.


As a pixel shader developer your computer must have at least one of the 12 D3DX9_xx.dlls present to compile the pixel shader code.

You can download the latest DirectX9 End-User Runtimes here:
DirectX End-User Runtimes (June 2010)
https://www.microsoft.com/en-us/download/details.aspx?id=8109

This way you can show your amazing pixel shaders only using d3d9.dll ( which is standard present on all windows operating systems from 2003 till now )
Creative coders use backward thinking techniques as a strategy.

daydreamer

Quote from: TimoVJL on December 23, 2023, 09:36:42 AMWith 9 kB asm source can generate a 127 kB exe with simple trick, a big ICO  :thumbsup:
Size matters, sometimes not lives.
Check hitchhikers  two 1k d3d9 shader demos in old UK Forum?
Put d3d headers on diet to bare minimum to put up quad and start tiny pixelshader
Wouldn't that be possible too with newer d3d12 header files?
I only managed to put ddraw included libs on diet,by removing including gdi, because you can draw everything with d3d except when you need to draw text

Humans do not care of trees lives, when they need to power their fossil powerplants, to power many power hungry consoles and gaming computers to load bloat on 800 watt / hour, play games loads of hours
So 64k demo running few minutes on newer mobile gpu cards in laptop 40w / hour, few W / hour when idle
Lot nicer to environment, but also to your wallet not needing pay big electric bills

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

QuoteCheck hitchhikers  two 1k d3d9 shader demos in old UK Forum?
Put d3d headers on diet to bare minimum to put up quad and start tiny pixelshader.

Then you have the same problem -> missing D3DX9_xx.dlls

With my code which only uses d3d9.dll, it will run from Windows XP and up, without extra dll's

Quotebecause you can draw everything with d3d except when you need to draw text.

I have a text drawing routine included in my D3D9 libs.  :cool:
Creative coders use backward thinking techniques as a strategy.

jj2007

Quote from: Siekmanski on December 23, 2023, 04:19:48 PMHi Jochen,

It's not a glitch, read the first post which explains it all.

Thanks, Marinus :thumbsup:

My fault, I had assumed I could skip reading your post, which is 5 years old.

The problem here is that Win10 has only one C:\Windows\System32\d3dxof.dll - it doesn't fit into the d3dx_xx.dll scheme (no understroke), Xylitol's program doesn't find it, and even if it did, GetProcAddress would miserably fail. Plus, there is no message to the user, and instead the program enters a loop at 100% cpu load. Not exactly a Christmas present ;-)

TimoVJL

May the source be with you

jj2007

QuoteFor Direct3D 11 users, the recommendation is to switch from D3DX11 to one of many open-source replacements

Interesting advice from Microsoft :biggrin:

NoCforMe

OK, dumb question:

I know nothing about Direct3D and all its associated stuff--compute shaders, etc., etc.

I just took a look at the Micro$oft introductory documentation on this: it's extensive, voluminous and about as clear as mud.

So my first question is, what the hell is Direct3D, really? I mean on a very basic level: what exactly does it do? can I see some examples of what it does and how it works? an understandable explanation of why it exists?

I use GDI, and a very little GDI+, which is the extent of my understanding of Win32 graphics stuff.

Help me get a handle on this, please.
Assembly language programming should be fun. That's why I do it.

Siekmanski

Direct3D is mainly used to write games.
Direct3D gives you full access to all the capabilities of the video card.  :cool:  :thumbsup:
Creative coders use backward thinking techniques as a strategy.


HSE

Quote from: Xylitol on December 22, 2023, 11:54:07 PMHere is my fork, i ported it to Dialogbox, tweaked a bit the ShaderCompiler to load file and compile the .hlsl on the fly with also a selector for the d3dx optimization flags.

:thumbsup: Very nice!
Equations in Assembly: SmplMath

daydreamer

#71
Quote from: Siekmanski on December 24, 2023, 11:02:35 AMDirect3D is mainly used to write games.
Direct3D gives you full access to all the capabilities of the video card.  :cool:  :thumbsup:
but I mostly used DDRAW together with SSE to draw fast directly to screen memory
the different kind of mindset needed for pixelshaders is hard for me to master writing cool demos with
still some asm code is inspired by inverse way of computing each pixel by calculate pythagoras when drawing circles 
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