toggle between hw/sw renderer?

Is it possible to toggle between hardware acceleration and a generic software renderer?

If I’m not mistaken, DirectX allows you to do this.

The reason I ask this question is that I am creating a suite of test programs that are interactive, and I want every test program to have the ability to toggle between hardware acceleration and a generic software renderer.