Skip to content

Commit 94edc13

Browse files
authored
Add files via upload
0 parents  commit 94edc13

File tree

7 files changed

+150
-0
lines changed

7 files changed

+150
-0
lines changed

amdgpu-opengl-switcher.spec

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Name: amdgpu-opengl-switcher
2+
Version: 1
3+
Release: 0%{?dist}
4+
License: GPL
5+
Group: Unspecified
6+
Summary: Select needed OpenGL implementation with gl_mesa, gl_zink or gl_pro prefix
7+
8+
9+
URL: https://github.com/Ashark/archlinux-amdgpu-pro/blob/master/progl
10+
11+
12+
13+
14+
15+
16+
Provides: amdgpu-opengl-switcher = 1-0.fc36
17+
Provides: amdgpu-opengl-switcher(x86-64) = 1-0.fc36
18+
Requires: /usr/bin/bash
19+
20+
%install
21+
tar -xf amdgpu-opengl-switcher-1-0.f36.x86_64.tar.gz
22+
mv usr %{buildroot}/
23+
24+
%description
25+
Select needed opengl implementation with gl_mesa, gl_zink or gl_pro prefix
26+
%files
27+
%attr(0755, root, root) "/usr/bin/gl_zink"
28+
%attr(0755, root, root) "/usr/bin/gl_pro"
29+
%attr(0755, root, root) "/usr/bin/gl_mesa"
30+
%attr(0644, root, root) "/usr/share/bash-completion/completions/gl_zink"
31+
%attr(0644, root, root) "/usr/share/bash-completion/completions/gl_pro"
32+
%attr(0644, root, root) "/usr/share/bash-completion/completions/gl_mesa"
33+

src/usr/bin/gl_mesa

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/bash
2+
3+
# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application.
4+
# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility.
5+
#
6+
# Usage:
7+
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
8+
# For example:
9+
# $ gl_pro davinci-resolve
10+
# This will start davinci resolve with AMDGPU PRO OpenGL driver.
11+
12+
gl_mesa() {
13+
export __GLX_VENDOR_LIBRARY_NAME=mesa
14+
}
15+
16+
gl_zink() {
17+
export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink
18+
}
19+
20+
gl_pro() {
21+
export LD_LIBRARY_PATH="/opt/amdgpu-pro/OpenGL/lib64:/opt/amdgpu-pro/OpenGL/lib:${LD_LIBRARY_PATH}" LIBGL_DRIVERS_PATH="/opt/amdgpu-pro/OpenGL/lib64/dri:/opt/amdgpu-pro/OpenGL/lib/dri"
22+
}
23+
24+
if [[ $(basename $0) == gl_mesa ]]; then
25+
gl_mesa
26+
elif [[ $(basename $0) == gl_zink ]]; then
27+
gl_zink
28+
elif [[ $(basename $0) == gl_pro ]]; then
29+
gl_pro
30+
else
31+
echo "Unknown function"
32+
exit 1
33+
fi
34+
35+
# applied variables, now execute the rest of the command
36+
"$@"

src/usr/bin/gl_pro

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/bash
2+
3+
# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application.
4+
# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility.
5+
#
6+
# Usage:
7+
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
8+
# For example:
9+
# $ gl_pro davinci-resolve
10+
# This will start davinci resolve with AMDGPU PRO OpenGL driver.
11+
12+
gl_mesa() {
13+
export __GLX_VENDOR_LIBRARY_NAME=mesa
14+
}
15+
16+
gl_zink() {
17+
export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink
18+
}
19+
20+
gl_pro() {
21+
export LD_LIBRARY_PATH="/opt/amdgpu-pro/OpenGL/lib64:/opt/amdgpu-pro/OpenGL/lib:${LD_LIBRARY_PATH}" LIBGL_DRIVERS_PATH="/opt/amdgpu-pro/OpenGL/lib64/dri:/opt/amdgpu-pro/OpenGL/lib/dri"
22+
}
23+
24+
if [[ $(basename $0) == gl_mesa ]]; then
25+
gl_mesa
26+
elif [[ $(basename $0) == gl_zink ]]; then
27+
gl_zink
28+
elif [[ $(basename $0) == gl_pro ]]; then
29+
gl_pro
30+
else
31+
echo "Unknown function"
32+
exit 1
33+
fi
34+
35+
# applied variables, now execute the rest of the command
36+
"$@"

src/usr/bin/gl_zink

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/bash
2+
3+
# This script applies amdogl-pro/zink/mesa OpenGL driver for specific application.
4+
# You can test the difference (GL_VENDOR, GL_RENDERER, GL_VERSION) with glmark2 utility.
5+
#
6+
# Usage:
7+
# <gl_mesa|gl_zink|gl_pro> <app and its parameters>
8+
# For example:
9+
# $ gl_pro davinci-resolve
10+
# This will start davinci resolve with AMDGPU PRO OpenGL driver.
11+
12+
gl_mesa() {
13+
export __GLX_VENDOR_LIBRARY_NAME=mesa
14+
}
15+
16+
gl_zink() {
17+
export __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink
18+
}
19+
20+
gl_pro() {
21+
export LD_LIBRARY_PATH="/opt/amdgpu-pro/OpenGL/lib64:/opt/amdgpu-pro/OpenGL/lib:${LD_LIBRARY_PATH}" LIBGL_DRIVERS_PATH="/opt/amdgpu-pro/OpenGL/lib64/dri:/opt/amdgpu-pro/OpenGL/lib/dri"
22+
}
23+
24+
if [[ $(basename $0) == gl_mesa ]]; then
25+
gl_mesa
26+
elif [[ $(basename $0) == gl_zink ]]; then
27+
gl_zink
28+
elif [[ $(basename $0) == gl_pro ]]; then
29+
gl_pro
30+
else
31+
echo "Unknown function"
32+
exit 1
33+
fi
34+
35+
# applied variables, now execute the rest of the command
36+
"$@"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_have gl_mesa && complete -F _command gl_mesa
2+
_have gl_zink && complete -F _command gl_zink
3+
_have gl_pro && complete -F _command gl_pro
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_have gl_mesa && complete -F _command gl_mesa
2+
_have gl_zink && complete -F _command gl_zink
3+
_have gl_pro && complete -F _command gl_pro
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_have gl_mesa && complete -F _command gl_mesa
2+
_have gl_zink && complete -F _command gl_zink
3+
_have gl_pro && complete -F _command gl_pro

0 commit comments

Comments
 (0)