Author Topic: Strange phenomena  (Read 4091 times)

jj2007

  • Member
  • *****
  • Posts: 8894
  • Assembler is fun ;-)
    • MasmBasic
Re: Strange phenomena
« Reply #30 on: January 12, 2018, 11:42:29 PM »
I am trying desperately to compete with Marinus :P

daydreamer

  • Member
  • ****
  • Posts: 563
  • reach for the stars
Re: Strange phenomena
« Reply #31 on: January 13, 2018, 12:42:13 AM »
The examples are translations of the shadertoy examples, so the credits must go to the guys who wrote the GLSL originals.

I will post the code how to do this kind of stuff if some of you are interested.
At this time the code isn't finished yet to be used in a convenient way.
Now I use 3 steps.

1) a source file to write the HLSL pixel shader code and compile it.
2) a source file to dump the shader code as an include file.
3) the final source file creates the actual Direct3D9 pixel shader stuff as posted here.
so if I start with write something completely using SSE ***ps xmm0,xyzw instructions+SSE2 integer instructions that uses 4 32bit integers and Before output maks use of SSE 3d transform code, would it be easier to port to shadercode?
so without porting to shadercode, if I do all color and light operations internally with SSE, with 4 floats RGBA would I maybe achieve better quality than I would be stuck to old DOS demo Picture quality with only 8bits a channel and with many lighs calculations it probably lose unnesserary information

@jj2007
Points for originality
Quote from Flashdance
Nick  :  When you give up your dream, you die.
*wears a flameproof asbestos suit*

AW

  • Member
  • *****
  • Posts: 1606
  • Let's Make ASM Great Again!
Re: Strange phenomena
« Reply #32 on: January 13, 2018, 12:55:18 AM »
1) a source file to write the HLSL pixel shader code and compile it.
This will include the GLSL to HLSL converter?  :t

Siekmanski

  • Member
  • *****
  • Posts: 1709
Re: Strange phenomena
« Reply #33 on: January 13, 2018, 01:40:52 AM »
@Jochen
Cool!   :biggrin:

@daydreamer2

GPU Pixel shader coding is a different beast, compared to CPU coding.
It has a different architecture than the CPU and has to be programmed in GPU assembly format, or in ( C style ) high level language format. (HLSL, GLSL etc.)

So, you need to learn a new language to program the GPU directly.
It's a total new way of programming mostly using math formulas to get the results.
Every pixel needs his own calculations, but it is executed mega fast, millions of pixels per frame.

Shadertoy, https://www.shadertoy.com/ is a great source to learn pixel shader progamming.
At this moment there are 20.000 examples.

The language they use is WebGL (openGL GLSL) which differs a bit from Direct3D HLSL, it needs to be rewritten before it can be used in my Direct3D pixel shader code.

@aw27

For now, I have to do the GLSL to HLSL conversion by hand.
A build in converter could be an option in the future maybe.
Creative coders use backward thinking techniques as a strategy.

felipe

  • Member
  • *****
  • Posts: 1011
  • Eagles are just great!
Re: Strange phenomena
« Reply #34 on: January 13, 2018, 03:34:39 PM »
jj that's cool too.  :greensml:
Felipe.

FORTRANS

  • Member
  • *****
  • Posts: 1035
Re: Strange phenomena
« Reply #35 on: January 14, 2018, 12:07:39 AM »
Hi,

   Not that it matters, but:  Windows 8.1; runs and looks very
cool.  Windows XP; runs as a blank window.  Windows 2000;
does not run.

Regards,

Steve N.

Siekmanski

  • Member
  • *****
  • Posts: 1709
Re: Strange phenomena
« Reply #36 on: January 14, 2018, 01:57:55 AM »
Hi steve,

The video card must support pixelshader version 3.0 and Direct3d9 from 2003 or later (DirectX9 version c) must be present on the older computers.
The older operating systems didn't include DirectX9c.
I didn't check if pixelshader 3.0 was available in the examples.
When I post the sources it will be implemented.

You can download the latest DirectX9 End-User Runtimes,

DirectX End-User Runtimes (June 2010)
https://www.microsoft.com/en-us/download/details.aspx?id=8109
Creative coders use backward thinking techniques as a strategy.

AW

  • Member
  • *****
  • Posts: 1606
  • Let's Make ASM Great Again!
