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

Shader sanitization #1530

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

colincornaby
Copy link
Contributor

Plasma's shaders were written in assembly - which also carried to the Metal implementation.

Goals in this branch:

  • The shaders should be written in clear code with proper variable names and functions where applicable.
  • Algorithms should be documented.
  • Any fast math assembly should be replaced with modern fast math functions where available. It is ok to drift from the HLSL 1.1 fast math code where imperceptible.
  • Shaders should be clearly reviewable and easy to port to other languages.

For water shaders in particular, Chapter 1 of GPU Gems is a good reference:
https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-1-effective-water-simulation-physical-models

There is a C code version of a water shader available here:
https://http.download.nvidia.com/developer/GPU_Gems/CD_Image/Index.html

Please note the shader supplied in GPU Gems does not appear to be the exact same shader that shipped with Uru.

// Plasma
//
// Created by Colin Cornaby on 12/29/22.
//
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the wrong headers made it in. I'll correct eventually - but this PR is just a draft right now.

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.

1 participant