ShaderReloadSoakTest.bv.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. -- WARNING: This is a soak test, do not add this test to the fully automated
  12. -- test suites.
  13. OpenSample('RPI/ShaderReloadTest')
  14. ResizeViewport(500, 500)
  15. function TestButton(buttonName)
  16. AssetTracking_Start()
  17. AssetTracking_ExpectAsset("shaders/shaderreloadtest/temp/fullscreen.shader")
  18. SetImguiValue(buttonName, true)
  19. AssetTracking_IdleUntilExpectedAssetsFinish(10)
  20. -- Even though the shader has been recompiled, it takes a few frames
  21. -- for the notification to bubble up and get the screen refreshed.
  22. IdleSeconds(0.25)
  23. SetShowImGui(false)
  24. SetImguiValue('Check color', true)
  25. -- Need a few frames to capture the screen and compare expected color.
  26. IdleSeconds(0.25)
  27. SetShowImGui(true)
  28. end
  29. -- Fixme. As a Soak Test, this should run for a long time and exit
  30. -- on the first failure, or upon user request.
  31. for i=1,5 do
  32. -- Always start with "Green shader" or "Blue shader" because when RPI/ShaderReloadTest
  33. -- activates it starts with the "Red shader", so updating the source asset
  34. --- to the exact same content won't trigger asset recompilation.
  35. TestButton("Green shader")
  36. TestButton("Blue shader")
  37. TestButton("Red shader")
  38. end