Re: Strange phenomena
« Reply #37 on: January 14, 2018, 04:34:33 AM »
Shatertoys art rain  (each time you launch the program, a different one, sometime no one  :( , sorry ).
Includes C++ source and a 64-bit release already built.
 
The interesting point is that it includes a primitive GLSL to HLSL converter.

* This is a deep modification of a kodi screensaver https://forum.kodi.tv/forumdisplay.php?fid=178 (they work all more or less the same way).

caballero

  • Member
  • *****
  • Posts: 1099
    • abre ojos ensamblador
Re: Strange phenomena
« Reply #38 on: January 14, 2018, 05:44:37 AM »
When I execute it I get more or less the next error:

This program cannot be init because the D3DCOMPILER_43.dll is missing in your pc. Try reinstalling it... blah blah
En un lugar de la Mancha de cuyo nombre no quiero acordarme

- There are 10 kind of people: those who know binary numbers and those who don't -

AW

  • Member
  • *****
  • Posts: 1606
  • Let's Make ASM Great Again!
Re: Strange phenomena
« Reply #39 on: January 14, 2018, 06:37:35 AM »
When I execute it I get more or less the next error:

This program cannot be init because the D3DCOMPILER_43.dll is missing in your pc. Try reinstalling it... blah blah
I think it is part of the DirectX 11 distribution. Here is the runtime.
https://www.microsoft.com/en-us/download/details.aspx?id=8109

I am checking now in my Windows 10, which has never been used for development and it contains
D3DCOMPILER_43.dll and D3DCOMPILER_47.dll. The usual .dll hell.

caballero

  • Member
  • *****
  • Posts: 1099
    • abre ojos ensamblador
Re: Strange phenomena
« Reply #40 on: January 14, 2018, 07:03:27 AM »
> The usual .dll hell
Yes. I have W7, maybe a bit old for such a new thingies :biggrin:
En un lugar de la Mancha de cuyo nombre no quiero acordarme

- There are 10 kind of people: those who know binary numbers and those who don't -

HSE

  • Member
  • ****
  • Posts: 856
  • <AMD>< 7-32>
Re: Strange phenomena
« Reply #41 on: January 14, 2018, 07:19:59 AM »
Hi Alfonso!
     What means py<<9 ?


Thanks

caballero

  • Member
  • *****
  • Posts: 1099
    • abre ojos ensamblador
Re: Strange phenomena
« Reply #42 on: January 14, 2018, 07:30:17 AM »
 :biggrin:
py << 9
means ShiftLeft py 9 times

Isn't it in another thread? :lol:

Code: [Select]
(py<<9) + (py<<7) + pxThis a faster way of doing
Code: [Select]
py * cdXSize + px
En un lugar de la Mancha de cuyo nombre no quiero acordarme

- There are 10 kind of people: those who know binary numbers and those who don't -

HSE

  • Member
  • ****
  • Posts: 856
  • <AMD>< 7-32>
Re: Strange phenomena
« Reply #43 on: January 14, 2018, 07:42:55 AM »
I don't know   8)

Siekmanski

  • Member
  • *****
  • Posts: 1709
Re: Strange phenomena
« Reply #44 on: January 14, 2018, 10:41:14 AM »
When I execute it I get more or less the next error:

This program cannot be init because the D3DCOMPILER_43.dll is missing in your pc. Try reinstalling it... blah blah
I think it is part of the DirectX 11 distribution. Here is the runtime.
https://www.microsoft.com/en-us/download/details.aspx?id=8109

I am checking now in my Windows 10, which has never been used for development and it contains
D3DCOMPILER_43.dll and D3DCOMPILER_47.dll. The usual .dll hell.

This is the reason I refuse to use one of those many different directx wrapper dlls in my release code.
The user needs to be lucky to have the correct one installed which is often not the case.
Unfortunately d3d9.dll ( is standard present on all windows operating systems from 2003 till now ) doesn't have a shader compiler function in it.
The fully functional Directx 9 shader compiler for shader version 3.0 is available in the wrapper libs D3DX9_32.dll up to D3DX9_43.dll.
If it will run on your computer depends which one of the 12 D3DX9_xx.dll is used by the coder, you as a user need to have the same D3DX9_xx.dll installed, if not, it won't execute.
This is why I choose not to use those D3DX9_xx.dll's in my released programs, but to precompile the shaders and include the pre compiled executable GPU code.
This way I don't bother the user with missing dll messages.

An advantage of this is you can compile the shaders with high optimization and make them faster (sometimes takes minutes to compile...), this is not ideal when when compiling on the fly from within your programs.
A disadvantage is, some pre compiled shaders produce a lot more code in size than the size of an included hlsl shader file.
There is still another way to compile the shaders on the fly from within your program and be successful it will execute.
Searching if there is one of the 12 D3DX9_xx.dlls available on the users computer and call the compiler function by using "LoadLibrary" and "GetProcAddress".

Done some testing with all 12 D3DX9_xx.dll's and guess what? Some of them produce smaller and/or faster code than others. I got the best results with the D3DX9_34.dll, it produces small and fast code and compiles fast.
I'm still not done exploring this fascinating shader stuff, want to do some more tests before posting the sources.
Creative coders use backward thinking techniques as a strategy.