The Ubuntu 22.04.2 LTS (Jammy Jellyfish) Desktop is hardware accelerated with wayland GPU, so you can use SDL2 with GPU by default on desktop.
sudo apt update
sudo apt upgrade
sudo apt install libsdl2-2.0-0 libsdl2-dev
cd /tmp
git clone https://github.com/libsdl-org/SDL
cd SDL
git checkout release-2.0.20
cd test
./configure
make
export SDL_VIDEODRIVER=wayland
./testgles2
If the installation was completed succesfully OpenGL ES2 Cube Demo should appear in the screen.