Skip to content

Conversation

@LegNeato
Copy link
Contributor

@LegNeato LegNeato commented Jul 2, 2025

  • Add saveScreenshot() method to capture swapchain images as PPM files
  • Extend benchmark class to support screenshot capture at specified frame
  • Add command-line flags --screenshot and --screenshotframe

This enables automated differential testing (not included in this PR, but trivial to add on top. I am doing so in our Rust fork)

- Add saveScreenshot() method to capture swapchain images as PPM files
- Extend benchmark class to support screenshot capture at specified frame
- Add command-line flags --screenshot and --screenshotframe

This enables automated differential testing (not included in this diff, but trivial to add on top)
@LegNeato
Copy link
Contributor Author

LegNeato commented Jul 3, 2025

(note I am not a C++ programmer so feel free to give pointers and corrections)

@LegNeato
Copy link
Contributor Author

LegNeato commented Jul 4, 2025

FWIW, here is output from my script that scripts the differential testing. Let me know if you want me to put up the script in a future PR:

Testing example: triangle
  Running with glsl shaders...
  ✓ glsl completed
  Running with hlsl shaders...
  ✓ hlsl completed
  Running with slang shaders...
  ✓ slang completed
  Running with rust shaders...
  ✓ rust completed
  Comparing outputs...
  ✓ glsl and hlsl are identical
  ✓ glsl and slang are identical
  ✓ glsl and rust are identical
  ✓ hlsl and slang are identical
  ✓ hlsl and rust are identical
  ✓ slang and rust are identical

Testing example: texture
  Running with glsl shaders...
  ✓ glsl completed
  Running with hlsl shaders...
  ✓ hlsl completed
  Running with slang shaders...
  ✓ slang completed
  Running with rust shaders...
  ✓ rust completed
  Comparing outputs...
  ⚠ glsl and hlsl differ
  ⚠ glsl and slang differ
  ⚠ glsl and rust differ
  ✓ hlsl and slang are identical
  ⚠ hlsl and rust differ
  ⚠ slang and rust differ

Testing example: computeshader
  Running with glsl shaders...
  ✓ glsl completed
  Running with hlsl shaders...
  ✓ hlsl completed
  Running with slang shaders...
  ✓ slang completed
  Running with rust shaders...
  ✓ rust completed
  Comparing outputs...
  ✓ glsl and hlsl are identical
  ✓ glsl and slang are identical
  ⚠ glsl and rust differ
  ✓ hlsl and slang are identical
  ⚠ hlsl and rust differ
  ⚠ slang and rust differ

@SaschaWillems
Copy link
Owner

SaschaWillems commented Jul 4, 2025

Will first need to test if this actually works. I did something similar a few years ago, but ran into issues with sync on some platforms/devices.

No need for the differential testing script from my side though. I like to keep CI small and fast.

@LegNeato
Copy link
Contributor Author

LegNeato commented Jul 4, 2025

Sounds good, no rush! Looks the differential testing isn't that useful on a lot of the output anyway due to float differences. I only tested this on mac with MoltenVK FWIW (which means some shaders were not tested of course).

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