Skip to main content
GameDev.net gamedev.net
🔒 Locked

Getting Instancing to work on ATI cards

Started by ph33r Jul 14, 2005 at 6:07 PM 7 replies 6k views
Original Post
ph33r
ph33r
I was reading up on instancing and I found out that it can be used on ATI cards here is the quote
Quote:
This feature is only supported on hardware that supports the vertex shader version 3 model or on ATI RADEON 9500 and upwards graphics cards, but if this hardware is available, it runs with every vertex shader version and even on the fixed-function pipeline.
Though, this doesn't make sense because if I run the Instancing sample in the June2005 SDK it says my card (ATI Radeon 9600 mobility) doesn't support hardware instancing. Whats the deal?
Namethatnobodyelsetook
Namethatnobodyelsetook
To DirectX, instancing is available if the card supports Shader Model 3. ATI cards can do instancing, even though they don't have SM3. Microsoft has tied instancing to an unrelated feature instead of adding a caps bit. There are "tricks" to get instancing to work on ATI hardware, though I don't know what they are offhand. MS doesn't support or encourage you to use ATI's tricks.

I can understand both points. MS doesn't want to pollute the spec with hack usages that need to be supported in the future (though they didn't mind nVidia using depth surfaces as textures for shadows). ATI wants to be able to run their card fairly, not hindered by an MS imposed artificial limit.

Many MVPs have made the DirectX team aware that one of our top issues is the ATI instancing problem. Hopefully it'll be solved in a new release shortly, but until then, I say do what you need to do. Check the card names and only attempt the hack on those cards, but go ahead and do the hack.
ph33r
ph33r
Thanks!

Btw for anyone doing a search here is the hack to get it to work

if (caps.VertexShaderVersion >= D3DVS_VERSION(3, 0)){supportsInstancing = true;} else {if (supportsInstancing = (d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE,(D3DFORMAT) MAKEFOURCC('I','N','S','T')) == D3D_OK)){// Enable instancingdev->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('I','N','S','T'));}}
circlesoft
circlesoft
Quote:
Original post by skittleo
Wow, interesting. I had no idea there were hidden features in certain graphics drivers. It makes you wonder if there are more too.

Ah yea, that is very interesting...can anyone actually explain the hack? What does the pointsize render state have to do with the instancing functionality?
circlesoft
circlesoft
Aye, I modified the Instancing sample and got it to work. However, on my 9600XT, it's barely faster than Shader Instancing (anywhere from 1-10 fps, at 300fps). Also, it only works with the Retail D3D runtimes - the Debug runtimes do some type of validation on the SetStreamSourceFreq() functions.
Muhammad Haggag
Muhammad Haggag
Quote:
Original post by circlesoft
Quote:
Original post by skittleo
Wow, interesting. I had no idea there were hidden features in certain graphics drivers. It makes you wonder if there are more too.

Ah yea, that is very interesting...can anyone actually explain the hack? What does the pointsize render state have to do with the instancing functionality?

Nothing. I think the advantage of a size render state is that it can accept a range of values, so the runtime which thinks the card doesn't do instancing can't can't "spoof" the message being passed, and otherwise failing. This wouldn't work with other states that have 'predefined' values (e.g. z-function, for example) where setting an undefined value will cause the runtime to kick yer behind.

EDIT: Just in case you didn't get it. The driver checks for the point-size passed in, and if it's equal to the FOURCC value given, it enables instancing instead. Basically, they embedded a renderstate inside the point-size renderstate.

Sneftel
Sneftel
Wwwwwoooow. Now THERE is a hack. Not to mention quite an advertisement for the OpenGL extension mechanism.
circlesoft
circlesoft
Quote:
Original post by Sneftel
Not to mention quite an advertisement for the OpenGL extension mechanism.

Or for another cap entry - we already have 15,000 of them, why stop now? [smile]
Muhammad Haggag
Muhammad Haggag
Quote:
Original post by Sneftel
Wwwwwoooow. Now THERE is a hack. Not to mention quite an advertisement for the OpenGL extension mechanism.

IMO, it's not quite of an advertisement for the extension mechanism as much as it is a warning against/objection to unfair constraints/capability design. nVidia had to do something similar with their floating-point buffers back then on the FX series.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.