Direct3D GPU Hacks

I’m catching up on various GPU hacks that exist for Direct3D 9 (things like native shadow mapping, render to vertex buffer, etc.). Turns out there’s a lot of them, but all the information is scattered around the intertubes.

So here are the D3D9 hacks known to me in one place.

Let me know if I missed something or got something wrong. I also want to figure out if Intel GPUs/drivers implement any of them.

17 Responses to 'Direct3D GPU Hacks'

  1. steve

    Nice, I haven’t seen this gathered together in one place before. I had no idea ATI had implemented the old Dx9 shadowmap lookup hack in the HD2xxx+.

    Hacks not in this list that I can think of that we’ve used:
    - Alpha to coverage: (D3DRS_ADAPTIVETESS_Y hack on nv, D3DRS_POINTSIZE on ATI, not sure about any others
    - Coverage Sampled AA (nvidia only?)

  2. Aras Pranckevičius

    @steve: I think I’ve got various forms of transparency anti-aliasing under… “Transparency anti-aliasing” :) How do you turn on CSAA on NVIDIA?

  3. martins

    It is mentioned here: http://developer.nvidia.com/object/coverage-sampled-aa.html

  4. VGP

    Don’t forget ATI’s Fetch4 functionality :

    #define FOURCC_GET4 MAKEFOURCC(‘G’,'E’,'T’,’4′)
    #define FOURCC_GET1 MAKEFOURCC(‘G’,'E’,'T’,’1′)

    setSamplerState(stage, D3DSAMP_MIPMAPLODBIAS, FOURCC_GET4);
    setSamplerState(stage, D3DSAMP_MIPMAPLODBIAS, FOURCC_GET1);

    http://developer.amd.com/gpu_assets/Advanced%20DX9%20Capabilities%20for%20ATI%20Radeon%20Cards_v2.pdf

  5. Aras Pranckevičius

    @steve, @martins, @VGP: thanks for the suggestions. Updated article with CSAA & Fetch4.

  6. modeless

    The fourcc “INST” is used to enable geometry instancing on SM2.0 ATI cards.

    if(d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT,
    D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE,
    (D3DFORMAT) MAKEFOURCC(‘I’,'N’,'S’,'T’)) == D3D_OK))
    device->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC(‘I’,'N’,'S’,'T’));

  7. Aras Pranckevičius

    @modeless: thanks! article updated.

  8. keith

    Thanks, very handy to have. Can you give any more details on ‘Render to Vertex Buffer’ on nVidia cards? Where did you hear some GPUs/drivers support it?

  9. Aras Pranckevičius

    @keith: I just ran custom FOURCC detection code, and it looks like on GeForce 6 & 7 series the driver says “yes!” to R2VB hack. No idea if it works in practice though.

  10. keith

    It seems that that R2VB isn’t supported on nVidia DX10 hardware (8800+), but vertex texture fetching is the preferred path on that hardware anyway. And there are texture format restrictions for using USAGE_DMAP formats on previous generation nVidia cards (only some 16 and 32bit formats are supported). But then the ATI X1xxx cards don’t support VTF. You just can’t win!

  11. Aras Pranckevičius

    Yeah, the awesome joys of developing on a PC… not!

  12. rride

    Hi, I’ve just found one more hack – RESZ, at least for the ATIs cards to resolve a multisample depth buffer into single-sample one

    see here http://developer.amd.com/gpu_assets/Advanced%20DX9%20Capabilities%20for%20ATI%20Radeon%20Cards.pdf

  13. rride

    Oh, sorry, I haven’t noticed that one in your list

  14. Fulg

    Thanks, this is useful! I’ve been developing on consoles for so long, I didn’t keep track of what works and what doesn’t… you get used pretty quickly to fixed hardware specs :)

    Cheers!

  15. Dragon

    Most recent games (GTA4, Dark Void) use new NVidia hack NVCS
    CreateTexture(Width = 24, Height = 1, Levels = 1, Usage = D3DUSAGE_RENDERTARGET, Format = ‘NVCS’, Pool = D3DPOOL_DEFAULT, *ppTexture = 00000000, pSharedHandle = 00000000)

    But I do not know why.

  16. JSeb

    From Amd’s paper, “RESZ” is supported by “HD 2xxx+” (not only “HD 4xxx+”)
    Plus, “The RESZ interface is a good alternative to use for cards that don’t support INTZ.”
    ie you get a INTZ buffer update with an additionnal copy & storage.

  17. Aras Pranckevičius

    @JSeb: it was not reported on Radeon HD 2600 and 3850 that I tried. Maybe I tried too old drivers; don’t remember right now.

Leave a Reply