Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d8] Add NVIDIA shadow filtering vendor hack for d3d8 #3536

Closed
wants to merge 5 commits into from

Conversation

AlpyneDreams
Copy link
Contributor

@AlpyneDreams AlpyneDreams commented Jun 24, 2023

Part of #3411, but not a requirement for #3411 to merge.

Features:

  • Some early D3D8 games expect Dref to be on the range of [0..2^bitDepth - 1], so this adds a config option for DXSO and D3D9 fixed function to scale it back down to [0..1]. Source
  • Certain D3D8 games expect hardware to perform shadow filtering when they sample depth textures. This PR adds another config option to enable a basic 2x2 PCF to emulate hardware shadow filtering.

More info:

@AlpyneDreams AlpyneDreams changed the title [d3d9] Add NVIDIA shadow filtering vendor hack [d3d9] Add NVIDIA shadow filtering vendor hack for d3d8 Jun 24, 2023
@AlpyneDreams AlpyneDreams changed the title [d3d9] Add NVIDIA shadow filtering vendor hack for d3d8 [d3d8] Add NVIDIA shadow filtering vendor hack for d3d8 Jun 27, 2023
@AlpyneDreams
Copy link
Contributor Author

AlpyneDreams commented Jun 27, 2023

Goals:

  • Re-implement for DXSO ideally without a spec constant.
  • Re-implement in fixed function renderer ideally without extending the PS shader key (want to avoid variants).
    • Use D3D9FixedFunctionOptions if necessary to configure behavior
    • Had to use shader key for now. When fixed function is rewritten it can be checked at runtime.
  • Try to avoid conditionals in the pixel shader too
  • Should also work with Splinter Cell: Pandora Tomorrow as well as Splinter Cell
    • And be applicable for other games

Options:

  • Best case: entirely hard-coded based on texture type and config settings for both FF and DXSO
  • Push constants have more room than spec constants
  • Extending D3D9SharedPS is also an option

Questions:

  • Can the Dref scale factor be hard-coded per-game (e.g. if game only uses D24S8) or per-shader (most likely case assuming games never bind more than one depth texture in a shader anyway)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants