BBC BASIC for Windows
« GPU Mandelbrot Viewer »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: GPU Mandelbrot Viewer  (Read 1640 times)
Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx GPU Mandelbrot Viewer
« Thread started on: Nov 16th, 2010, 04:19am »

I have made a GPU Mandelbrot Viewer.

http://tech.groups.yahoo.com/group/bb4w/files/Graphics/MandelBrotGPU%20v1.00b.exe

Controls are:

Cursor Keys : Pan around image
=/- : Increase/Decrease Iteration count.
Right Mouse button : Zoom In
Middle Mouse Button : Zoom Out

The speed of this Mandel Viewer depends entirely on your graphics card so better GPU = faster rendering.

If you have DirextX11, try the program first. It *might* run although you may need to install DirextX9.

It requires DirectX9 already installed on your system and a graphics card capable of pixel shader 3.0. If you don't have DirectX9 you can install it from here :

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displayLang=en

Version History:

Version v1.00b:
1. Made the Maximum iteration count unlimited.

2. Made the frame rate 'unlimited' even faster.

On my desktop system (Quad Xeon, Radeon 5900 ATI graphics card) I get the following frame rates....and I swear these are true!!

All in 'windowed' mode and 'Unlimited' frame rate:
1. Initial view and 63 iterations 2500 fps
2. Zooming way outside set, 63 interations ~5500 fps
3. Zooming way outside set, 1,075,180 iterations ~4800 fps.
4. Zooming to center of set 63 iterations ~1200 fps
5. Zooming to center of set 1,075,180 iterations ~316 fps (can it really do this?)

Note that I still haven't update the colour algorithm to take into account of the number of iterations so you won't actually see anything when the iteration count goes too high...smiley


Version v1.00a (not available anymore) are:
1. Uses a 32x32 pixel texture and then scale transforms this to the screen thus saving a lot of video memory.

2. Fullscreen option. At the moment chooses 1600x1200 display, windowed is 640x512. I will probably add an option for the user to choose the display dimensions themselves.

3. vsync / no vsync option. The no vsync option sets the D3DPRESENT_PARAMETERS.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE. You may therefore see more stuttering/shearing or tearing effects when rendering and you might also see the Mandel Iterations being performed. In windowed mode with 'unlimited' framerate set I can get 100-130 fps with the maximum iteration count.

4. You can set the number of iterations with =/- (+/-) keys. Increasing or decreasing the iteration count by 5% each time. You may see changes in the colour palette as you do this. As yet I have not auto adjusted the Colour to take account of the number of iterations. Minimum iterations is 63 and maximum is 1063 at the moment. I am unsure of the effects on the pixel shader/graphics card of increasing the iteration count too high.

5. Other small bug fixes / code tidy.
« Last Edit: Nov 19th, 2010, 03:23am by Michael Hutton » User IP Logged

Malcolm
Guest
xx Re: GPU Mandelbrot Viewer
« Reply #1 on: Nov 16th, 2010, 9:33pm »

Are you sure about this DX9. It worked for me with DX11 in Win7 and I sure would not want to screw up my machine adding components that might interfere with later versions.

I would say try it first before you start downloading DX9.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: GPU Mandelbrot Viewer
« Reply #2 on: Nov 17th, 2010, 12:40am »

DierectX11 must be backwards compatible with Dx9 or you have previously played a DX9 game and it is preinstalled if it running in your system. It must mean you have the D3DX9.DLL in your system folder somewhere...

You obviously don't need to load the D39 stuff. So stay as you are. Interesting to hear that it worked though.

Michael
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: GPU Mandelbrot Viewer
« Reply #3 on: Nov 17th, 2010, 05:12am »

Get the message:
'Could not find the effect: Mandelbrot'

Am I doing something wrong?

Matt
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: GPU Mandelbrot Viewer
« Reply #4 on: Nov 17th, 2010, 06:03am »

Well, yes and no!

At the moment if you get that error message I am not quite sure what is going on as it seems that the effect is being properly compiled but then not able to 'FindFirstValidTechnique'. I haven't come accross this before and am not sure how to interpret it yet.

Have you got any other information available ie:

1. Operating System
2. DirectX version
3. Graphics card type and memory.
4. anything else you can think of (ha ha)

?

Michael
« Last Edit: Nov 17th, 2010, 06:07am by Michael Hutton » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GPU Mandelbrot Viewer
« Reply #5 on: Nov 17th, 2010, 08:10am »

on Nov 17th, 2010, 06:03am, Michael Hutton wrote:
I haven't come accross this before

I reported the identical error message, which you acknowledged on the group yesterday.

Quote:
I am not quite sure what is going on as it seems that the effect is being properly compiled but then not able to 'FindFirstValidTechnique'

How do you know that the machine has a suitable D3DX9_xx.DLL? For example the highest version on my PC is D3DX9_32.DLL but I've seen several references to D3DX9_42.DLL being required by some programs.

