ShaderReloadSoakTest.bv.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. RunScript("scripts/TestEnvironment.luac")
  14. OpenSample('RPI/ShaderReloadTest')
  15. ResizeViewport(500, 500)
  16. function TestButton(buttonName)
  17. AssetTracking_Start()
  18. AssetTracking_ExpectAsset("shaders/shaderreloadtest/temp/fullscreen.shader")
  19. SetImguiValue(buttonName, true)
  20. AssetTracking_IdleUntilExpectedAssetsFinish(10)
  21. -- Even though the shader has been recompiled, it takes a few frames
  22. -- for the notification to bubble up and get the screen refreshed.
  23. IdleSeconds(0.25)
  24. SetShowImGui(false)
  25. SetImguiValue('Check color', true)
  26. -- Need a few frames to capture the screen and compare expected color.
  27. IdleSeconds(0.25)
  28. SetShowImGui(true)
  29. end
  30. -- Fixme. As a Soak Test, this should run for a long time and exit
  31. -- on the first failure, or upon user request.
  32. for i=1,5 do
  33. -- Always start with "Green shader" or "Blue shader" because when RPI/ShaderReloadTest
  34. -- activates it starts with the "Red shader", so updating the source asset
  35. --- to the exact same content won't trigger asset recompilation.
  36. TestButton("Green shader")
  37. TestButton("Blue shader")
  38. TestButton("Red shader")
  39. end