Sign in to follow this  
MrJul

Concern about rendering to texture

Recommended Posts

I know how to render to texture and such. But I have a question about it : Will any texture format work on any card ? Eg can I use D3DFMT_A8R8G8B8 and be sure that it will work everywhere ? Or should I expect error from older graphic cards or screen depth ? Are there any limitations which I must know of ? Thank you.

Share this post


Link to post
Share on other sites
Hi there MrJul,
How are you doing?

The Problem
Render to texture formats. Compatible with all screen cards?

The Solution
It is generally a good idea to test what format the card supports before rendering to the texture or even creating the texture. Checking the Render Target Formats, Back Buffer Formats... etc.. They are very important and can be found using the IDirect3D9::CheckDeviceFormat() method..

I hope this helps buddy.

Share this post


Link to post
Share on other sites
Thanks for your quick reply !

However if the format that I want isn't supported, should I try others until I find a working one ? And then, is DirectX doing all the rest itself ? I mean, if I have to use alpha channels but for some reason no format with alpha is availaible, will DirectX still draw on the texture with skipping transparency ? Or will the call fail ?

There are many possible configuration nowadays for PCs and I am a little lost with all those checking and how to make a DirectX app working everywhere :(

Share this post


Link to post
Share on other sites
Quote:
However if the format that I want isn't supported, should I try others until I find a working one ? And then, is DirectX doing all the rest itself ? I mean, if I have to use alpha channels but for some reason no format with alpha is availaible, will DirectX still draw on the texture with skipping transparency ? Or will the call fail ?


In Managed DirectX at least you'll have some serious issues if you're using a format that isn't available. Most likely you'll get an Invalid Call error when attempting to create the texture with an unsupported format. Unsupported by the initialized device that is, you'll still get the error even when the hardware itself does support the surface format.

However, Managed DX allows you to easily check formats using Manager.CheckDeviceFormat. I'm sure something equivalent exists in Cpp DX too. It's just some extra work really, but if you want to do device initialization properly (ie. 'gracefully degrading' on older cards) you probably will have something similar already in place.

Share this post


Link to post
Share on other sites
Quote:
Original post by MrJul
There are many possible configuration nowadays for PCs and I am a little lost with all those checking and how to make a DirectX app working everywhere :(

Yes, there is a big issues of "Combinatorial Explosion" - it's part of what makes graphics programming fun [lol]

As you've probably noted with commercial titles they DO set a minimum base requirement. Part of this will be due to performance, and part of it will be so that the software doesn't have to worry about handling those odd cases with 7-yr old graphics cards that really don't offer many features.

The way I go about it is identify your preferred format (e.g. D3DFMT_A8R8G8B8) and then offer a couple of fallbacks (e.g. D3DFMT_X8R8G8B8 and D3DFMT_X1R5G5B5/D3DFMT_R5G6B5). Provided you pick sensible fallbacks you should cover about 90% of current hardware - simply declare the remaining cards as incompatible with your game...

Even if you don't actually install it, I highly recommend you pick up the October 2005 DirectX SDK - it has an excel spreadsheet with the D3DCAPS9 results for (what looked like) a wide array of hardware. It might take a while, but you can probably use that to make an informed choice on what formats to support..

Oh, and as Armadon suggeste, always enumerate the features you're after - it's definitely one of the best ways to make robust code [smile]

hth
Jack

Share this post


Link to post
Share on other sites
Thanks for all your replies, especially Jack's one.
I'll have a look at the .xls file and I'll try to support as many cards as possible by checking caps. Damn hardware.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this