Archived

This topic is now archived and is closed to further replies.

Lohrno

Intercompatibility problems...

Recommended Posts

I''m having trouble getting my program to work on my friends'' computer. Basically its a program that displays surfaces in D3D. On my computer, (Windows XP, GeForce3, DX 8.1) it works normally, but on one of his computers without hardware accel, it repeats the cursor over and over. I tried setting each pixel to the backbuffer, I tried changing the D3DSWAPEFECT, and it still doesnt seem to work with his computer. I even created the Direct3d Device using the REF flag, and it still doesnt work...here is how I created the device:
  
 d3dpp.BackBufferWidth = Width;
 d3dpp.BackBufferHeight = Height;  //Set Width and height of back buffer

 d3dpp.BackBufferFormat = bWindowed ? d3ddm.Format : FullScreenFormat;  //Set Format for back buffer

 d3dpp.BackBufferCount = 1;  //Set number of back buffers

 d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;  //Set no multisampling

 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; //Set so need to always refresh backbuffer

 d3dpp.hDeviceWindow = hWndTarget; //set handle to window we want to render to

 d3dpp.Windowed = bWindowed;  //Windowed or full screen?

 d3dpp.EnableAutoDepthStencil = TRUE;  //lets Direct3d handle depth buffer

 d3dpp.AutoDepthStencilFormat = D3DFMT_D16; //depth buffer format is 16 bit


 d3dpp.FullScreen_RefreshRateInHz = 0;  //Use default refresh rate


 d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
 d3dpp.FullScreen_PresentationInterval = bWindowed ? 0 : D3DPRESENT_INTERVAL_IMMEDIATE;
 r = pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWndTarget, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, ppDevice);
  
Any clues? -Lohrno

Share this post


Link to post
Share on other sites
1. The REF device is only present in the SDK, its intended as a development tool rather than a generic software device - if your friend doesn''t have the SDK installed, REF devices won''t work on his machine.

2. Asking for a _LOCKABLE_BACKBUFFER can be asking for quite a lot on some hardware - don''t set that unless you absolutely need it and have no other way of achieving the same result.

3. Put some error handling into your program - for example you could make a function which passes any HRESULTs into DXGetErrorDescription8() before outputting the result to a file or a message box - when the program goes wrong on your friends computer you simply take a look at the log file on his machine...


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Ok...now comes the newb questions =)

1) How do you write to the backbuffer without locking it?
Dont you have to lock it first?

2) How do I ask for a software device instead of a hardware
device...? like if I''m afraid that HAL wont work on all machines,
what would be the setting for non HAL?

-Lohrno

Share this post


Link to post
Share on other sites
1) Draw*Primitive*() - it''ll get you far higher performance than locking the buffer and writing the pixels. People pay money for graphics *accelerators*, i.e. they expect the speed of their graphics card to make a difference to the performance of graphics intensive programs.
If you lock the buffer and plot all the pixels with the CPU, then you''re ignoring 99.99% of the hardware acceleration, and even if you are doing some rendering with Draw*Primitive*(), as soon as you Lock(), you stall the graphics card and lose all multiprocessing (parallelism) benefits.


2) If you need a software device which performs at a decent(ish) speed, you either:
a. Use DirectX 7 interfaces and create an RGB device OR
b. Use a 3rd party software device (e.g. Surrender3D etc)

MS considered adding a plug-in software device which they were planning on shipping separately to the SDK - but apparently after research into how many people had hardware rasterisation capable cards versus those without and the amount of time it would have taken to rewrite the software renderer to work with the DX8 interfaces, they decided not to implement the software device in DX8. There is even talk about removing the plugin interface too (you''d need the DDK to write one anyway).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Actually I was hoping to write a simple 2d game using Direct3D
8 surfaces, and I was hoping to make it compatible with people
who did not have 3d cards, but oh well...

-=Lohrno

Share this post


Link to post
Share on other sites
You don''t have to lock the backbuffer to write to it. Draw*Primitive* writes to backbuffer. You only have to lock and write to index/vertex buffers.

Share this post


Link to post
Share on other sites