During normal execution it isn't possible to switch workarounds. However when running test cases we want to check if shaders and other tests work when work arounds are enabled. Currently shader patches are cached globally. This PR moves the cached shader patch to the device level which is rebuild every time a device needs to be reinitialized. For OpenGL this is also an issue, but harder to solve as the concept device doesn't exist there. Pull Request: https://projects.blender.org/blender/blender/pulls/116042