Perhaps it would be helpful if your program reported which DLL it was using, then maybe you could correlate that with success/failure.

Richard.
« Last Edit: Nov 17th, 2010, 09:27am by admin » User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: GPU Mandelbrot Viewer
« Reply #6 on: Nov 17th, 2010, 10:25am »

on Nov 17th, 2010, 08:10am, Richard Russell wrote:
I reported the identical error message, which you acknowledged on the group yesterday.

Yes, I know. I should have said 'come accross it before this end....' <sigh>


on Nov 17th, 2010, 08:10am, Richard Russell wrote:
How do you know that the machine has a suitable D3DX9_xx.DLL? For example the highest version on my PC is D3DX9_32.DLL but I've seen several references to D3DX9_42.DLL being required by some programs.


What is failing is: the ID3DXEffect::FindNextValidTechnique. With a quick search I can't find anything related to different dll versions, but maybe something will get dug up (No doubt by you in a few minutes...).

Code:
      REM ****************************************************************
      REM
      REM Load and compile the Effect file
      REM
      REM ****************************************************************
      IF V% THEN PRINT"Compiling Effect File."
      SYS D3DXCreateEffectFromFile%, pDevice%, ShaderVersion$, 0, 0, 0, 0, ^Effect%, ^Errorlog%
      IF Effect% = 0 THEN
        SYS !(!Errorlog% + 12), Errorlog% TO B%
        ERROR 100, "Failed to Compile Effect. Sorry, you do not appear to be able to compile this shader with your graphics card.."+CHR$13+CHR$13+$$B%
      ENDIF
            
      REM ****************************************************************
      REM
      REM Find the first Valid technique in the Effect file
      REM This is the Mandel effect
      REM
      REM ****************************************************************
      IF V% THEN PRINT"Getting Effect Mandel."
      REM ID3DXEffect::FindNextValidTechnique
      SYS !(!Effect% + 240), Effect%, 0, ^Technique1% TO R%
      IF R% THEN ERROR 100, "Could not find the effect : Mandelbrot"
 


I have recompiled a version to use the _32.dll. If this works for you then that could explain the problem, but it 'works here fine'.

http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/MandelGPU/MandelBrotGPU%20v1.00a%20limited%20to%20D3DX9_32.exe

Btw I am uploading as exes at the moment to keep all the code in one place.. I will publish it all but it needs to be tidied. A lot of device querying could be done.


Oh.... and in fact I think I don't even have to use that function at all.

http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/MandelGPU/MandelBrotGPU%20v1.00a%20limited%20to%20D3DX9_32%20without%20%27that%27%20fn.exe
Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GPU Mandelbrot Viewer
« Reply #7 on: Nov 17th, 2010, 1:23pm »

on Nov 17th, 2010, 10:25am, Michael Hutton wrote:
Oh.... and in fact I think I don't even have to use that function at all.

OK, that version produces no error messages, and reports a frame rate of 85 fps (my native hardware refresh rate) but displays only a black window! Absolutely no graphics displayed at all. sad

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: GPU Mandelbrot Viewer
« Reply #8 on: Nov 17th, 2010, 6:25pm »

I'm using XP with DirectX9 on my netbook. No idea about anything else you might need to know. Not sure where to find out about the graphics 'card'.

Matt
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: GPU Mandelbrot Viewer
« Reply #9 on: Nov 18th, 2010, 12:34am »

on Nov 17th, 2010, 1:23pm, Richard Russell wrote:
OK, that version produces no error messages, and reports a frame rate of 85 fps (my native hardware refresh rate) but displays only a black window! Absolutely no graphics displayed at all. :-(


I am on familiar territory here (blank screens) it happened to me a lot during development and may be related to the shader input

Code:
float4 Mandelbrot_PixelShader(float2 texCoord : SV_Position) : COLOR
 


The shader attempts to take the screen co-ordinates and then iterates them in the complex plane. Now this works 'this end'.

but originally the shader tried to take the texture co-ordinates

Code:
float4 MandelShader(float2 texCoord : TEXCOORD0) : COLOR0
 


which didn't work for me.

Changing that (and the offset to -0.5 rather than the screen dimensions) might work.. :P Also changing the shader versions might help... but it may not compile.

The files are at:
http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/MandelGPU/MandelBrotGPU%20v1.00a%20limited%20to%20D3DX9_32%20without%20%27that%27%20fn.bbc

and

http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/MandelGPU/MandelPixelShader%20v1.00a.fx" target="_blank">
http://tech.groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/MDCH/MandelGPU/MandelPixelShader%20v1.00a.fx

I have 'tidied' up the code and included all the libraries in the program.

Michael
« Last Edit: Nov 18th, 2010, 12:37am by Michael Hutton » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls