Jump to content
  • Advertisement
Sign in to follow this  
Bart Masschelein

[SlimDX] SupportsHardwareTransformAndLight

This topic is 3689 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to detect if the graphics device support hardware vertex processing or not, preferably before creating the device and checking the result. In MDX, there is SupportsHardwareTransformAndLight for this. I did not find a counterpart in SlimDX. Does somebody knows what happens behind the scene of this method call, or in other words, which caps should be verified to know whether the device supports HW VP? Bart

Share this post


Link to post
Share on other sites
Advertisement
I've tried what you suggest before:

bool tmp = d3d.CheckDeviceType(0, DeviceType.Hardware, Format.Unknown, Format.Unknown, true);

but I got a false, although I'm sure the machine I'm running this on supports HW Vertex Processing. Very likely it is because I filled in the remaining parameters quick and dirty to unknown.

Anyway, browsing a bit further through the SlimDX code, I found that this gives me the correct answer on two different machines (one with, and one without HWVP capabilities)

DeviceCaps dc = caps.DeviceCaps;
bool HW = (dc & DeviceCaps.HWTransformAndLight) != 0;

Of course, here we assume that this flag also means that hardware vertex processing is possible, but it is the same as DirectX does, if nothing else happens in the SupportsHardwareTransformAndLight method.

Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by Bart Masschelein
Anyway, browsing a bit further through the SlimDX code, I found that this gives me the correct answer on two different machines (one with, and one without HWVP capabilities)

DeviceCaps dc = caps.DeviceCaps;
bool HW = (dc & DeviceCaps.HWTransformAndLight) != 0;

Of course, here we assume that this flag also means that hardware vertex processing is possible, but it is the same as DirectX does, if nothing else happens in the SupportsHardwareTransformAndLight method.

Thanks!
That flag tells you if the card can do Hardware TnL (Is GeForce 2 or above). It doesn't tell you if you can run vertex shaders in hardware though. Is that what you want?

Share this post


Link to post
Share on other sites
>> That flag tells you if the card can do Hardware TnL (Is GeForce 2 or above). It doesn't tell you if you can run vertex shaders in hardware though. Is that what you want?

That would make sense, based on their naming. What I actually want is the latter, namely checking if I can run vertex shaders in hardware or not. But on several MDX sites (even on the MSDN blogsphere: http://blogs.msdn.com/coding4fun/archive/2006/11/03/940223.aspx), I found the following snippet:

// Check the capabilities of the graphcis card is capable of
// performing the vertex-processing operations
// The HardwareVertexProcessing choice is the best
if (caps.DeviceCaps.SupportsHardwareTransformAndLight)
{
createFlags = CreateFlags.HardwareVertexProcessing;
}
else
{
createFlags = CreateFlags.SoftwareVertexProcessing;
}

So although they have a different meaning, apparently one can assume that if the device supports HardwareTransformAndLight, also hardware vertex processing is supported. Is this generally true? Or their architectures known where this is not the case?

Share this post


Link to post
Share on other sites
I'd simply try to create the device with hardware processing, and if that fails then try again with software. If neither works then show an error message.

You can use the device caps to check for any other features you require, like the appropriate version of vertex / pixel shaders.

Share this post


Link to post
Share on other sites
Hardware Transform and Light is what is typically known as Hardware TnL in short, and was introduced as a feature with the original GeForce I believe. It's the ability of the card to process vertices at all in hardware. This is all fixed function stuff. If you want to check whether the device can run the shader you want, you'll need to check the VS shader version in the caps for that device. Software vertex processing will frequently give you vertex shader versions that are not available in hardware on older cards. A version of 0.0 means the device as specified cannot handle that type of shader and is fixed function only.

Share this post


Link to post
Share on other sites
Quote:
Original post by Adam_42
I'd simply try to create the device with hardware processing, and if that fails then try again with software. If neither works then show an error message.

You can use the device caps to check for any other features you require, like the appropriate version of vertex / pixel shaders.
I'd avoid that, it's not very "clean" to do that, and the device might fail to create for other reasons. It's better to check for support first.

Quote:
Original post by Bart Masschelein
So although they have a different meaning, apparently one can assume that if the device supports HardwareTransformAndLight, also hardware vertex processing is supported. Is this generally true? Or their architectures known where this is not the case?
No - HardwareTransformAndLight tells you that the graphics card can do transformation and lighting in hardware, not that it can run custom vertex programs. The GeForce 2 can only run fixed function vertex shading in hardware, not vertex shaders (as far as I know).

if you're using the fixed function, then SupportsHardwareTransformAndLight is what you want, if you want to know if vertex shaders are supported, you need to check the VertexShaderVersion member of the D3DCAPS9 struct (Not sure what it is in SlimDX), to make sure that the card can support the version of vertex shaders you're using (And similarly for pixel shaders if you need them).


EDIT: Bah, too slow [smile]

Share this post


Link to post
Share on other sites
>> I'd avoid that, it's not very "clean" to do that, and the device might fail to create for other reasons. It's better to check for support first.

I agree on that one.

>> No

I'm following (about checking the TnL).

So checking the VS version is apparently the preffered way. On one machine, which has a nVidia 8400, I get VertexShaderVersion is 3.0. On a laptop, with only an Intel GMA or similar, I get VertexShaderVersion equal to 0.0. So this means there is no hardware vertex processing support, and hence I can safely assume that I use SoftwareVertexProcessing?

If all of this is correct, how can I extract the VS version for the software version then? Or is this fixed from within the DirectX SDK?

Bart


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!