diff --git a/.gitignore b/.gitignore index dcfc7d96..0b1a442f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ bookmarks +venv diff --git a/README.md b/README.md index 97c7d3bc..46a52c5d 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,6 @@ The following projects have inspired me: - https://github.com/dianaw353/hyprland-configuration-rootfs and many more... + + +#TODO: add files in .local/share as well \ No newline at end of file diff --git a/setup-arch.sh b/setup-arch.sh index 9e73bcac..d284adc0 100755 --- a/setup-arch.sh +++ b/setup-arch.sh @@ -1,7 +1,7 @@ #!/bin/bash clear -repo="mylinuxforwork/dotfiles" +repo="quack-o/ml4w-dotfiles" # Get latest tag from GitHub get_latest_release() { diff --git a/share/dotfiles/.config/VSCodium/User/settings.json b/share/dotfiles/.config/VSCodium/User/settings.json new file mode 100644 index 00000000..64299d89 --- /dev/null +++ b/share/dotfiles/.config/VSCodium/User/settings.json @@ -0,0 +1,51 @@ +{ + "security.workspace.trust.untrustedFiles": "open", + "window.titleBarStyle": "custom", + "editor.fontSize": 12, + // "editor.fontFamily": "'Berkeley Mono', 'Droid Sans Mono', 'Font Awesome 6 Pro Regular','monospace', monospace", + "editor.fontFamily": "'PragmataPro Mono Regular', 'Droid Sans Mono', 'Font Awesome 6 Pro Regular','monospace', monospace", + + "files.autoSave": "afterDelay", + "files.exclude": { + "**/__pycache__": true, + "**/.syncthing.*": true, + "**/.vscode": true + }, + "jupyter.askForKernelRestart": false, + "editor.fontLigatures": false, + "python.defaultInterpreterPath": "/home/kushy/Syncthing/Projects/Shoonya/venv", + "pylint.lintOnChange": true, + "git.enableSmartCommit": true, + "git.openRepositoryInParentFolders": "never", + "workbench.iconTheme": "symbols", + "window.zoomLevel": 2, + "symbols.hidesExplorerArrows": false, + "colorInfo.languages": [ + { + "selector": "json", + "colors": "css" + }, + { + "selector": "html", + "colors": "css" + }, + { + "selector": "html", + "colors": "qss" + } + ], + "colorize.languages": [ + "javascript", + "json", + "yml", + "qss", + "css" + + + // ... + ], + "explorer.confirmDelete": false, + "workbench.colorTheme": "Default Light+", + // "workbench.colorTheme": "Default Light+", + +} diff --git a/share/dotfiles/.config/albert/config b/share/dotfiles/.config/albert/config new file mode 100644 index 00000000..32716460 --- /dev/null +++ b/share/dotfiles/.config/albert/config @@ -0,0 +1,72 @@ +[General] +notifiedUnsupportedHotkey=true +showTray=true +telemetry=false +terminal=Console + +[applications] +enabled=true +use_exec=true +use_generic_name=true +use_keywords=true + +[audio_switcher] +enabled=true + +[calculator_qalculate] +enabled=true + +[copyq] +enabled=true +trigger="c " + +[python] +enabled=true + +[python.audio_switcher] +enabled=true + +[python.copyq] +enabled=true +trigger="c " + +[python.pomodoro] +enabled=true +trigger=pm + +[python.shoonya_totp] +enabled=true + +[python.timer_new] +enabled=true +trigger="t " + +[shoonya_totp] +enabled=true + +[system] +command_hibernate=systemctl hibernate -i +command_lock=swaylock +command_poweroff=systemctl poweroff +command_reboot=systemctl reboot +command_suspend=systemctl suspend -i +enabled=true + +[timer_new] +enabled=true +trigger="t " + +[widgetsboxmodel] +alwaysOnTop=true +clearOnHide=false +clientShadow=false +darkTheme=Custom Dark +displayScrollbar=false +followCursor=true +hideOnFocusLoss=true +historySearch=true +itemCount=5 +lightTheme=Custom Dark +quitOnClose=false +showCentered=true +systemShadow=false diff --git a/share/dotfiles/.config/appimagelauncher.cfg b/share/dotfiles/.config/appimagelauncher.cfg new file mode 100644 index 00000000..26aa5e82 --- /dev/null +++ b/share/dotfiles/.config/appimagelauncher.cfg @@ -0,0 +1,8 @@ +[AppImageLauncher] +ask_to_move=true +destination=/home/kushy/.local/bin/appimages +enable_daemon=true + +[appimagelauncherd] +%23%20additional_directories_to_watch=~/otherApplications:/even/more/applications +%23%20monitor_mounted_filesystems=false diff --git a/share/dotfiles/.config/darkman/config.yaml b/share/dotfiles/.config/darkman/config.yaml new file mode 100644 index 00000000..f2ed14dd --- /dev/null +++ b/share/dotfiles/.config/darkman/config.yaml @@ -0,0 +1,5 @@ +lat: 26.4499 +lng: 80.3319 +dbusserver: true +usegeoclue: true +portal: true \ No newline at end of file diff --git a/share/dotfiles/.config/eww/assets/applications/discord.png b/share/dotfiles/.config/eww/assets/applications/discord.png new file mode 100755 index 00000000..3f10de06 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/applications/discord.png differ diff --git a/share/dotfiles/.config/eww/assets/avatar.png b/share/dotfiles/.config/eww/assets/avatar.png new file mode 100755 index 00000000..dae0df02 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/avatar.png differ diff --git a/share/dotfiles/.config/eww/assets/images/bongo.png b/share/dotfiles/.config/eww/assets/images/bongo.png new file mode 100755 index 00000000..05fca537 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/images/bongo.png differ diff --git a/share/dotfiles/.config/eww/assets/images/pepe-money-rain.gif b/share/dotfiles/.config/eww/assets/images/pepe-money-rain.gif new file mode 100755 index 00000000..dbc07cc9 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/images/pepe-money-rain.gif differ diff --git a/share/dotfiles/.config/eww/assets/images/pepe_based.png b/share/dotfiles/.config/eww/assets/images/pepe_based.png new file mode 100755 index 00000000..4d70b11d Binary files /dev/null and b/share/dotfiles/.config/eww/assets/images/pepe_based.png differ diff --git a/share/dotfiles/.config/eww/assets/images/right_hand_arrow.png b/share/dotfiles/.config/eww/assets/images/right_hand_arrow.png new file mode 100755 index 00000000..e01115fc Binary files /dev/null and b/share/dotfiles/.config/eww/assets/images/right_hand_arrow.png differ diff --git a/share/dotfiles/.config/eww/assets/images/right_hand_arrow_2.png b/share/dotfiles/.config/eww/assets/images/right_hand_arrow_2.png new file mode 100755 index 00000000..d18a5a21 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/images/right_hand_arrow_2.png differ diff --git a/share/dotfiles/.config/eww/assets/ui/banner.jpg b/share/dotfiles/.config/eww/assets/ui/banner.jpg new file mode 100755 index 00000000..c6fd99d8 Binary files /dev/null and b/share/dotfiles/.config/eww/assets/ui/banner.jpg differ diff --git a/share/dotfiles/.config/eww/assets/ui/music-fallback.png b/share/dotfiles/.config/eww/assets/ui/music-fallback.png new file mode 100755 index 00000000..9dd2c7fd Binary files /dev/null and b/share/dotfiles/.config/eww/assets/ui/music-fallback.png differ diff --git a/share/dotfiles/.config/eww/assets/ui/wedding-bells.png b/share/dotfiles/.config/eww/assets/ui/wedding-bells.png new file mode 100755 index 00000000..dce90f5f Binary files /dev/null and b/share/dotfiles/.config/eww/assets/ui/wedding-bells.png differ diff --git a/share/dotfiles/.config/eww/bar/eww.scss b/share/dotfiles/.config/eww/bar/eww.scss new file mode 100755 index 00000000..ef6f60a5 --- /dev/null +++ b/share/dotfiles/.config/eww/bar/eww.scss @@ -0,0 +1,155 @@ +.bar { + background-color: $bg; + padding: .35rem 1.5rem .35rem 1.5rem; +} + +scale trough { + all: unset; + background-color: $black; + border-radius: 1rem; + min-height: .3rem; + min-width: 5rem; + margin-left: .3rem; + box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.3); +} + +.group { + background-color: $bg-alt; + padding: 0rem 1rem 0rem 1rem; + border-radius: .5rem; +} + +.power-icon, +.pacman-icon, +.network-icon, +.volume-icon { + font-size: 1.2rem; + font-family: "Font Awesome 6 Pro Solid"; +} + +.pacman-text, +.network-text, +.memory-info, +.cpu-info { + font-family: "SF Pro Text"; + font-size: .9rem; + font-weight: bold; +} + +.power-icon { + color: $red; + margin-top: 0.1rem; +} + +.workspaces { + font-family: "Font Awesome 6 Pro Solid"; + font-size: 1.2rem; + background-color: $bg-alt; + padding: .5rem 1rem .5rem 1rem; + border-radius: .5rem; +} +.occupied-active { + color: $green; +} + +.occupied-inactive { + color: rgba($fg, 0.3); +} + +.empty-inactive { + color: rgba($fg, 0.1); +} + +.empty-active { + color: $green; +} + +.memory-inside, +.cpu-inside { + padding: .7rem; +} + +.memory-bar { + color: $magenta; + background-color: $black; +} + +.cpu-bar { + color: $red; + background-color: $black; +} + +.pacman-icon { + color: $yellow; +} + +.pacman-text { + color: $fg; + margin-left: .3rem; +} + +.volume-bar trough highlight { + background: $green; + border-radius: 1rem; +} + +.network-text { + color: $fg; + margin-left: .3rem; +} + +.clock { + font-family: "SF Mono"; +} + +.clock-hour { + font-size: 1.2rem; + font-weight: bold; + color: $fg; +} + +.clock-minute { + font-size: 1.2rem; + color: $fg-alt; +} + +.clock-separator { + font-size: 1.2rem; + color: $fg-alt; + margin-top: .075rem; +} + +.musicbar-art { + background-repeat: no-repeat; + background-size: cover; + background-position: center; + min-width: 2.2rem; + border-radius: 6.25rem; +} + +.musicbar-title { + font-size: 1rem; + font-weight: bold; + font-family: "SF Pro"; + color: $fg; +} + +.musicbar-toggle-icon { + font-size: 1.25rem; +} + +.musicbar-previous-icon, +.musicbar-next-icon { + font-size: 1rem; +} + +.musicbar-previous-icon, +.musicbar-next-icon, +.musicbar-toggle-icon { + font-family: "Font Awesome 6 Pro Solid"; + color: $fg; + + &:hover { + color: $magenta; + } +} \ No newline at end of file diff --git a/share/dotfiles/.config/eww/bar/eww.yuck b/share/dotfiles/.config/eww/bar/eww.yuck new file mode 100755 index 00000000..a4d1aa45 --- /dev/null +++ b/share/dotfiles/.config/eww/bar/eww.yuck @@ -0,0 +1,271 @@ +(defwidget power [] + (button + :class "power-icon" + :valign "center" + :onclick "eww open powermenu" + "" + ) +) + +(defwidget workspaces [] + (literal + :content workspaces + ) +) + +(defwidget music [] + (eventbox + :onhover "eww update music-rev=true" + :onhoverlost "eww update music-rev=false" + (box + :space-evenly false + :spacing 8 + (button + :class "musicbar-art" + :onclick "eww open --toggle player" + :style "background-image: url('${music-art}');" + ) + (label + :class "musicbar-title" + :limit-width 25 + :text music-title + ) + (revealer + :transition "slideright" + :reveal music-rev + :duration "500ms" + (box + :spacing 10 + (button + :class "musicbar-previous-icon" + :onclick "./scripts/mediacontrol --previous" + "" + ) + (button + :class "musicbar-toggle-icon" + :onclick "./scripts/mediacontrol --toggle" + music-toggle) + (button + :class "musicbar-next-icon" + :onclick "./scripts/mediacontrol --next" + "" + ) + ) + ) + ) + ) +) + +(defwidget memory [] + (box + :class "memory" + :space-evenly false + :spacing 5 + (circular-progress + :value memory + :class "memory-bar" + :thickness 4 + (label + :class "memory-inside" + :tooltip "${memorymb}MB used" + :text "" + ) + ) + (label + :class "memory-info" + :text "${memory}%" + ) + ) +) + +(defwidget cpu [] + (box + :class "cpu" + :space-evenly false + :spacing 5 + (circular-progress + :class "cpu-bar" + :value cpu + :thickness 4 + (label + :class "cpu-inside" + :text "" + ) + ) + (label + :class "cpu-info" + :text "${cpu}%" + ) + ) +) + +(defwidget pacman [] + (eventbox + :onhover "eww update pacman-rev=true" + :onhoverlost "eww update pacman-rev=false" + (box + :space-evenly false + (button + :class "pacman-icon" + :onclick "scripts/popup updates" + :tooltip "click to update" + "" + ) + (revealer + :transition "slideright" + :reveal pacman-rev + :duration "500ms" + (box + :space-evenly false + (label + :class "pacman-text" + :text "${updates}" + ) + ) + ) + ) + ) +) + +(defwidget network [] + (eventbox + :onhover "eww update network-rev=true" + :onhoverlost "eww update network-rev=false" + (box + :space-evenly false + (button + :class "network-icon" + :style "color: ${network-color}" + "${network-icon}" + ) + (revealer + :transition "slideright" + :reveal network-rev + :duration "500ms" + (box + :space-evenly false + (label + :class "network-text" + :text network-speed + ) + ) + ) + ) + ) +) + +(defwidget volume [] + (eventbox + :onhover "eww update volume-rev=true" + :onhoverlost "eww update volume-rev=false" + (box + :space-evenly false + (button + :class "volume-icon" + :style "color: ${volume-color}" + :tooltip "${volume-percent}%" + :onclick "scripts/volume toggle" + volume-icon + ) + (revealer + :class "volumebar-reveal" + :transition "slideleft" + :reveal volume-rev + :duration "500ms" + (scale + :class "volume-bar" + :tooltip "${volume-percent}%" + :value volume-percent + :min 0 + :max 101 + :onchange "pamixer -u && pamixer --set-volume {}" + ) + ) + ) + ) +) + +(defwidget clock [] + (button + :onclick "eww open --toggle calendar" + (box + :class "clock" + :space-evenly false + :spacing 8 + (label + :class "clock-hour" + :text hour + ) + (label + :class "clock-separator" + :text "" + ) + (label + :class "clock-minute" + :text minute + ) + ) + ) +) + +(defwidget group [] + (box + :class "group" + :space-evenly false + :spacing 15 + :hexpand true + (pacman) + (network) + (volume) + ) +) + +(defwidget left [] + (box + :space-evenly false + :halign "start" + :spacing 15 + (power) + (workspaces) + ) +) + +(defwidget center [] + (box + :space-evenly false + :halign "center" + (music) + ) +) + +(defwidget right [] + (box + :space-evenly false + :halign "end" + :spacing 15 + (memory) + (cpu) + (group) + (clock) + ) +) + +(defwidget bar [] + (box + :class "bar" + (left) + (center) + (right) + ) +) + +(defwindow bar + :stacking "fg" + :wm-ignore false + :windowtype "dock" + :reserve (struts :distance "80px" :side "top") + :geometry (geometry :y "2%" + :width "80%" + :anchor "top center") + (bar) +) diff --git a/share/dotfiles/.config/eww/eww.scss b/share/dotfiles/.config/eww/eww.scss new file mode 100755 index 00000000..d73e64ef --- /dev/null +++ b/share/dotfiles/.config/eww/eww.scss @@ -0,0 +1,23 @@ +// @import "./src/scss/variables"; +// @import "./src/scss/overrides"; +// @import "./src/scss/modules"; + +// @import "./src/scss/bar/index.scss"; +// @import "./src/scss/control-center/index.scss"; +// @import "./src/scss/exitscreen/exit-screen"; +// @import "./src/scss/info-center/index.scss"; +// @import "./src/scss/lockscreen/index.scss"; +// @import "./src/scss/notification-center/index.scss"; +// @import "./src/scss/notification-popup/index.scss"; + +// @import "./src/scss/desk-widgets/index.scss"; + +// @import "./src/scss/clock/index.scss"; + +@import "./src/scss/calendar/index.scss"; +// @import "./src/scss/trade-counter/index.scss"; + +// @import "./src/scss/quotes/index.scss"; + +// @import "./src/scss/events/index.scss"; + diff --git a/share/dotfiles/.config/eww/eww.yuck b/share/dotfiles/.config/eww/eww.yuck new file mode 100755 index 00000000..814d7521 --- /dev/null +++ b/share/dotfiles/.config/eww/eww.yuck @@ -0,0 +1,44 @@ + +(include "./src/yuck/_variables.yuck") +(include "./src/yuck/_modules.yuck") + + +(include "./src/yuck/desk-widgets/_widgets.yuck") +(include "./src/yuck/desk-widgets/_windows.yuck") + + +(include "./src/yuck/exitscreen/_widgets.yuck") +(include "./src/yuck/exitscreen/_windows.yuck") + + +(include "./src/yuck/calendar-closer/_widgets.yuck") +(include "./src/yuck/calendar-closer/_windows.yuck") + +;; (include "./src/yuck/info-center/_widgets.yuck") +;; (include "./src/yuck/info-center/_windows.yuck") + + +(include "./src/yuck/clock/_widgets.yuck") +(include "./src/yuck/clock/_windows.yuck") + + + +(include "./src/yuck/calendar/_widgets.yuck") +(include "./src/yuck/calendar/_windows.yuck") + + +(include "./src/yuck/bar/_widgets.yuck") +(include "./src/yuck/bar/_windows.yuck") + +;; (include "./src/yuck/bar/_widgets.yuck") +;; (include "./src/yuck/bar/_windows.yuck") + +(include "./src/yuck/trade-counter/_widgets.yuck") +(include "./src/yuck/trade-counter/_windows.yuck") + + +(include "./src/yuck/quotes/_widgets.yuck") +(include "./src/yuck/quotes/_windows.yuck") + + + diff --git a/share/dotfiles/.config/eww/music_widget.png b/share/dotfiles/.config/eww/music_widget.png new file mode 120000 index 00000000..35cdae98 --- /dev/null +++ b/share/dotfiles/.config/eww/music_widget.png @@ -0,0 +1 @@ +/tmp/music_widget.png \ No newline at end of file diff --git a/share/dotfiles/.config/eww/player/eww.scss b/share/dotfiles/.config/eww/player/eww.scss new file mode 100755 index 00000000..4ce37f37 --- /dev/null +++ b/share/dotfiles/.config/eww/player/eww.scss @@ -0,0 +1,89 @@ +.player { + font-family: "SF Pro", "Font Awesome 6 Pro Solid"; + background-color: $bg; + padding: .6rem; + min-height: 10rem; + border-radius: .6rem; +} + +.player-art { + background-size: cover; + background-repeat: no-repeat; + background-position: center; + box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.4); + border-radius: 1rem; + min-width: 22rem; + min-height: 12rem; +} + +.player-info { + border-radius: 12px; + background: linear-gradient(to right, rgb(25, 25, 25, 1), rgba(38, 38, 38, 0.5)); + padding: .65rem; +} + +.player-title { + font-size: 1.1rem; + font-weight: bolder; +} + +.player-artist { + color: $white; +} + +.player-bar scale trough highlight { + all: unset; + background-image: linear-gradient(to right, $cyan, $green); + border-radius: 1.5rem; +} +.player-bar scale trough { + all: unset; + background-color: rgba($cyan, 0.5); + box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.9); + border-radius: 1rem; + min-height: .25rem; + min-width: 21rem; +} + +.player-position { + font-size: .9rem; + font-weight: 500; + color: $fg-alt; +} + +.player-controls { + //background-color: $bg-alt; + padding: .5rem; + border-radius: 1rem; +} + +.player-toggle { + font-size: 2rem; + color: $fg; +} + +.player-previous, +.player-next { + font-size: 1.6rem; + color: $fg-alt; +} + +.player-toggle:hover, +.player-previous:hover, +.player-next:hover { + color: $magenta; +} + +.player-shuffle, +.player-loop { + font-size: 1rem; +} + +.spotify-icon { + font-family: "Font Awesome 6 Brands"; + font-size: 1.25rem; + background-color: rgb(15, 15, 15, 0.6); + color: $green; + box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.5); + border-radius: 8rem; +} \ No newline at end of file diff --git a/share/dotfiles/.config/eww/player/eww.yuck b/share/dotfiles/.config/eww/player/eww.yuck new file mode 100755 index 00000000..0725dcf2 --- /dev/null +++ b/share/dotfiles/.config/eww/player/eww.yuck @@ -0,0 +1,130 @@ +(defwidget player [] + (box + :class "player" + :space-evenly false + :spacing 10 + (box + :class "player-art" + :style "background-image: url('${music-art}')" + (box + :class "player-info" + :space-evenly false + :orientation "v" + :spacing 10 + (box + :class "top-icons" + (box + :space-evenly false + :spacing 10 + (button + :class "player-shuffle" + :onclick "scripts/mediacontrol --shuffle" + :halign "start" + :tooltip "${music-shuffle-status}" + :style "color:${music-shuffle-color}" + "" + ) + (button + :class "player-loop" + :onclick "./scripts/mediacontrol --loop" + :halign "start" + :tooltip "${music-loop-status}" + :style "color:${music-loop-color}" + music-loop-icon + ) + ) + (box + (button + :class "spotify-icon" + :halign "end" + "" + ) + ) + ) + (label + :class "player-title" + :halign "start" + :text music-title + :limit-width 30 + ) + (label + :class "player-artist" + :halign "start" + :text music-artist + :limit-width 35 + ) + (box + :space-evenly false + :orientation "v" + :valign "end" + :spacing 6 + :vexpand true + (box + :class "player-bar" + :halign "center" + :valign "end" + (eventbox + :cursor "pointer" + (scale + :onchange "playerctl -p spotify position {}" + :min 0 + :max music-lengths + :value music-positions + ) + ) + ) + (box + :class "player-position" + :space-evenly false + :valign "end" + (label + :class "player-time" + :text "${music-position} / ${music-length}" + ) + ) + ) + ) + ) + (box + :class "player-controls" + :orientation "v" + :valign "center" + :hexpand true + :space-evenly false + :spacing 30 + (eventbox + :cursor "pointer" + (button + :class "player-previous" + :onclick "scripts/mediacontrol --previous" + "" + ) + ) + (eventbox + :cursor "pointer" + (button + :class "player-toggle" + :onclick "scripts/mediacontrol --toggle" + music-toggle + ) + ) + (eventbox + :cursor "pointer" + (button + :class "player-next" + :onclick "scripts/mediacontrol --next" + "" + ) + ) + ) + ) +) + +(defwindow player + :stacking "fg" + :wm-ignore false + :windowtype "dock" + :geometry (geometry :y "7%" + :anchor "top center") + (player) +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/scripts/bspLayout.sh b/share/dotfiles/.config/eww/scripts/bspLayout.sh new file mode 100755 index 00000000..44f06f8a --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/bspLayout.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +FOCUSED_DESKTOP=$(bspc query -D -d focused --names) +LAYOUT=$(bsp-layout get $FOCUSED_DESKTOP) + +case $1 in + "icon") + if [ $LAYOUT = "tall" ]; then + echo "" + elif [ $LAYOUT = "grid" ]; then + echo "" + elif [ $LAYOUT = "tiled" ]; then + echo "" + elif [ $LAYOUT = "even" ]; then + echo "" + fi + ;; + "set") + bsp-layout next --layouts tall,grid,even,tiled --desktop $FOCUSED_DESKTOP + ;; + "reset") + bsp-layout set tiled $FOCUSED_DESKTOP + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/calendar b/share/dotfiles/.config/eww/scripts/calendar new file mode 100755 index 00000000..8a7f4724 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/calendar @@ -0,0 +1,6 @@ +#!/bin/sh + +month=$(date +%m) +month=$((month-1)) # for some reason eww gives the month as a zero-based integer + +echo $month \ No newline at end of file diff --git a/share/dotfiles/.config/eww/scripts/calendar.sh b/share/dotfiles/.config/eww/scripts/calendar.sh new file mode 100755 index 00000000..25d17341 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/calendar.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +file="/tmp/trade_counter.json" + +# notify-send hello kys + +new_date=$(date '+%d/%m/%g') + +getEvents(){ + day=$1 + new_date=$(date '+%d/%m/%Y' -d "+ $day days") + khal list $new_date | tail -n +2 | sed 's|.*PM ||' | sed 's/^/ - /' +} + +verbose='false' +while getopts 'g:pls:v' flag; do + case "${flag}" in + g) val=${OPTARG} + getEvents $val;; + p) getPnl;; + l) getMaxLoss;; + s) val="${OPTARG}" + set_volume $val + #pactl -- set-sink-volume $sink $val% + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + + diff --git a/share/dotfiles/.config/eww/scripts/dashActions.sh b/share/dotfiles/.config/eww/scripts/dashActions.sh new file mode 100755 index 00000000..69b8f5d4 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/dashActions.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +DATE=$(date '+%b%d-%H-%M:%S.png'); + +EWW_BIN="$HOME/.local/bin/eww" +AIRPLANE_MODE_LOCK_FILE="$HOME/.cache/airplane-mode.lock" +DND_LOCK_FILE="$HOME/.cache/dnd-lock.lock" +JEFF_LOCK_FILE="$HOME/.cache/jeff-lock.lock" + +pre_run() { + if [[ -f "$HOME/.cache/eww-control-center.lock" ]]; then + ${EWW_BIN} update ccenter=false + sleep 0.8 + ${EWW_BIN} close control-center + rm "$HOME/.cache/eww-control-center.lock" + fi +} + +run_dnd() { + if [[ ! -f "$DND_LOCK_FILE" ]]; then + touch "$DND_LOCK_FILE" + dunstctl set-paused true + else + rm "$DND_LOCK_FILE" + dunstctl set-paused false + fi +} + +run_scrot() { + pre_run & sleep 0.8 + + maim -us "$HOME/Pictures/Screenshots/$DATE"; + sh $HOME/.local/bin/viewscr $HOME/Pictures/Screenshots/$DATE +} + +run_giph() { + pre_run & sleep 0.8 + + if [[ ! -f "$JEFF_LOCK_FILE" ]]; then + touch "$JEFF_LOCK_FILE" + + ps x | grep 'ffmpeg -f x11grab' | grep -v grep | awk '{print $1}' | xargs kill + sh $HOME/.local/bin/jeff selmp4 + else + rm "$JEFF_LOCK_FILE" + ps x | grep 'ffmpeg -f x11grab' | grep -v grep | awk '{print $1}' | xargs kill -2 + fi +} + +run_am() { + if [[ ! -f "$AIRPLANE_MODE_LOCK_FILE" ]]; then + touch "$AIRPLANE_MODE_LOCK_FILE" + rfkill block wlan + rfkill block bluetooth + else + rm "$AIRPLANE_MODE_LOCK_FILE" + rfkill unblock wlan + rfkill unblock bluetooth + fi +} + +case $1 in + "dnd") + run_dnd + ;; + "scrot") + run_scrot & + ;; + "jeff") + run_giph & + ;; + "am") + run_am + ;; + "dndstat") + [[ ! -f "$DND_LOCK_FILE" ]] && echo "$bgSecondary" || echo "#1c2325" + ;; + "jstat") + [[ ! -f "$JEFF_LOCK_FILE" ]] && echo "$bgSecondary" || echo "#1c2325" + ;; + "amstat") + [[ ! -f "$AIRPLANE_MODE_LOCK_FILE" ]] && echo "" || echo "" +esac diff --git a/share/dotfiles/.config/eww/scripts/exitScreenActions.sh b/share/dotfiles/.config/eww/scripts/exitScreenActions.sh new file mode 100755 index 00000000..d57d9161 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/exitScreenActions.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +DATE=$(date '+%b%d-%H-%M:%S.png'); + +EWW_BIN="$HOME/.local/bin/eww" + +hide_unhide_windows() { + while bspc node any.hidden.window -g hidden=off; do false; done && while bspc node 'any.!hidden.window' -g hidden=on; do :; done +} + +pre_run() { + if [[ -f "$HOME/.cache/eww-escreen.lock" ]]; then + ${EWW_BIN} update escreen=false + sleep 0.8 + $HOME/.local/bin/tglbar + hide_unhide_windows + ${EWW_BIN} close exit-screen + rm "$HOME/.cache/eww-escreen.lock" + fi +} + +run() { + pre_run && sleep 0.2 + systemctl $1 +} + +case $1 in + "shutdown") + run "poweroff" & + ;; + "reboot") + run "reboot" & + ;; + "suspend") + run "suspend" & + ;; + "hibernate") + run "hibernate" & + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/gcalcli_eww/__init__.py b/share/dotfiles/.config/eww/scripts/gcalcli_eww/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.ipynb b/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.ipynb new file mode 100644 index 00000000..05378462 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.ipynb @@ -0,0 +1,202 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import subprocess\n", + "import json\n", + "from datetime import datetime, timedelta\n", + "import re \n", + "import argparse\n", + "# Run the gcalcli command\n", + "current_date = datetime.now()\n", + "next_date = current_date + timedelta(days=1)\n", + "command = [\"gcalcli\", \"--refresh\" ,\"agenda\", current_date.strftime('%Y-%m-%d'), next_date.strftime('%Y-%m-%d'), \"--details\", \"end\"]\n", + "result = subprocess.run(command, capture_output=True, text=True)\n", + "command_update = [\"/bin/eww\", \"update\"]\n", + "\n", + "# print(result)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# TODO: fucking up if there is an event spanning over 2 days" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "gcalcli_output = str(result.stdout)\n", + "print(str(gcalcli_output))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "def strip_ansi_colors(text):\n", + " ansi_escape = re.compile(r'\\x1B\\[[0-?]*[ -/]*[@-~]')\n", + " return ansi_escape.sub('', text)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "date_str = datetime.now().strftime('%a %b %d') + ' '\n", + "print(date_str)\n", + "resultstr = strip_ansi_colors(gcalcli_output).replace(date_str, \"\", 1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "events = []\n", + "full_day_events = []\n", + "counter = 0\n", + "for line in resultstr.splitlines():\n", + " line = line.lstrip()\n", + " if ':' in line:\n", + " print(line)\n", + " match = re.match(r'(?P\\d{1,2}:\\d{2}[ap]m)\\s*-\\s*(?P\\d{1,2}:\\d{2}[ap]m)\\s+(?P.+)', line)\n", + " start_time = match.group(\"start_time\")\n", + " end_time = match.group(\"end_time\")\n", + " title = match.group(\"title\")\n", + " event = {'start':start_time, 'end':end_time, 'title':title}\n", + " # event = {'interval':f\"{start_time}-{end_time}\", 'title':title}\n", + "\n", + " events.append(event)\n", + " elif line != '':\n", + " full_day_events.append({counter:line})\n", + " counter = counter + 1\n", + " \n", + "print(events)\n", + "print(full_day_events)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def dt(time_str):\n", + " time_obj = datetime.strptime(time_str, '%I:%M%p').time()\n", + " dt_obj = datetime.combine(datetime.now().date(), time_obj)\n", + " # print(dt_obj)\n", + " return dt_obj" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "def get_events():\n", + " current_event = ''\n", + " next_event = {}\n", + "\n", + " current_time = datetime.now()\n", + " for i, event in enumerate(events):\n", + " if dt(event['start']) < current_time and dt(event['end']) >current_time:\n", + " current_event = event\n", + " if i < len(events) - 1:\n", + " next_event = events[i+1]\n", + " print(f\"current event is {current_event}\")\n", + " print(f\"next event is {next_event}\")\n", + " break\n", + " elif dt(event['start']) > current_time:\n", + " next_event = event\n", + " print(f\"no current event next event is {next_event}\")\n", + " break\n", + " data = {'0':current_event ,'1': next_event}\n", + " with open(\"/tmp/events.json\", \"w\") as file:\n", + " json.dump(data, file, indent=4) \n", + " with open(\"/tmp/entire_day_events.json\", \"w\") as file:\n", + " json.dump(full_day_events, file, indent=4) \n", + "\n", + "def getCurrentEvent():\n", + " current_event, b = get_events()\n", + " return current_event\n", + "\n", + "def getNextEvent():\n", + " a , next_event = get_events()\n", + " return next_event\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "get_events()\n", + "result = subprocess.run(command_update, capture_output=True, text=True)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# if __name__ == \"__main__\":\n", + "# parser = argparse.ArgumentParser()\n", + "# parser.add_argument('--getCurrentEvent', action='store_true', default=None)\n", + "# parser.add_argument('--getNextEvent', action='store_true', default=None)\n", + " \n", + "# args = parser.parse_args()\n", + "\n", + "\n", + "# if args.getCurrentEvent is not None:\n", + "# print(getCurrentEvent())\n", + "\n", + "# if args.getNextEvent is not None:\n", + "# print(getNextEvent())" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.7" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.py b/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.py new file mode 100644 index 00000000..5c7c3e35 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/gcalcli_eww/gcalcli.py @@ -0,0 +1,116 @@ +# %% +import subprocess +import json +from datetime import datetime, timedelta +import re +import argparse +# Run the gcalcli command +current_date = datetime.now() +next_date = current_date + timedelta(days=1) +command = ["gcalcli", "--refresh" ,"agenda", current_date.strftime('%Y-%m-%d'), next_date.strftime('%Y-%m-%d'), "--details", "end"] +result = subprocess.run(command, capture_output=True, text=True) +command_update = ["/bin/eww", "update"] + +# print(result) + +# %% +gcalcli_output = str(result.stdout) +print(str(gcalcli_output)) + +# %% + +def strip_ansi_colors(text): + ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') + return ansi_escape.sub('', text) + +# %% +date_str = datetime.now().strftime('%a %b %d') + ' ' +print(date_str) +resultstr = strip_ansi_colors(gcalcli_output).replace(date_str, "", 1) + + +# %% +events = [] +full_day_events = [] +counter = 0 +for line in resultstr.splitlines(): + line = line.lstrip() + if ':' in line: + match = re.match(r'(?P<start_time>\d{1,2}:\d{2}[ap]m)\s*-\s*(?P<end_time>\d{1,2}:\d{2}[ap]m)\s+(?P<title>.+)', line) + start_time = match.group("start_time") + end_time = match.group("end_time") + title = match.group("title") + event = {'start':start_time, 'end':end_time, 'title':title} + # event = {'interval':f"{start_time}-{end_time}", 'title':title} + + events.append(event) + elif line != '': + full_day_events.append({counter:line}) + counter = counter + 1 + +print(events) +print(full_day_events) + +# %% +def dt(time_str): + time_obj = datetime.strptime(time_str, '%I:%M%p').time() + dt_obj = datetime.combine(datetime.now().date(), time_obj) + # print(dt_obj) + return dt_obj + +# %% + + +def get_events(): + current_event = '' + next_event = {} + + current_time = datetime.now() + for i, event in enumerate(events): + if dt(event['start']) < current_time and dt(event['end']) >current_time: + current_event = event + if i < len(events) - 1: + next_event = events[i+1] + print(f"current event is {current_event}") + print(f"next event is {next_event}") + break + elif dt(event['start']) > current_time: + next_event = event + print(f"no current event next event is {next_event}") + break + data = {'0':current_event ,'1': next_event} + with open("/tmp/events.json", "w") as file: + json.dump(data, file, indent=4) + with open("/tmp/entire_day_events.json", "w") as file: + json.dump(full_day_events, file, indent=4) + +def getCurrentEvent(): + current_event, b = get_events() + return current_event + +def getNextEvent(): + a , next_event = get_events() + return next_event + + +# %% +get_events() +result = subprocess.run(command_update, capture_output=True, text=True) + + +# %% +# if __name__ == "__main__": +# parser = argparse.ArgumentParser() +# parser.add_argument('--getCurrentEvent', action='store_true', default=None) +# parser.add_argument('--getNextEvent', action='store_true', default=None) + +# args = parser.parse_args() + + +# if args.getCurrentEvent is not None: +# print(getCurrentEvent()) + +# if args.getNextEvent is not None: +# print(getNextEvent()) + + diff --git a/share/dotfiles/.config/eww/scripts/gcalcli_eww/requirememnts.txt b/share/dotfiles/.config/eww/scripts/gcalcli_eww/requirememnts.txt new file mode 100644 index 00000000..060804ea --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/gcalcli_eww/requirememnts.txt @@ -0,0 +1,5 @@ +gcalcli +google-auth +google-auth-oauthlib +google-auth-httplib2 +google-api-python-client \ No newline at end of file diff --git a/share/dotfiles/.config/eww/scripts/getBattery.sh b/share/dotfiles/.config/eww/scripts/getBattery.sh new file mode 100755 index 00000000..2b5cb901 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getBattery.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# INTERNAL USE! Do not edit. +FAKE_BATTERY="0" + +if [[ "$FAKE_BATTERY" -gt 0 ]]; then + if [[ ! -f "$HOME/.cache/fake_battery_capacity" ]]; then + echo $(($RANDOM % 100)) > "$HOME/.cache/fake_battery_capacity" + fi +fi + +case $1 in + "icon") + if [[ -d /sys/class/power_supply/ACAD ]]; then + echo "" + elif [[ -d /sys/class/power_supply/BAT ]]; then + [[ $(cat /sys/class/power_supply/BAT/status) == "Discharging" ]] && echo "" || echo "" + else + echo "" + fi + ;; + "capacity") + if [[ "$FAKE_BATTERY" -gt 0 ]]; then + if [[ -f "$HOME/.cache/fake_battery_capacity" ]]; then + echo $(cat "$HOME/.cache/fake_battery_capacity") + fi + elif [[ -f /sys/class/power_supply/BAT0/capacity ]]; then + echo $(cat /sys/class/power_supply/BAT0/capacity) + elif [[ ! -d /sys/class/power_supply/BAT ]]; then + echo "100" + fi + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getBluetooth.sh b/share/dotfiles/.config/eww/scripts/getBluetooth.sh new file mode 100755 index 00000000..5375cbca --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getBluetooth.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +case $1 in + "icon") + [[ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]] && echo "" || echo "" + ;; + "status") + [[ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]] && echo "Off" || echo "On" + ;; + "supported") + [[ ! -z $(lsusb | grep "Bluetooth") ]] && echo true || echo false + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getEvents.sh b/share/dotfiles/.config/eww/scripts/getEvents.sh new file mode 100755 index 00000000..475dddfa --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getEvents.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +#!/bin/bash + +width=30 +getCurrentTitle() { + text=$(jq -r '.["0"].title // empty' /tmp/events.json | fold -w $width | sed 's/^[[:space:]]*//' ) + echo "$text" +} + +getCurrentInterval(){ + start=$(jq -r '.["0"].start // empty' /tmp/events.json || echo "") + end=$(jq -r '.["0"].end // empty' /tmp/events.json || echo "") + echo $start-$end +} + +getNextTitle() { + text=$(jq -r '.["1"].title // empty' /tmp/events.json | fold -w $width | sed 's/^[[:space:]]*//' ) + echo "$text" +} + +getNextInterval() { + start=$(jq -r '.["1"].start // empty' /tmp/events.json || echo "") + end=$(jq -r '.["1"].end // empty' /tmp/events.json || echo "") + echo $start-$end +} + +getUpcomingTime() { + upcoming_time=$(jq -r '.["1"].start // empty' /tmp/events.json | sed 's| .*||') + target_time=$(date -d "$upcoming_time" +%H:%M) + current_time=$(date +%H:%M) + diff_seconds=$(( $(date -d "$target_time" +%s) - $(date -d "$current_time" +%s) )) + # Convert seconds to hours and minutes + hours=$(( diff_seconds / 3600 )) + minutes=$(( (diff_seconds % 3600) / 60 )) + + # Display the result + if [[ -n $upcoming_time ]];then + echo " ${hours}h${minutes}m" + fi + +} + +# getNextTitle() { +# jq -r '.["1"].title' /tmp/events.json +# } + +# getNextInterval() { +# jq -r '.["1"].interval' /tmp/events.json +# } + + +verbose='false' +while getopts 'abcdue:v' flag; do + case "${flag}" in + a) getCurrentTitle;; + b) getCurrentInterval;; + c) getNextTitle;; + d) getNextInterval;; + u) getUpcomingTime;; + + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + + diff --git a/share/dotfiles/.config/eww/scripts/getMedia.sh b/share/dotfiles/.config/eww/scripts/getMedia.sh new file mode 100755 index 00000000..f46a4a97 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getMedia.sh @@ -0,0 +1,69 @@ +#!/bin/bash +#!/bin/bash + + + +status=$(playerctl status) +title=$(playerctl metadata title) +artist=$(playerctl metadata artist) + +image=$(/usr/bin/playerctl metadata | grep artUrl | sed 's|^.*file://||') +ln -sf $image /tmp/music_widget.png + + +get_status() { + if [[ $(/usr/bin/playerctl status) == "Playing" ]];then + return 1 + fi + return 0 +} + +get_symbol() { + echo "♪" +} + +get_title() { + # title=${title:0:20} + title=$(echo $title | sed 's/|.*//g;s/(.*//g') + echo $title +} + + +get_artist() { + artist=${artist:0:20} + artist=$(echo $artist | sed 's/|.*//g;s/(.*//g') + echo $artist +} + + + +verbose='false' +while getopts 'stads:v' flag; do + case "${flag}" in + s) val="${OPTARG}" + get_symbol + ;; + t) val="${OPTARG}" + get_title + ;; + a) val="${OPTARG}" + get_artist + #pactl -- set-sink-volume $sink +$val% + ;; + d) val="${OPTARG}" + pulseaudio-ctl down $val && dunstify "Volume $volume" -h int:value:$(pamixer --get-volume) -a sound -r $msgId -u low + ;; + s) val="${OPTARG}" + set_volume $val + #pactl -- set-sink-volume $sink $val% + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + +# exec 26> "/tmp/get_media.lock" +# if ! flock -n 26; then +# printf 'another instance is running\n'; +# exit 1 +# fi \ No newline at end of file diff --git a/share/dotfiles/.config/eww/scripts/getNetwork.sh b/share/dotfiles/.config/eww/scripts/getNetwork.sh new file mode 100755 index 00000000..52858050 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getNetwork.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +case $1 in + "icon") + [[ $(cat /sys/class/net/w*/operstate) = down ]] && echo "" || echo "" + ;; + "name") + SSID=$(iwgetid -r) + [[ -z "$SSID" ]] && echo "" || echo "$SSID" + ;; + "trname") + SSID=$(iwgetid -r) + [[ -z "$SSID" ]] && echo "" || echo "${SSID::13}..." + ;; + "color") + [[ $(cat /sys/class/net/w*/operstate) = down ]] && echo "$bgSecondary" || echo "#1c2325" + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getNotificationCount.sh b/share/dotfiles/.config/eww/scripts/getNotificationCount.sh new file mode 100755 index 00000000..f2ae71d4 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getNotificationCount.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +[[ "$(dunstctl history | jq -r '.data[0]')" = "[]" ]] && echo true || echo false diff --git a/share/dotfiles/.config/eww/scripts/getRedshift.sh b/share/dotfiles/.config/eww/scripts/getRedshift.sh new file mode 100755 index 00000000..eda6c607 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getRedshift.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +LOCK_FILE="$HOME/.cache/eww-redshift.lock" + +case $1 in + "color") + [[ ! -f "$LOCK_FILE" ]] && echo "$bgSecondary" || echo "#1c2325" + ;; + "toggle") + if [[ ! -f "$LOCK_FILE" ]]; then + touch "$LOCK_FILE" + redshift -P -O 5500 + else + rm "$LOCK_FILE" + redshift -x + fi + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getSongArt.sh b/share/dotfiles/.config/eww/scripts/getSongArt.sh new file mode 100755 index 00000000..143a19e4 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getSongArt.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +TMP_DIR="$HOME/.cache/eww" +TMP_COVER_PATH=$TMP_DIR/cover.png +TMP_TEMP_PATH=$TMP_DIR/temp.png + +if [[ ! -d $TMP_DIR ]]; then + mkdir -p $TMP_DIR +fi + +ART_FROM_SPOTIFY="$(playerctl -p %any,spotify metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')" +ART_FROM_BROWSER="$(playerctl -p %any,mpd,firefox,chromium,brave metadata mpris:artUrl | sed -e 's/file:\/\///g')" + +if [[ $(playerctl -p spotify,%any,firefox,chromium,brave,mpd metadata mpris:artUrl) ]]; then + curl -s "$ART_FROM_SPOTIFY" --output $TMP_TEMP_PATH +elif [[ -n $ART_FROM_BROWSER ]]; then + cp $ART_FROM_BROWSER $TMP_TEMP_PATH +else + cp $HOME/.config/eww/assets/ui/music-fallback.png $TMP_TEMP_PATH +fi + +cp $TMP_TEMP_PATH $TMP_COVER_PATH + +# an epic effekt +# convert $TMP_TEMP_PATH -alpha set -channel A -evaluate multiply 1.0 $TMP_COVER_PATH +# convert $TMP_TEMP_PATH -gravity center +repage -alpha set -channel A \ +# -sparse-color Barycentric '%[fx:w*2/32],0 transparent %[fx:w+0.5],0 opaque' \ +# -evaluate multiply 0.45 \ +# $TMP_COVER_PATH diff --git a/share/dotfiles/.config/eww/scripts/getSongMetadata.sh b/share/dotfiles/.config/eww/scripts/getSongMetadata.sh new file mode 100755 index 00000000..9c4dee1b --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getSongMetadata.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +PLAYERS="spotify,%any,firefox,chromium,brave,mpd" +ARTIST=$(playerctl -p $PLAYERS metadata --format '{{ artist }}') +TITLE=$(playerctl -p $PLAYERS metadata --format '{{ title }}') +STATUS=$(playerctl -p $PLAYERS status) + +artist() { + # Check if $title is "Advertisement" cause fuck Spotify. + # Deathemonic: How about using a spicetify adblocker (The Easy Way) or a adblock script https://github.com/abba23/spotify-adblock (The Chad Way) + # Kizu: https://github.com/abba23/spotify-adblock to big to clone for my wifi lmao + if [[ "$TITLE" = "Advertisement" ]]; then + echo "Spotify Free" + else + [[ -z "$ARTIST" ]] && echo "Unknown Artist" || echo "by $ARTIST" + fi +} + +title() { + if [[ -z "$TITLE" ]]; then + echo "Nothing Playing" + else + # Eww can't truncate Japanese and Chinese characters. + if [[ "$TITLE" =~ ^[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+ ]]; then + [[ ${#TITLE} -gt 16 ]] && echo ${TITLE::10}... || echo $TITLE + else + echo $TITLE + fi + fi +} + +player_status() { + if [[ "$STATUS" = "Playing" ]]; then + echo "" + elif [[ "$STATUS" = "Paused" ]]; then + echo "" + else + echo "" + fi +} + +player_status_text() { + # Author Notes: + # Deathemonic: It checks for the first priority player name and removes the rest of the players. This is usefull when spotify and mpd are both running + + PLAYER_NAME=$(playerctl -p $PLAYERS -l | head -n 1) + # Some browsers sometimes have ".instance(RANDOM_STRING)" in their names like Firefox. This removes the instance name. + PLAYER_NAME_SPLIT=($(echo $PLAYER_NAME | tr "." "\n")) + PLAYER_NAME_SPLIT=${PLAYER_NAME_SPLIT[0]} + + [[ "$STATUS" = "Playing" ]] && echo "Now Playing - via ${PLAYER_NAME_SPLIT^}" || echo "Music" +} + +position() { + POSITION=$(playerctl -p $PLAYERS position | sed 's/..\{6\}$//') + DURATION=$(playerctl -p $PLAYERS metadata mpris:length | sed 's/.\{6\}$//') + + # Author Notes: + # Deathemonic: It check if the position is greater than 0 then execute the position if not just echo a empty space + # Why do this? Because playerctl can't detect position on some players like firefox and spotify, and instead of manually modifying the script it just detects + if [[ $POSITION -gt 0 ]]; then + printf "%0d:%02d" $((POSITION % 3600 / 60)) $((POSITION % 60)) + printf " / " + printf "%0d:%02d" $((DURATION % 3600 / 60)) $((DURATION % 60)) + else + echo "" + fi +} + +case $1 in + "artist") artist;; + "title") title;; + "player_status") player_status;; + "player_status_text") player_status_text;; + "position") position;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getUsedRam.sh b/share/dotfiles/.config/eww/scripts/getUsedRam.sh new file mode 100755 index 00000000..da37c1df --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getUsedRam.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') diff --git a/share/dotfiles/.config/eww/scripts/getWeather.sh b/share/dotfiles/.config/eww/scripts/getWeather.sh new file mode 100755 index 00000000..9f04ccc9 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getWeather.sh @@ -0,0 +1,123 @@ +#!/bin/sh + +encode_to_url_format() { + echo "$1" | sed 's/ /%20/g' +} + +KEY="" +CITY="Kanpur" +CITY=$(encode_to_url_format "$CITY") + +weather=$(curl -sf "api.openweathermap.org/data/2.5/weather?q=$CITY&appid=$KEY&units=metric") +# weather_desc=$(echo $weather | jq -r ".weather[0].main") +weather_desc=$(curl "wttr.in/Kanpur?format='%C'" | sed "s|'||g") +weather_icon=$(curl "wttr.in/Kanpur?format='%c'" | sed "s|'||g") +# weather_temp=$(echo $weather | jq ".main.temp" | cut -d "." -f 1) +weather_temp=$(curl rpi:8000/getTemps | jq .temprature ) +pying stackoverflow ansfeels_like=$(curl "wttr.in/Kanpur?format='%f'" | sed "s|'||g") +weather_icon_code=$(echo "$weather" | jq -r ".weather[].icon" | head -1) +# feels_like=$(echo $weather | jq ".main.feels_like" | cut -d "." -f 1) +# humidity=$(echo $weather | jq ".main.humidity" | cut -d "." -f 1) +humidity=$(curl rpi:8000/getTemps | jq .Humidity) + +weather_hex="" + +check_if_empty() { + [[ -z "$1" ]] && echo "0" || echo "$1" +} + +# YandereDev moment. +if [[ "$weather_icon_code" == "50d" ]]; then + weather_icon=" " + weather_hex="#84afdb" +elif [[ "$weather_icon_code" == "50n" ]]; then + weather_icon=" " + weather_hex="#84afdb" +elif [[ "$weather_icon_code" == "01d" ]]; then + weather_icon=" " + weather_hex="#ffd86b" +elif [[ "$weather_icon_code" == "01n" ]]; then + weather_icon=" " + weather_hex="#fcdcf6" +elif [[ "$weather_icon_code" == "02d" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "02n" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "03d" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "03n" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "04d" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "04n" ]]; then + weather_icon=" " + weather_hex="#adadff" +elif [[ "$weather_icon_code" == "09d" ]]; then + weather_icon="" + weather_hex="#6b95ff" +elif [[ "$weather_icon_code" == "09n" ]]; then + weather_icon="" + weather_hex="#6b95ff" +elif [[ "$weather_icon_code" == "10d" ]]; then + weather_icon="" + weather_hex="#6b95ff" +elif [[ "$weather_icon_code" == "10n" ]]; then + weather_icon="" + weather_hex="#6b95ff" +elif [[ "$weather_icon_code" == "11d" ]]; then + weather_icon="" + weather_hex="#ffeb57" +elif [[ "$weather_icon_code" == "11n" ]]; then + weather_icon="" + weather_hex="#ffeb57" +elif [[ "$weather_icon_code" == "13d" ]]; then + weather_icon=" " + weather_hex="#e3e6fc" +elif [[ "$weather_icon_code" == "13n" ]]; then + weather_icon=" " + weather_hex="#e3e6fc" +elif [[ "$weather_icon_code" == "40d" ]]; then + weather_icon=" " + weather_hex="#84afdb" +elif [[ "$weather_icon_code" == "40n" ]]; then + weather_icon=" " + weather_hex="#84afdb" +else + weather_icon=" " + weather_hex="#adadff" +fi + +weather_hex="#adadff" + +case $1 in + current_temp) + check_if_empty $weather_temp + ;; + current_temp_fahrenheit) + weather_temp=$((($weather_temp * 9 / 5) + 32)) + check_if_empty $weather_temp + ;; + feels_like) + check_if_empty $feels_like + ;; + humidity) + check_if_empty $humidity + ;; + weather_desc) + [[ -z $weather_desc ]] && echo "Not Available." || echo "$weather_desc" + ;; + weather_icon) + echo $weather_icon + ;; + hex) + echo $weather_hex + ;; + full) + echo $weather + ;; +esac diff --git a/share/dotfiles/.config/eww/scripts/getWorkspaces.sh b/share/dotfiles/.config/eww/scripts/getWorkspaces.sh new file mode 100755 index 00000000..34975efa --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/getWorkspaces.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +workspaces() { + # check if Occupied + o1=$(bspc query -D -d .occupied --names | grep 1) + o2=$(bspc query -D -d .occupied --names | grep 2) + o3=$(bspc query -D -d .occupied --names | grep 3) + o4=$(bspc query -D -d .occupied --names | grep 4) + o5=$(bspc query -D -d .occupied --names | grep 5) + + # check if Focused + f1=$(bspc query -D -d focused --names | grep 1) + f2=$(bspc query -D -d focused --names | grep 2) + f3=$(bspc query -D -d focused --names | grep 3) + f4=$(bspc query -D -d focused --names | grep 4) + f5=$(bspc query -D -d focused --names | grep 5) + + # le spagetti + content1="◇" + content2="◇" + content3="◇" + content4="◇" + content5="◇" + + [[ "$f1" ]] && content1="◆" + [[ "$f2" ]] && content2="◆" + [[ "$f3" ]] && content3="◆" + [[ "$f4" ]] && content4="◆" + [[ "$f5" ]] && content5="◆" + + echo "(box :class \"ws\" :orientation \"h\" :halign \"center\" :valign \"start\" :space-evenly \"false\" :spacing \"-5\" (button :onclick \"bspc desktop -f 1\" :class \"0$o1$f1\" \"$content1\") (button :onclick \"bspc desktop -f 2\" :class \"0$o2$f2\" \"$content2\") (button :onclick \"bspc desktop -f 3\" :class \"0$o3$f3\" \"$content3\") (button :onclick \"bspc desktop -f 4\" :class \"0$o4$f4\" \"$content4\") (button :onclick \"bspc desktop -f 5\" :class \"0$o5$f5\" \"$content5\" ))" +} + +workspaces +bspc subscribe desktop node_transfer | while read -r _ ; do +workspaces +done diff --git a/share/dotfiles/.config/eww/scripts/openControlCenter.sh b/share/dotfiles/.config/eww/scripts/openControlCenter.sh new file mode 100755 index 00000000..27010a39 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/openControlCenter.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +LOCK_FILE="$HOME/.cache/eww-control-center.lock" +EWW_BIN="$HOME/.local/bin/eww" +ACTIVE_PLAYERS=$(playerctl -l | head -n 1) + +run() { + ${EWW_BIN} open control-center + sleep 0.2 + xdo raise -N eww-bar + ${EWW_BIN} update ccenter=true + + sleep 1 && [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=true +} + +# Run eww daemon if not running +if [[ ! `pidof eww` ]]; then + ${EWW_BIN} daemon + sleep 1 +else + if [[ ! -f "$LOCK_FILE" ]]; then + touch "$LOCK_FILE" + run + else + [[ ! -z "$ACTIVE_PLAYERS" ]] && ${EWW_BIN} update mp=false && sleep 0.4 + ${EWW_BIN} update ccenter=false + sleep 0.6 + ${EWW_BIN} close control-center + [[ ! -f "$HOME/.cache/eww-calendar.lock" ]] && xdo lower -N eww-bar + rm "$LOCK_FILE" + fi +fi diff --git a/share/dotfiles/.config/eww/scripts/openExitScreen.sh b/share/dotfiles/.config/eww/scripts/openExitScreen.sh new file mode 100755 index 00000000..42e89a4b --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/openExitScreen.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +LOCK_FILE="$HOME/.cache/eww-escreen.lock" +EWW_BIN="$HOME/.local/bin/eww" + +hide_unhide_windows() { + while bspc node any.hidden.window -g hidden=off; do false; done && while bspc node 'any.!hidden.window' -g hidden=on; do :; done +} + +rerun() { + if [[ ! -f "$HOME/.cache/bar.lck" ]]; then + $HOME/.local/bin/tglbar + fi + + ${EWW_BIN} update escreen=true +} + +prerun() { + [[ -f "$HOME/.cache/eww-info-center.lock" ]] && sh $HOME/.config/eww/scripts/openInfoCenter.sh & + [[ -f "$HOME/.cache/eww-control-center.lock" ]] && sh $HOME/.config/eww/scripts/openControlCenter.sh & + [[ -f "$HOME/.cache/eww-notification-center.lock" ]] && sh $HOME/.config/eww/scripts/openNotificationCenter.sh & +} + +run() { + $HOME/.local/bin/tglbar + ${EWW_BIN} open exit-screen + sleep 0.2 && hide_unhide_windows + sleep 0.15 && ${EWW_BIN} update escreen=true + + # Sometimes, eww is a dick. It doesn't update the exitscreen properly. + sleep 0.2 && rerun +} + +# Run eww daemon if not running +if [[ ! `pidof eww` ]]; then + ${EWW_BIN} daemon + sleep 1 +else + if [[ ! -f "$LOCK_FILE" ]]; then + touch "$LOCK_FILE" + prerun && run + else + sleep 0.15 && ${EWW_BIN} update escreen=false + sleep 0.2 && hide_unhide_windows + $HOME/.local/bin/tglbar + ${EWW_BIN} close exit-screen + rm "$LOCK_FILE" + fi +fi diff --git a/share/dotfiles/.config/eww/scripts/openInfoCenter.sh b/share/dotfiles/.config/eww/scripts/openInfoCenter.sh new file mode 100755 index 00000000..02fb2848 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/openInfoCenter.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +LOCK_FILE="$HOME/.cache/eww-info-center.lock" +EWW_BIN="$HOME/.local/bin/eww" + +run() { + ${EWW_BIN} open info-center + sleep 0.2 + ${EWW_BIN} update icenter=true +} + +# Run eww daemon if not running +if [[ ! `pidof eww` ]]; then + ${EWW_BIN} daemon + sleep 1 +else + if [[ ! -f "$LOCK_FILE" ]]; then + touch "$LOCK_FILE" + run + else + ${EWW_BIN} update icenter=false + sleep 0.6 + ${EWW_BIN} close info-center + rm "$LOCK_FILE" + fi +fi diff --git a/share/dotfiles/.config/eww/scripts/openNotificationCenter.sh b/share/dotfiles/.config/eww/scripts/openNotificationCenter.sh new file mode 100755 index 00000000..151a6689 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/openNotificationCenter.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +LOCK_FILE="$HOME/.cache/eww-notification-center.lock" +EWW_BIN="$HOME/.local/bin/eww" + +run() { + ${EWW_BIN} open notification-center + sleep 0.2 + ${EWW_BIN} update noticenter=true +} + +# Run eww daemon if not running +if [[ ! `pidof eww` ]]; then + ${EWW_BIN} daemon + sleep 1 +else + if [[ ! -f "$LOCK_FILE" ]]; then + touch "$LOCK_FILE" + run + else + ${EWW_BIN} update noticenter=false + sleep 0.8 + ${EWW_BIN} close notification-center + rm "$LOCK_FILE" + fi +fi diff --git a/share/dotfiles/.config/eww/scripts/trade_counter.py b/share/dotfiles/.config/eww/scripts/trade_counter.py new file mode 100644 index 00000000..0f862e6a --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/trade_counter.py @@ -0,0 +1,105 @@ +from shared_libraries.helper_scripts import consulHelper, misc +import argparse +from datetime import datetime +from plyer import notification +import os, sys, time +from shared_libraries.helper_scripts.mibianLib import mibian +import math + +def notif(title, body): + notification.notify( + title = title, + message = body, + app_icon = "alert", + timeout = 10, + ) + +def maxLoss(): + return consulHelper.getConsulVar('shoonya/maxLoss') + + +def tradeCount(): + return consulHelper.getConsulVar('shoonya/tradeCount') + +def killswitch(pnl, peakPnl, tradeCount, maxLoss): + starttime = datetime.today().replace(hour=9, minute=15, second=0, microsecond=0) + endtime = datetime.today().replace(hour=15, minute=30, second=0, microsecond=0) + # endtime = datetime.today().replace(hour=23, minute=59, second=0, microsecond=0) + + current_date = datetime.today().strftime('%d-%m-%y') + consul_date = consulHelper.getConsulVar('shoonya/date') + + if datetime.today() > starttime and datetime.today() < endtime: + + # shut down if max loss crossed + if current_date == consul_date and pnl < maxLoss* -1: + notif("max loss crossed", 'shutting down') + time.sleep(5) + # print('hui hui') + os.system('systemctl poweroff') + + # shut down if max pnl gets eroded + if peakPnl >= 3000 and pnl <= peakPnl / 2: + notif("max profit eroded", 'shutting down') + time.sleep(5) + os.system('systemctl poweroff') + + # shut down if max trades crossed + if tradeCount > 10: + # notif("Too many trades", 'limit trading now') + if tradeCount > 40 and pnl < 1000 : + notif("trades exceeded 20", 'stopping trading now') + time.sleep(5) + os.system('systemctl poweroff') + + +def pnl(): + pnl = consulHelper.getConsulVar('shoonya/pnl') + peakPnl = consulHelper.getConsulVar('shoonya/peakPnl') + tradeCount = consulHelper.getConsulVar('shoonya/tradeCount') + if pnl != None: + maxxLoss = consulHelper.getConsulVar('shoonya/maxLoss') + killswitch(float(pnl), float(peakPnl), int(tradeCount), float(maxxLoss)) + return pnl + + +def latestCE(): + latestCE = consulHelper.getConsulVar('shoonya/ceOtm') + return latestCE + +def latestPE(): + latestPE = consulHelper.getConsulVar('shoonya/peOtm') + return latestPE + +def checkValidDay(): + consul_date = consulHelper.getConsulVar('shoonya/date') + if consul_date != datetime.now().strftime('%d-%m-%y'): + print('NA') + exit(0) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--getMaxLoss', action='store_true', default=None) + parser.add_argument('--getPnl', action='store_true', default=None) + parser.add_argument('--getTradeCount', action='store_true', default=None) + parser.add_argument('--getLatestCE', action='store_true', default=None) + parser.add_argument('--getLatestPE', action='store_true', default=None) + + args = parser.parse_args() + + checkValidDay() + + if args.getMaxLoss is not None: + print(maxLoss()) + + if args.getPnl is not None: + print(pnl()) + + if args.getTradeCount is not None: + print(tradeCount()) + + if args.getLatestCE is not None: + print(latestCE()) + + if args.getLatestPE is not None: + print(latestPE()) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/scripts/trade_counter.sh b/share/dotfiles/.config/eww/scripts/trade_counter.sh new file mode 100755 index 00000000..5acb7dde --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/trade_counter.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +dir="/home.kushy" +dir="$( dirname $0)" +source $dir/trade/bin/activate + +getTrades() { + python $dir/trade_counter.py --getTradeCount +} + +getMaxLoss(){ + python $dir/trade_counter.py --getMaxLoss +} + +getPnl() { + python $dir/trade_counter.py --getPnl +} + +getLatestCE() { + python $dir/trade_counter.py --getLatestCE +} + +getLatestPE() { + python $dir/trade_counter.py --getLatestPE +} + +refresh() { + trade_count=$(python $dir/trade_counter.py --getTradeCount) + +} + +verbose='false' +while getopts 'tplceus:v' flag; do + case "${flag}" in + r) refresh;; + t) getTrades;; + p) getPnl;; + l) getMaxLoss;; + c) checkvalidDay;; + e) getLatestCE;; + u) getLatestPE;; + s) val="${OPTARG}" + set_volume $val + #pactl -- set-sink-volume $sink $val% + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + + diff --git a/share/dotfiles/.config/eww/scripts/trade_time.py b/share/dotfiles/.config/eww/scripts/trade_time.py new file mode 100644 index 00000000..76372875 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/trade_time.py @@ -0,0 +1,12 @@ +import datetime + +date = datetime.datetime.now() +new_date = date - datetime.timedelta(0,3) # days, seconds, then other fields. +minutes = int(new_date.strftime("%M"))%3 +seconds = new_date.strftime("%S") + +# old_minutes = int(date.strftime("%M"))%3 +# old_seconds = date.strftime("%S") + +print(f"{minutes}:{seconds}") +# print(f"{old_minutes}:{old_seconds}") diff --git a/share/dotfiles/.config/eww/scripts/trade_time.sh b/share/dotfiles/.config/eww/scripts/trade_time.sh new file mode 100755 index 00000000..763a9210 --- /dev/null +++ b/share/dotfiles/.config/eww/scripts/trade_time.sh @@ -0,0 +1,11 @@ +#!/bin/bash +min=$(date +%M) +min=$(echo $min | sed 's/^0*//') +min=$(( $min % 3 )) +min=$(( 2 - min )) + + +sec=$(date +%S) +sec=$(( 58 - sec )) +sec=$(printf "%02d\n" $sec) +echo $min:$sec diff --git a/share/dotfiles/.config/eww/src/scss/_modules.scss b/share/dotfiles/.config/eww/src/scss/_modules.scss new file mode 100755 index 00000000..bd80312e --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/_modules.scss @@ -0,0 +1,126 @@ +.notification { + font-family: "DM Sans", "Sarasa Mono CL Nerd Font"; + background-color: $darker-background; + border-radius: 10px; + margin-bottom: 1.5em; + + // box-shadow: 4px 3px 8px 1px rgba(0, 0, 0, 0.55); + + .notification-title { + // background-color: $background-secondary; + background-color: inherit; + padding: .95em 0em .75em; + font-size: 14px; + + border-radius: 10px 10px 0px 0px; + + .notification-title-text { + margin: 0em 0em 0em 1em; + font-weight: bold; + } + + .notification-close { + margin: 0em 1em 0em 0em; + color: $red; + } + } + + .notification-body { + padding: .05em 0em .15em; + font-size: 14px; + border-radius: 0px 0px 10px 10px; + + .notification-image { + background-size: cover; + background-repeat: no-repeat; + background-position: center; + border-radius: 8px; + min-height: 64px; + min-width: 64px; + margin-left: 1.5em; + } + + .notification-content { + margin: 1em; + + .notification-summary { + font-size: 16px; + font-weight: bold; + margin: .25em 0em .5em; + } + + .notification-message { + font-size: 12px; + color: $foreground-secondary; + } + } + } + + .notification-screenshot-opt, .notification-opt { + margin: 1em 1em 0em; + border-radius: inherit; + + button { + background-color: $background-tertiary; + border-radius: 6px; + padding: .5em; + margin: 0em .5em; + } + } +} + +.cc-button { + font-family: "DM Sans"; + margin: 1em .5; + + .cc-button-btn { + font-family: "Material Icons"; + padding: .5em; + margin: .5em; + border-radius: 6px; + font-size: 18px; + // color: $darker-background; + + .sep-column { + font-size: 24px; + margin: 0em .05em; + color: $foreground-tertiary; + } + } + + .cc-button-title { + font-size: 13px; + } +} + +.cc-button-icon-only { + font-family: "DM Sans"; + margin: 1em .5; + + .cc-button-btn { + font-family: "Material Icons"; + padding: .75em 2.25em; + margin: .5em; + border-radius: 6px; + font-size: 18px; + // color: $darker-background; + + .sep-column { + font-size: 24px; + margin: 0em .05em; + color: $foreground-tertiary; + } + } + + .cc-button-title { + font-size: 13px; + } +} + +.layout-btn { + font-size: 24px; + margin: .4em .5em .4em 0em; + padding: .0em .6em; + background-color: #1C2325; + border-radius: 10px; +} diff --git a/share/dotfiles/.config/eww/src/scss/_overrides.scss b/share/dotfiles/.config/eww/src/scss/_overrides.scss new file mode 100755 index 00000000..185e36ca --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/_overrides.scss @@ -0,0 +1,16 @@ +* { + all: unset; +} + +window { + color: $foreground-primary; + font-family: "Segoe UI"; + font-weight: 700; +} + +tooltip { + background-color: $background-tertiary; + border-radius: 4px; + font-family: "Segoe UI"; + font-size: 14px; +} diff --git a/share/dotfiles/.config/eww/src/scss/_variables.scss b/share/dotfiles/.config/eww/src/scss/_variables.scss new file mode 100755 index 00000000..d90dcde0 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/_variables.scss @@ -0,0 +1,23 @@ +$darker-background: #0b0f10; +$background-primary: #101415; +// $background-secondary: #131718; +// $background-primary: #101415; +$background-secondary: rgba(19, 23, 24, 0.3); +$background-tertiary: #151a1c; +$lighter-background: #1C2325; + +$foreground-primary: #C5C8C9; +$foreground-secondary: #9fa0a0; +$foreground-tertiary: #6e7071; + +$red: #ee6a70; +$blue: #7ba5dd; +$blue-desaturated: #6791c9; +$magenta: #cb92f2; +$green: #96d6b0; +$yellow: #ffb29b; +$accent: $blue; + +$javacafeMagenta: #d7c1ed; +$javacafeBlue: #bac8ef; +$javacafeCyan: #c7e5d6; diff --git a/share/dotfiles/.config/eww/src/scss/bar/_bar.scss b/share/dotfiles/.config/eww/src/scss/bar/_bar.scss new file mode 100755 index 00000000..d0caa64e --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/_bar.scss @@ -0,0 +1,17 @@ +window { + button:hover { + color: $accent; + } + + .eww-bar { + background-color: $darker-background; + // border-radius: 0px 0px 10px 10px; + font-family: "DM Sans"; + font-weight: normal; + } + + .separator { + color: #1c2325; + font-size: 2em; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/bar/index.scss b/share/dotfiles/.config/eww/src/scss/bar/index.scss new file mode 100755 index 00000000..a9854e20 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/index.scss @@ -0,0 +1,6 @@ +@import "./bar"; +@import "./widgets/action-center"; +@import "./widgets/battery"; +@import "./widgets/launcher"; +@import "./widgets/time"; +@import "./widgets/workspaces"; diff --git a/share/dotfiles/.config/eww/src/scss/bar/widgets/_action-center.scss b/share/dotfiles/.config/eww/src/scss/bar/widgets/_action-center.scss new file mode 100755 index 00000000..50aa95fc --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/widgets/_action-center.scss @@ -0,0 +1,10 @@ +.action-center { + font-family: "Material Icons"; + font-size: 1.5em; + + border-radius: 10px; + // background-color: #1c2325; + + margin: .5em 0em .5em 0em; + padding: 0em .25em; +} diff --git a/share/dotfiles/.config/eww/src/scss/bar/widgets/_battery.scss b/share/dotfiles/.config/eww/src/scss/bar/widgets/_battery.scss new file mode 100755 index 00000000..fbac4ab3 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/widgets/_battery.scss @@ -0,0 +1,19 @@ +.battery { + scale trough { + background-color: #50906a; + border-radius: 10px; + min-height: 2.4em; + min-width: 6em; + } + + trough highlight { + background-image: linear-gradient(to right, $green); + border-radius: 10px; + } + + .battery-label { + color: $background-primary; + font-size: 18px; + margin: .1em 0em 0em; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/bar/widgets/_launcher.scss b/share/dotfiles/.config/eww/src/scss/bar/widgets/_launcher.scss new file mode 100755 index 00000000..d0f6353a --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/widgets/_launcher.scss @@ -0,0 +1,13 @@ +.launcher { + margin: .5em .5em .5em 1.5em; + + button { + // background-color: #1c2325; + border-radius: 6px; + font-size: 1.6em; + font-family: "Material Icons"; + // margin: .15em; + // padding: 0em .65em; + + } +} diff --git a/share/dotfiles/.config/eww/src/scss/bar/widgets/_time.scss b/share/dotfiles/.config/eww/src/scss/bar/widgets/_time.scss new file mode 100755 index 00000000..b1316182 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/widgets/_time.scss @@ -0,0 +1,12 @@ +.time { + // font-family: "Sarasa Mono CL Nerd Font"; + font-weight: bold; + font-size: 1.3em; + + margin: .5em 1em; + + .time-sep { + margin-bottom: .25em; + color: $foreground-primary; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/bar/widgets/_workspaces.scss b/share/dotfiles/.config/eww/src/scss/bar/widgets/_workspaces.scss new file mode 100755 index 00000000..58c1e3ff --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/bar/widgets/_workspaces.scss @@ -0,0 +1,28 @@ +.ws { + font-size: 1.1em; + font-family: "Sarasa Mono CL Nerd Font"; + margin: .5em; + padding: .25em .5em; + border-radius: 24px; + // background-color: $background-tertiary; + + .0, .01, .02, .03, .04, .05, .06, + .011, .022, .033, .044, .055, .066 { + margin: .5em; + } + + /* Unoccupied */ + .0 { + color: #32393b; + } + + /* Occupied */ + .01, .02, .03, .04, .05, .06 { + color: #bfc9db; + } + + /* Focused */ + .011, .022, .033, .044, .055, .066 { + color: #b7b8b8; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/calendar/bongo.png b/share/dotfiles/.config/eww/src/scss/calendar/bongo.png new file mode 100755 index 00000000..05fca537 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/bongo.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/bongo2.png b/share/dotfiles/.config/eww/src/scss/calendar/bongo2.png new file mode 100755 index 00000000..d40a97f0 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/bongo2.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/calendar.scss b/share/dotfiles/.config/eww/src/scss/calendar/calendar.scss new file mode 100755 index 00000000..f2686e3c --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/calendar/calendar.scss @@ -0,0 +1,127 @@ +/* Created by https://github.com/rxyhn + Designed by https://github.com/rxyhn + Maintaned by https://github.com/rxyhn +*/ +@import "../../../../../.cache/wal/colors.scss"; + + + +// Global +*{ + all:unset; + font-size: 14px; + font-family: "Fira Sans semibold", sans-serif; + font-weight: normal; + } + + // Variable Color's + $background: #1A1B26; + // $foreground: #A9B1D6; + + $black: #222222; + $gray: #565F89; + $red: #F7768E; + $green: #608B4E; + $yellow: #E0AF68; + $blue: #7AA2F7; + $magenta: #BB9AF7; + $cyan: #7DCFFF; + $white: $foreground; + + + // Calendar + .cal-box { + background-color: $black; + border-radius: 10px; + border-top-left-radius: 0px; + border-top-right-radius: 0px; + box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.377); + // border : 3px solid $green; + font-size: 14px; + .cal-inner-box { + padding: 1rem 1rem .2rem; + + .cal { + &.highlight { + padding: 10rem; + } + + padding: .3rem ; + margin-left: 10px; + } + } + } + + calendar:selected { + // color: $blue; + background-color: $color11; + margin: 0 0 5px 0; + border-radius: 4px; + } + + calendar.header { + color: $blue; + font-weight: bold; + } + + calendar.button { + color: $magenta; + } + + calendar.highlight { + color: $magenta; + font-weight: bold; + } + + calendar:indeterminate { + color: $foreground; + } + + + +// calendar + +$border-blue: #21ABE7; + + + +.events { + background: $black; + margin : 10px; + padding : 15px ; + font-weight: 500; + border-radius: 8px; + // font-family: Inter UI, ; + box-shadow: 2px 0px 2px 2px rgba(200,200,200,0.3); + .sep { + color : white; + font-size: 15px; + font-weight: 700; + background: $black; + padding : 10px 0 0 0 ; + } + .event{ + background-color: $black; + color: $color11; + border-left: 4px solid $color11; + border-radius: 4px; + padding : 0 0 0 5px; + font-size: 16px; + } + .next_event{ + // background-color: #E4F5FF; + color: $color11; + border-left: 4px solid $color11; + border-radius: 0px; + padding : 0 0 0 5px; + font-size: 20px; + } +} + +.desc{ + font-size: 16px; +} +.time{ + color:white; + font-size: 13px; +} \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/scss/calendar/cat.gif b/share/dotfiles/.config/eww/src/scss/calendar/cat.gif new file mode 100755 index 00000000..028fb4e4 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/cat.gif differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/catto.png b/share/dotfiles/.config/eww/src/scss/calendar/catto.png new file mode 100755 index 00000000..8de24879 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/catto.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/catto2.png b/share/dotfiles/.config/eww/src/scss/calendar/catto2.png new file mode 100755 index 00000000..75f0f40f Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/catto2.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/catto4.png b/share/dotfiles/.config/eww/src/scss/calendar/catto4.png new file mode 100755 index 00000000..b6ccd3de Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/catto4.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/index.scss b/share/dotfiles/.config/eww/src/scss/calendar/index.scss new file mode 100755 index 00000000..6b8e2448 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/calendar/index.scss @@ -0,0 +1 @@ +@import "./calendar"; \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/scss/calendar/scratch.png b/share/dotfiles/.config/eww/src/scss/calendar/scratch.png new file mode 100755 index 00000000..a1af6ef1 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/scratch.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/scratch2.png b/share/dotfiles/.config/eww/src/scss/calendar/scratch2.png new file mode 100755 index 00000000..0d9df633 Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/scratch2.png differ diff --git a/share/dotfiles/.config/eww/src/scss/calendar/scratch4.png b/share/dotfiles/.config/eww/src/scss/calendar/scratch4.png new file mode 100755 index 00000000..e661592e Binary files /dev/null and b/share/dotfiles/.config/eww/src/scss/calendar/scratch4.png differ diff --git a/share/dotfiles/.config/eww/src/scss/clock/_clock.scss b/share/dotfiles/.config/eww/src/scss/clock/_clock.scss new file mode 100755 index 00000000..f7c59946 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/clock/_clock.scss @@ -0,0 +1,28 @@ +.clock { + font-family: "Shoguns Clan", "Roboto"; + font-size: 60px; + padding: 0px; + .separator{ + font-size: 35px; + font-family: "Shoguns Clan"; + // font-family: "Cantarell"; + color: red; + } + .time{ + font-size: 50px; + } + .time-period{ + font-size: 40px; + // font-family: "Cantarell"; + color: red; + } + // .time-hour{ + // transition: all 0.8s cubic-bezier(0.455, 0.03, 0.515, 1); + // } + + // .time-minute { + // background-color: $darker-background; + // border-radius: 10px; + // font-family: "DM Sans"; + // } +} diff --git a/share/dotfiles/.config/eww/src/scss/clock/index.scss b/share/dotfiles/.config/eww/src/scss/clock/index.scss new file mode 100755 index 00000000..5a2263cb --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/clock/index.scss @@ -0,0 +1 @@ +@import "./clock"; \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/scss/control-center/_control-center.scss b/share/dotfiles/.config/eww/src/scss/control-center/_control-center.scss new file mode 100755 index 00000000..52601e46 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/control-center/_control-center.scss @@ -0,0 +1,69 @@ +.control-center-window { + .control-center-spacer { + transition: all 0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955); + } + + .control-center { + background-color: $darker-background; + border-radius: 10px; + font-family: "DM Sans"; + } + + .music-player { + background-color: $darker-background; + margin-top: 1em; + padding: 1em; + min-height: 152px; + border-radius: 6px; + font-family: "DM Sans", "Sarasa Mono CL Nerd Font"; + + .song-art { + background-color: $darker-background; + background-size: cover; + background-repeat: no-repeat; + background-position: center; + border-radius: 6px; + + margin-right: 5px; + min-width: 24em; + + .music-info { + border-radius: 4px 6px 6px 4px; + background: linear-gradient(to right, rgba(16, 20, 21, 1), rgba(16, 20, 21, 0.5)); + + padding-top: 10px; + padding-left: 1em; + + .now-playing { + margin-bottom: 6px; + } + .song-title { + font-size: 16px; + font-weight: bolder; + } + .song-artist, .song-position { + color: $foreground-secondary; + } + .song-position { + margin-top: 5.1em; + } + } + } + + .song-controls { + background-color: $background-secondary; + padding: 0em 1em; + margin-left: 10px; + border-radius: 5px; + + button { + font-family: "Material Icons"; + font-size: 24px; + + &:hover { + color: $accent; + } + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/control-center/index.scss b/share/dotfiles/.config/eww/src/scss/control-center/index.scss new file mode 100755 index 00000000..043b2007 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/control-center/index.scss @@ -0,0 +1,4 @@ +@import "./control-center"; +@import "./rows/first-row"; +@import "./rows/second-row"; +@import "./rows/third-row"; diff --git a/share/dotfiles/.config/eww/src/scss/control-center/rows/_first-row.scss b/share/dotfiles/.config/eww/src/scss/control-center/rows/_first-row.scss new file mode 100755 index 00000000..dde18fcf --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/control-center/rows/_first-row.scss @@ -0,0 +1,40 @@ +.control-center { + .first-row { + margin: 1em 1em 0em; + + .weather { + margin: .5em 0em 0em 0em; + + .weather-icon { + font-size: 36px; + font-family: "Sarasa Mono CL Nerd Font"; + } + + .weather-data { + margin-left: 1em; + + .weather-temp { + font-size: 20px; + font-weight: bold; + } + } + } + + .date { + margin: 0em 0em 0em 0em; + + .current-time { + font-size: 36px; + margin-left: .5em; + } + + .date-data { + .date-md { + font-size: 20px; + font-weight: bold; + margin-bottom: -.65em; + } + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/control-center/rows/_second-row.scss b/share/dotfiles/.config/eww/src/scss/control-center/rows/_second-row.scss new file mode 100755 index 00000000..8ab63291 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/control-center/rows/_second-row.scss @@ -0,0 +1,67 @@ +.control-center { + .second-row { + font-family: "Material Icons"; + margin-bottom: 1.25em; + + box { + margin: .25em 0em; + } + + scale trough { + background-color: $background-primary; + border-radius: 10px; + min-height: 1em; + min-width: 20em; + margin: 0em 1em; + + highlight { + margin: .25em; + border-radius: inherit; + } + } + + .slider-clicker { + font-size: 20px; + background-color: $background-tertiary; + border-radius: 100%; + padding: .25em; + } + + .volume-slider { + margin-left: 2em; + + .volume-icon { + padding: .25em; + border-radius: 2em; + // background-color: $background-primary; + color: $foreground-tertiary; + font-size: 20px; + } + + .volume-level { + color: wheat; + } + + trough highlight { + // background-image: linear-gradient(to top, #df5b61, $red); + background-color: #7ba5dd; + } + } + .brightness-slider { + margin-left: 2em; + + .brightness-icon { + padding: .25em; + border-radius: 2em; + // background-color: $background-primary; + color: $foreground-tertiary; + font-size: 20px; + } + + trough highlight { + // background-image: linear-gradient(to top, #de8f78, $yellow); + background-color: #96d6b0; + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/control-center/rows/_third-row.scss b/share/dotfiles/.config/eww/src/scss/control-center/rows/_third-row.scss new file mode 100755 index 00000000..455434b3 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/control-center/rows/_third-row.scss @@ -0,0 +1,37 @@ +.control-center { + .third-row { + .user-info { + margin: 0em 0em 1.25em 2.5em; + + .user-info-avatar { + background-image: url("./assets/avatar.png"); + background-size: cover; + min-height: 36px; + min-width: 36px; + border-radius: 100%; + } + + .user-info-label { + margin: 0em 0em 0em .8em; + font-size: 16px; + font-weight: bold; + } + } + + .system-btn { + background-color: $background-tertiary; + padding: .5em; + border-radius: 12px; + margin: 0em 2.5em 1.25em 0em; + + button { + margin: 0em .25em; + } + + .edit-btn, .exit-btn { + font-size: 20px; + font-weight: bold; + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/desk-widgets/_desk-widgets.scss b/share/dotfiles/.config/eww/src/scss/desk-widgets/_desk-widgets.scss new file mode 100755 index 00000000..068532db --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/desk-widgets/_desk-widgets.scss @@ -0,0 +1,79 @@ +.desk-widgets{ + padding: 2em; + + .first-row { + // margin: 0px 12em; + padding: 2em; + + .weather { + padding: 1em 1em 1em 0em; + font-family: "Fira sans"; + background-color: $background-secondary; + border-radius: 10px; + box-shadow: 2px 2px 4px rgba(0,0,0,0.8); + margin: 0px 1em; + + .top { + .weather-icon { + font-size: 32px; + } + .temperature { + font-family: "Bebas Neue"; + font-size: 32px; + font-weight: 300; + } + } + + .weather-data { + margin-left: 1em; + + .weather-desc { + font-size: 20px; + font-weight: bold; + + } + } + + } + + .music { + background-color: $background-secondary; + // background-image: url("/tmp/music_widget.png"); + background-size: 150px 150px; + padding: 1em ; + margin: 0px 1em; + font-family: "Fira sans"; + border-radius: 10px; + box-shadow: 2px 2px 4px rgba(0,0,0,0.8); + + .top { + .song-icon { + font-size: 32px; + } + } + + .song-detail { + .song-title { + font-size: 20px; + font-weight: bold; + } + .song-title { + + } + } + } + } + .second-row { + padding: 2em; + .lyrics{ + padding: 2em ; + font-family: "Fira sans"; + background-color: $background-secondary; + font-size: 20px; + + border-radius: 10px; + box-shadow: 2px 2px 4px rgba(0,0,0,0.8); + margin: 0px 1em; + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/desk-widgets/index.scss b/share/dotfiles/.config/eww/src/scss/desk-widgets/index.scss new file mode 100755 index 00000000..9bcc2994 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/desk-widgets/index.scss @@ -0,0 +1 @@ +@import "./desk-widgets"; \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/scss/exitscreen/_exit-screen.scss b/share/dotfiles/.config/eww/src/scss/exitscreen/_exit-screen.scss new file mode 100755 index 00000000..56ed44bb --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/exitscreen/_exit-screen.scss @@ -0,0 +1,44 @@ +.exit-screen { + button { + background-color: $darker-background; + color: $background-primary; + border: 6px solid $background-primary; + border-radius: 10px; + font-family: "Material Icons"; + font-size: 64px; + + margin: 0em .5em; + padding: .25em; + } + + .shutdown-btn { + color: $red; + &:hover { + border-color: $red; + } + } + .reboot-btn { + color: $green; + &:hover { + border-color: $green; + } + } + .sleep-btn { + color: $yellow; + &:hover { + border-color: $yellow; + } + } + .hibernate-btn { + color: $blue; + &:hover { + border-color: $blue; + } + } + .logout-btn { + color: $magenta; + &:hover { + border-color: $magenta; + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/exitscreen/index.scss b/share/dotfiles/.config/eww/src/scss/exitscreen/index.scss new file mode 100755 index 00000000..2aa57f9b --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/exitscreen/index.scss @@ -0,0 +1 @@ +@import "./exit-screen"; diff --git a/share/dotfiles/.config/eww/src/scss/info-center/_info-center.scss b/share/dotfiles/.config/eww/src/scss/info-center/_info-center.scss new file mode 100755 index 00000000..bbff610a --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/info-center/_info-center.scss @@ -0,0 +1,11 @@ +.info-center-window { + .info-center-spacer { + transition: all 0.8s cubic-bezier(0.455, 0.03, 0.515, 1); + } + + .info-center { + background-color: $darker-background; + border-radius: 10px; + font-family: "DM Sans"; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/info-center/index.scss b/share/dotfiles/.config/eww/src/scss/info-center/index.scss new file mode 100755 index 00000000..01582c4c --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/info-center/index.scss @@ -0,0 +1,4 @@ +@import "./info-center"; +@import "./rows/first-row"; +@import "./rows/second-row"; +@import "./rows/third-row"; diff --git a/share/dotfiles/.config/eww/src/scss/info-center/rows/_first-row.scss b/share/dotfiles/.config/eww/src/scss/info-center/rows/_first-row.scss new file mode 100755 index 00000000..403ba953 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/info-center/rows/_first-row.scss @@ -0,0 +1,32 @@ +.info-center { + .time { + font-size: 48px; + + // label { + // margin: 0em .25em; + // } + + .time-separator { + margin: 0em .5em; + + label { + font-size: 24px; + font-family: "Material Icons"; + + &:nth-child(1) { + color: $red; + } + &:nth-child(2) { + color: $green; + } + &:nth-child(3) { + color: $blue; + } + } + } + } + + .date { + font-size: 18px; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/info-center/rows/_second-row.scss b/share/dotfiles/.config/eww/src/scss/info-center/rows/_second-row.scss new file mode 100755 index 00000000..4430ab45 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/info-center/rows/_second-row.scss @@ -0,0 +1,51 @@ +.info-center { + .second-row { + margin: 1em; + .cal-box { + background-color: $background-secondary; + border-radius: 10px; + + padding: .5em; + margin: 1em 0.75em .25em; + + .month-year { + font-size: 18px; + font-weight: bold; + margin: 0.5em 0em 0em; + } + + .day-names { + margin: 1em 1em 0em; + font-size: 14px; + font-weight: bold; + color: $green; + } + + .cal { + padding: 1em .75em 0em; + } + } + } +} + +calendar { + font-family: "DM Sans"; + font-weight: bold; + + &:selected { + color: $accent; + } + &:indeterminate { + color: rgba(205, 219, 249, 0.3); + } +} + +calendar.button { + color: #192022; +} +calendar.highlight { + color: $green; + font-weight: bold; + padding: 20px; + margin: 20px; +} diff --git a/share/dotfiles/.config/eww/src/scss/info-center/rows/_third-row.scss b/share/dotfiles/.config/eww/src/scss/info-center/rows/_third-row.scss new file mode 100755 index 00000000..187d96ce --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/info-center/rows/_third-row.scss @@ -0,0 +1,44 @@ +.info-center { + .third-row { + margin: 0em 1.75em 1.5em; + + .weather { + padding: 1.5em 1em; + + background-color: $background-secondary; + border-radius: 10px; + + .weather-details { + margin: 0em 1em 0em 0em; + + .weather-icon { + font-size: 32px; + font-family: "Sarasa Mono CL Nerd Font"; + } + + .weather-data { + margin-left: 1em; + + .weather-desc { + font-size: 20px; + font-weight: bold; + + } + } + } + + .weather-temp-and-feel { + margin: 0em 1em 0em 0em; + + .weather-data { + // margin-left: 1.5em; + + .weather-temp { + font-size: 20px; + font-weight: bold; + } + } + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/lockscreen/_lock-screen.scss b/share/dotfiles/.config/eww/src/scss/lockscreen/_lock-screen.scss new file mode 100755 index 00000000..510723cd --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/lockscreen/_lock-screen.scss @@ -0,0 +1,34 @@ +.lock-screen { + background-color: $darker-background; + border: 6px solid $background-primary; + border-radius: 100%; + + .lock-inner { + margin-top: 1em; + + .lock-pfp { + background-image: url("./assets/avatar.png"); + background-size: 100%; + border-radius: 100%; + + margin: 2.4em 6em 0em; + } + + .lock-text { + margin: 2.5em 1em; + padding: 1em; + + .lock-username { + color: $foreground-primary; + font-size: 20px; + } + + .lock-hostname { + color: $foreground-tertiary; + font-size: 16px; + font-style: italic; + font-family: "VictorMono Nerd Font"; + } + } + } +} diff --git a/share/dotfiles/.config/eww/src/scss/lockscreen/index.scss b/share/dotfiles/.config/eww/src/scss/lockscreen/index.scss new file mode 100755 index 00000000..403e6dc4 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/lockscreen/index.scss @@ -0,0 +1 @@ +@import "./lock-screen"; diff --git a/share/dotfiles/.config/eww/src/scss/notification-center/_notification-center.scss b/share/dotfiles/.config/eww/src/scss/notification-center/_notification-center.scss new file mode 100755 index 00000000..cef21fa0 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/notification-center/_notification-center.scss @@ -0,0 +1,48 @@ +.notification-center-window { + .notification-center-spacer { + transition: all 0.8s cubic-bezier(0.455, 0.03, 0.515, 1); + } + + .notification-center-box { + border-radius: 10px; + padding: 2em; + + background-color: $darker-background; + + min-width: 310px; + font-family: "DM Sans"; + + .notification-text { + margin: .5em 0em; + font-size: 22px; + font-weight: bold; + } + + .notification-scroller { + margin-top: .75em; + min-height: 40em; + // background-color: $background-secondary; + border-radius: 6px; + + .notification-history { + .eon { + font-size: 18px; + font-weight: bold; + } + + .notification { + margin: .25em 1em .75em; + box-shadow: none; + + background-color: $background-secondary; + } + } + } + } + + .quick-utilities { + // background-color: $background-primary; + border-radius: 5px; + // margin-top: 2em; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/notification-center/index.scss b/share/dotfiles/.config/eww/src/scss/notification-center/index.scss new file mode 100755 index 00000000..26e0f618 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/notification-center/index.scss @@ -0,0 +1 @@ +@import "./notification-center"; diff --git a/share/dotfiles/.config/eww/src/scss/notification-popup/_notification-popup.scss b/share/dotfiles/.config/eww/src/scss/notification-popup/_notification-popup.scss new file mode 100755 index 00000000..3839f292 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/notification-popup/_notification-popup.scss @@ -0,0 +1,7 @@ +.notification-scroller { + min-height: 140px; + + .notification-history { + margin: 1em 0em; + } +} diff --git a/share/dotfiles/.config/eww/src/scss/notification-popup/index.scss b/share/dotfiles/.config/eww/src/scss/notification-popup/index.scss new file mode 100755 index 00000000..4775526e --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/notification-popup/index.scss @@ -0,0 +1 @@ +@import "./notification-popup"; diff --git a/share/dotfiles/.config/eww/src/scss/quotes/_quotes.scss b/share/dotfiles/.config/eww/src/scss/quotes/_quotes.scss new file mode 100755 index 00000000..2857a1c0 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/quotes/_quotes.scss @@ -0,0 +1,20 @@ +.quotes { + font-family: "Roboto"; + font-size: 20px; + padding: 20px; + margin: 10px; + background-color: rgba(82, 134, 133, 0.1); + + border-radius: 10px; + // border : 1px solid #000; + + box-shadow: 3px 3px 3px rgba($color: #000000, $alpha: 0.6); + + .quote{ + color: #000; + padding: 10px 10px; + border-radius: 10px; + border : none; + + } +} diff --git a/share/dotfiles/.config/eww/src/scss/quotes/index.scss b/share/dotfiles/.config/eww/src/scss/quotes/index.scss new file mode 100755 index 00000000..537a00dc --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/quotes/index.scss @@ -0,0 +1 @@ +@import "./quotes"; \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/scss/trade-counter/_trade-counter.scss b/share/dotfiles/.config/eww/src/scss/trade-counter/_trade-counter.scss new file mode 100755 index 00000000..8847fad2 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/trade-counter/_trade-counter.scss @@ -0,0 +1,74 @@ +.counter1 { + font-family: "Shoguns Clan", "Roboto"; + font-size: 20px; + padding: 0px; + margin: 10px; + background-color: #CA7E82; + + // background-image: linear-gradient(to bottom right, #CA7E82, #1E1E28); + border-radius: 10px; + border : 1px solid #000; + // border-top : 30px solid #2D2D2D; + + // background-image: url("/home/kushy/.config/eww/assets/images/pepe-money-rain.gif"); + // background-position: 300px 100px; + // background-size: 20%; + // background-repeat: no-repeat; + box-shadow: 3px 3px 3px rgba($color: #000000, $alpha: 0.6); + + .rules{ + padding: 10px 10px; + border-radius: 10px; + // background-color: #00ffff; + + .clock{ + + font-size: 70px; + font-family: "Roboto"; + // font-family: "Cantarell"; + color: white ; + padding: 0px 25px; + margin: 10px 0px; + background-color: #373737; + border-radius: 10px; + // margin: 10px 20px; + // border-radius: 10px; + + } + .rule{ + font-size: 20px; + font-family: "Roboto"; + font-weight: 500; + // font-family: "Cantarell"; + color: black; + padding: 5px 35px 5px 40px; + // background-color: #373737; + margin: 0px 0px; + border-radius: 20px; + background-image: url("/home/kushy/.config/eww/assets/images/right_hand_arrow_2.png"); + // background-size: 20%; + background-repeat: no-repeat; + background-position: 0px 12px; + } + + } + + .trade { + + .counter{ + + font-size: 20px; + font-family: "Roboto"; + // font-family: "Cantarell"; + color: white ; + padding: 10px 25px; + margin: 10px 20px; + background-color: #373737; + border-radius: 5px; + // margin: 10px 20px; + // border-radius: 10px; + + } + + } +} diff --git a/share/dotfiles/.config/eww/src/scss/trade-counter/index.scss b/share/dotfiles/.config/eww/src/scss/trade-counter/index.scss new file mode 100755 index 00000000..bcf9b116 --- /dev/null +++ b/share/dotfiles/.config/eww/src/scss/trade-counter/index.scss @@ -0,0 +1 @@ +@import "./trade-counter"; \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/_modules.yuck b/share/dotfiles/.config/eww/src/yuck/_modules.yuck new file mode 100755 index 00000000..e4588745 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/_modules.yuck @@ -0,0 +1,75 @@ +(defwidget notification [title summary body icon ?LC ?reveal_close_icon] + (box :class "notification" :orientation "v" :space-evenly "false" + (box :class "notification-title" + (label :class "notification-title-text" :halign "start" :text title) + (revealer :reveal {reveal_close_icon ?: false} + (box :halign "end" + (button :class "notification-close" + :onclick {LC ?: "echo 'Hello, world!'"} + "") + ) + ) + ) + (box :class "notification-body" :space-evenly "false" :orientation "v" + (box :space-evenly "false" :orientation "h" + (box :class "notification-image" :orientation "h" :valign "center" :style "background-image: url('${icon}')") + (box + (box :class "notification-content" :orientation "v" :space-evenly "true" + ; WIP!!! Still finding a way to remove the extra margin on a multi-line label. + (label :class "notification-summary" :halign "start" :valign "start" + :limit-width 15 + :text summary) + (label :class "notification-message" :halign "start" :valign "start" + :limit-width 25 :wrap true :tooltip body + :text body) + ) + ) + ) + ; (box :class "notification-screenshot-opt" :space-evenly "true" :orientation "h" :visible {is_ss ?: false} + ; (button :onclick "viewnior '${icon}' &" "Open") + ; (button :onclick "rm -f '${icon}'" "Delete") + ; ) + ; (box :class "notification-opt" :space-evenly "true" :orientation "h" :visible {!is_ss ?: true} + ; (button :onclick "notify-send \"To be implemented.\"" "Dismiss") + ; ) + ) + ) +) + +(defwidget cc_button [?title ?icon ?is_active ?onclick ?disabled ?tooltip] + (box :orientation "v" :space-evenly "false" :class "cc-button" :tooltip {tooltip ?: "Disabled"} + (box :orientation "h" :class "cc-button-btn" :style {disabled == true ? "background-color: #101415;" : (is_active == true ? "background-color: #1C2325;" : "background-color: #131718;")} + (label :class "cc-button-icon" :text {icon ?: ""} :style {disabled == true ? "color: #6e7071;" : ""}) + (box :class "sep-column" + (label :text "|") + ) + (button :class "cc-button-clicker" :onclick {onclick ?: "echo 'debugger'"} + :style {disabled == true ? "color: #6e7071;" : ""} "") + ) + (label :class "cc-button-title" :text {title ?: ""} :style {disabled == true ? "color: #6e7071;" : ""}) + ) +) + +(defwidget cc_button_icon_only [?title ?icon ?is_active ?onclick ?disabled] + (box :orientation "v" :space-evenly "false" :class "cc-button-icon-only" + (box :orientation "h" :class "cc-button-btn" :style {disabled == true ? "background-color: #101415;" : (is_active == true ? "background-color: #1C2325;" : "background-color: #131718;")} + (button :class "cc-button-clicker" :onclick {onclick ?: "echo 'debugger'"} :style {disabled == true ? "color: #6e7071;" : ""} {icon ?: ""}) + ) + (label :class "cc-button-title" :text {title ?: ""} :style {disabled == true ? "color: #6e7071;" : ""}) + ) +) + +(defwidget layout [] + (box :orientation "h" + (button :class "layout-btn" + :onclick "sh ./scripts/bspLayout.sh set" + :onmiddleclick "sh ./scripts/bspLayout.sh reset" + {layout_icon ?: ""}) + ) +) + +(defwidget separator [text] + (box :orientation "h" + (label :class "separator" :text text) + ) +) diff --git a/share/dotfiles/.config/eww/src/yuck/_variables.yuck b/share/dotfiles/.config/eww/src/yuck/_variables.yuck new file mode 100755 index 00000000..82a5ed41 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/_variables.yuck @@ -0,0 +1,191 @@ +;; DATE VARS +(defpoll minute :interval "1s" + "date '+%M'") +(defpoll hour :interval "1s" + "date '+%I'") +(defpoll timePeriod :interval "1s" + "date '+%p'") +(defpoll weekday :interval "24h" + "date '+%A'") +(defpoll monthday :interval "24h" + "date '+%d'") +(defpoll month_year :interval "24h" + "date '+%B %Y'") +(defpoll month :interval "24h" + "date '+%b'") +(defpoll wd-m-d :interval "24h" + "date '+%A, %d %B'") + +;; SYSTEM INFO VARS +(defpoll used_ram :interval "5s" + "./scripts/getUsedRam.sh") +(defpoll volume :interval "500ms" + "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll micro :interval "1s" + "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") +(defpoll brightness :interval "500ms" + "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'") +(defpoll battery_capacity :interval "1s" + "./scripts/getBattery.sh capacity") + +;; MUSIC PLAYER VARS +(defpoll song_icon :interval "24h" + "./scripts/getMedia.sh -s") +(defpoll art :interval "1s" + "echo \"$HOME/.cache/eww/cover.png\"") +(defpoll song_art :interval "3s" + "./scripts/getMedia.sh") +(defpoll song_artist :interval "1s" + "./scripts/getMedia.sh -a") +(defpoll song_title :interval "1s" + "./scripts/getMedia.sh -t") +(defpoll song_position :interval "250ms" + "./scripts/getSongMetadata.sh position") +(defpoll player_status :interval "1s" + "./scripts/getSongMetadata.sh player_status") +(defpoll player_status_text :interval "1s" + "./scripts/getSongMetadata.sh player_status_text") + +(defpoll lyrics :interval "1s" + "cat /home/kushy/x.txt | tail -1") + + +;; LOCK SCREEN VARS +(defpoll username :interval "24h" + "whoami") +(defpoll fullname :interval "24h" + "user_record=\"$(getent passwd $USER)\"; user_gecos_field=\"$(echo \"$user_record\" | cut -d ':' -f 5)\"; user_full_name=\"$(echo \"$user_gecos_field\" | cut -d ',' -f 1)\"; echo $user_full_name") +(defpoll hostname :interval "24h" + "hostname") + +;; WEATHER VARS +(defpoll weather_temp :interval "3h" + "./scripts/getWeather.sh current_temp") +(defpoll weather_temp_f :interval "3h" + "./scripts/getWeather.sh current_temp_fahrenheit") +(defpoll weather_desc :interval "3h" + "./scripts/getWeather.sh weather_desc") +(defpoll weather_feels_like :interval "3h" + "./scripts/getWeather.sh feels_like") +(defpoll weather_humidity :interval "3h" + "./scripts/getWeather.sh humidity") +(defpoll weather_icon :interval "3h" + "./scripts/getWeather.sh weather_icon") +(defpoll weather_hex :interval "3h" + "./scripts/getWeather.sh hex") + +;; CALENDAR VARS +;;(defpoll calendar_day :interval "10h" +;; "date '+%d'") +;;(defpoll calendar_month :interval "10h" +;; "MONTH=$(date +%m) && MONTH=$((MONTH )) && echo $MONTH") +;;(defpoll calendar_year :interval "10h" +;; "date '+%Y'") + +;; UTILITY ROW VARS +(defpoll network_status :interval "1s" + "./scripts/getNetwork.sh color") +(defpoll network_icon :interval "1s" + "./scripts/getNetwork.sh icon") +(defpoll network_name :interval "1s" + "./scripts/getNetwork.sh name") +(defpoll network_name_truncated :interval "1s" + "./scripts/getNetwork.sh trname") +(defpoll redshift_status :interval "1s" + "./scripts/getRedshift.sh color") +(defpoll dnd_status :interval "1s" + "./scripts/dashActions.sh dndstat") +(defpoll jeff_status :interval "1s" + "./scripts/dashActions.sh jstat") + +;; NOTIFICATION CENTER/POPUP VARS +(defpoll dunst_history :interval "250ms" + "dunstctl history") +(defpoll reveal_no_notification_text :interval "5m" + "./scripts/getNotificationCount.sh") + +;; BLUETOOTH VARS +(defpoll bluetooth_icon :interval "1s" + "./scripts/getBluetooth.sh icon") +(defpoll bluetooth_status :interval "1s" + "./scripts/getBluetooth.sh status") +(defpoll bluetooth_supported :interval "1s" + "./scripts/getBluetooth.sh supported") + +;; UNSORTED VARS +(defpoll layout_icon :interval "250ms" + "./scripts/bspLayout.sh icon") +(defpoll airplane_mode_status :interval "1s" + "./scripts/dashActions.sh amstat") + + + +(defpoll trade_rules :interval "1s" + "echo 'trade rule 1 \\ntrade rule 2 \\ntrade rule 3'") + + +(defpoll clock_3m :interval "1s" + "python scripts/trade_time.py") + +;; get total trades +(defpoll trade_counter :interval "5s" + "./scripts/trade_counter.sh -t") + +;; get pnl +(defpoll pnl_counter :interval "5s" + "./scripts/trade_counter.sh -p") + +;; get max loss +(defpoll max_loss :interval "5s" + "./scripts/trade_counter.sh -l") + +;; get events +(defpoll event :interval "30m" + "./scripts/calendar.sh -g 0") + +;; get ce +(defpoll ce :interval "1m" + "./scripts/trade_counter.sh -e") + + +;; get pe +(defpoll pe :interval "1m" + "./scripts/trade_counter.sh -u") + + +;; quotes +(defpoll q1 :interval "1h" + "sed '1q;d' /home/kushy/Syncthing/quotes.txt") +(defpoll q2 :interval "1h" + "sed '2q;d' /home/kushy/Syncthing/quotes.txt") +(defpoll q3 :interval "1h" + "sed '3q;d' /home/kushy/Syncthing/quotes.txt") +(defpoll q4 :interval "1h" + "sed '4q;d' /home/kushy/Syncthing/quotes.txt") + + +;; keep updating events from google calender to a file +;;(defpoll current :interval "1m" +;; "python /home/kushy/.config/eww/scripts/gcalcli_eww/gcalcli.py") + +(defpoll current_title :interval "1m" + "./scripts/getEvents.sh -a") +(defpoll current_interval :interval "1m" + "./scripts/getEvents.sh -b") + +(defpoll next_title :interval "1m" + "./scripts/getEvents.sh -c") +(defpoll next_interval :interval "1m" + "./scripts/getEvents.sh -d") +(defpoll upcoming_time :interval "1m" + "./scripts/getEvents.sh -u") + + + +(defpoll calendar_day :interval "10h" + "date '+%d'") +(defpoll calendar_month :interval "10h" + "date '+%m'") +;; "scripts/calendar") +(defpoll calendar_year :interval "10h" + "date '+%Y'") \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/bar/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/bar/_widgets.yuck new file mode 100755 index 00000000..6b76e747 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/bar/_widgets.yuck @@ -0,0 +1,91 @@ +(defwidget launcher [] + (box :class "launcher" + :orientation "h" + :space-evenly "false" + :halign "center" + (button :class "launcher-btn" + :onclick "$HOME/.local/bin/appmnu" + "" + ) + ) +) + +(defwidget workspaces [] + (literal :content workspace)) +(deflisten workspace "scripts/getWorkspaces.sh") + +(defwidget time [] + (box :orientation "h" + :class "time" + :halign "start" + (button :onclick "sh scripts/openInfoCenter.sh &" + "${monthday}, ${hour}:${minute}" + ) + ) +) + +(defwidget battery [] + (box :class "battery" + :orientation "h" + :space-evenly "false" + :tooltip "Battery: ${battery_capacity}%" + + (overlay + (scale :class "battery-scale" + :min 0 + :max 100 + :orientation "h" + :value battery_capacity + ) + (label :class "battery-label" + :text "" + ) + ) + ) +) + +(defwidget action-center [] + (box :class "action-center" + :orientation "h" + :space-evenly "true" + (button :class "control-center-btn" + :onclick "sh scripts/openControlCenter.sh &" + :tooltip "Control Center" + "${network_icon} ${bluetooth_icon} ${airplane_mode_status}" + ) + ; (button :class "wifi-btn" :tooltip "Connected to ${network_name}" + ; :onclick "sh scripts/openControlCenter.sh &" + ; network_icon + ; ) + ; (button :class "bluetooth-btn" :tooltip "Powered: ${bluetooth_status}" + ; :onclick "sh scripts/openControlCenter.sh &" + ; bluetooth_icon + ; ) + ) +) + +;; BAR IS SEPARATED INTO THREE PARTS: TOP, CENTER AND BOTTOM +;; TOP WIDGETS +(defwidget top [] + (box :class "top" :orientation "h" :space-evenly "false" :halign "start" + (time))) + +;; CENTER WIDGETS +(defwidget center [] + (box :orientation "h" :space-evenly "false" :halign "center" + (workspaces))) +;; BOTTOM WIDGETS +(defwidget bottom [] + (box :orientation "h" :space-evenly "false" :halign "end" + (action-center) + (separator :text "‏ ‏ ‏") + (battery) + ; (time) + (separator :text "‏ ‏ ‏") + (layout))) + +(defwidget bar [] + (box :class "eww-bar" :orientation "h" :valign "false" :halign "false" + (top) + (center) + (bottom))) diff --git a/share/dotfiles/.config/eww/src/yuck/bar/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/bar/_windows.yuck new file mode 100755 index 00000000..d31ffc04 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/bar/_windows.yuck @@ -0,0 +1,10 @@ +(defwindow bar + :geometry (geometry :x "0%" + :y "0%" + :height "6%" + :width "100%") + :monitor 0 + :stacking "bg" + :windowtype "dock" + :wm-ignore false + (bar)) diff --git a/share/dotfiles/.config/eww/src/yuck/calendar-closer/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/calendar-closer/_widgets.yuck new file mode 100755 index 00000000..aa36d197 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/calendar-closer/_widgets.yuck @@ -0,0 +1,2 @@ +(defwidget closer [window] + (eventbox :onclick "eww close ${window} && eww close ${window}-closer")) diff --git a/share/dotfiles/.config/eww/src/yuck/calendar-closer/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/calendar-closer/_windows.yuck new file mode 100755 index 00000000..479c8e53 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/calendar-closer/_windows.yuck @@ -0,0 +1,6 @@ +(defwindow calendar-closer + :monitor "VG271U" + :geometry (geometry :width "100%" :height "100%") + :stacking "fg" + :focusable false + (closer :window "calendar")) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/calendar/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/calendar/_widgets.yuck new file mode 100755 index 00000000..42b8ee6e --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/calendar/_widgets.yuck @@ -0,0 +1,39 @@ +;; Calendar Widgets ;; +(defwidget cal [] + (box :class "cal-box" + :orientation "h" + (box :class "cal-inner-box" + (calendar :class "cal" + :day calendar_day + :month calendar_month + :year calendar_year + ) + ) + (box + :class "events" + :orientation "vertical" + :space-evenly false + (label :text "CURRENT " :class "sep" :halign "start") + (box + :class "event" + :orientation "vertical" + :height: 10 + :vexpand true + (label :text "${current_title}" :class "desc" :halign "start" :vexpand true) + (label :text "${current_interval}" :class "time" :halign "start") + ) + (box :orientation "horizontal" :class "sep" + (label :text "UPCOMING" :class "sep" :halign "start") + (label :text "${upcoming_time}" :class "sep" :halign "end") + ) + (box + :class "next_event" + :orientation "vertical" + :height: 1 + :vexpand true + (label :text "${next_title}" :class "desc" :halign "start") + (label :text "${next_interval}" :class "time" :halign "start") + ) + ) + ) +) diff --git a/share/dotfiles/.config/eww/src/yuck/calendar/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/calendar/_windows.yuck new file mode 100755 index 00000000..712d08a3 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/calendar/_windows.yuck @@ -0,0 +1,12 @@ +;; Calendar Windows ;; +(defwindow calendar + :monitor "VG271U" + :stacking "fg" + :windowtype "normal" + :wm-ignore false + + :geometry (geometry :x "1000px" + :y "0%" + :width "270px" + :height "40px") +(cal)) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/clock/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/clock/_widgets.yuck new file mode 100755 index 00000000..e2329abf --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/clock/_widgets.yuck @@ -0,0 +1,18 @@ +(defwidget clock [] + (box :class "clock" :orientation "v" :space-evenly "true" :halign "center" + + + (box :class "time" :orientation "h" :space-evenly "true" :halign "center" + (label :class "time-hour" :text "${hour}" :halign "end") + (label :class "separator" :text "1" :halign "center") + (label :class "time-minute" :text "${minute}" :halign "start") + ;(label :class "time-period" :text "${timePeriod }" :halign "start") + ) + + (box :class "date" :orientation "h" :space-evenly "true" :halign "center" + (label :class "day" :text "${monthday}" :halign "center") + ;(label :class "month" :text "${month}" :halign "center") + ) + + ) +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/clock/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/clock/_windows.yuck new file mode 100755 index 00000000..a40d84c1 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/clock/_windows.yuck @@ -0,0 +1,11 @@ +(defwindow clock + :monitor "0" + :geometry (geometry :x "100" + :y "100" + :width "2%" + :height "10%" + :anchor "bottom right") + :windowtype "normal" + :stacking "fg" + :wm-ignore false + (clock)) diff --git a/share/dotfiles/.config/eww/src/yuck/control-center/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/control-center/_widgets.yuck new file mode 100755 index 00000000..a8476448 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/control-center/_widgets.yuck @@ -0,0 +1,111 @@ +(defwidget control-center [] + (box :class "control-center-window" :space-evenly "false" :orientation "v" + (box :class "control-center-spacer" :style {ccenter ? "padding-top: 43em;" : "padding-top: 0em;"}) + (box :class "control-center" :orientation "v" :space-evenly "false" :style "margin-top: 5px;" + (box :class "first-row" :orientation "v" :space-evenly "false" + ; (box :orientation "h" :space-evenly "true" + ; (box :class "weather" :orientation "h" :halign "start" + ; (label :class "weather-icon" :style "color: ${weather_hex};" :text weather_icon) + ; (box :class "weather-data" :orientation "v" :space-evenly "false" + ; (label :class "weather-temp" :text "${weather_temp}°C") + ; (label :class "weather-desc" :text "${weather_desc}") + ; ) + ; ) + ; (box :class "date" :orientation "h" :halign "start" :space-evenly "false" + ; (box :class "date-data" :orientation "v" :space-evenly "true" + ; (label :class "date-md" :text "${monthday}") + ; (label :class "date-weekday" :text "${weekday}") + ; ) + ; (label :class "current-time" :text "${hour}:${minute}") + ; ) + ; ) + (box :orientation "h" + (cc_button :title {strlength(network_name) >= 13 ? network_name_truncated : network_name} :icon network_icon + :is_active {network_name != ""} :onclick "iwgtk &" + :tooltip "Connected to ${network_name}" + ) + (cc_button :title {bluetooth_status != "Off" ? hostname : "Bluetooth"} :icon bluetooth_icon + :is_active {bluetooth_status != "Off"} :onclick "blueman-manager &" + :tooltip "Status: ${bluetooth_status}" :disabled {bluetooth_supported == "false"} + ) + (cc_button :title "Airplane Mode" :icon airplane_mode_status + :is_active {airplane_mode_status == ""}:onclick "sh ./scripts/dashActions.sh am" + :tooltip "Status: ${airplane_mode_status == '' ? 'On' : 'Off'}" :disabled {bluetooth_supported == "false"} + ) + ) + (box :orientation "h" + (cc_button :title "Night Light" :icon "" + :is_active {redshift_status == "#1c2325"} :onclick "sh ./scripts/getRedshift.sh toggle" + :tooltip "Status: ${redshift_status == '#1c2325' ? 'On' : 'Off'}" + ) + (cc_button :title "Do Not Disturb" :icon "" + :is_active {dnd_status == "#1c2325"} :onclick "sh ./scripts/dashActions.sh dnd" + :tooltip "Status: ${dnd_status == '#1c2325' ? 'On' : 'Off'}" + ) + (cc_button :disabled "true") + ) + ) + (box :class "second-row" :orientation "v" + (box :class "volume-slider" :orientation "h" :space-evenly "false" + (label :class "volume-icon" :text "") + (scale :min 0 + :max 101 + :value volume + :orientation "h" + :tooltip "Volume: ${volume}%" + :onchange "amixer -D pulse sset Master {}%" + ) + (button :class "slider-clicker" :onclick "pavucontrol &" "") + ) + (box :class "brightness-slider" :orientation "h" :space-evenly "false" + (label :class "brightness-icon" :text "") + (scale :min 0 + :max 101 + :value brightness + :orientation "h" + :tooltip "Brightness: ${brightness}%" + :onchange "brightnessctl set {}%" + ) + (button :class "slider-clicker" :style "color: #6e7071;" "") + ) + ) + (box :class "third-row" :orientation "h" :space-evenly "true" + (box :class "user-info" :orientation "h" :halign "start" :space-evenly "false" + (box :class "user-info-avatar") + (label :class "user-info-label" :halign "start" :text "${fullname}") + ) + (box :class "system-btn" :halign "end" :orientation "h" :space-evenly "false" + (button :class "edit-btn" :onclick "xdg-open ${EWW_CONFIG_DIR} &" "") + (button :class "exit-btn" :onclick "sh ./scripts/openExitScreen.sh &" "") + ) + ) + ) + (revealer :reveal mp :transition "crossfade" + (box :class "music-player" :orientation "h" :space-evenly "false" + (box :class "song-art" :orientation "v" :style "background-image: url('${art}')" + (box :class "music-info" :orientation "v" :space-evenly "false" :hexpand "false" :vexpand "false" + (label :class "now-playing" :halign "start" :text player_status_text) + (label :class "song-title" :halign "start" + :text song_title + :limit-width 27) + (label :class "song-artist" :halign "start" + :text song_artist + :limit-width 35) + (box :orientation "h" + (label :class "song-position" :halign "start" + :text song_position) + song_art + ) + ) + ) + (box :class "song-controls" :orientation "v" + (button :onclick "playerctl previous" "") + (button :class "play-pause" :onclick "playerctl play-pause" player_status) + (button :onclick "playerctl next" "") + ) + ) + ) + ) +) +(defvar ccenter false) +(defvar mp false) diff --git a/share/dotfiles/.config/eww/src/yuck/control-center/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/control-center/_windows.yuck new file mode 100755 index 00000000..31427791 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/control-center/_windows.yuck @@ -0,0 +1,10 @@ +(defwindow control-center + :geometry (geometry :x "-1%" + :y "-60%" + :width "26%" + :height "80%" + :anchor "top right") + :windowtype "dock" + :stacking "fg" + :wm-ignore false + (control-center)) diff --git a/share/dotfiles/.config/eww/src/yuck/desk-widgets/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/desk-widgets/_widgets.yuck new file mode 100755 index 00000000..36ce6060 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/desk-widgets/_widgets.yuck @@ -0,0 +1,35 @@ +(defwidget desk-widgets [] + (box :class "desk-widgets" :orientation "v" :space-evenly "false" + (box :class "first-row" :orientation "h" :space-evenly "false" + + + (box :class "weather" :orientation "v" :space-evenly "false" + (box :class "top" :orientation "h" :space-evenly "true" + (label :class "weather-icon" :style "color: ${weather_hex};" :text "${weather_icon}") + (label :class "temperature" :style "color: #ffffff;" :text "${weather_temp}" ) + ) + + (box :class "weather-data" :orientation "v" :space-evenly "false" + (label :class "weather-desc" :halign "start" :text "${weather_desc}") + (label :class "weather-humi" :halign "start" :text "Humidity: ${weather_humidity}") + ) + ) + + (box :class "music" :orientation "v" :space-evenly "false" + (box :class "top" :orientation "h" :space-evenly "true" + (label :class "song-icon" :style "color:#ff0000;" :halign "start" :text "${song_icon}") + ) + + (box :class "song-detail" :orientation "v" :space-evenly "false" + (label :class "song-title" :halign "start" :text "${song_title}") + (label :class "song-artist" :halign "start" :text "${song_artist}") + ) + ) + + ) + + ;;(box :class "second-row" :orientation "h" :space-evenly "true" + ;;(label :class "lyrics" :halign "center" :text "${lyrics}") + ;;) + ) +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/desk-widgets/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/desk-widgets/_windows.yuck new file mode 100755 index 00000000..ccaab6ca --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/desk-widgets/_windows.yuck @@ -0,0 +1,11 @@ +(defwindow desk-widgets + :monitor "0" + :geometry (geometry :x "10" + :y "10" + :width "2%" + :height "40%" + :anchor "top right") + :windowtype "dock" + :stacking "fg" + :wm-ignore false + (desk-widgets)) diff --git a/share/dotfiles/.config/eww/src/yuck/exitscreen/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/exitscreen/_widgets.yuck new file mode 100755 index 00000000..8050b40a --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/exitscreen/_widgets.yuck @@ -0,0 +1,15 @@ +(defwidget exit-screen [] + (revealer :reveal escreen :duration "500ms" :transition "crossfade" + (box :orientation "h" :space-evenly "true" + (box :class "exit-screen" :orientation "h" :space-evenly "false" :halign "center" :valign "center" + (button :class "shutdown-btn" :onclick "sh $HOME/.config/eww/scripts/exitScreenActions.sh poweroff" :tooltip "Shutdown" "") + (button :class "reboot-btn" :onclick "sh $HOME/.config/eww/scripts/exitScreenActions.sh reboot" :tooltip "Reboot" "") + (button :class "sleep-btn" :onclick "sh $HOME/.config/eww/scripts/exitScreenActions.sh suspend" :tooltip "Sleep" "") + (button :class "hibernate-btn" :onclick "sh $HOME/.config/eww/scripts/exitScreenActions.sh hibernate" :tooltip "Hibernate" "") + (button :class "logout-btn" :onclick "bspc quit" :tooltip "Logout" "") + ; (button :class "lock-btn" :onclick "sh $HOME/.local/bin/lck" "") + ) + ) + ) +) +(defvar escreen false) diff --git a/share/dotfiles/.config/eww/src/yuck/exitscreen/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/exitscreen/_windows.yuck new file mode 100755 index 00000000..ff90d0ab --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/exitscreen/_windows.yuck @@ -0,0 +1,8 @@ +(defwindow exit-screen + :monitor "0" + :geometry (geometry :x "0%" + :y "0%" + :width "100%" + :height "100%" + :anchor "center") + (exit-screen)) diff --git a/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck new file mode 100755 index 00000000..9fa03f61 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck @@ -0,0 +1,43 @@ +(defwidget info-center [] + (box :class "info-center-window" :space-evenly "false" :orientation "h" + (box :class "info-center-spacer" :style {icenter ? "padding-left: 43em;" : "padding-left: 0em;"}) + (box :class "info-center" :orientation "v" :space-evenly "false" + (box :class "first-row" :orientation "v" :space-evenly "false" + (box :class "time" :orientation "h" :space-evenly "true" :halign "center" + (label :class "time-hour" :text "${hour}" :halign "end") + (box :class "time-separator" :orientation "v" :space-evenly "false" :halign "center" + (label :text "") + (label :text "") + (label :text "") + ) + (label :class "time-minute" :text minute :halign "start") + ) + (box :class "date" :orientation "h" :space-evenly "false" :halign "center" + (label :text wd-m-d) + ) + ) + (box :class "second-row" :orientation "v" + (box :class "cal-box" + + (calendar :class "cal" + :show-details true :show-heading true :show-day-names true + :day calendar_day :month calendar_month :year calendar_year) + ) + ) + (box :class "third-row" :orientation "h" :space-evenly "true" + (box :class "weather" :orientation "h" + (box :class "weather-details" :space-evenly "false" + (label :class "weather-icon" :style "color: ${weather_hex};" :text "${weather_icon}") + (box :class "weather-data" :orientation "v" :space-evenly "false" + (label :class "weather-desc" :halign "start" :text "${weather_desc}") + (label :class "weather-humi" :halign "start" :text "Humidity: ${weather_humidity}") + (label :class "weather-temp" :halign "start" :text "Temp: ${weather_temp}") + + ) + ) + ) + ) + ) + ) +) +(defvar icenter false) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck.new b/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck.new new file mode 100755 index 00000000..f546b1bb --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/info-center/_widgets.yuck.new @@ -0,0 +1,60 @@ +(defwidget info-center [] + (box :class "info-center-window" :space-evenly "false" :orientation "h" + (box :class "info-center-spacer" :style {icenter ? "padding-left: 43em;" : "padding-left: 0em;"}) + (box :class "info-center" :orientation "v" :space-evenly "false" + (box :class "first-row" :orientation "v" :space-evenly "false" + (box :class "time" :orientation "h" :space-evenly "true" :halign "center" + (label :class "time-hour" :text "${hour}" :halign "end") + (box :class "time-separator" :orientation "v" :space-evenly "false" :halign "center" + (label :text "") + (label :text "") + (label :text "") + ) + (label :class "time-minute" :text minute :halign "start") + ) + (box :class "date" :orientation "h" :space-evenly "false" :halign "center" + (label :text wd-m-d) + ) + ) + (box :class "second-row" :orientation "v" + (box :class "cal-box" + :orientation "v" + :space-evenly "false" + (label :class "month-year" :text month_year) + (box :class "day-names" :orientation "h" :space-evenly "true" + (label :text "Su") + (label :text "Mo") + (label :text "Tu") + (label :text "We") + (label :text "Th") + (label :text "Fr") + (label :text "Sa") + ) + (calendar :class "cal" + :show-details false :show-heading false :show-day-names false + :day calendar_day :month calendar_month :year calendar_year) + ) + ) + (box :class "third-row" :orientation "h" :space-evenly "true" + (box :class "weather" :orientation "h" + (box :class "weather-details" :space-evenly "false" + (label :class "weather-icon" :style "color: ${weather_hex};" :text "${weather_icon}") + (box :class "weather-data" :orientation "v" :space-evenly "false" + (label :class "weather-desc" :halign "start" :text "${weather_desc}") + (label :class "weather-humi" :halign "start" :text "Humidity: ${weather_humidity}") + (label :class "weather-temp" :halign "start" :text "Temp: ${weather_temp}") + (label :class "weather-feels-like" :halign "start" :text "Feels like: ${weather_feels_like}") + ) + ) + ;(box :class "weather-temp-and-feel" + ;(box :class "weather-data" :orientation "v" :space-evenly "false" + ;(label :class "weather-temp" :halign "end" :text "${weather_temp}") + ;(label :class "weather-feels-like" :halign "end" :text "Feels like: ${weather_feels_like}") + ;) + ;) + ) + ) + ) + ) +) +(defvar icenter false) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/info-center/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/info-center/_windows.yuck new file mode 100755 index 00000000..fbc311af --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/info-center/_windows.yuck @@ -0,0 +1,11 @@ +(defwindow info-center + :monitor 0 + :geometry (geometry :x "10" + :y "10" + :width "1%" + :height "40%" + :anchor "top left") + :windowtype "dock" + :stacking "fg" + :wm-ignore false + (info-center)) diff --git a/share/dotfiles/.config/eww/src/yuck/lockscreen/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/lockscreen/_widgets.yuck new file mode 100755 index 00000000..069b5216 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/lockscreen/_widgets.yuck @@ -0,0 +1,11 @@ +(defwidget lock-screen [] + (box :class "lock-screen" :orientation "h" :space-evenly "true" + (box :class "lock-inner" :orientation "v" :space-evenly "true" + ; (box :class "lock-pfp") + ; (box :class "lock-text" :orientation "v" :space-evenly "false" + ; (label :class "lock-username" :text "${name}") + ; (label :class "lock-hostname" :text "@${username}") + ; ) + ) + ) +) diff --git a/share/dotfiles/.config/eww/src/yuck/lockscreen/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/lockscreen/_windows.yuck new file mode 100755 index 00000000..ed3427a1 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/lockscreen/_windows.yuck @@ -0,0 +1,7 @@ +(defwindow lock-screen + :geometry (geometry :x "0%" + :y "-10%" + :width "8%" + :height "14%" + :anchor "bottom center") + (lock-screen)) diff --git a/share/dotfiles/.config/eww/src/yuck/notification-center/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/notification-center/_widgets.yuck new file mode 100755 index 00000000..6bc50ffb --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/notification-center/_widgets.yuck @@ -0,0 +1,50 @@ +;; Yes, this notification center is bad. + +(defwidget notification-center [] + (box :class "notification-center-window" :orientation "h" :space-evenly "false" + (box :class "notification-center-spacer" :style {noticenter ? "padding-left: 0em;" : "padding-left: 37em;"}) + (box :class "notification-center-box" :orientation "v" :space-evenly "false" :style "margin-right: 6px;" + (box :class "notification-text" :space-evenly "true" :orientation "h" + (label :text "Notifications" :halign "center") + ; (button :class "clear-all-btn" :halign "end" :onclick "pkill dunst" "Clear All") + ) + (box :space-evenly "true" :orientation "v" :style "min-width: 315px;" + (scroll :class "notification-scroller" :vscroll "true" + (box :class "notification-history" :orientation "v" :space-evenly "false" + (box :orientation "v" + (for entry in {dunst_history["data"][0]} + (notification :class 'notif-${entry["id"]["data"]}' + :title {entry["appname"]["data"]} + :summary {entry["summary"]["data"]} + :body {entry["body"]["data"]} + :icon {entry["appname"]["data"] == "Spotify" ? "../../.cache/dunst/${entry['summary']['data']}.png" : + entry["appname"]["data"] == "discord" ? "./assets/applications/discord.png" : + (entry["icon_path"]["data"] ?: "../dunst/assets/notification/fallback.png")} + :reveal_close_icon "false" + :LC "notify-send 'Did you think this really works?'" + ; :is_ss {entry["appname"]["data"] == "Screenshot Tool" ? "true" : "false"} + ) + ) + ) + (revealer :reveal reveal_no_notification_text + (box :orientation "v" :space-evenly "false" + :style {reveal_no_notification_text ? "margin: 11em 0em;" : "margin: 0em 0em;"} + (image :style "margin-bottom: 2em;" :path "./assets/ui/wedding-bells.png") + (label :class "eon" + :valign "center" + :text "No Notifications." + ) + ) + ) + ) + ) + ) + (box :class "quick-utilities" :orientation "h" :space-evenly "true" + (box :halign "end" :orientation "h" :space-evenly "false" + (cc_button_icon_only :title "Clear All" :icon "" :onclick "pkill dunst") + ) + ) + ) + ) +) +(defvar noticenter false) diff --git a/share/dotfiles/.config/eww/src/yuck/notification-center/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/notification-center/_windows.yuck new file mode 100755 index 00000000..2d7934ce --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/notification-center/_windows.yuck @@ -0,0 +1,10 @@ +(defwindow notification-center + :geometry (geometry :x "32%" + :y "3%" + :width "26%" + :height "84%" + :anchor "center right") + :windowtype "dock" + :stacking "fg" + :wm-ignore false + (notification-center)) diff --git a/share/dotfiles/.config/eww/src/yuck/notification-popup/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/notification-popup/_widgets.yuck new file mode 100755 index 00000000..0b6d8c12 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/notification-popup/_widgets.yuck @@ -0,0 +1,21 @@ +(defwidget notification-popup [] + (revealer :transition "crossfade" :duration "500ms" :reveal noti + (scroll :class "notification-scroller" :vscroll "true" + (box :class "notification-history" :orientation "v" + (for entry in {dunst_history["data"][0]} + (notification :class 'notif-${entry["id"]["data"]}' + :title {entry["appname"]["data"]} + :summary {entry["summary"]["data"]} + :body {entry["body"]["data"]} + :icon {entry["appname"]["data"] == "Spotify" ? "../../.cache/dunst/${entry['summary']['data']}.png" : + entry["appname"]["data"] == "discord" ? "./assets/applications/discord.png" : + (entry["icon_path"]["data"] ?: "../dunst/assets/notification/fallback.png")} + :LC "${EWW_CMD} update noti=false; sleep 0.270; ${EWW_CMD} close notification-popup; pkill openEwwPopup.sh" + :reveal_close_icon "true" + ) + ) + ) + ) + ) +) +(defvar noti false) diff --git a/share/dotfiles/.config/eww/src/yuck/notification-popup/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/notification-popup/_windows.yuck new file mode 100755 index 00000000..f659fb0a --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/notification-popup/_windows.yuck @@ -0,0 +1,10 @@ +(defwindow notification-popup + :geometry (geometry :x "-1%" + :y "-1%" + :width "24%" + :height "20%" + :anchor "bottom right") + :windowtype "dock" + :stacking "fg" + :wm-ignore false + (notification-popup)) diff --git a/share/dotfiles/.config/eww/src/yuck/quotes/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/quotes/_widgets.yuck new file mode 100755 index 00000000..d74533e5 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/quotes/_widgets.yuck @@ -0,0 +1,27 @@ +(defwidget quotes [] + + (box + :class "quotes" + :orientation "v" + :space-evenly "false" + :halign "center" + :spacing 0 + (label + :class "quote" + :text "${q1}" + ) + (label + :class "quote" + :text "${q2}" + ) + (label + :class "quote" + :text "${q3}" + ) + (label + :class "quote" + :text "${q4}" + ) + ) + +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/quotes/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/quotes/_windows.yuck new file mode 100755 index 00000000..ef5c5c2b --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/quotes/_windows.yuck @@ -0,0 +1,16 @@ +;; get monitors +(defvar screen "1") + + + +(defwindow quotes + :monitor 0 + :geometry (geometry :x "10" + :y "10" + :width "400" + :height "8%" + :anchor "top right") + :windowtype "dock" + :stacking "bottom" + :wm-ignore false + ( quotes)) diff --git a/share/dotfiles/.config/eww/src/yuck/sample/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/sample/_widgets.yuck new file mode 100755 index 00000000..e2329abf --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/sample/_widgets.yuck @@ -0,0 +1,18 @@ +(defwidget clock [] + (box :class "clock" :orientation "v" :space-evenly "true" :halign "center" + + + (box :class "time" :orientation "h" :space-evenly "true" :halign "center" + (label :class "time-hour" :text "${hour}" :halign "end") + (label :class "separator" :text "1" :halign "center") + (label :class "time-minute" :text "${minute}" :halign "start") + ;(label :class "time-period" :text "${timePeriod }" :halign "start") + ) + + (box :class "date" :orientation "h" :space-evenly "true" :halign "center" + (label :class "day" :text "${monthday}" :halign "center") + ;(label :class "month" :text "${month}" :halign "center") + ) + + ) +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/sample/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/sample/_windows.yuck new file mode 100755 index 00000000..1f5dc280 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/sample/_windows.yuck @@ -0,0 +1,11 @@ +(defwindow clock + :monitor "0" + :geometry (geometry :x "100" + :y "100" + :width "2%" + :height "10%" + :anchor "bottom right") + :windowtype "stacking" + :stacking "fg" + :wm-ignore false + (clock)) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/trade-counter/_widgets.yuck b/share/dotfiles/.config/eww/src/yuck/trade-counter/_widgets.yuck new file mode 100755 index 00000000..d20bb9eb --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/trade-counter/_widgets.yuck @@ -0,0 +1,59 @@ +(defwidget trade-counter [] + ;;(box :class "counter1" :orientation "v" :space-evenly "true" :halign "center" + ;; (label :class "counter" :text "${trade_counter}" :halign "center") + ;;) + + (box + :class "counter1" + :space-evenly false + :orientation "h" + :spacing 0 + +;; (box +;; :space-evenly false +;; :spacing 0 +;; :orientation "v" +;; :class "rules" +;; (label +;; :class "clock" +;; :text "${clock_3m}" +;; :halign "start" +;; ) +;; (label +;; :class "rule" +;; :text "always wait for a candle to close" +;; :halign "start" +;; ) +;; ) + + (box + :class "trade" + :orientation "v" + :space-evenly "false" + :halign "center" + :spacing 5 + (label + :class "counter" + :limit-width 25 + :text "Trades : ${trade_counter}" + ) + (label + :class "counter" + :limit-width 25 + :text "pnl : ${pnl_counter}" + ) + (label + :class "counter" + :limit-width 25 + :text "max loss : ${max_loss}" + ) + (label + :class "counter" + :limit-width 25 + :text "${ce} ${pe}" + ) + ) + + + ) +) \ No newline at end of file diff --git a/share/dotfiles/.config/eww/src/yuck/trade-counter/_windows.yuck b/share/dotfiles/.config/eww/src/yuck/trade-counter/_windows.yuck new file mode 100755 index 00000000..e6205971 --- /dev/null +++ b/share/dotfiles/.config/eww/src/yuck/trade-counter/_windows.yuck @@ -0,0 +1,11 @@ +(defwindow trade-counter + :monitor 1 + :geometry (geometry :x "20" + :y "10" + :width "100" + :height "8%" + :anchor "top right") + :windowtype "utility" + :stacking "fg" + :wm-ignore false + ( trade-counter)) diff --git a/share/dotfiles/.config/foot/foot.ini b/share/dotfiles/.config/foot/foot.ini new file mode 100755 index 00000000..733c0de4 --- /dev/null +++ b/share/dotfiles/.config/foot/foot.ini @@ -0,0 +1,179 @@ +# -*- conf -*- + +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +# app-id=foot +# title=foot +# locked-title=no +include=/usr/share/foot/themes/kitty +font=Fira Code Retina:size=12 +# font-bold=<bold variant of regular font> +# font-italic=<italic variant of regular font> +# font-bold-italic=<bold+italic variant of regular font> +# line-height=<font metrics> +# letter-spacing=0 +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# underline-offset=<font metrics> +# box-drawings-uses-font-glyphs=no +dpi-aware=no + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars=<COLSxROWS> +# initial-window-mode=windowed +pad=10x10 # optionally append 'center' +# resize-delay-ms=100 + +# notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +# bold-text-in-bright=no +# bell=none +# word-delimiters=,│`|:"'()[]{}<> +# selection-target=primary +# workers=<number of logical CPUs> + +[bell] +# urgent=no +# notify=no +# command= +# command-focused=no + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format= + +[url] +# launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="' + +[cursor] +# style=block +# color=111111 dcdccc +# blink=no +# beam-thickness=1.5 +# underline-thickness=<font underline thickness> + +[mouse] +# hide-when-typing=no +# alternate-scroll-mode=yes + +[colors] +# alpha=1.0 +# foreground=dcdccc +# background=111111 + +## Normal/regular colors (color palette 0-7) +# regular0=222222 # black +# regular1=cc9393 # red +# regular2=7f9f7f # green +# regular3=d0bf8f # yellow +# regular4=6ca0a3 # blue +# regular5=dc8cc3 # magenta +# regular6=93e0e3 # cyan +# regular7=dcdccc # white + +## Bright colors (color palette 8-15) +# bright0=666666 # bright black +# bright1=dca3a3 # bright red +# bright2=bfebbf # bright green +# bright3=f0dfaf # bright yellow +# bright4=8cd0d3 # bright blue +# bright5=fcace3 # bright magenta +# bright6=b3ffff # bright cyan +# bright7=ffffff # bright white + +## dimmed colors (see foot.ini(5) man page) +# dim0=<not set> +# ... +# dim7=<not-set> + +## The remaining 256-color palette +# 16 = <256-color palette #16> +# ... +# 255 = <256-color palette #255> + +## Misc colors +# selection-foreground=<inverse foreground/background> +# selection-background=<inverse foreground/background> +# jump-labels=<regular0> <regular3> +# urls=<regular3> +# scrollback-indicator=<regular0> <bright4> + +[csd] +# preferred=server +# size=26 +# font=<primary font> +# color=<foreground color>border +border-width=6 +# border-color=<csd.color> +button-width=20 +# button-color=<background color> +# button-minimize-color=<regular4> +# button-maximize-color=<regular2> +# button-close-color=<regular1> + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# clipboard-copy=Control+Shift+c +# clipboard-paste=Control+Shift+v +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+y +# primary-paste=Shift+Insert + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[mouse-bindings] +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 diff --git a/share/dotfiles/.config/glava/bars.glsl b/share/dotfiles/.config/glava/bars.glsl new file mode 100644 index 00000000..0a55fe8b --- /dev/null +++ b/share/dotfiles/.config/glava/bars.glsl @@ -0,0 +1,34 @@ +/* Note: to only render a single channel, see `setmirror` in `rc.glsl`. */ + +/* Center line thickness (pixels) */ +#define C_LINE 1 +/* Width (in pixels) of each bar */ +#define BAR_WIDTH 5 +/* Width (in pixels) of each bar gap */ +#define BAR_GAP 1 +/* Outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 1 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 200 +/* Whether the current settings use the alpha channel; + enabling this is required for alpha to function + correctly on X11 with `"native"` transparency */ +#define USE_ALPHA 0 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 80 +/* Bar color. By default this provides a blue-white gradient. */ +#define COLOR @fg:mix(#3366b2, #a0a0b2, clamp(d / GRADIENT, 0, 1)) +/* Outline color. By default this provides a 'glint' outline based on the bar color */ +#define BAR_OUTLINE @bg:vec4(COLOR.rgb * 1.5, COLOR.a) +/* Direction that the bars are facing, 0 for inward, 1 for outward */ +#define DIRECTION 0 +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to flip the output vertically */ +#define FLIP 1 +/* Whether to mirror output along `Y = X`, causing output to render on the left side of the window */ +/* Use with `FLIP 1` to render on the right side */ +#define MIRROR_YX 0 +/* Whether to disable mono rendering when `#request setmirror true` is set in `rc.glsl`. */ +#define DISABLE_MONO 0 + diff --git a/share/dotfiles/.config/glava/bars/1.frag b/share/dotfiles/.config/glava/bars/1.frag new file mode 100644 index 00000000..dcebf3eb --- /dev/null +++ b/share/dotfiles/.config/glava/bars/1.frag @@ -0,0 +1,135 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include "@bars.glsl" +#include ":bars.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; +#include ":util/smooth.glsl" + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +#if DISABLE_MONO == 1 +#define _CHANNELS 2 +#endif + +void main() { + + #if MIRROR_YX == 0 + #define AREA_WIDTH screen.x + #define AREA_HEIGHT screen.y + #define AREA_X gl_FragCoord.x + #define AREA_Y gl_FragCoord.y + #else + #define AREA_WIDTH screen.y + #define AREA_HEIGHT screen.x + #define AREA_X gl_FragCoord.y + #define AREA_Y gl_FragCoord.x + #endif + + #if _CHANNELS == 2 + float dx = (AREA_X - (AREA_WIDTH / 2)); + #else + #if INVERT == 1 + float dx = AREA_WIDTH - AREA_X; + #else + float dx = AREA_X; + #endif + #endif + #if FLIP == 0 + float d = AREA_Y; + #else + float d = AREA_HEIGHT - AREA_Y; + #endif + float section = BAR_WIDTH + BAR_GAP; /* size of section for each bar (including gap) */ + float center = section / 2.0F; /* half section, distance to center */ + float m = abs(mod(dx, section)); /* position in section */ + float md = m - center; /* position in section from center line */ + float nbars = floor((AREA_WIDTH * 0.5F) / section) * 2; + float p, s; + if (md < ceil(float(BAR_WIDTH) / 2) && md >= -floor(float(BAR_WIDTH) / 2)) { /* if not in gap */ + s = dx / section; + p = (sign(s) == 1.0 ? ceil(s) : floor(s)); + #if _CHANNELS == 2 + p /= float(nbars / 2); + #else + p /= float(nbars); + #endif + p += sign(p) * ((0.5F + center) / AREA_WIDTH); /* index center of bar position */ + /* Apply smooth function and index texture */ + #define smooth_f(tex, p) smooth_audio(tex, audio_sz, p) + float v; + /* ignore out of bounds values */ + if (p > 1.0F || p < -1.0F) { + fragment = vec4(0, 0, 0, 0); + return; + } + /* handle user options and store result of indexing in 'v' */ + if (p > 0.0F) { + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_l, p); + #else + v = smooth_f(audio_r, p); + #endif + } else { + p = abs(p); + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_r, p); + #else + v = smooth_f(audio_l, p); + #endif + } + #undef smooth_f + + v *= AMPLIFY; /* amplify result */ + if (d < v - BAR_OUTLINE_WIDTH) { /* if within range of the reported frequency, draw */ + #if BAR_OUTLINE_WIDTH > 0 + if (md < ceil(float(BAR_WIDTH) / 2) - BAR_OUTLINE_WIDTH && md >= -floor(float(BAR_WIDTH) / 2) + BAR_OUTLINE_WIDTH) + fragment = COLOR; + else + fragment = BAR_OUTLINE; + #else + fragment = COLOR; + #endif + return; + } + + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + fragment = BAR_OUTLINE; + return; + } + #endif + } + fragment = vec4(0, 0, 0, 0); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/bars/2.frag b/share/dotfiles/.config/glava/bars/2.frag new file mode 100644 index 00000000..0ed8188c --- /dev/null +++ b/share/dotfiles/.config/glava/bars/2.frag @@ -0,0 +1,5 @@ +#if USE_ALPHA == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/circle.glsl b/share/dotfiles/.config/glava/circle.glsl new file mode 100644 index 00000000..30906d9b --- /dev/null +++ b/share/dotfiles/.config/glava/circle.glsl @@ -0,0 +1,18 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 1.5 +/* outline color */ +#define OUTLINE @fg:#333333 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 150 +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to fill in the space between the line and inner circle */ +#define C_FILL 0 +/* Whether to apply a post-processing image smoothing effect + 1 to enable, 0 to disable. Only works with `xroot` transparency, + and improves performance if disabled. */ +#define C_SMOOTH 1 diff --git a/share/dotfiles/.config/glava/circle/1.frag b/share/dotfiles/.config/glava/circle/1.frag new file mode 100644 index 00000000..6caccd1d --- /dev/null +++ b/share/dotfiles/.config/glava/circle/1.frag @@ -0,0 +1,84 @@ +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@circle.glsl" +#include ":circle.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +/* This shader is based on radial.glsl, refer to it for more commentary */ + +float apply_smooth(float theta) { + float idx = theta + ROTATE; + float dir = mod(abs(idx), TWOPI); + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); + if (INVERT > 0) + idx = -idx; + + float pos = abs(idx) / (PI + 0.001F); + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) + float v; + if (idx > 0) v = smooth_f(audio_l); + else v = smooth_f(audio_r); + v *= AMPLIFY; + #undef smooth_f + return v; +} + +void main() { + fragment = vec4(0, 0, 0, 0); + float + dx = gl_FragCoord.x - (screen.x / 2), + dy = gl_FragCoord.y - (screen.y / 2); + float theta = atan(dy, dx); + float d = sqrt((dx * dx) + (dy * dy)); + float adv = (1.0F / d) * (C_LINE * 0.5); + float + adj0 = theta + adv, + adj1 = theta - adv; + d -= C_RADIUS; + if (d >= -(float(C_LINE) / 2.0F)) { + float v = apply_smooth(theta); + + adj0 = apply_smooth(adj0) - v; + adj1 = apply_smooth(adj1) - v; + + float + dmax = max(adj0, adj1), + dmin = min(adj0, adj1); + + d -= v; + #if C_FILL > 0 + #define BOUNDS (d < (float(C_LINE) / 2.0F)) + #else + #define BOUNDS (d > -(float(C_LINE) / 2.0F) && d < (float(C_LINE) / 2.0F)) || (d <= dmax && d >= dmin) + #endif + if (BOUNDS) { + fragment = OUTLINE; + } + } +} diff --git a/share/dotfiles/.config/glava/circle/2.frag b/share/dotfiles/.config/glava/circle/2.frag new file mode 100644 index 00000000..e6cd45a5 --- /dev/null +++ b/share/dotfiles/.config/glava/circle/2.frag @@ -0,0 +1,33 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@circle.glsl" +#include ":circle.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + #if C_SMOOTH > 0 + #if _USE_ALPHA + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (fragment.a == 0) { + fragment = avg; + } + #endif + #endif +} diff --git a/share/dotfiles/.config/glava/circle/3.frag b/share/dotfiles/.config/glava/circle/3.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/circle/3.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/env_KWin.glsl b/share/dotfiles/.config/glava/env_KWin.glsl new file mode 100644 index 00000000..aa168ba4 --- /dev/null +++ b/share/dotfiles/.config/glava/env_KWin.glsl @@ -0,0 +1,8 @@ +#request setdecorated false +#request setxwintype "normal" +#request addxwinstate "below" +#request addxwinstate "skip_taskbar" +#request addxwinstate "skip_pager" +#request addxwinstate "pinned" +#request setclickthrough true + diff --git a/share/dotfiles/.config/glava/env_Openbox.glsl b/share/dotfiles/.config/glava/env_Openbox.glsl new file mode 100644 index 00000000..c95c6162 --- /dev/null +++ b/share/dotfiles/.config/glava/env_Openbox.glsl @@ -0,0 +1,2 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" diff --git a/share/dotfiles/.config/glava/env_Xfwm4.glsl b/share/dotfiles/.config/glava/env_Xfwm4.glsl new file mode 100644 index 00000000..1c20359a --- /dev/null +++ b/share/dotfiles/.config/glava/env_Xfwm4.glsl @@ -0,0 +1,3 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" +#request addxwinstate "below" diff --git a/share/dotfiles/.config/glava/env_awesome.glsl b/share/dotfiles/.config/glava/env_awesome.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/env_awesome.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/env_default.glsl b/share/dotfiles/.config/glava/env_default.glsl new file mode 100644 index 00000000..90336cc6 --- /dev/null +++ b/share/dotfiles/.config/glava/env_default.glsl @@ -0,0 +1 @@ +#request setxwintype "desktop" diff --git a/share/dotfiles/.config/glava/env_i3.glsl b/share/dotfiles/.config/glava/env_i3.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/env_i3.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/env_spectrwm.glsl b/share/dotfiles/.config/glava/env_spectrwm.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/env_spectrwm.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava/bars.glsl b/share/dotfiles/.config/glava/glava/bars.glsl new file mode 100644 index 00000000..6ff84c2f --- /dev/null +++ b/share/dotfiles/.config/glava/glava/bars.glsl @@ -0,0 +1,34 @@ +/* Note: to only render a single channel, see `setmirror` in `rc.glsl`. */ + +/* Center line thickness (pixels) */ +#define C_LINE 1 +/* Width (in pixels) of each bar */ +#define BAR_WIDTH 5 +/* Width (in pixels) of each bar gap */ +#define BAR_GAP 1 +/* Outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 1 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* Whether the current settings use the alpha channel; + enabling this is required for alpha to function + correctly on X11 with `"native"` transparency */ +#define USE_ALPHA 0 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 80 +/* Bar color. By default this provides a blue-white gradient. */ +#define COLOR @fg:mix(#3366b2, #a0a0b2, clamp(d / GRADIENT, 0, 1)) +/* Outline color. By default this provides a 'glint' outline based on the bar color */ +#define BAR_OUTLINE @bg:vec4(COLOR.rgb * 1.5, COLOR.a) +/* Direction that the bars are facing, 0 for inward, 1 for outward */ +#define DIRECTION 0 +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to flip the output vertically */ +#define FLIP 0 +/* Whether to mirror output along `Y = X`, causing output to render on the left side of the window */ +/* Use with `FLIP 1` to render on the right side */ +#define MIRROR_YX 0 +/* Whether to disable mono rendering when `#request setmirror true` is set in `rc.glsl`. */ +#define DISABLE_MONO 0 + diff --git a/share/dotfiles/.config/glava/glava/bars/1.frag b/share/dotfiles/.config/glava/glava/bars/1.frag new file mode 100644 index 00000000..dcebf3eb --- /dev/null +++ b/share/dotfiles/.config/glava/glava/bars/1.frag @@ -0,0 +1,135 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include "@bars.glsl" +#include ":bars.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; +#include ":util/smooth.glsl" + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +#if DISABLE_MONO == 1 +#define _CHANNELS 2 +#endif + +void main() { + + #if MIRROR_YX == 0 + #define AREA_WIDTH screen.x + #define AREA_HEIGHT screen.y + #define AREA_X gl_FragCoord.x + #define AREA_Y gl_FragCoord.y + #else + #define AREA_WIDTH screen.y + #define AREA_HEIGHT screen.x + #define AREA_X gl_FragCoord.y + #define AREA_Y gl_FragCoord.x + #endif + + #if _CHANNELS == 2 + float dx = (AREA_X - (AREA_WIDTH / 2)); + #else + #if INVERT == 1 + float dx = AREA_WIDTH - AREA_X; + #else + float dx = AREA_X; + #endif + #endif + #if FLIP == 0 + float d = AREA_Y; + #else + float d = AREA_HEIGHT - AREA_Y; + #endif + float section = BAR_WIDTH + BAR_GAP; /* size of section for each bar (including gap) */ + float center = section / 2.0F; /* half section, distance to center */ + float m = abs(mod(dx, section)); /* position in section */ + float md = m - center; /* position in section from center line */ + float nbars = floor((AREA_WIDTH * 0.5F) / section) * 2; + float p, s; + if (md < ceil(float(BAR_WIDTH) / 2) && md >= -floor(float(BAR_WIDTH) / 2)) { /* if not in gap */ + s = dx / section; + p = (sign(s) == 1.0 ? ceil(s) : floor(s)); + #if _CHANNELS == 2 + p /= float(nbars / 2); + #else + p /= float(nbars); + #endif + p += sign(p) * ((0.5F + center) / AREA_WIDTH); /* index center of bar position */ + /* Apply smooth function and index texture */ + #define smooth_f(tex, p) smooth_audio(tex, audio_sz, p) + float v; + /* ignore out of bounds values */ + if (p > 1.0F || p < -1.0F) { + fragment = vec4(0, 0, 0, 0); + return; + } + /* handle user options and store result of indexing in 'v' */ + if (p > 0.0F) { + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_l, p); + #else + v = smooth_f(audio_r, p); + #endif + } else { + p = abs(p); + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_r, p); + #else + v = smooth_f(audio_l, p); + #endif + } + #undef smooth_f + + v *= AMPLIFY; /* amplify result */ + if (d < v - BAR_OUTLINE_WIDTH) { /* if within range of the reported frequency, draw */ + #if BAR_OUTLINE_WIDTH > 0 + if (md < ceil(float(BAR_WIDTH) / 2) - BAR_OUTLINE_WIDTH && md >= -floor(float(BAR_WIDTH) / 2) + BAR_OUTLINE_WIDTH) + fragment = COLOR; + else + fragment = BAR_OUTLINE; + #else + fragment = COLOR; + #endif + return; + } + + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + fragment = BAR_OUTLINE; + return; + } + #endif + } + fragment = vec4(0, 0, 0, 0); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/glava/bars/2.frag b/share/dotfiles/.config/glava/glava/bars/2.frag new file mode 100644 index 00000000..0ed8188c --- /dev/null +++ b/share/dotfiles/.config/glava/glava/bars/2.frag @@ -0,0 +1,5 @@ +#if USE_ALPHA == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava/circle.glsl b/share/dotfiles/.config/glava/glava/circle.glsl new file mode 100644 index 00000000..30906d9b --- /dev/null +++ b/share/dotfiles/.config/glava/glava/circle.glsl @@ -0,0 +1,18 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 1.5 +/* outline color */ +#define OUTLINE @fg:#333333 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 150 +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to fill in the space between the line and inner circle */ +#define C_FILL 0 +/* Whether to apply a post-processing image smoothing effect + 1 to enable, 0 to disable. Only works with `xroot` transparency, + and improves performance if disabled. */ +#define C_SMOOTH 1 diff --git a/share/dotfiles/.config/glava/glava/circle/1.frag b/share/dotfiles/.config/glava/glava/circle/1.frag new file mode 100644 index 00000000..6caccd1d --- /dev/null +++ b/share/dotfiles/.config/glava/glava/circle/1.frag @@ -0,0 +1,84 @@ +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@circle.glsl" +#include ":circle.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +/* This shader is based on radial.glsl, refer to it for more commentary */ + +float apply_smooth(float theta) { + float idx = theta + ROTATE; + float dir = mod(abs(idx), TWOPI); + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); + if (INVERT > 0) + idx = -idx; + + float pos = abs(idx) / (PI + 0.001F); + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) + float v; + if (idx > 0) v = smooth_f(audio_l); + else v = smooth_f(audio_r); + v *= AMPLIFY; + #undef smooth_f + return v; +} + +void main() { + fragment = vec4(0, 0, 0, 0); + float + dx = gl_FragCoord.x - (screen.x / 2), + dy = gl_FragCoord.y - (screen.y / 2); + float theta = atan(dy, dx); + float d = sqrt((dx * dx) + (dy * dy)); + float adv = (1.0F / d) * (C_LINE * 0.5); + float + adj0 = theta + adv, + adj1 = theta - adv; + d -= C_RADIUS; + if (d >= -(float(C_LINE) / 2.0F)) { + float v = apply_smooth(theta); + + adj0 = apply_smooth(adj0) - v; + adj1 = apply_smooth(adj1) - v; + + float + dmax = max(adj0, adj1), + dmin = min(adj0, adj1); + + d -= v; + #if C_FILL > 0 + #define BOUNDS (d < (float(C_LINE) / 2.0F)) + #else + #define BOUNDS (d > -(float(C_LINE) / 2.0F) && d < (float(C_LINE) / 2.0F)) || (d <= dmax && d >= dmin) + #endif + if (BOUNDS) { + fragment = OUTLINE; + } + } +} diff --git a/share/dotfiles/.config/glava/glava/circle/2.frag b/share/dotfiles/.config/glava/glava/circle/2.frag new file mode 100644 index 00000000..e6cd45a5 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/circle/2.frag @@ -0,0 +1,33 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@circle.glsl" +#include ":circle.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + #if C_SMOOTH > 0 + #if _USE_ALPHA + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (fragment.a == 0) { + fragment = avg; + } + #endif + #endif +} diff --git a/share/dotfiles/.config/glava/glava/circle/3.frag b/share/dotfiles/.config/glava/glava/circle/3.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/glava/circle/3.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava/env_KWin.glsl b/share/dotfiles/.config/glava/glava/env_KWin.glsl new file mode 100644 index 00000000..aa168ba4 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_KWin.glsl @@ -0,0 +1,8 @@ +#request setdecorated false +#request setxwintype "normal" +#request addxwinstate "below" +#request addxwinstate "skip_taskbar" +#request addxwinstate "skip_pager" +#request addxwinstate "pinned" +#request setclickthrough true + diff --git a/share/dotfiles/.config/glava/glava/env_Openbox.glsl b/share/dotfiles/.config/glava/glava/env_Openbox.glsl new file mode 100644 index 00000000..c95c6162 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_Openbox.glsl @@ -0,0 +1,2 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" diff --git a/share/dotfiles/.config/glava/glava/env_Xfwm4.glsl b/share/dotfiles/.config/glava/glava/env_Xfwm4.glsl new file mode 100644 index 00000000..1c20359a --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_Xfwm4.glsl @@ -0,0 +1,3 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" +#request addxwinstate "below" diff --git a/share/dotfiles/.config/glava/glava/env_awesome.glsl b/share/dotfiles/.config/glava/glava/env_awesome.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_awesome.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava/env_default.glsl b/share/dotfiles/.config/glava/glava/env_default.glsl new file mode 100644 index 00000000..90336cc6 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_default.glsl @@ -0,0 +1 @@ +#request setxwintype "desktop" diff --git a/share/dotfiles/.config/glava/glava/env_i3.glsl b/share/dotfiles/.config/glava/glava/env_i3.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_i3.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava/env_spectrwm.glsl b/share/dotfiles/.config/glava/glava/env_spectrwm.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/env_spectrwm.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava/graph.glsl b/share/dotfiles/.config/glava/glava/graph.glsl new file mode 100644 index 00000000..cbcce46a --- /dev/null +++ b/share/dotfiles/.config/glava/glava/graph.glsl @@ -0,0 +1,25 @@ + +/* Vertical scale, larger values will amplify output */ +#define VSCALE 300 +/* Rendering direction, either -1 (outwards) or 1 (inwards). */ +#define DIRECTION 1 + +/* Color gradient scale, (optionally) used in `COLOR` macro */ +#define GRADIENT 75 +/* Color definition. By default this is a gradient formed by mixing two colors. + `pos` represents the pixel position relative to the visualizer baseline. */ +#define COLOR @fg:mix(#802A2A, #4F4F92, clamp(pos / GRADIENT, 0, 1)) +/* 1 to draw outline, 0 to disable */ +#define DRAW_OUTLINE 0 +/* 1 to draw edge highlight, 0 to disable */ +#define DRAW_HIGHLIGHT 1 +/* Whether to anti-alias the border of the graph, creating a smoother curve. + This may have a small impact on performance. + Note: requires `xroot` or `none` opacity to be set */ +#define ANTI_ALIAS 0 +/* outline color */ +#define OUTLINE @bg:#262626 +/* 1 to join the two channels together in the middle, 0 to clamp both down to zero */ +#define JOIN_CHANNELS 0 +/* 1 to invert (vertically), 0 otherwise */ +#define INVERT 0 diff --git a/share/dotfiles/.config/glava/glava/graph/1.frag b/share/dotfiles/.config/glava/glava/graph/1.frag new file mode 100644 index 00000000..bfbf04a4 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/graph/1.frag @@ -0,0 +1,133 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +/* When we transform our audio, we need to go through the following steps: + + transform -> "window" + First, apply a window function to taper off the ends of the spectrum, helping + avoid artifacts in the FFT output. + + transform -> "fft" + Apply the Fast Fourier Transform algorithm to separate raw audio data (waves) + into their respective spectrums. + + transform -> "fft" + As part of the FFT process, we return spectrum magnitude on a log(n) scale, + as this is how the (decibel) dB scale functions. + + transform -> "gravity" + To help make our data more pleasing to look at, we apply our data received over + time to a buffer, taking the max of either the existing value in the buffer or + the data from the input. We then reduce the data by the 'gravity step', and + return the storage buffer. + + This makes frequent and abrupt changes in frequency less distracting, and keeps + short frequency responses on the screen longer. + + transform -> "avg" + As a final step, we take the average of several data frames (specified by + 'setavgframes') and return the result to further help smooth the resulting + animation. In order to mitigate abrupt changes to the average, the values + at each end of the average buffer can be weighted less with a window function + (the same window function used at the start of this step!). It can be disabled + with 'setavgwindow'. +*/ + +#include ":util/smooth.glsl" +#include "@graph.glsl" +#include ":graph.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +/* distance from center */ +#define CDIST (abs((screen.x / 2) - gl_FragCoord.x) / screen.x) +/* distance from sides (far) */ +#define FDIST (min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) + +#if DIRECTION < 0 +#define LEFT_IDX (gl_FragCoord.x) +#define RIGHT_IDX (-gl_FragCoord.x + screen.x) +/* distance from base frequencies */ +#define BDIST FDIST +/* distance from high frequencies */ +#define HDIST CDIST +#else +#define LEFT_IDX (half_w - gl_FragCoord.x) +#define RIGHT_IDX (gl_FragCoord.x - half_w) +#define BDIST CDIST +#define HDIST FDIST +#endif + +#define TWOPI 6.28318530718 + +float half_w; +float middle; +highp float pixel = 1.0F / float(screen.x); + +float get_line_height(in sampler1D tex, float idx) { + float s = smooth_audio_adj(tex, audio_sz, idx / half_w, pixel); + /* scale the data upwards so we can see it */ + s *= VSCALE; + /* clamp far ends of the screen down to make the ends of the graph smoother */ + + float fact = clamp((abs((screen.x / 2) - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + #if JOIN_CHANNELS > 0 + fact = -2 * pow(fact, 3) + 3 * pow(fact, 2); /* To avoid spikes */ + s = fact * s + (1 - fact) * middle; + #else + s *= fact; + #endif + + s *= clamp((min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + + return s; +} + +void render_side(in sampler1D tex, float idx) { + float s = get_line_height(tex, idx); + + /* and finally set fragment color if we are in range */ + #if INVERT > 0 + float d = float(screen.y) - gl_FragCoord.y; + #else + float d = gl_FragCoord.y; + #endif + #define pos d + if (pos + 1.5 <= s) { + fragment = COLOR; + } else { + fragment = vec4(0, 0, 0, 0); + } +} + +void main() { + half_w = (screen.x / 2); + + middle = VSCALE * (smooth_audio_adj(audio_l, audio_sz, 1, pixel) + smooth_audio_adj(audio_r, audio_sz, 0, pixel)) / 2; + + if (gl_FragCoord.x < half_w) { + render_side(audio_l, LEFT_IDX); + } else { + render_side(audio_r, RIGHT_IDX); + } +} diff --git a/share/dotfiles/.config/glava/glava/graph/2.frag b/share/dotfiles/.config/glava/glava/graph/2.frag new file mode 100644 index 00000000..ff184452 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/graph/2.frag @@ -0,0 +1,44 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if DRAW_OUTLINE == 0 && DRAW_HIGHLIGHT == 0 +#error __disablestage +#endif + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0) { + /* outline */ + #if DRAW_OUTLINE > 0 + fragment = OUTLINE; + #endif + } else if (avg.a < 1) { + /* creates a highlight along the edge of the spectrum */ + #if DRAW_HIGHLIGHT > 0 + fragment.rgb *= avg.a * 2; + #endif + } + } +} diff --git a/share/dotfiles/.config/glava/glava/graph/3.frag b/share/dotfiles/.config/glava/glava/graph/3.frag new file mode 100644 index 00000000..22631399 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/graph/3.frag @@ -0,0 +1,104 @@ + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +/* Moves toward the border of the graph, gives the + y coordinate of the last colored pixel */ +float get_col_height_up(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y >= 0) { + #else + while (y < screen.y) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a <= 0) { + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + break; + } + #if INVERT > 0 + y -= 1; + #else + y += 1; + #endif + } + + return y; +} + +/* Moves toward the base of the graph, gives the + y coordinate of the first colored pixel */ +float get_col_height_down(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y < screen.y) { + #else + while (y >= 0) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a > 0) { + break; + } + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + } + + return y; +} + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + #if ANTI_ALIAS > 0 + + if (fragment.a <= 0) { + bool left_done = false; + float h2; + float a_fact = 0; + + if (texelFetch(tex, ivec2(gl_FragCoord.x - 1, gl_FragCoord.y), 0).a > 0) { + float h1 = get_col_height_up(gl_FragCoord.x - 1, gl_FragCoord.y); + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + + a_fact = clamp(abs((h1 - gl_FragCoord.y) / (h2 - h1)), 0.0, 1.0); + + left_done = true; + } + if (texelFetch(tex, ivec2(gl_FragCoord.x + 1, gl_FragCoord.y), 0).a > 0) { + if (!left_done) { + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + } + float h3 = get_col_height_up(gl_FragCoord.x + 1, gl_FragCoord.y); + + a_fact = max(a_fact, clamp(abs((h3 - gl_FragCoord.y) / (h2 - h3)), 0.0, 1.0)); + } + + fragment.a *= a_fact; + + } + + #endif +} diff --git a/share/dotfiles/.config/glava/glava/graph/4.frag b/share/dotfiles/.config/glava/glava/graph/4.frag new file mode 100644 index 00000000..f4b70595 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/graph/4.frag @@ -0,0 +1,5 @@ +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava/radial.glsl b/share/dotfiles/.config/glava/glava/radial.glsl new file mode 100644 index 00000000..ee5ea92c --- /dev/null +++ b/share/dotfiles/.config/glava/glava/radial.glsl @@ -0,0 +1,36 @@ + +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 2 +/* outline color */ +#define OUTLINE @bg:#333333 +/* number of bars (use even values for best results) */ +#define NBARS 160 +/* width (in pixels) of each bar*/ +#define BAR_WIDTH 4.5 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 95 +/* Bar color. This is a gradient by default. */ +#define COLOR @fg:mix(#cc3333, #cca0a0, clamp(d / GRADIENT, 0, 1)) +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to swap left/right audio buffers, set to 1 to enable */ +#define INVERT 0 +/* Aliasing factors. Higher values mean more defined and jagged lines. + Note: aliasing does not have a notable impact on performance, but requires + `xroot` transparency to be enabled since it relies on alpha blending with + the background. */ +#define BAR_ALIAS_FACTOR 1.2 +#define C_ALIAS_FACTOR 1.8 +/* Offset (Y) of the visualization */ +#define CENTER_OFFSET_Y 0 +/* Offset (X) of the visualization */ +#define CENTER_OFFSET_X 0 + +/* (DEPRECATED) outline color */ +#define BAR_OUTLINE OUTLINE +/* (DEPRECATED) outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 0 diff --git a/share/dotfiles/.config/glava/glava/radial/1.frag b/share/dotfiles/.config/glava/glava/radial/1.frag new file mode 100644 index 00000000..f1942e00 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/radial/1.frag @@ -0,0 +1,116 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@radial.glsl" +#include ":radial.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +void main() { + + #if _USE_ALPHA > 0 + #define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a)) + fragment = #00000000; + #else + #define APPLY_FRAG(f, c) f = c + #endif + + /* To handle jagged edges, we alias in the shader by using alpha layer blending. + Alpha layer blending is only applied when `xroot` transparency is enabled. */ + + float /* translate (x, y) to use (0, 0) as the center of the screen */ + dx = gl_FragCoord.x - (screen.x / 2) + CENTER_OFFSET_X, + dy = gl_FragCoord.y - (screen.y / 2) + CENTER_OFFSET_Y; + float theta = atan(dy, dx); /* fragment angle with the center of the screen as the origin */ + float d = sqrt((dx * dx) + (dy * dy)); /* distance */ + if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) { + APPLY_FRAG(fragment, OUTLINE); + #if _USE_ALPHA > 0 + fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1); + #else + return; /* return immediately if there is no alpha blending available */ + #endif + } + if (d > C_RADIUS) { + const float section = (TWOPI / NBARS); /* range (radians) for each bar */ + const float center = ((TWOPI / NBARS) / 2.0F); /* center line angle */ + float m = mod(theta, section); /* position in section (radians) */ + float ym = d * sin(center - m); /* distance from center line (cartesian coords) */ + if (abs(ym) < BAR_WIDTH / 2) { /* if within width, draw audio */ + float idx = theta + ROTATE; /* position (radians) in texture */ + float dir = mod(abs(idx), TWOPI); /* absolute position, [0, 2pi) */ + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); /* Re-correct position values to [-pi, pi) */ + #if INVERT == 0 + idx = -idx; /* Invert if needed */ + #endif + float pos = int(abs(idx) / section) / float(NBARS / 2); /* bar position, [0, 1) */ + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) /* smooth function format */ + float v; + if (idx > 0) v = smooth_f(audio_l); /* left buffer */ + else v = smooth_f(audio_r); /* right buffer */ + v *= AMPLIFY; /* amplify */ + #undef smooth_f + /* offset to fragment distance from inner circle */ + #if _USE_ALPHA > 0 + #define ALIAS_FACTOR (((BAR_WIDTH / 2) - abs(ym)) * BAR_ALIAS_FACTOR) + d -= C_RADIUS; /* start bar overlapping the inner circle for blending */ + #else + #define ALIAS_FACTOR 1 + d -= C_RADIUS + (float(C_LINE) / 2.0F); /* start bar after circle */ + #endif + if (d <= v - BAR_OUTLINE_WIDTH) { + vec4 r; + #if BAR_OUTLINE_WIDTH > 0 + if (abs(ym) < (BAR_WIDTH / 2) - BAR_OUTLINE_WIDTH) + r = COLOR; + else + r = BAR_OUTLINE; + #else + r = COLOR; + #endif + #if _USE_ALPHA > 0 + r.a *= ALIAS_FACTOR; + #endif + APPLY_FRAG(fragment, r); + return; + } + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + #if _USE_ALPHA > 0 + vec4 r = BAR_OUTLINE; + r.a *= ALIAS_FACTOR; + APPLY_FRAG(fragment, r); + #else + APPLY_FRAG(fragment, BAR_OUTLINE); + #endif + return; + } + #endif + } + } + fragment = APPLY_FRAG(fragment, vec4(0, 0, 0, 0)); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/glava/radial/2.frag b/share/dotfiles/.config/glava/glava/radial/2.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/glava/radial/2.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava/rc.glsl b/share/dotfiles/.config/glava/glava/rc.glsl new file mode 100644 index 00000000..a0d43ca2 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/rc.glsl @@ -0,0 +1,236 @@ + +/* The module to use. A module is a set of shaders used to produce + the visualizer. The structure for a module is the following: + + module_name [directory] + 1.frag [file: fragment shader], + 2.frag [file: fragment shader], + ... + + Shaders are loaded in numerical order, starting at '1.frag', + continuing indefinitely. The results of each shader (except + for the final pass) is given to the next shader in the list + as a 2D sampler. + + See documentation for more details. */ +#request mod bars + +/* Window hints */ +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false + +/* Set window background opacity mode. Possible values are: + + "native" - True transparency provided by the compositor. Can + reduce performance on some systems, depending on + the compositor used. + + "xroot" - Maintain a copy of the root window's pixmap + (usually the desktop background) to provide a + pseudo-transparent effect. Useful when no compositor + is available or native transparency isn't nessecary. + Has very little performance impact. + + "none" - Disable window opacity completely. */ +#request setopacity "native" + +/* Whether to average and mirror left and right audio input channels. + This may cause some modules to only render a single channel. */ +#request setmirror false + +/* OpenGL context and GLSL shader versions, do not change unless + you *absolutely* know what you are doing. */ +#request setversion 3 3 +#request setshaderversion 330 + +/* Window title */ +#request settitle "GLava" + +/* Window geometry (x, y, width, height) */ +#request setgeometry 0 0 800 600 + +/* Window background color (RGBA format). + Does not work with `setopacity "xroot"` */ +#request setbg 00000000 + +/* (X11 only) EWMH Window type. Possible values are: + + "desktop", "dock", "toolbar", "menu", + "utility", "splash", "dialog", "normal" + + This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE), + where (TYPE) is the one of the window types listed (after being + converted to uppercase). + + Alternatively, you can set this value to "!", which will cause + the window to be unmanaged. If this is set, then `addxwinstate` + will do nothing, but you can use "!+" and "!-" to stack on top + or below other windows. +*/ +#request setxwintype "normal" + +/* (X11 only) EWMH Window state atoms (multiple can be specified). + Possible values are: + + "modal", "sticky", "maximized_vert", "maximized_horz", + "shaded", "skip_taskbar", "skip_pager", "hidden", "fullscreen", + "above", "below", "demands_attention", "focused", "pinned" + + This will add _NET_WM_STATE_(TYPE) atoms to _NET_WM_STATE, + where (TYPE) is one of the window states listed (after being + converted to uppercase). + + The lines below (commented out by default) are of relevance + if you are trying to get GLava to behave as a desktop widget + and your WM is not correctly responding to the "desktop" value + for `setxwintype`. +*/ +// #request addxwinstate "sticky" +// #request addxwinstate "skip_taskbar" +// #request addxwinstate "skip_pager" +// #request addxwinstate "above" +// #request addxwinstate "pinned" + +/* (X11 only) Use the XShape extension to support clicking through + the GLava window. Useful when you want to interact with other + desktop windows (icons, menus, desktop shells). Enabled by + default when GLava itself is a desktop window. */ +#request setclickthrough false + +/* Audio source + + When the "pulseaudio" backend is set, this can be a number or + a name of an audio sink or device to record from. Set to "auto" + to use the default output device. + + When the "fifo" backend is set, "auto" is interpreted as + "/tmp/mpd.fifo". Otherwise, a valid path should be provided. */ +#request setsource "auto" + +/* Buffer swap interval (vsync), set to '0' to prevent + waiting for refresh, '1' (or more) to wait for the specified + amount of frames. */ +#request setswap 1 + +/* Linear interpolation for audio data frames. Drastically + improves smoothness with configurations that yield low UPS + (`setsamplerate` and `setsamplesize`), or monitors that have + high refresh rates. + + This feature itself, however, will effect performance as it + will have to interpolate data every frame on the CPU. It will + automatically (and temporarily) disable itself if the update + rate is close to, or higher than the framerate: + + if (update_rate / frame_rate > 0.9) disable_interpolation; + + This will delay data output by one update frame, so it can + desync audio with visual effects on low UPS configs. */ +#request setinterpolate false + +/* Frame limiter, set to the frames per second (FPS) desired or + simply set to zero (or lower) to disable the frame limiter. */ +#request setframerate 0 + +/* Suspends rendering if a fullscreen window is focused while + GLava is still visible (ie. on another monitor). This prevents + rendering from interfering with other graphically intensive + tasks. + + If GLava is minimized or completely obscured, it will not + render regardless of this option. */ +#request setfullscreencheck false + +/* Enable/disable printing framerate every second. 'FPS' stands + for 'Frames Per Second', and 'UPS' stands for 'Updates Per + Second'. Updates are performed when new data is submitted + by pulseaudio, and require transformations to be re-applied + (thus being a good measure of how much work your CPU has to + perform over time) */ +#request setprintframes true + +/* PulseAudio sample buffer size. Lower values result in more + frequent audio updates (also depends on sampling rate), but + will also require all transformations to be applied much + more frequently (CPU intensive). + + High (>2048, with 22050 Hz) values will decrease accuracy + (as some signals can be missed by transformations like FFT) + + The following settings (@22050 Hz) produce the listed rates: + + Sample UPS Description + - 2048 -> 43.0 (low accuracy, cheap), use with < 60 FPS + - 1024 -> 86.1 (high accuracy, expensive), use with >= 60 FPS + - 512 -> 172.3 (extreme accuracy, very expensive), use only + for graphing accurate spectrum data with + custom modules. + + If the framerate drops below the update rate, the update rate + will be locked to the framerate (to prevent wasting CPU time). + This behaviour means you can use a 1024 sample size on a 60Hz + monitor with vsync enabled to get 60FPS and 60UPS. + + For high refresh rate monitors (120+ Hz), it's recommended to + also stick with the 1024 sample size and use interpolation to + smooth the data, as accuracy beyond this setting is mostly + meaningless for visual purposes. +*/ +#request setsamplesize 1024 + +/* Audio buffer size to be used for processing and shaders. + Increasing this value can have the effect of adding 'gravity' + to FFT output, as the audio signal will remain in the buffer + longer. + + This value has a _massive_ effect on FFT performance and + quality for some modules. */ +#request setbufsize 4096 + +/* PulseAudio sample rate. Lower values can add 'gravity' to + FFT output, but can also reduce accuracy. Most hardware + samples at 44100Hz. + + Lower sample rates also can make output more choppy, when + not using interpolation. It's generally OK to leave this + value unless you have a strange PulseAudio configuration. + + This option does nothing when using the "fifo" audio + backend. Instead, an ideal rate should be be configured + in the application generating the output. */ +#request setsamplerate 22050 + +/* Enable GPU acceleration of the audio buffer's fourier transform. + This drastically reduces CPU usage, but should be avoided on + old integrated graphics hardware. + + Enabling this also enables acceleration for post-FFT processing + effects, such as gravity, averaging, windowing, and interpolation. */ +#request setaccelfft true + +/* ** DEPRECATED ** + Force window geometry (locking the window in place), useful + for some pesky WMs that try to reposition the window when + embedding in the desktop. + + This routinely sends X11 events and should be avoided. */ +#request setforcegeometry false + +/* ** DEPRECATED ** + Force window to be raised (focused in some WMs), useful for + WMs that have their own stacking order for desktop windows. + + This routinely sends X11 events and should be avoided. */ +#request setforceraised false + +/* ** DEPRECATED ** + Scale down the audio buffer before any operations are + performed on the data. Higher values are faster. + + This value can affect the output of various transformations, + since it applies (crude) averaging to the data when shrinking + the buffer. It is reccommended to use `setsamplerate` and + `setsamplesize` to improve performance or accuracy instead. */ +#request setbufscale 1 diff --git a/share/dotfiles/.config/glava/glava/smooth_parameters.glsl b/share/dotfiles/.config/glava/glava/smooth_parameters.glsl new file mode 100644 index 00000000..09e829fa --- /dev/null +++ b/share/dotfiles/.config/glava/glava/smooth_parameters.glsl @@ -0,0 +1,78 @@ + +/* Settings for smoothing functions and transformations commonly + used to display FFT output. + + IMPORTANT: THESE VALUES CAN BE OVERRIDDEN IN MODULE CONFIG + FILES, IF CHANGING VALUES HERE DOES NOT WORK, CHECK + TO MAKE SURE THEY ARE NOT BEING SET ELSEWHERE. +*/ + +/* The type of formula to use for weighting values when smoothing. + Possible values: + + - circular heavily rounded points + - sinusoidal rounded at both low and high weighted values + like a sine wave + - linear not rounded at all; linear distance + */ +#define ROUND_FORMULA sinusoidal + +/* The sampling mode for processing raw FFT input: + + - average averages all the inputs in the sample range for + a given point. Produces smooth output, but peaks + are not well represented + - maximum obtains the best value from the closest peak in + the sample range. Very accurate peaks, but + output is jagged and sporadic. + - hybrid uses the results from both `average` and `maximum` + with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ +#define SAMPLE_MODE average +/* Weight should be provided in the range (0, 1). Higher values favour + averaged results. `hybrid` mode only. */ +#define SAMPLE_HYBRID_WEIGHT 0.65 + +/* Factor used to scale frequencies. Lower values allows lower + frequencies to occupy more space. */ +#define SAMPLE_SCALE 8 + +/* The frequency range to sample. 1.0 would be the entire FFT output, + and lower values reduce the displayed frequencies in a log-like + scale. */ +#define SAMPLE_RANGE 0.9 + +/* Factor for how to scale higher frequencies. Used in a linear equation + which is multiplied by the result of the fft transformation. */ +#request setfftscale 10.2 + +/* Cutoff for the bass end of the audio data when scaling frequencies. + Higher values cause more of the bass frequencies to be skipped when + scaling. */ +#request setfftcutoff 0.3 + +/* How many frames to queue and run through the average function. + Increasing this value will create latency between the audio and the + animation, but will make for much smoother results. */ +#request setavgframes 5 + +/* Whether to window frames ran through the average function (new & old + frames are weighted less). This massively helps smoothing out + spontaneous values in the animation. */ +#request setavgwindow true + +/* Gravity step, higher values means faster drops. The step is applied + in a rate independant method like so: + + val -= (gravitystep) * (seconds per update) */ +#request setgravitystep 4.2 + +/* Smoothing factor. Larger values mean more smoothing in the output, + however high values can be expensive to compute. Values are in + normalized width: [0.0, 1.0) */ +#request setsmoothfactor 0.025 + +/* Whether to use a separate pass for audio data while smoothing. On + most hardware, this will improve performance, but involves doing a + separate render step for each audio texture and will add some driver + (CPU) overhead. */ +#request setsmoothpass true diff --git a/share/dotfiles/.config/glava/glava/test/1.frag b/share/dotfiles/.config/glava/glava/test/1.frag new file mode 100644 index 00000000..5a7bd634 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/test/1.frag @@ -0,0 +1,33 @@ +/* Request transforms and basic uniforms to assert nothing here breaks */ + +#include ":util/smooth.glsl" + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +void main() { + float dummy_result0 = smooth_audio(audio_l, audio_sz, gl_FragCoord.x / float(screen.x)); + float dummy_result1 = smooth_audio(audio_r, audio_sz, gl_FragCoord.x / float(screen.x)); + fragment = vec4(1.0, 0, 0, float(1) / float(3)); +} diff --git a/share/dotfiles/.config/glava/glava/test/2.frag b/share/dotfiles/.config/glava/glava/test/2.frag new file mode 100644 index 00000000..85498f85 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/test/2.frag @@ -0,0 +1,12 @@ +/* Pass the initial results to a dummy shader to assert that linking works correctly */ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); +} diff --git a/share/dotfiles/.config/glava/glava/test/3.frag b/share/dotfiles/.config/glava/glava/test/3.frag new file mode 100644 index 00000000..d5db2d25 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/test/3.frag @@ -0,0 +1,2 @@ +/* Assert that the premultiply step works */ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava/test_rc.glsl b/share/dotfiles/.config/glava/glava/test_rc.glsl new file mode 100644 index 00000000..60ebf431 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/test_rc.glsl @@ -0,0 +1,27 @@ +#request mod test +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false +#request setopacity "native" +#request setmirror false +#request setversion 3 3 +#request setshaderversion 330 +#request settitle "GLava" +#request setgeometry 0 0 640 640 +#request setbg 00000000 +#request setxwintype "desktop" +#request setclickthrough false +#request setsource "auto" +#request setswap 0 +#request setinterpolate true +#request setframerate 0 +#request setfullscreencheck false +#request setprintframes true +#request setsamplesize 1024 +#request setbufsize 4096 +#request setsamplerate 22050 +#request setforcegeometry false +#request setforceraised false +#request setbufscale 1 +#request settesteval 55000055 diff --git a/share/dotfiles/.config/glava/glava/wave.glsl b/share/dotfiles/.config/glava/glava/wave.glsl new file mode 100644 index 00000000..f23848d0 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/wave.glsl @@ -0,0 +1,10 @@ +/* Min (vertical) line thickness */ +#define MIN_THICKNESS 1 +/* Max (vertical) line thickness */ +#define MAX_THICKNESS 6 +/* Base color to use, distance from center will multiply the RGB components */ +#define BASE_COLOR @fg:vec4(0.7, 0.2, 0.45, 1) +/* Amplitude */ +#define AMPLIFY 500 +/* Outline color */ +#define OUTLINE @bg:vec4(0.15, 0.15, 0.15, 1) diff --git a/share/dotfiles/.config/glava/glava/wave/1.frag b/share/dotfiles/.config/glava/glava/wave/1.frag new file mode 100644 index 00000000..13522046 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/wave/1.frag @@ -0,0 +1,39 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "wrange" +uniform sampler1D audio_l; + +out vec4 fragment; + +#include "@wave.glsl" +#include ":wave.glsl" + +#define index(offset) ((texture(audio_l, (gl_FragCoord.x + offset) / screen.x).r - 0.5) * AMPLIFY) + 0.5F + +void main() { + float + os = index(0), + adj0 = index(-1), + adj1 = index(1); + float + s0 = adj0 - os, + s1 = adj1 - os; + float + dmax = max(s0, s1), + dmin = min(s0, s1); + + float s = (os + (screen.y * 0.5F) - 0.5F); /* center to screen coords */ + float diff = gl_FragCoord.y - s; + if (abs(diff) < clamp(abs(s - (screen.y * 0.5)) * 6, MIN_THICKNESS, MAX_THICKNESS) + || (diff <= dmax && diff >= dmin)) { + fragment = BASE_COLOR + (abs((screen.y * 0.5F) - s) * 0.02); + } else { + fragment = vec4(0, 0, 0, 0); + } +} diff --git a/share/dotfiles/.config/glava/glava/wave/2.frag b/share/dotfiles/.config/glava/glava/wave/2.frag new file mode 100644 index 00000000..5ff07067 --- /dev/null +++ b/share/dotfiles/.config/glava/glava/wave/2.frag @@ -0,0 +1,33 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +out vec4 fragment; /* output */ + +#include "@wave.glsl" +#include ":wave.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0 || gl_FragCoord.x == 0 || gl_FragCoord.x == screen.x - 1) + fragment = OUTLINE; + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/.github/FUNDING.yml b/share/dotfiles/.config/glava/glava_repo/.github/FUNDING.yml new file mode 100644 index 00000000..3d474ac7 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/.github/FUNDING.yml @@ -0,0 +1 @@ +liberapay: Jarcode diff --git a/share/dotfiles/.config/glava/glava_repo/.gitignore b/share/dotfiles/.config/glava/glava_repo/.gitignore new file mode 100644 index 00000000..d1638636 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/share/dotfiles/.config/glava/glava_repo/.gitmodules b/share/dotfiles/.config/glava/glava_repo/.gitmodules new file mode 100644 index 00000000..677ace07 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/.gitmodules @@ -0,0 +1,3 @@ +[submodule "glad"] + path = glad + url = https://github.com/Dav1dde/glad diff --git a/share/dotfiles/.config/glava/glava_repo/CONTRIBUTING.md b/share/dotfiles/.config/glava/glava_repo/CONTRIBUTING.md new file mode 100644 index 00000000..02ca2d62 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/CONTRIBUTING.md @@ -0,0 +1,55 @@ + +## Code Style + +GLava uses a bastardized version of the [linux kernel style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html), with the following modifications: + +* Opening braces are _always_ on the same line as the token it is associated with (`if`, `while`, labels, functions). The only time this is not honoured is when a set of braces has no associated token (ie. scope usage). + +* Indentation is 4 spaces, and tabs are forbidden + +* The content of a `switch` statement, including `case` labels, are indented. + +* Preprocessor directives should inherit the same intentation level as the code it resides in. + +* Align tokens in repetitious lines by padding spacing between tokens. + +The following rules of the linux style are **ignored**: + +* Function size and control flow recommendations +* Comment formatting rules +* Any other rules regarding preprocessor directives + +Naming rules and the usage of `typedef` is strictly honoured from the Linux style. Anything not mentioned here is probably subjective and won't hurt your chances of getting a PR accepted. + +If you use GNU Emacs, the above style can be configured via the following elisp: + +```emacs +(setq-default c-basic-offset 4) +(setq c-default-style "linux") +(setq tab-stop-list (number-sequence 4 200 4)) +(c-set-offset (quote cpp-macro) 0 nil) +(c-set-offset 'case-label '+) +``` + +## Lua + +If you are contributing to `glava-config`, we use a style close to standard Lua with some emphasis on compact table definitions and readability + +* If an opening brace has no tokens preceding it on the same line, take the first entry in the table and place it on the same line following the brace +* If there are multiple closing braces, combine them onto the same line +* Always have exactly one space between braces and other tokens, but zero for brackets and parenthesis +* Use two-space indentation with no tabs + +## Shaders + +If you author and maintain your own shader module for GLava, you are free to use your preferred code style. Otherwise, shaders follow the same style as GLava's C sources. + +The only exception to this is a hard rule for builtin prefixes. Variables should _never_ start with an underscore, as `__` are reserved by the GLSL compiler, and `_` are reserved for GLava builtins and namespaces. + +## Pull Requests + +You are free to make pull requests for any change, even if you are not sure if the proposed changes are appropriate. @jarcode-foss and/or @coderobe will be able to suggest changes or commentary on the PR if there is a reason it is not acceptable. + +## Conduct + +Engagement in the issue tracker and pull requests simply requires participants remain rational and on-topic. \ No newline at end of file diff --git a/share/dotfiles/.config/glava/glava_repo/LICENSE b/share/dotfiles/.config/glava/glava_repo/LICENSE new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/share/dotfiles/.config/glava/glava_repo/LICENSE_ORIGINAL b/share/dotfiles/.config/glava/glava_repo/LICENSE_ORIGINAL new file mode 100644 index 00000000..31750aca --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/LICENSE_ORIGINAL @@ -0,0 +1,19 @@ +Copyright (c) 2015 Karl Stavestrand <karl@stavestrand.no> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/share/dotfiles/.config/glava/glava_repo/Makefile b/share/dotfiles/.config/glava/glava_repo/Makefile new file mode 100644 index 00000000..df08df3a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/Makefile @@ -0,0 +1,53 @@ +.PHONY: all install clean ninja + +# In case these were specified explicitly as options instead of environment variables, export them to child processes +export DESTDIR +export CFLAGS + +BUILD_DIR = build + +MESON_CONF = $(BUILD_DIR) -Ddisable_obs=true -Ddisable_config=true --prefix /usr + +# Support assigning standalone/debug builds as the old Makefile did, otherwise complain + +ifeq ($(BUILD),debug) + MESON_CONF += --buildtype=debug +else + ifdef BUILD + $(warning WARNING: ignoring build option '$(BUILD)' in compatibility Makefile) + endif +endif + +ifeq ($(INSTALL),standalone) + MESON_CONF += -Dstandalone=true +else + ifdef INSTALL + $(warning WARNING: ignoring install option '$(INSTALL)' in compatibility Makefile) + endif +endif + +# Store relevant variables that may change depending on the environment or user input +STATE = $(BUILD),$(INSTALL),$(PYTHON),$(CC),$(CFLAGS),$(DESTDIR) +# Only update the file if the contents changed, `make` just looks at the timestamp +$(shell if [[ ! -e build_state ]]; then touch build_state; fi) +$(shell if [ '$(STATE)' != "`cat build_state`" ]; then echo '$(STATE)' > build_state; fi) + +all: ninja + +# Rebuild if the makefile state changes to maintain old behaviour and smooth rebuilds with altered parameters +build: build_state + $(warning !!PACKAGE MAINTAINER NOTICE!!) + $(warning Configuring build for compatibility with old makefile. Some new features may be missing.) + $(warning If you are a package maintainer consider using meson directly!) + @rm -rf $(BUILD_DIR) + meson $(BUILD_DIR) + meson configure $(MESON_CONF) + +ninja: build + ninja -C $(BUILD_DIR) + +install: + ninja -C build install + +clean: + rm -rf $(BUILD_DIR) diff --git a/share/dotfiles/.config/glava/glava_repo/README.md b/share/dotfiles/.config/glava/glava_repo/README.md new file mode 100644 index 00000000..f1c2148e --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/README.md @@ -0,0 +1,152 @@ + +<img align="left" width="200" height="200" src="https://thumbs.gfycat.com/DefiantInformalIndianspinyloach-size_restricted.gif" /> + +**GLava** is a general-purpose, highly configurable OpenGL audio spectrum visualizer for X11. Displayed to the left is the `radial` shader module, or for a more extensive demonstration [see this demo](https://streamable.com/dgpj8). Development is active, and reporting issues is encouranged. + +**Compiling:** + +```bash +$ git clone https://github.com/jarcode-foss/glava +$ cd glava +$ meson build --prefix /usr +$ ninja -C build +$ sudo ninja -C build install +``` + +You can pass `-Dbuildtype=debug` to Meson for debug builds of glava, and `-Dstandalone=true` to run glava directly from the `build` directory. + +Note that versions since `2.0` use Meson for the build system, although the `Makefile` will remain to work identically to earlier `1.xx` releases (with new features disabled). Package maintainers are encouraged to use Meson directly instead of the Make wrapper. + +**Requirements:** + +- X11 (Xext, Xcomposite, & Xrender) +- PulseAudio +- Linux or BSD +- libBlocksRuntime if compiling with Clang + +**Configuration tool requirements:** + +- Lua (5.3 by default, change with `-Dlua_version=...`), and the following lua libraries: + - Lua GObject Introspection (LGI) + - LuaFilesystem (LFS) +- GTK+ 3 + +**Additional compile time requirements:** + +- Meson +- OBS (disable with `-Ddisable_obs=true`) + +**Optional requirements:** + +- GLFW 3.1+ (optional, enable with `-Denable_glfw=true`) + +**Ubuntu/Debian users:** the following command ensures you have all the needed packages and headers to compile GLava with the default feature set: +```bash +sudo apt-get install libgl1-mesa-dev libpulse0 libpulse-dev libxext6 libxext-dev libxrender-dev libxcomposite-dev liblua5.3-dev liblua5.3 lua-lgi lua-filesystem libobs0 libobs-dev meson build-essential gcc +``` +Don't forget to run `sudo ldconfig` after installing. + +## Installation +Some distributions have a package for `glava`. If your distribution is not listed please use the compilation instructions above. + +- Arch Linux [`glava` package](https://www.archlinux.org/packages/community/x86_64/glava/), or [`glava-git` AUR package](https://aur.archlinux.org/packages/glava-git/) +- NixOS [package](https://github.com/NixOS/nixpkgs/blob/release-18.09/pkgs/applications/misc/glava/default.nix) +- openSUSE [package](https://build.opensuse.org/package/show/X11:Utilities/glava) + +## [Configuration](https://github.com/jarcode-foss/glava/wiki) + +GLava will start by looking for an entry point in the user configuration folder (`~/.config/glava/rc.glsl`), and will fall back to loading from the shader installation folder (`/etc/xdg/glava`). The entry point will specify a module to load and should set global configuration variables. Configuration for specific modules can be done in their respective `.glsl` files, which the module itself will include. + +You should start by running `glava --copy-config`. This will copy over default configuration files and create symlinks to modules in your user config folder. GLava will either load system configuration files or the user provided ones, so it's not advised to copy these files selectively. + +To embed GLava in your desktop (for EWMH compliant window managers), run it with the `--desktop` flag and then position it accordingly with `#request setgeometry x y width height` in your `rc.glsl`. + +For more information, see the [main configuration page](https://github.com/jarcode-foss/glava/wiki). + +## Desktop window compatibility + +GLava aims to be compatible with _most_ EWMH compliant window managers. Below is a list of common window managers and issues specific to them for trying to get GLava to behave as a desktop window or widget: + +| WM | ! | Details +| :---: | --- | --- | +| Mutter (GNOME, Budgie) | ![-](https://placehold.it/15/118932/000000?text=+) | `"native"` (default) opacity should be used +| KWin (KDE) | ![-](https://placehold.it/15/118932/000000?text=+) | "Show Desktop" [temporarily hides GLava](https://github.com/jarcode-foss/glava/issues/4#issuecomment-419729184) +| Openbox (LXDE or standalone) | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| Xfwm (XFCE) | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| Fluxbox | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| IceWM | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| Bspwm | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| SpectrWM | +| Herbstluftwm | ![-](https://placehold.it/15/118932/000000?text=+) | `hc rule windowtype~'_NET_WM_WINDOW_TYPE_DESKTOP' manage=off` can be used to unmanage desktop windows +| Unity | ![-](https://placehold.it/15/118932/000000?text=+) | No issues +| AwesomeWM | ![-](https://placehold.it/15/118932/000000?text=+) | Defaults to unmanaged +| i3 (and i3-gaps) | ![-](https://placehold.it/15/118932/000000?text=+) | Defaults to unmanaged +| spectrwm | ![-](https://placehold.it/15/118932/000000?text=+) | Defaults to unmanaged +| EXWM | ![-](https://placehold.it/15/f03c15/000000?text=+) | EXWM does not have a desktop, and forces window decorations +| Enlightenment | ![-](https://placehold.it/15/1589F0/000000?text=+) | Needs testing +| Xmonad | ![-](https://placehold.it/15/118932/000000?text=+) | No issues after enabling ewmh hints via `XMonad.Hooks.EwmhDesktops.ewmh` +| Any non EWMH-compliant WM | ![-](https://placehold.it/15/f03c15/000000?text=+) | Window types and hints will not work if the window manager does not support the EWMH standards. + +Note that some WMs listed without issues have specific overrides when using the `--desktop` flag. See `shaders/env_*.glsl` files for details. + +## Reading from MPD's FIFO output + +Add the following to your `~/.config/mpd.conf`: + +``` +audio_output { + type "fifo" + name "glava_fifo" + path "/tmp/mpd.fifo" + format "22050:16:2" +} +``` + +Note the `22050` sample rate -- this is the reccommended setting for GLava. Restart MPD (if nessecary) and start GLava with `glava --audio=fifo`. + +## Using GLava with OBS + +GLava installs a plugin for rendering directly to an OBS scene, if support was enabled at compile-time. This is enabled by default in Meson, but it is overridden to disabled in the `Makefile` for build compatibility. + +To use the plugin, simply select `GLava Direct Source` from the source list in OBS and position the output accordingly. You can provide options to GLava in the source properties. + +Note that this only works for the default GLX builds of both OBS and GLava. This feature will not work if OBS was compiled with EGL for context creation, or if GLava is using GLFW. + +## Performance + +GLava will have a notable performance impact by default due to reletively high update rates, interpolation, and smoothing. Because FFT computations are (at the moment) performed on the CPU, you may wish to _lower_ `setsamplesize` and `setbufsize` on old hardware. + +However, there is functionality to prevent GLava from unessecarily eating resources. GLava will always halt completely when obscured, so a fullscreen application covering the visualizer should enounter no issues (ie. games). If you wish for GLava to halt rendering when _any_ fullscreen application is in focus regardless of visibility, you can set `setfullscreencheck` to `true` in `rc.glsl`. + +Any serious performance and/or updating issues (low FPS/UPS) should be reported. At a minimum, modules should be expected to run smoothly on Intel HD graphics and software rasterizers like `llvmpipe`. + +## Licensing + +GLava is licensed under the terms of the GPLv3, with the exemption of `khrplatform.h`, which is licensed under the terms in its header. GLava includes some (heavily modified) source code that originated from [cava](https://github.com/karlstav/cava), which was initially provided under the MIT license. The source files that originated from cava are the following: + +- `[cava]/input/fifo.c -> [glava]/fifo.c` +- `[cava]/input/fifo.h -> [glava]/fifo.h` +- `[cava]/input/pulse.c -> [glava]/pulse_input.c` +- `[cava]/input/pulse.h -> [glava]/pulse_input.h` + +The below copyright notice applies for the original versions of these files: + +`Copyright (c) 2015 Karl Stavestrand <karl@stavestrand.no>` + +GLava also contains GLFFT, an excellent FFT implementation using Opengl 4.3 compute shaders. This was also initiallly provided under the MIT license, and applies to the following source files (where `*` refers to both `hpp` and `cpp`): + +- `glfft/glfft.*` +- `glfft/glfft_common.hpp` +- `glfft/glfft_gl_interface.*` +- `glfft/glfft_interface.hpp` +- `glfft/glfft_wisdom.*` + +The below copyright notice applies for the original versions of these files: + +`Copyright (c) 2015 Hans-Kristian Arntzen <maister@archlinux.us>` + +**The noted files above are all sublicensed under the terms of the GPLv3**. The MIT license is included for your convenience and to satisfy the requirements of the original license, although it no longer applies to any code in this repository. You will find the original copyright notice and MIT license in the `LICENSE_ORIGINAL` file for cava, or `glfft/LICENSE_ORIGINAL` for GLFFT. + +The below copyright applies for the modifications to the files listed above, and the remaining sources in the repository: + +`Copyright (c) 2017 Levi Webb` diff --git a/share/dotfiles/.config/glava/glava_repo/glad_generate.sh b/share/dotfiles/.config/glava/glava_repo/glad_generate.sh new file mode 100755 index 00000000..c1e74240 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glad_generate.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +GLAD_GEN="${1:-c}" + +pushd glad +python -m glad --generator=${GLAD_GEN} --extensions=GL_EXT_framebuffer_multisample,GL_EXT_texture_filter_anisotropic,GL_NV_texture_barrier --local-files --out-path=. +popd +cp glad/*.h glava/ +cp glad/glad.c glava/ diff --git a/share/dotfiles/.config/glava/glava_repo/glava-cli/cli.c b/share/dotfiles/.config/glava/glava_repo/glava-cli/cli.c new file mode 100644 index 00000000..d8e1bbce --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-cli/cli.c @@ -0,0 +1,26 @@ +#include <glava.h> +#include <signal.h> +#include <stdlib.h> +#include <stdio.h> + +static glava_handle handle; + +static void handle_term (int _) { + printf("Interrupt received, closing...\n"); + glava_terminate(&handle); +} +static void handle_reload(int _) { + printf("User signal received, reloading...\n"); + glava_reload(&handle); +} + +int main(int argc, char** argv) { + const struct sigaction term_action = { .sa_handler = handle_term }; + const struct sigaction reload_action = { .sa_handler = handle_reload }; + sigaction(SIGTERM, &term_action, NULL); + sigaction(SIGINT, &term_action, NULL); + sigaction(SIGUSR1, &reload_action, NULL); + + glava_entry(argc, argv, &handle); + return EXIT_SUCCESS; +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/config.lua b/share/dotfiles/.config/glava/glava_repo/glava-config/config.lua new file mode 100644 index 00000000..d51088b1 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/config.lua @@ -0,0 +1,320 @@ +local lfs = require "lfs" +local mappings = require "glava-config.mappings" + +local config = { + Profile = { mt = {} }, + PROFILES_DIR = "profiles" +} + +config.Profile.__index = config.Profile +setmetatable(config.Profile, config.Profile.mt) + +-- Split path into entries, such that `table.concat` can be used to +-- reconstruct the path. Prepends the result with an empty string so +-- root (absolute) paths are preserved +local function path_split(str, sep) + local sep, fields = sep or ":", (str:sub(1, sep:len()) == sep and {""} or {}) + local pattern = string.format("([^%s]+)", sep) + str:gsub(pattern, function(c) fields[#fields + 1] = c end) + return fields +end + +-- Concatenates paths such that duplicate path separators are removed. +-- Can be used on non-split arguments, and resolves `..` syntax +local function path_concat(...) + local ret = {} + for _, v in ipairs({...}) do + for _, e in ipairs(path_split(v, "/")) do + if e ~= "" or #ret == 0 then + if e == ".." and #ret >= 1 then + ret[#ret] = nil + else + ret[#ret + 1] = e + end + end + end + end + return table.concat(ret, "/") +end + +-- Wrap table such that it can be called to index and call its members, +-- useful for switch-style syntax +local function switch(tbl) + local mt = { __call = function(self, i) return rawget(self, i)() end } + return setmetatable(tbl, mt) +end + +-- To parse data from GLSL configs we use some complex pattern matching. +-- +-- Because Lua's patterns operate on a per-character basis and do not offer +-- any read-ahead functionality, we use a pattern 'replacement' functionality +-- such that the match of an input pattern is passed to a function to produce +-- an output pattern. +-- +-- This effectively means we have some fairly powerful parsing which allows us +-- to handle things like quoted strings with escaped characters. +local function unquote(match) + local ret = {} + local escaped = false + for c in match:gmatch(".") do + if c == "\"" then + if escaped then ret[#ret + 1] = c end + elseif c ~= "\\" then ret[#ret + 1] = c end + if c == "\\" then + if escaped then ret[#ret + 1] = c end + escaped = not escaped + else escaped = false end + end + return table.concat(ret, "") +end +local function none(...) return ... end +local MATCH_ENTRY_PATTERN = "^%s*%#(%a+)%s+(%a+)" +local MATCH_DATA_PREFIX = "^%s*%#%a+%s+%a+" +local MATCH_TYPES = { + ["float"] = { pattern = "(%d+.?%d*)" }, + ["int"] = { pattern = "(%d+)" }, + ["color-expr"] = { pattern = "(.+)" }, + ["expr"] = { pattern = "(.+)" }, + ["ident"] = { pattern = "(%a%w*)" }, + ["string"] = { + pattern = "(.+)", + cast = unquote, + -- Read-ahead function to generate a fixed-width pattern + -- to match the next (possibly quoted) string + transform = function(match) + local quoted = false + local start = true + local escaped = false + local count = 0 + local skip = 0 + for c in match:gmatch(".") do + count = count + 1 + if c == "\"" then + if start then + start = false + quoted = true + elseif not escaped then + if quoted then + -- End-quote; end of string + break + else + -- Formatting error: non-escaped quote after string start: `foo"bar` + -- We attempt to resolve this by halting parsing and skipping the + -- out-of-context quotation + count = count - 1 + skip = skip + 1 + break + end + end + elseif c == " " then + if not start and not quoted then + -- Un-escaped space; end of string + -- skip the space itself + count = count - 1 + break + end + else start = false end + if c == "\\" then + escaped = not escaped + else escaped = false end + end + -- Strings without an ending quote will simply take up the remainder of + -- the request, causing the following arguments to be overwritten. This + -- is intended to ensure we can save valid options after stripping out + -- the errornous quotes and using defaults for the subsequent arguments. + local ret = { "(" } + for t = 1, count do + ret[1 + t] = "." + end + ret[2 + count] = ")" + for t = 1, skip do + ret[2 + count + t] = "." + end + return table.concat(ret, "") + end, + serialize = function(x) + return string.format("\"%s\"", x) + end + } +} + +config.path_concat = path_concat +config.path_split = path_split + +local function create_pf(arr, mode, silent) + local parts = {} + local function errfmt(err) + return string.format("Failed to create '%s' in '%s': %s", + path_concat(parts, "/"), path_concat(arr, "/"), err) + end + for i, v in ipairs(arr) do + parts[#parts + 1] = v + local failret = false + if silent then failret = #parts == #arr end + local path = path_concat(parts, "/") + local m = (i == #arr and mode or "directory") + local attr, err = lfs.attributes(path, "mode") + if attr == nil then + local ret, err = switch { + file = function() + local ret, err = lfs.touch(path) + if not ret then return false, errfmt(err) end + end, + directory = function() + local ret, err = lfs.mkdir(path) + if not ret then return false, errfmt(err) end + end, + }(m) + if ret == false then return ret, err end + elseif attr ~= m then + if not (silent and #parts == #arr) then + return false, string.format("'%s' is not a %s", path, m) + else + return true + end + end + end + return true +end + +local function create_p(path, ...) create_pf(path_split(path, "/"), ...) end +local function unwrap(ret, err) + if ret == nil or ret == false then + glava.fail(err) + else return ret end +end + +function config.Profile:__call(args) + local self = { name = args.name or ".." } + self:rebuild() + return setmetatable(self, config.Profile) +end + +function config.Profile:rename(new) + error("not implemented") +end + +function config.Profile:get_path() + return path_concat(glava.config_path, config.PROFILES_DIR, self.name) +end + +function config.Profile:rebuild() + self.store = {} + self.path = path_concat(glava.config_path, config.PROFILES_DIR, self.name) + unwrap(create_p(self.path, "directory", true)) + local unbuilt = {} + for k, _ in pairs(mappings) do + unbuilt[k] = true + end + for file in lfs.dir(self.path) do + if file ~= "." and file ~= ".." and mappings[file] ~= nil then + self:rebuild_file(file, path_concat(path, file)) + unbuilt[file] = nil + end + end + for file, _ in pairs(unbuilt) do + self:rebuild_file(file, path_concat(path, file), true) + end +end + +function config.Profile:rebuild_file(file, path, phony) + local fstore = {} + local fmap = mappings[file] + self.store[file] = fstore + + for k, _ in pairs(fmap) do + if type(k) == "string" and k ~= "name" then + unbuilt[k] = true + end + end + + function parse_line(line, idx, key, default) + local map = fmap[key] + if map == nil then return end + local tt = type(map.field_type) == "table" and map.field_type or { map.field_type } + local _,e = string.find(line, MATCH_DATA_PREFIX) + local at = string.sub(line, 1, e) + if default == nil or fstore[key] == nil then + fstore[key] = {} + end + if default == nil then fstore[key].line = idx end + for t, v in ipairs(tt) do + local r, i, match = string.find(at, "%s*" .. MATCH_TYPES[v].pattern) + if r ~= nil then + -- Handle read-ahead pattern transforms + if MATCH_TYPES[v].transform ~= nil then + _, i, match = string.find(at, "%s*" .. MATCH_TYPES[v].transform(match)) + end + if default == nil or fstore[key][t] == nil then + fstore[key][t] = MATCH_TYPES[v].cast and MATCH_TYPES[v].cast(match) or match + end + at = string.sub(at, 1, i) + else break end + end + end + + local idx = 1 + if phony ~= true then + for line in io.lines(path) do + local mtype, arg = string.match(line, MATCH_ENTRY_PATTERN) + if mtype ~= nil then + parse_line(line, idx, string.format("%s:%s", mtype, arg)) + end + idx = idx + 1 + end + end + + idx = 1 + for line in io.lines(path_concat(glava.system_shader_path, file)) do + local mtype, arg = string.match(line, MATCH_ENTRY_PATTERN) + if mtype ~= nil then + parse_line(line, idx, string.format("%s:%s", mtype, arg), true) + end + idx = idx + 1 + end +end + +-- Sync all +function config.Profile:sync() + for k, v in pairs(self.store) do self:sync_file(k) end +end + +-- Sync filename relative to profile root +function config.Profile:sync_file(fname) + local fstore = self.store[fname] + local fmap = mappings[file] + local fpath = path_concat(self.path, fname) + local buf = {} + local extra = {} + local idx = 1 + for k, v in fstore do + local parts = { string.format("#%s", string.gsub(k, ":", " ")) } + local field = fmap[k].field_type + for i, e in ipairs(type(field) == "table" and field or { field }) do + parts[#parts + 1] = MATCH_TYPES[e].serialize and MATCH_TYPES[e].serialize(v[i]) or v[i] + end + local serialized = table.concat(parts, " ") + if v.line then buf[line] = serialized + else extra[#extra + 1] = serialized end + end + if lfs.attributes(fpath, "mode") == "file" then + for line in io.lines(path) do + if not buf[idx] then + buf[idx] = line + end + idx = idx + 1 + end + for _, v in ipairs(extra) do + buf[#buf + 1] = v + end + end + local handle, err = io.open(fpath, "w+") + if handle then + handle:write(table.concat(buf, "\n")) + handle:close() + else + glava.fail(string.format("Could not open file handle to \"%s\": %s", handle, err)) + end +end + +return config diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/entry.c b/share/dotfiles/.config/glava/glava_repo/glava-config/entry.c new file mode 100644 index 00000000..577ed576 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/entry.c @@ -0,0 +1,109 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <stdbool.h> + +#include <lua.h> +#include <lualib.h> +#include <lauxlib.h> + +#define GLAVA_LUA_ENTRY "glava-config.main" +#define GLAVA_LUA_ENTRY_FUNC "entry" + +#ifndef LUA_OK +#define LUA_OK 0 +#endif + +/* Should be already defined by Meson */ +#ifndef GLAVA_RESOURCE_PATH +#define GLAVA_RESOURCE_PATH "../resources" +#endif +#ifndef SHADER_INSTALL_PATH +#ifndef GLAVA_STANDALONE +#define SHADER_INSTALL_PATH "/etc/xdg/glava" +#else +#define SHADER_INSTALL_PATH "../shaders/glava" +#endif +#endif + +static int traceback(lua_State *L) { + if (!lua_isstring(L, 1)) + return 1; + lua_getglobal(L, "debug"); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + return 1; + } + lua_getfield(L, -1, "traceback"); + if (!lua_isfunction(L, -1)) { + lua_pop(L, 2); + return 1; + } + lua_pushvalue(L, 1); + lua_pushinteger(L, 2); + lua_call(L, 2, 1); + return 1; +} + +int main(int argc, char** argv) { + + puts("WARNING: `glava-config` is in an incomplete state. Do not use this tool outside of development purposes."); + fflush(stdout); + + lua_State* L = luaL_newstate(); + luaL_openlibs(L); + + lua_pushcfunction(L, traceback); + + #ifdef GLAVA_STANDALONE + /* Local path environment for standalone execution */ + lua_getglobal(L, "package"); + lua_pushstring(L, "path"); + lua_gettable(L, -2); + lua_pushstring(L, "./glava-env/?.lua;./glava-env/?/init.lua;"); + lua_insert(L, -2); + lua_concat(L, 2); + lua_pushstring(L, "path"); + lua_insert(L, -2); + lua_settable(L, -3); + lua_pop(L, 1); + #endif + + /* GLava compilation settings */ + lua_newtable(L); + lua_pushstring(L, "resource_path"); + lua_pushstring(L, GLAVA_RESOURCE_PATH); + lua_rawset(L, -3); + lua_pushstring(L, "system_shader_path"); + lua_pushstring(L, SHADER_INSTALL_PATH); + lua_rawset(L, -3); + lua_setglobal(L, "glava"); + + lua_getglobal(L, "require"); + lua_pushstring(L, GLAVA_LUA_ENTRY); + lua_call(L, 1, 1); + lua_pushstring(L, GLAVA_LUA_ENTRY_FUNC); + lua_gettable(L, -2); + if (!lua_isfunction(L, -1)) { + fprintf(stderr, "FATAL: no `" GLAVA_LUA_ENTRY_FUNC "` function in entry module\n"); + exit(EXIT_FAILURE); + } + for (int t = 0; t < argc; ++t) + lua_pushstring(L, argv[t]); + int result = EXIT_FAILURE; + switch (lua_pcall(L, argc, 1, 1)) { + case LUA_OK: + if (lua_isnumber(L, -1)) + result = lua_tonumber(L, -1); + break; + case LUA_ERRRUN: + fprintf(stderr, "FATAL: error in `" GLAVA_LUA_ENTRY + "." GLAVA_LUA_ENTRY_FUNC "`: %s\n", lua_tostring(L, -1)); + break; + default: + fprintf(stderr, "FATAL: unhandled error from lua_pcall\n"); + break; + } + lua_close(L); + return result; +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/main.lua b/share/dotfiles/.config/glava/glava_repo/glava-config/main.lua new file mode 100644 index 00000000..09525d35 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/main.lua @@ -0,0 +1,79 @@ +local function dependency(name) + if package.loaded[name] then + return + else + for _, searcher in ipairs(package.searchers or package.loaders) do + local loader = searcher(name) + if type(loader) == 'function' then + package.preload[name] = loader + return + end + end + print("Dependency \"" .. name .. "\" is not installed.") + print("Please install it through your package manager or Lua distribution.") + os.exit(1) + end +end + +function glava.fail(message) + print(string.format("!!FATAL!!: %s", message)) + os.exit(1) +end + +local main = {} + +-- Format string, but silently return nil if varargs contains any nil entries +local function format_silent(fmt, ...) + for _, v in ipairs({...}) do + if v == nil then return nil end + end + return string.format(fmt, ...) +end + +function main.entry(prog, ...) + dependency("lgi") + dependency("lfs") + + if glava.resource_path:sub(glava.resource_path:len()) ~= "/" then + glava.resource_path = glava.resource_path .. "/" + end + glava.config_path = format_silent("%s/glava", os.getenv("XDG_CONFIG_HOME")) + or format_silent("%s/.config/glava", os.getenv("HOME")) + or "/home/.config/glava" + + local lfs = require "lfs" + local window = require "glava-config.window" + + glava.module_list = {} + for m in lfs.dir(glava.system_shader_path) do + if m ~= "." and m ~= ".." + and lfs.attributes(glava.system_shader_path .. "/" .. m, "mode") == "directory" + and m ~= "util" then + glava.module_list[#glava.module_list + 1] = m + end + end + + local mappings = require "glava-config.mappings" + -- Associate `map_name = tbl` from mapping list for future lookups, etc. + for k, v in pairs(mappings) do + local i = 1 + local adv = false + while v[i] ~= nil do + if type(v[i]) == "table" then + v[v[i][1]] = v[i] + v[i].advanced = adv + i = i + 1 + elseif type(v[i]) == "string" and v[i] == "advanced" then + adv = true + table.remove(v, i) + else + glava.fail(string.format("Unknown mappings entry type for file: \"%s\"", type(v))) + end + end + end + + -- Enter into Gtk window + window() +end + +return main diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/mappings.lua b/share/dotfiles/.config/glava/glava_repo/glava-config/mappings.lua new file mode 100644 index 00000000..6b28170d --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/mappings.lua @@ -0,0 +1,38 @@ +return { + ["rc.glsl"] = { + name = "Global Options", + { "request:mod", + field_type = "string", + field_attrs = { entries = glava.module_list }, + description = "Visualizer module" + }, + { "request:fakeident", + field_type = "ident", + description = "Some identifier" + }, + { "request:fakefloat", + field_type = "float", + description = "Some Float" + }, + { "request:fakecolorexpr", + field_type = "color-expr", + field_attrs = { alpha = true }, + description = "Color Expression" + }, + { "request:setbg", + field_type = "color", + field_attrs = { alpha = true }, + description = "Window background color" + }, + "advanced", + { "request:setversion", + field_type = { "int", "int" }, + field_attrs = { + frame_label = "Version", + { lower = 0, upper = 10, width = 2 }, + { lower = 0, upper = 10, width = 2 } + }, + description = "OpenGL context version request" + } + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/utils.lua b/share/dotfiles/.config/glava/glava_repo/glava-config/utils.lua new file mode 100644 index 00000000..8b24d3c1 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/utils.lua @@ -0,0 +1,68 @@ +local lgi = require "lgi" +local Gdk = lgi.Gdk + +local utils = {} + +function utils.infer_color_bits(x) + if x:sub(1, 1) ~= "#" then + x = "#" .. x + end + for i = 1, 9 - x:len() do + x = x .. (x:len() >= 7 and "F" or "0") + end + return x +end + +function utils.sanitize_color(x) + return utils.infer_color_bits(x):sub(1, 9):gsub("[^#0-9a-fA-F]", "0") +end + +function utils.parse_color_rgba(x) + local x = utils.infer_color_bits(x) + return Gdk.RGBA.parse( + string.format( + "rgba(%d,%d,%d,%f)", + tonumber(x:sub(2, 3), 16), + tonumber(x:sub(4, 5), 16), + tonumber(x:sub(6, 7), 16), + tonumber(x:sub(8, 9), 16) / 255 + ) + ) +end + +function utils.rgba_to_gdk_color(x) + return Gdk.Color( + math.floor(x.red * 255 + 0.5), + math.floor(x.green * 255 + 0.5), + math.floor(x.blue * 255 + 0.5) + ) +end + +function utils.rgba_to_integral(x) + return { + red = math.floor(x.red * 255 + 0.5), + green = math.floor(x.green * 255 + 0.5), + blue = math.floor(x.blue * 255 + 0.5) + } +end + +function utils.format_color_rgba(x) + return string.format( + "#%02X%02X%02X%02X", + math.floor(x.red * 255 + 0.5), + math.floor(x.green * 255 + 0.5), + math.floor(x.blue * 255 + 0.5), + math.floor(x.alpha * 255 + 0.5) + ) +end + +function utils.format_color_rgb(x) + return string.format( + "#%02X%02X%02X", + math.floor(x.red * 255 + 0.5), + math.floor(x.green * 255 + 0.5), + math.floor(x.blue * 255 + 0.5) + ) +end + +return utils diff --git a/share/dotfiles/.config/glava/glava_repo/glava-config/window.lua b/share/dotfiles/.config/glava/glava_repo/glava-config/window.lua new file mode 100644 index 00000000..97252563 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-config/window.lua @@ -0,0 +1,984 @@ +--[[ + MAINTAINER NOTICE: + + This application aims to be both Gtk+ 3 and 4 compatible for future-proofing. This means + avoiding *every* deprecated widget in Gtk+ 3, and watching out for some old functionality: + + * Gdk.Color usage, use Gdk.RGBA instead + * Pango styles and style overrides + * Check convenience wrappers for deprecation, ie. GtkColorButton + * Avoid seldom used containers, as they may have been removed in 4.x (ie. GtkButtonBox) + + In some cases we use deprecated widgets or 3.x restricted functionality, but only when we + query that the types are available from LGI (and otherwise use 4.x compatible code). +]] + +return function() + local lgi = require 'lgi' + local utils = require 'glava-config.utils' + local mappings = require 'glava-config.mappings' + local GObject = lgi.GObject + local Gtk = lgi.Gtk + local Pango = lgi.Pango + local Gdk = lgi.Gdk + local GdkPixbuf = lgi.GdkPixbuf + local cairo = lgi.cairo + + -- Both `GtkColorChooserDialog` and `GtkColorSelectionDialog` are + -- supported by this tool, but the latter is deprecated and does + -- not exist in 4.x releases. + -- + -- The old chooser, however, is objectively better so let's try + -- to use it if it exists. + local use_old_chooser = true + if Gtk.get_major_version() >= 4 then + use_old_chooser = false + end + + local window + + local repeat_pattern = cairo.SurfacePattern( + cairo.ImageSurface.create_from_png(glava.resource_path .. "transparent.png") + ) + repeat_pattern:set_extend("REPEAT") + + -- We need to define a CSS class to use an alternative font for + -- color and identity entries; used to indicate to the user that + -- the field has formatting requirements + local cssp = Gtk.CssProvider {} + cssp:load_from_data(".fixed-width-font-entry { font-family: \"Monospace\"; }") + + local ItemColumn = { + PROFILE = 1, + ENABLED = 2, + ACTIVABLE = 3, + WEIGHT = 4, + VISIBLE = 5 + } + + -- Fill store with initial items. + local item_store = Gtk.ListStore.new { + [ItemColumn.PROFILE] = GObject.Type.STRING, + [ItemColumn.ENABLED] = GObject.Type.BOOLEAN, + [ItemColumn.ACTIVABLE] = GObject.Type.BOOLEAN, + [ItemColumn.VISIBLE] = GObject.Type.BOOLEAN, + [ItemColumn.WEIGHT] = GObject.Type.INT + } + + local default_entry = { + [ItemColumn.PROFILE] = "Default", + [ItemColumn.ENABLED] = false, + [ItemColumn.VISIBLE] = false, + [ItemColumn.ACTIVABLE] = false, + [ItemColumn.WEIGHT] = 600 + } + + -- Apply `t[k] = v` to all table argument at array indexes, + -- and return the unpacked list of tables. Used for nesting + -- widget construction. + local function apply(tbl) + local ret = {} + for k, v in ipairs(tbl) do + ret[k] = v + tbl[k] = nil + end + for k, v in pairs(tbl) do + for _, r in ipairs(ret) do + r[k] = v + end + end + return unpack(ret) + end + + -- Apply `binds[k] = v` while returning unpacked values + local binds = {} + local function bind(tbl) + local ret = {} + for k, v in pairs(tbl) do + binds[k] = v + ret[#ret + 1] = v + end + return unpack(ret) + end + + local function link(tbl) + for _, v in ipairs(tbl) do + v:get_style_context():add_class("linked") + end + return unpack(tbl) + end + + local function ComboBoxFixed(tbl) + local inst = Gtk.ComboBoxText { id = tbl.id } + for _, v in pairs(tbl) do + inst:append_text(v) + end + inst:set_active(tbl.default or 0) + return inst + end + + local SpoilerView = function(tbl) + local stack = Gtk.Stack { + expand = true, + transition_type = Gtk.StackTransitionType.CROSSFADE + } + local btn = Gtk.CheckButton { + active = tbl.active or false + } + if tbl.active ~= true then + stack:add_named(Gtk.Box {}, "none") + end + stack:add_named(tbl[1], "view") + if tbl.active == true then + stack:add_named(Gtk.Box {}, "none") + end + function btn:on_toggled(path) + stack:set_visible_child_name(btn.active and "view" or "none") + end + return Gtk.Box { + expand = false, + orientation = "VERTICAL", + spacing = 4, + Gtk.Box { + orientation = "HORIZONTAL", + spacing = 6, + btn, + Gtk.Label { label = tbl.label or "Spoiler" } + }, + Gtk.Separator(), + stack + } + end + + local ConfigView = function(tbl) + local grid = { + row_spacing = 2, + column_spacing = 12, + column_homogeneous = false, + row_homogeneous = false + } + local list = {} + local idx = 0 + local function cbuild(list, entry) + list[#list + 1] = { + Gtk.Label { label = entry[1], halign = "START", valign = "START" }, + left_attach = 0, top_attach = idx + } + list[#list + 1] = { + Gtk.Box { hexpand = true }, + left_attach = 1, top_attach = idx + } + list[#list + 1] = { + apply { halign = "END", entry[3] or Gtk.Box {} }, + left_attach = 2, top_attach = idx + } + list[#list + 1] = { + apply { halign = "FILL", hexpand = false, entry[2] }, + left_attach = 3, top_attach = idx + } + list[#list + 1] = { + Gtk.Separator { + vexpand = false + }, left_attach = 0, top_attach = idx + 1, width = 3 + } + idx = idx + 2 + end + for _, entry in ipairs(tbl) do + cbuild(list, entry) + end + local adv = {} + if tbl.advanced then + idx = 0 + for _, entry in ipairs(tbl.advanced) do + cbuild(adv, entry) + end + end + for k, v in pairs(grid) do + list[k] = v + adv[k] = v + end + return Gtk.ScrolledWindow { + expand = true, + Gtk.Box { + margin_top = 12, + margin_start = 16, + margin_end = 16, + hexpand = true, + vexpand = true, + halign = "FILL", + orientation = "VERTICAL", + spacing = 6, + Gtk.Grid(list), + #adv > 0 and SpoilerView + { label = "Show Advanced", + Gtk.Grid(adv) + } or Gtk.Box {} + } } + end + local function wrap_label(widget, label) + if label then + widget = Gtk.Box { + orientation = "HORIZONTAL", + spacing = 6, + Gtk.Label { + label = label + }, widget + } + end + return widget + end + + -- Generators for producing widgets (and their layouts) that bind to configuration values + -- note: `get_data` returns stringified data + local widget_generators + widget_generators = { + -- A switch to represent a true/false value + ["boolean"] = function(attrs) + local widget = Gtk.Switch { hexpand = false } + return { + widget = Gtk.Box { Gtk.Box { hexpand = true }, wrap_label(widget, attrs.label) }, + set_data = function(x) + widget.active = x + return true + end, + get_data = function() return widget.active end, + connect = function(f) widget.on_state_set = f end + } + end, + -- Entry for a generic string, may have predefined selections + ["string"] = function(attrs) + local widget = apply { + attrs.entries ~= nil + and apply { ComboBoxFixed(attrs.entries) } + or Gtk.Entry { width_chars = 12 }, + hexpand = true + } + return { + widget = wrap_label(widget, attrs.label), + internal = widget, + set_data = function(x) + if not attrs.entries then + widget:set_text(x) + else + for k, v in ipairs(attrs.entries) do + if v == x then + widget:set_active(v - 1) + return true + end + end + return false + end + return true + end, + get_data = function() + local text = (not attrs.entries) and widget:get_text() or widget:get_active_text() + if attrs.translate then + text = attrs.translate[text] + end + return text + end, + connect = function(f) + -- Note: the underlying widget can be `GtkComboBoxText` or `GtkEntry`; + -- they simply just use the same signal for user input + widget.on_changed = f + end + } + end, + -- Entry for a valid C/GLSL identity, may have predefined selections + ["ident"] = function(attrs) + local s = widget_generators.string(attrs) + -- Set fixed-width font if the users enter/select identifiers by their name, + -- rather than a description to indicate it's a GLSL identity + if not attrs.translate then + s.internal:get_style_context():add_provider(cssp, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + s.internal:get_style_context():add_class("fixed-width-font-entry") + end + if not attrs.entries and not attrs._ignore_restrict then + -- Handle idenifier formatting for entries without a preset list + local handlers = {} + local function run_handlers() + for _, f in ipairs(handlers) do f() end + end + function s.internal:on_changed() + local i = s.internal.text + if i:match("[^%w]") ~= nil or i:sub(1, 1):match("[^%a]") ~= nil then + s.internal.text = i:gsub("[^%w]", ""):gsub("^[^%a]+", "") + else + run_handlers() + end + end + s.connect = function(f) + handlers[#handlers + 1] = f + end + end + return s + end, + -- A full GLSL expression + ["expr"] = function(attrs) + -- Expressions can be implemented by using the identity field and disabling + -- input format restrictions. + attrs._ignore_restrict = true + return widget_generators.ident(attrs) + end, + -- Adjustable and bound floating-point value + ["float"] = function(attrs) + local widget = Gtk.SpinButton { + hexpand = true, + adjustment = Gtk.Adjustment { + lower = attrs.lower or 0, + upper = attrs.upper or 100, + page_size = 1, + step_increment = attrs.increment or 1, + page_increment = attrs.increment or 1 + }, + width_chars = attrs.width or 6, + numeric = true, + digits = attrs.digits or 2, + climb_rate = attrs.increment or 1 + } + return { + widget = wrap_label(widget, attrs.label), + set_data = function(x) + widget:set_text(x) + return true + end, + get_data = function() return widget:get_text() end, + connect = function(f) widget.on_value_changed = f end + } + end, + -- Adjustable and bound integral value + ["int"] = function(attrs) + local widget = Gtk.SpinButton { + hexpand = true, + adjustment = Gtk.Adjustment { + lower = attrs.lower or 0, + upper = attrs.upper or 100, + page_size = 1, + step_increment = attrs.increment or 1, + page_increment = attrs.increment or 1 + }, + width_chars = attrs.width or 6, + numeric = true, + digits = 0, + climb_rate = attrs.increment or 1 + } + return { + widget = wrap_label(apply { vexpand = false, widget }, attrs.label), + set_data = function(x) + widget:set_text(x) + return true + end, + get_data = function() return widget:get_text() end, + connect = function(f) widget.on_value_changed = f end + } + end, + -- The color type is the hardest to implement; as Gtk deprecated + -- the old color chooser button, so we have to implement our own. + -- The benefits of doing this mean we get to use the "nice" Gtk3 + -- chooser, and the button rendering itself is much better. + ["color"] = function(attrs) + local dialog_open = false + local handlers = {} + local function run_handlers() + for _, f in ipairs(handlers) do f() end + end + local c = Gdk.RGBA { + red = 1.0, green = 1.0, blue = 1.0, alpha = 1.0 + } + local area = Gtk.DrawingArea() + area:set_size_request(16, 16) + local draw = function(widget, cr) + local context = widget:get_style_context() + local width = widget:get_allocated_width() + local height = widget:get_allocated_height() + local aargc = { width / 2, height / 2, math.min(width, height) / 2, 0, 2 * math.pi } + Gtk.render_background(context, cr, 0, 0, width, height) + cr:set_source(repeat_pattern) + cr:arc(unpack(aargc)) + cr:fill() + cr:set_source_rgba(c.red, c.green, c.blue, c.alpha) + cr:arc(unpack(aargc)) + cr:fill() + end + if Gtk.get_major_version() >= 4 then + area:set_draw_func(draw) + else + area.on_draw = draw + end + local btn = Gtk.Button { + apply { + margin_top = 1, + margin_bottom = 1, + area + } } + local entry = Gtk.Entry { + hexpand = true, + width_chars = 9, + max_length = 9, + text = attrs.alpha and "#FFFFFFFF" or "#FFFFFF" + } + entry:get_style_context():add_provider(cssp, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + entry:get_style_context():add_class("fixed-width-font-entry") + local widget = Gtk.Box { + orientation = "HORIZONTAL", + spacing = 0, + entry, btn + } + link { widget } + widget = wrap_label(widget, attrs.label) + function btn:on_clicked() + local c_change_staged = false + local dialog = (use_old_chooser and Gtk.ColorSelectionDialog or Gtk.ColorChooserDialog) + { title = "Select Color", + transient_for = window, + modal = true, + destroy_with_parent = true + } + if use_old_chooser then + dialog.cancel_button:set_visible(false) + dialog.ok_button.label = "Close" + dialog.color_selection.current_rgba = c + if attrs.alpha then + dialog.color_selection.has_opacity_control = true + end + function dialog.color_selection:on_color_changed() + c_change_staged = true + c = dialog.color_selection.current_rgba + entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c)) + area:queue_draw() + end + else + dialog.rgba = c + if attrs.alpha then + dialog.use_alpha = true + end + end + + dialog_open = true + local ret = dialog:run() + dialog_open = false + dialog:set_visible(false) + + if not use_old_chooser and ret == Gtk.ResponseType.OK then + c = dialog.rgba + entry:set_text(attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c)) + area:queue_draw() + run_handlers() + elseif use_old_chooser and c_change_staged then + run_handlers() + end + end + function entry:on_changed() + local s = utils.sanitize_color(entry.text) + c = utils.parse_color_rgba(s) + area:queue_draw() + if not dialog_open then run_handlers() end + end + return { + widget = widget, + set_data = function(x) + local s = utils.sanitize_color(x) + c = utils.parse_color_rgba(s) + area:queue_draw() + entry:set_text(s) + return true + end, + get_data = function(x) + return attrs.alpha and utils.format_color_rgba(c) or utils.format_color_rgb(c) + end, + connect = function(f) + handlers[#handlers + 1] = f + end + } + end, + -- A field capable of producing a GLSL color expression. + ["color-expr"] = function(attrs, header) + -- Define color control variables for use in color expressions + local controls = { + { "Baseline", "d" }, + { "X axis", "gl_FragCoord.x" }, + { "Y axis", "gl_FragCoord.y" } + } + local control_list = {} + for i, v in ipairs(controls) do + control_list[i] = v[1] + controls[v[1]] = v[2] + end + + -- Define color expression types. Field data is assigned according + -- to the associated pattern, and entries are ordered in terms of + -- match priority + local cetypes = { + { "Gradient", + fields = { + { "color" }, + { "color" }, + { "ident", + entries = control_list, + translate = controls, + header = "Axis:" + }, + { "float", + upper = 1000, + lower = -1000, + header = "Scale:" + } }, + -- match against GLSL mix expression, ie. + -- `mix(#3366b2, #a0a0b2, clamp(d / GRADIENT, 0, 1))` + match = "mix%s*%(" .. + "%s*(#[%dA-Fa-f]*)%s*," .. + "%s*(#[%dA-Fa-f]*)%s*," .. + "%s*clamp%s*%(%s*(%w+)%s*/%s*(%w+)%s*,%s*0%s*,%s*1%s*%)%s*%)", + output = "mix(%s, %s, clamp(%s / %s, 0, 1))" + }, + { "Solid", + fields = { { "color" } }, + match = "#[%dA-Fa-f]*", + output = "%s", + default = true + } } + + local stack = Gtk.Stack { vhomogeneous = false } + local hstack = Gtk.Stack { vhomogeneous = false } + + local cekeys = {} + local default = nil + for i, v in ipairs(cetypes) do + if not v.default then + cekeys[#cekeys + 1] = v[1] + else + table.insert(cekeys, 1, v[1]) + end + cetypes[v[1]] = v + local wfields = {} + local hfields = { + Gtk.Label { + halign = "END", + valign = "START", + label = header + } } + local gen = {} + for k, e in ipairs(v.fields) do + v.alpha = attrs.alpha + local g = widget_generators[e[1]](e) + gen[#gen + 1] = g + wfields[k] = g.widget + hfields[#hfields + 1] = Gtk.Label { + halign = "END", + label = e.header + } + end + v.gen = gen + v.widget = Gtk.Box( + apply { + homogeneous = true, + orientation = "VERTICAL", + spacing = 1, + wfields + } ) + v.hwidget = Gtk.Box( + apply { + homogeneous = true, + orientation = "VERTICAL", + spacing = 1, + hfields + } ) + hstack:add_named(v.hwidget, v[1]) + stack:add_named(v.widget, v[1]) + if v.default then + default = v[1] + end + v.set_data = function(x) + for i, m in ipairs { string.match(x, v.match) } do + gen[i].set_data(m) + end + end + v.get_data = function() + local fields = {} + for i = 1, #v.fields do + fields[i] = gen[i]:get_data() + end + return string.format(v.output, unpack(fields)) + end + v.connect = function(f) + for _, g in ipairs(gen) do + g.connect(f) + end + end + end + local cbox = apply { + hexpand = true, + ComboBoxFixed(cekeys) + } + stack:set_visible_child(cetypes[default].widget) + hstack:set_visible_child(cetypes[default].hwidget) + cetypes[default].widget:show() + cetypes[default].hwidget:show() + function cbox:on_changed() + local t = cbox:get_active_text() + stack:set_visible_child_name(t) + hstack:set_visible_child_name(t) + end + local widget = Gtk.Box { + orientation = "VERTICAL", + spacing = 1, + wrap_label(cbox, attrs.label), stack + } + return { + widget = widget, + header_widget = hstack, + set_data = function(x) + for i, v in ipairs(cetypes) do + if string.match(x, v.match) ~= nil then + v.set_data(x) + return true + end + end + return false + end, + get_data = function() + return cetypes[cbox:get_active_text()].get_data() + end, + connect = function(f) + for i, v in ipairs(cetypes) do + v.connect(f) + end + end + } + end + } + + -- Extra widget for special service/autostart functionality + local ServiceView = function(self) + local switch = Gtk.Switch { + sensitive = false, + hexpand = false + } + local method = ComboBoxFixed { + "None", + "SystemD User Service", + "InitD Entry", + "Desktop Entry" + } + method.on_changed = function(box) + local opt = box:get_active_text() + switch.sensitive = opt ~= "None" + if switch.active == true and opt == "None" then + switch:activate() + end + for _, entry in item_store:pairs() do + if entry[ItemColumn.PROFILE] == self.name then + entry[ItemColumn.ACTIVABLE] = opt ~= "None" + if opt == "None" then + entry[ItemColumn.ENABLED] = false + end + end + end + end + switch.on_notify["active"] = function(inst, pspec) + for _, entry in item_store:pairs() do + if entry[ItemColumn.PROFILE] == self.name then + entry[ItemColumn.ENABLED] = switch.active + end + end + -- TODO handle enable here + end + return ConfigView { + { "Enabled", Gtk.Box { Gtk.Box { hexpand = true }, switch } }, + { "Autostart Method", method } + }, switch + end + + -- Produce a widget containing a scroll area full of widgets bound to + -- requests/defines in the specified profile. + local function ProfileView(name) + local self = { name = name } + local args = {} + for k, v in pairs(mappings) do + local layout = {} + for _, e in ipairs(v) do + if type(e) == "table" then + local header = nil + local fields = {} + local ftypes = type(e.field_type) == "table" and e.field_type or { e.field_type } + local fattrs = type(e.field_type) == "table" and e.field_attrs or { e.field_attrs } + if not fattrs then fattrs = {} end + for i, f in ipairs(ftypes) do + local entry = widget_generators[f](fattrs[i] or {}, e.header) + if not header then + header = entry.header_widget + end + fields[#fields + 1] = entry.widget + -- todo: finish linking config + entry.connect(function() + print(string.format("assign %s->%s->%s[%d] = %s", k, e[1], f, i, tostring(entry.get_data()))) + end) + end + -- disable header display widget if there are multiple fields + if #fields > 1 then header = nil end + fields.orientation = "VERTICAL" + fields.spacing = 2 + local fwidget = { + e.description, + #fields > 1 and + Gtk.Frame { + label = fattrs.frame_label, + apply { + margin_start = 4, + margin_end = 4, + margin_top = 4, + margin_bottom = 4, + Gtk.Box(fields) + } } or fields[1], + header or (e.header and Gtk.Label { valign = "START", label = e.header } or Gtk.Box {}) + } + if not e.advanced then + layout[#layout + 1] = fwidget + else + if not layout.advanced then layout.advanced = {} end + layout.advanced[#layout.advanced + 1] = fwidget + end + end + end + args[#args + 1] = { tab_label = v.name, ConfigView(layout) } + end + local service, chk = ServiceView(self) + args[#args + 1] = { + tab_label = "Autostart", + name ~= "Default" and service or + Gtk.Box { + valign = "CENTER", + orientation = "VERTICAL", + spacing = 8, + Gtk.Label { + label = "Autostart options are not available for the default user profile." + }, + Gtk.Button { + hexpand = false, + halign = "CENTER", + label = "Show Profiles" + } } } + args.expand = true + notebook = Gtk.Notebook(args) + notebook:show_all() + self.widget = notebook + self.autostart_enabled = chk + function self:rename(new) + self.name = new + end + function self:delete() + + end + return self; + end + + local view_registry = {} + view_registry[default_entry[ItemColumn.PROFILE]] = ProfileView(default_entry[ItemColumn.PROFILE]) + item_store:append(default_entry) + + window = Gtk.Window { + title = "GLava Config", + default_width = 320, + default_height = 200, + border_width = 5, + Gtk.Box { + orientation = "HORIZONTAL", + spacing = 6, + homogeneous = false, + Gtk.Box { + hexpand = false, + orientation = "VERTICAL", + spacing = 5, + Gtk.ScrolledWindow { + shadow_type = "ETCHED_IN", + vexpand = true, + width_request = 200, + bind { + view = Gtk.TreeView { + model = item_store, + activate_on_single_click = true, + Gtk.TreeViewColumn { + title = "Profile", + expand = true, + { bind { profile_renderer = Gtk.CellRendererText {} }, + { text = ItemColumn.PROFILE, + editable = ItemColumn.VISIBLE, + weight = ItemColumn.WEIGHT + } } }, + Gtk.TreeViewColumn { + title = "Enabled", + alignment = 0.5, + -- Note `xalign` usage here comes from GtkCellRenderer, which unlike the + -- legacy alignment widget is not deprecated + { bind { toggle_renderer = Gtk.CellRendererToggle { xalign = 0.5 } }, + { active = ItemColumn.ENABLED, + activatable = ItemColumn.ACTIVABLE, + visible = ItemColumn.VISIBLE + } } } } } }, + link { + Gtk.Box { + hexpand = true, + bind { + reload = Gtk.Button { + Gtk.Image { + icon_name = "view-refresh-symbolic" + } }, + }, + bind { + add = Gtk.Button { + halign = "FILL", + hexpand = true, + label = "Create Profile", + } }, + bind { + remove = Gtk.Button { + halign = "END", + sensitive = false, + Gtk.Image { + icon_name = "user-trash-symbolic" + } } } } } }, + Gtk.Box { + orientation = "VERTICAL", + spacing = 6, + link { + Gtk.Box { + Gtk.ToggleButton { + Gtk.Image { + icon_name = "view-paged-symbolic" + }, + on_clicked = function() + -- + end + }, + bind { + display_path = Gtk.Entry { + -- todo: bind to config + text = "~/.config/glava/rc.glsl", + editable = false, + hexpand = true + } } } }, + bind { + stack_view = Gtk.Stack { + expand = true, + transition_type = Gtk.StackTransitionType.CROSSFADE + } } } } } + + local selection = binds.view:get_selection() + selection.mode = 'SINGLE' + binds.stack_view:add_named(view_registry[default_entry[ItemColumn.PROFILE]].widget, + default_entry[ItemColumn.PROFILE]) + + function unique_profile(profile_name_proto) + local profile_idx = 0 + local profile_name = profile_name_proto + while true do + local used = false + for i, entry in item_store:pairs() do + if entry[ItemColumn.PROFILE] == profile_name then + used = true + end + end + if not used then break else + profile_idx = profile_idx + 1 + profile_name = profile_name_proto .. " (" .. tostring(profile_idx) .. ")" + end + end + return profile_name + end + + function binds.view:on_row_activated(path, column) + local name = item_store[path][ItemColumn.PROFILE] + binds.stack_view:set_visible_child_name(name) + binds.remove.sensitive = (name ~= "Default") + end + + function binds.profile_renderer:on_edited(path_string, new_profile) + local path = Gtk.TreePath.new_from_string(path_string) + local old = item_store[path][ItemColumn.PROFILE] + local store = binds.stack_view:get_child_by_name(old) + new_profile = string.match(new_profile, "^%s*(.-)%s*$") + if old == new_profile or new_profile == "Default" then return end + new_profile = unique_profile(new_profile) + print("Renamining profile \"" .. old .. "\" -> \"" .. new_profile .. "\"") + binds.stack_view:remove(store) + binds.stack_view:add_named(store, new_profile) + local vstore = view_registry[old] + view_registry[old] = nil + view_registry[new_profile] = vstore + vstore:rename(new_profile) + item_store[path][ItemColumn.PROFILE] = new_profile + end + + function binds.toggle_renderer:on_toggled(path_string) + local path = Gtk.TreePath.new_from_string(path_string) + if view_registry[item_store[path][ItemColumn.PROFILE]].autostart_enabled.active + ~= not item_store[path][ItemColumn.ENABLED] then + view_registry[item_store[path][ItemColumn.PROFILE]].autostart_enabled:activate() + end + item_store[path][ItemColumn.ENABLED] = + view_registry[item_store[path][ItemColumn.PROFILE]].autostart_enabled.active + end + + function binds.add:on_clicked() + local profile_name = unique_profile("New Profile") + local entry = { + [ItemColumn.PROFILE] = profile_name, + [ItemColumn.ENABLED] = false, + [ItemColumn.ACTIVABLE] = false, + [ItemColumn.VISIBLE] = true, + [ItemColumn.WEIGHT] = 400 + } + local view = ProfileView(profile_name) + item_store:append(entry) + view_registry[profile_name] = view + binds.stack_view:add_named(view.widget, profile_name); + end + + function binds.remove:on_clicked() + local dialog = Gtk.Dialog { + title = "Confirmation", + transient_for = window, + modal = true, + destroy_with_parent = true + } + local byes = dialog:add_button("Yes", Gtk.ResponseType.YES) + local bcancel = dialog:add_button("Cancel", Gtk.ResponseType.CANCEL) + dialog:get_action_area().halign = Gtk.Align.CENTER + local box = Gtk.Box { + orientation = 'HORIZONTAL', + spacing = 8, + border_width = 8, + Gtk.Image { + icon_name = "dialog-warning-symbolic", + icon_size = Gtk.IconSize.DIALOG, + }, + Gtk.Label { + label = "Are you sure you want to delete the selected profile?" + } } + dialog:get_content_area():add(box) + box:show_all() + local ret = dialog:run() + dialog:set_visible(false) + if ret ~= Gtk.ResponseType.YES then return end + + local model, iter = selection:get_selected() + if model and iter then + for iter, entry in item_store:pairs() do + if selection:iter_is_selected(iter) then + binds.stack_view:remove( + binds.stack_view:get_child_by_name( + entry[ItemColumn.PROFILE])) + view_registry[entry[ItemColumn.PROFILE]]:delete() + view_registry[entry[ItemColumn.PROFILE]] = nil + end + end + model:remove(iter) + end + end + + function window:on_destroy() os.exit(0) end + + window:show_all() + window:set_icon_from_file(glava.resource_path .. "glava.bmp") + Gtk.main() +end diff --git a/share/dotfiles/.config/glava/glava_repo/glava-obs/entry.c b/share/dotfiles/.config/glava/glava_repo/glava-obs/entry.c new file mode 100644 index 00000000..cdc9dd24 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava-obs/entry.c @@ -0,0 +1,263 @@ +#include <stdlib.h> +#include <obs/obs-module.h> +#include <obs/obs.h> +#include <obs/util/threading.h> +#include <obs/util/platform.h> + +#include "../glava/glava.h" +#include <X11/Xlib.h> + +#pragma GCC visibility push(default) +OBS_DECLARE_MODULE(); +#pragma GCC visibility pop + +static glava_handle handle; + +/* To access OBS's GL context and internal texture handles we need to define internal + OBS structures such that we can access these members. This is not API-stable, but + these structure layouts rarely change. */ + +/* OBS INTERNAL DEFS */ + +typedef struct __GLXcontextRec* GLXContext; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +typedef XID GLXPbuffer; + +struct gl_platform_internal { + Display *display; + GLXContext context; + GLXPbuffer pbuffer; +}; + +struct gs_device_internal { + struct gl_platform_internal* plat; + /* trailing members present */ +}; + + +struct gs_subsystem_internal { + void* module; + struct gs_device_internal* device; + /* trailing members present */ +}; + +struct gs_texture { + struct gs_device_internal* device; + int type; + int format; + int gl_format; + int gl_target; + int gl_internal_format; + int gl_type; + unsigned int texture; + uint32_t levels; + bool is_dynamic; + bool is_render_target; + bool is_dummy; + bool gen_mipmaps; + void* cur_sampler; + void* fbo; +}; + +struct gs_texture_2d_internal { + struct gs_texture base; + uint32_t width; + uint32_t height; + /* trailing members present */ +}; + +/* END OBS INTERNAL DEFS */ + +struct mod_state { + obs_source_t* source; + pthread_t thread; + bool initialized; + gs_texture_t* gs_tex; + unsigned int old_tex; + struct { + char* opts; + int w, h; + } cfg; +}; + +static const char* get_name(void* _) { + UNUSED_PARAMETER(_); + return "GLava Direct Source"; +} + +static obs_properties_t* get_properties(void* _) { + UNUSED_PARAMETER(_); + + obs_properties_t* props = obs_properties_create(); + // (obs_properties_t *props, const char *name, const char *description, int min, int max, int step) + obs_properties_add_int (props, "width", "Output width", 0, 65535, 1); + obs_properties_add_int (props, "height", "Output height", 0, 65535, 1); + obs_properties_add_text(props, "options", "GLava options", OBS_TEXT_DEFAULT); + + return props; +} + +static uint32_t get_width(void* data) { + struct mod_state* s = (struct mod_state*) data; + return (uint32_t) s->cfg.w; +} + +static uint32_t get_height(void* data) { + struct mod_state* s = (struct mod_state*) data; + return (uint32_t) s->cfg.h; +} + +static void* work_thread(void* _) { + UNUSED_PARAMETER(_); + glava_entry(1, (char**) &"glava", &handle); + return NULL; +} + +static void glava_join(void* data) { + struct mod_state* s = (struct mod_state*) data; + + glava_terminate(&handle); + + if (s->initialized) { + if (pthread_join(s->thread, NULL)) { + blog(LOG_ERROR, "Failed to join GLava thread"); + return; + } + } + + s->initialized = false; + + if (s->gs_tex != NULL) { + obs_enter_graphics(); + /* restore old GL texture */ + ((struct gs_texture_2d_internal*) s->gs_tex)->base.texture = s->old_tex; + gs_texture_destroy(s->gs_tex); + obs_leave_graphics(); + s->gs_tex = NULL; + } +} + +static void glava_start(void* data) { + struct mod_state* s = (struct mod_state*) data; + + if (s->initialized) { + blog(LOG_ERROR, "Already initialized GLava thread"); + return; + } + + if (pthread_create(&s->thread, NULL, work_thread, s) != 0) { + blog(LOG_ERROR, "Failed to create GLava thread"); + return; + } + + s->initialized = true; + + /* Obtain GLava's texture handle */ + blog(LOG_INFO, "Waiting for GLava GL texture..."); + glava_wait(&handle); + unsigned int g_tex = glava_tex(handle); + glava_sizereq(handle, 0, 0, s->cfg.w, s->cfg.h); + obs_enter_graphics(); + /* Create a new high-level texture object */ + s->gs_tex = gs_texture_create(s->cfg.w, s->cfg.h, GS_RGBA, 1, NULL, GS_DYNAMIC); + /* Re-assign the internal GL texture for the object */ + s->old_tex = ((struct gs_texture_2d_internal*) s->gs_tex)->base.texture; + ((struct gs_texture_2d_internal*) s->gs_tex)->base.texture = g_tex; + obs_leave_graphics(); + blog(LOG_INFO, "GLava texture assigned"); +} + +static void destroy(void* data) { + struct mod_state* s = (struct mod_state*) data; + if (s) { + glava_join(s); + bfree(s); + } +} + +static void update(void* data, obs_data_t* settings) { + struct mod_state* s = (struct mod_state*) data; + + s->cfg.w = (int) obs_data_get_int(settings, "width"); + s->cfg.h = (int) obs_data_get_int(settings, "height"); + const char* opts = obs_data_get_string(settings, "options"); + printf("debug: input str '%s', set '%s'\n", opts, s->cfg.opts); + bool opts_changed = s->cfg.opts == NULL || strcmp(opts, s->cfg.opts); + if (s->cfg.opts != NULL) { + free(s->cfg.opts); + } + s->cfg.opts = strdup(opts); + + if (opts_changed) { + blog(LOG_INFO, "Updating GLava state"); + glava_join(s); + glava_start(s); + } else { + glava_sizereq(handle, 0, 0, s->cfg.w, s->cfg.h); + ((struct gs_texture_2d_internal*) s->gs_tex)->width = s->cfg.w; + ((struct gs_texture_2d_internal*) s->gs_tex)->height = s->cfg.h; + } +} + +static void video_render(void* data, gs_effect_t* effect) { + struct mod_state* s = (struct mod_state*) data; + if (s->gs_tex == NULL) + return; + + effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); + + gs_eparam_t* img = gs_effect_get_param_by_name(effect, "image"); + gs_effect_set_texture(img, s->gs_tex); + while (gs_effect_loop(effect, "Draw")) + obs_source_draw(s->gs_tex, 0, 0, 0, 0, true); +} + +static void* create(obs_data_t* settings, obs_source_t* source) { + + blog(LOG_INFO, "Initializing GLava OBS Plugin..."); + + struct mod_state* s = bzalloc(sizeof(struct mod_state)); + s->source = source; + s->cfg = (typeof(s->cfg)) { .w = 512, .h = 256, .opts = NULL }; + s->gs_tex = NULL; + s->initialized = false; + + struct obs_video_info ovi; + if (!obs_get_video_info(&ovi)) { + blog(LOG_ERROR, "Failed to obtain `obs_video_info`"); + return NULL; + } + + if (strncmp(ovi.graphics_module, "libobs-opengl", 13) != 0) { + blog(LOG_ERROR, "No GLX rendering context present"); + return NULL; + } + + obs_enter_graphics(); + struct gs_subsystem_internal* sub = (struct gs_subsystem_internal*) gs_get_context(); + glava_assign_external_ctx(sub->device->plat->context); + obs_leave_graphics(); + + update(s, settings); + return s; +} + +static struct obs_source_info glava_src = { + .id = "glava", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = get_name, + .create = create, + .destroy = destroy, + .update = update, + .video_render = video_render, + .get_width = get_width, + .get_height = get_height, + .get_properties = get_properties +}; + +__attribute__((visibility("default"))) bool obs_module_load(void) { + obs_register_source(&glava_src); + return true; +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava/fifo.c b/share/dotfiles/.config/glava/glava_repo/glava/fifo.c new file mode 100644 index 00000000..4aeff083 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/fifo.c @@ -0,0 +1,129 @@ +#include <stdlib.h> +#include <stdio.h> +#include <stdbool.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <math.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <poll.h> + +#include "fifo.h" + +/* Implementation struct storage */ + +typeof(*audio_impls) audio_impls[sizeof(audio_impls) / sizeof(struct audio_impl*)] = {}; +size_t audio_impls_idx = 0; + +/* FIFO backend */ + +static void init(struct audio_data* audio) { + if (!audio->source) { + audio->source = strdup("/tmp/mpd.fifo"); + } +} + +static void* entry(void* data) { + struct audio_data* audio = (struct audio_data *) data; + + float* bl = (float*) audio->audio_out_l; + float* br = (float*) audio->audio_out_r; + size_t fsz = audio->audio_buf_sz; + size_t ssz = audio->sample_sz; + + int fd; + int16_t buf[ssz / 2]; + size_t q; + int timeout = 50; + + struct timespec tv_last = {}, tv; + bool measured = false; + + if ((fd = open(audio->source, O_RDONLY)) == -1) { + fprintf(stderr, "failed to open FIFO audio source \"%s\": %s\n", audio->source, strerror(errno)); + exit(EXIT_FAILURE); + } + + struct pollfd pfd = { + .fd = fd, + .events = POLLIN + }; + + size_t buffer_offset = (fsz - (ssz / 4)); + + while (true) { + + /* The poll timeout is set to accommodate an approximate UPS, but has little purpose except + for effectively setting the rate of empty samples in the event of the FIFO descriptor + blocking for long periods of time. */ + + switch (poll(&pfd, 1, timeout)) { + case -1: + fprintf(stderr, "FIFO backend: poll() failed (%s)\n", strerror(errno)); + exit(EXIT_FAILURE); + case 0: + pthread_mutex_lock(&audio->mutex); + + memmove(bl, &bl[ssz / 4], buffer_offset * sizeof(float)); + memmove(br, &br[ssz / 4], buffer_offset * sizeof(float)); + + for (q = 0; q < (ssz / 4); ++q) bl[buffer_offset + q] = 0; + for (q = 0; q < (ssz / 4); ++q) br[buffer_offset + q] = 0; + + audio->modified = true; + + pthread_mutex_unlock(&audio->mutex); + break; + default: { + read(fd, buf, sizeof(buf)); + clock_gettime(CLOCK_REALTIME, measured ? &tv : &tv_last); + if (measured) { + /* Set the timeout slightly higher than the delay between samples to prevent empty writes */ + timeout = (((tv.tv_sec - tv_last.tv_sec) * 1000) + ((tv.tv_nsec - tv_last.tv_nsec) / 1000000)) + 1; + tv_last = tv; + } else measured = true; + + pthread_mutex_lock(&audio->mutex); + + memmove(bl, &bl[ssz / 4], buffer_offset * sizeof(float)); + memmove(br, &br[ssz / 4], buffer_offset * sizeof(float)); + + for (size_t n = 0, q = 0; q < (ssz / 2); q += 2) { + + size_t idx = (fsz - (ssz / 4)) + n; + + if (audio->channels == 1) { + float sample = ((buf[q] + buf[q + 1]) / 2) / (float) 65535; + bl[idx] = sample; + br[idx] = sample; + } + + if (audio->channels == 2) { + bl[idx] = buf[q] / (float) 65535; + br[idx] = buf[q + 1] / (float) 65535; + } + + n++; + } + + audio->modified = true; + + pthread_mutex_unlock(&audio->mutex); + break; + } + } + + if (audio->terminate == 1) { + close(fd); + break; + } + + } + + return 0; +} + +AUDIO_ATTACH(fifo); diff --git a/share/dotfiles/.config/glava/glava_repo/glava/fifo.h b/share/dotfiles/.config/glava/glava_repo/glava/fifo.h new file mode 100644 index 00000000..14e3cfa1 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/fifo.h @@ -0,0 +1,46 @@ + +#ifndef FIFO_H +#define FIFO_H + +#include <pthread.h> +#include <stdlib.h> +#include <stdbool.h> + +struct audio_data { + volatile float* audio_out_r; + volatile float* audio_out_l; + bool modified; + size_t audio_buf_sz, sample_sz; + int format; + unsigned int rate; + char *source; // pulse source + int channels; + int terminate; // shared variable used to terminate audio thread + pthread_mutex_t mutex; +}; + +struct audio_impl { + const char* name; + void (*init)(struct audio_data* data); + void* (*entry)(void* data); +}; + +#define AUDIO_FUNC(F) \ + .F = (typeof(((struct audio_impl*) NULL)->F)) &F + +extern struct audio_impl* audio_impls[4]; +extern size_t audio_impls_idx; + +static inline void register_audio_impl(struct audio_impl* impl) { audio_impls[audio_impls_idx++] = impl; } + +#define AUDIO_ATTACH(N) \ + static struct audio_impl N##_var = { \ + .name = #N, \ + AUDIO_FUNC(init), \ + AUDIO_FUNC(entry), \ + }; \ + void __attribute__((constructor)) _##N##_construct(void) { \ + register_audio_impl(&N##_var); \ + } + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glad.c b/share/dotfiles/.config/glava/glava_repo/glava/glad.c new file mode 100644 index 00000000..637dafe5 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glad.c @@ -0,0 +1,2550 @@ +/* + + OpenGL loader generated by glad 0.1.24a0 on Tue Sep 10 15:02:41 2019. + + Language/Generator: C/C++ + Specification: gl + APIs: gl=4.6 + Profile: compatibility + Extensions: + GL_EXT_framebuffer_multisample, + GL_EXT_texture_filter_anisotropic, + GL_NV_texture_barrier + Loader: True + Local files: True + Omit khrplatform: False + + Commandline: + --profile="compatibility" --api="gl=4.6" --generator="c" --spec="gl" --local-files --extensions="GL_EXT_framebuffer_multisample,GL_EXT_texture_filter_anisotropic,GL_NV_texture_barrier" + Online: + http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.6&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_NV_texture_barrier +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "glad.h" + +static void* get_proc(const char *namez); + +#if defined(_WIN32) || defined(__CYGWIN__) +#include <windows.h> +static HMODULE libGL; + +typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); +static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; + +#ifdef _MSC_VER +#ifdef __has_include + #if __has_include(<winapifamily.h>) + #define HAVE_WINAPIFAMILY 1 + #endif +#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ + #define HAVE_WINAPIFAMILY 1 +#endif +#endif + +#ifdef HAVE_WINAPIFAMILY + #include <winapifamily.h> + #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + #define IS_UWP 1 + #endif +#endif + +static +int open_gl(void) { +#ifndef IS_UWP + libGL = LoadLibraryW(L"opengl32.dll"); + if(libGL != NULL) { + gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress( + libGL, "wglGetProcAddress"); + return gladGetProcAddressPtr != NULL; + } +#endif + + return 0; +} + +static +void close_gl(void) { + if(libGL != NULL) { + FreeLibrary((HMODULE) libGL); + libGL = NULL; + } +} +#else +#include <dlfcn.h> +static void* libGL; + +#ifndef __APPLE__ +typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); +static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; +#endif + +static +int open_gl(void) { +#ifdef __APPLE__ + static const char *NAMES[] = { + "../Frameworks/OpenGL.framework/OpenGL", + "/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" + }; +#else + static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; +#endif + + unsigned int index = 0; + for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { + libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); + + if(libGL != NULL) { +#ifdef __APPLE__ + return 1; +#else + gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, + "glXGetProcAddressARB"); + return gladGetProcAddressPtr != NULL; +#endif + } + } + + return 0; +} + +static +void close_gl(void) { + if(libGL != NULL) { + dlclose(libGL); + libGL = NULL; + } +} +#endif + +static +void* get_proc(const char *namez) { + void* result = NULL; + if(libGL == NULL) return NULL; + +#ifndef __APPLE__ + if(gladGetProcAddressPtr != NULL) { + result = gladGetProcAddressPtr(namez); + } +#endif + if(result == NULL) { +#if defined(_WIN32) || defined(__CYGWIN__) + result = (void*)GetProcAddress((HMODULE) libGL, namez); +#else + result = dlsym(libGL, namez); +#endif + } + + return result; +} + +int gladLoadGL(void) { + int status = 0; + + if(open_gl()) { + status = gladLoadGLLoader(&get_proc); + close_gl(); + } + + return status; +} + +struct gladGLversionStruct GLVersion; + +#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) +#define _GLAD_IS_SOME_NEW_VERSION 1 +#endif + +static int max_loaded_major; +static int max_loaded_minor; + +static const char *exts = NULL; +static int num_exts_i = 0; +static char **exts_i = NULL; + +static int get_exts(void) { +#ifdef _GLAD_IS_SOME_NEW_VERSION + if(max_loaded_major < 3) { +#endif + exts = (const char *)glGetString(GL_EXTENSIONS); +#ifdef _GLAD_IS_SOME_NEW_VERSION + } else { + unsigned int index; + + num_exts_i = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); + if (num_exts_i > 0) { + exts_i = (char **)realloc((void *)exts_i, (size_t)num_exts_i * (sizeof *exts_i)); + } + + if (exts_i == NULL) { + return 0; + } + + for(index = 0; index < (unsigned)num_exts_i; index++) { + const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); + size_t len = strlen(gl_str_tmp); + + char *local_str = (char*)malloc((len+1) * sizeof(char)); + if(local_str != NULL) { +#if _MSC_VER >= 1400 + strncpy_s(local_str, len+1, gl_str_tmp, len); +#else + strcpy(local_str, gl_str_tmp); +#endif + } + exts_i[index] = local_str; + } + } +#endif + return 1; +} + +static void free_exts(void) { + if (exts_i != NULL) { + int index; + for(index = 0; index < num_exts_i; index++) { + free((char *)exts_i[index]); + } + free((void *)exts_i); + exts_i = NULL; + } +} + +static int has_ext(const char *ext) { +#ifdef _GLAD_IS_SOME_NEW_VERSION + if(max_loaded_major < 3) { +#endif + const char *extensions; + const char *loc; + const char *terminator; + extensions = exts; + if(extensions == NULL || ext == NULL) { + return 0; + } + + while(1) { + loc = strstr(extensions, ext); + if(loc == NULL) { + return 0; + } + + terminator = loc + strlen(ext); + if((loc == extensions || *(loc - 1) == ' ') && + (*terminator == ' ' || *terminator == '\0')) { + return 1; + } + extensions = terminator; + } +#ifdef _GLAD_IS_SOME_NEW_VERSION + } else { + int index; + if(exts_i == NULL) return 0; + for(index = 0; index < num_exts_i; index++) { + const char *e = exts_i[index]; + + if(exts_i[index] != NULL && strcmp(e, ext) == 0) { + return 1; + } + } + } +#endif + + return 0; +} +int GLAD_GL_VERSION_1_0; +int GLAD_GL_VERSION_1_1; +int GLAD_GL_VERSION_1_2; +int GLAD_GL_VERSION_1_3; +int GLAD_GL_VERSION_1_4; +int GLAD_GL_VERSION_1_5; +int GLAD_GL_VERSION_2_0; +int GLAD_GL_VERSION_2_1; +int GLAD_GL_VERSION_3_0; +int GLAD_GL_VERSION_3_1; +int GLAD_GL_VERSION_3_2; +int GLAD_GL_VERSION_3_3; +int GLAD_GL_VERSION_4_0; +int GLAD_GL_VERSION_4_1; +int GLAD_GL_VERSION_4_2; +int GLAD_GL_VERSION_4_3; +int GLAD_GL_VERSION_4_4; +int GLAD_GL_VERSION_4_5; +int GLAD_GL_VERSION_4_6; +PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; +PFNGLCOLOR4DPROC glad_glColor4d; +PFNGLBEGINQUERYPROC glad_glBeginQuery; +PFNGLINDEXFPROC glad_glIndexf; +PFNGLDISABLEIPROC glad_glDisablei; +PFNGLGETTRANSFORMFEEDBACKI_VPROC glad_glGetTransformFeedbacki_v; +PFNGLCOLORMASKPROC glad_glColorMask; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +PFNGLVERTEXP4UIPROC glad_glVertexP4ui; +PFNGLLINKPROGRAMPROC glad_glLinkProgram; +PFNGLGETNPIXELMAPUIVPROC glad_glGetnPixelMapuiv; +PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl; +PFNGLBUFFERSTORAGEPROC glad_glBufferStorage; +PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; +PFNGLGETNMAPDVPROC glad_glGetnMapdv; +PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv; +PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; +PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glad_glMultiDrawElementsIndirectCount; +PFNGLVIEWPORTPROC glad_glViewport; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +PFNGLRECTIPROC glad_glRecti; +PFNGLBINDBUFFERSBASEPROC glad_glBindBuffersBase; +PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; +PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glad_glClearNamedFramebufferuiv; +PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +PFNGLNAMEDRENDERBUFFERSTORAGEPROC glad_glNamedRenderbufferStorage; +PFNGLLOGICOPPROC glad_glLogicOp; +PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; +PFNGLTRANSLATEFPROC glad_glTranslatef; +PFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv; +PFNGLRASTERPOS3DPROC glad_glRasterPos3d; +PFNGLUNIFORM3UIPROC glad_glUniform3ui; +PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; +PFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog; +PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glad_glGetActiveAtomicCounterBufferiv; +PFNGLGETQUERYBUFFEROBJECTIVPROC glad_glGetQueryBufferObjectiv; +PFNGLVERTEX2SPROC glad_glVertex2s; +PFNGLOBJECTLABELPROC glad_glObjectLabel; +PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; +PFNGLUNMAPNAMEDBUFFERPROC glad_glUnmapNamedBuffer; +PFNGLRASTERPOS4SPROC glad_glRasterPos4s; +PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; +PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +PFNGLGETMAPIVPROC glad_glGetMapiv; +PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +PFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d; +PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; +PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; +PFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +PFNGLCOLOR4FPROC glad_glColor4f; +PFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram; +PFNGLMEMORYBARRIERPROC glad_glMemoryBarrier; +PFNGLMAPNAMEDBUFFERRANGEPROC glad_glMapNamedBufferRange; +PFNGLGETNSEPARABLEFILTERPROC glad_glGetnSeparableFilter; +PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glad_glGetNamedRenderbufferParameteriv; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; +PFNGLLIGHTFVPROC glad_glLightfv; +PFNGLDEPTHRANGEPROC glad_glDepthRange; +PFNGLGETQUERYBUFFEROBJECTI64VPROC glad_glGetQueryBufferObjecti64v; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +PFNGLRASTERPOS2DPROC glad_glRasterPos2d; +PFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName; +PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; +PFNGLVERTEX4DPROC glad_glVertex4d; +PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri; +PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv; +PFNGLUNIFORM4DPROC glad_glUniform4d; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +PFNGLTEXCOORD3DPROC glad_glTexCoord3d; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +PFNGLTEXGENFPROC glad_glTexGenf; +PFNGLCOLOR4USVPROC glad_glColor4usv; +PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; +PFNGLCOLOR4IPROC glad_glColor4i; +PFNGLVERTEX4SVPROC glad_glVertex4sv; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +PFNGLGETDOUBLEVPROC glad_glGetDoublev; +PFNGLGETTEXTUREIMAGEPROC glad_glGetTextureImage; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +PFNGLVERTEXPOINTERPROC glad_glVertexPointer; +PFNGLGETSYNCIVPROC glad_glGetSynciv; +PFNGLRASTERPOS4DPROC glad_glRasterPos4d; +PFNGLFOGFPROC glad_glFogf; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +PFNGLSTENCILOPPROC glad_glStencilOp; +PFNGLTEXGENIPROC glad_glTexGeni; +PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; +PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; +PFNGLTEXCOORD4DPROC glad_glTexCoord4d; +PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; +PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; +PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +PFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv; +PFNGLMAP1FPROC glad_glMap1f; +PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; +PFNGLGENTEXTURESPROC glad_glGenTextures; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv; +PFNGLCREATEQUERIESPROC glad_glCreateQueries; +PFNGLGENQUERIESPROC glad_glGenQueries; +PFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +PFNGLALPHAFUNCPROC glad_glAlphaFunc; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +PFNGLFRONTFACEPROC glad_glFrontFace; +PFNGLGETSHADERIVPROC glad_glGetShaderiv; +PFNGLUNIFORM2IPROC glad_glUniform2i; +PFNGLFOGIVPROC glad_glFogiv; +PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; +PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; +PFNGLLIGHTIPROC glad_glLighti; +PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; +PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +PFNGLNORMAL3DPROC glad_glNormal3d; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +PFNGLUNIFORM2FPROC glad_glUniform2f; +PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glad_glCompressedTextureSubImage3D; +PFNGLGETVERTEXARRAYINDEXEDIVPROC glad_glGetVertexArrayIndexediv; +PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; +PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv; +PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; +PFNGLRASTERPOS3IPROC glad_glRasterPos3i; +PFNGLUNIFORM3IPROC glad_glUniform3i; +PFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv; +PFNGLSTENCILFUNCPROC glad_glStencilFunc; +PFNGLTEXTURESTORAGE1DPROC glad_glTextureStorage1D; +PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +PFNGLGETNCOMPRESSEDTEXIMAGEPROC glad_glGetnCompressedTexImage; +PFNGLSHADEMODELPROC glad_glShadeModel; +PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; +PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +PFNGLMULTIDRAWELEMENTSINDIRECTPROC glad_glMultiDrawElementsIndirect; +PFNGLREADBUFFERPROC glad_glReadBuffer; +PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; +PFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +PFNGLCOLOR3USPROC glad_glColor3us; +PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; +PFNGLUNIFORM4FVPROC glad_glUniform4fv; +PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv; +PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; +PFNGLMAPGRID1FPROC glad_glMapGrid1f; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +PFNGLGETNAMEDBUFFERSUBDATAPROC glad_glGetNamedBufferSubData; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +PFNGLVERTEX2FVPROC glad_glVertex2fv; +PFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i; +PFNGLTEXSTORAGE2DMULTISAMPLEPROC glad_glTexStorage2DMultisample; +PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; +PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv; +PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +PFNGLLIGHTIVPROC glad_glLightiv; +PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; +PFNGLGETLIGHTFVPROC glad_glGetLightfv; +PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +PFNGLTEXENVIVPROC glad_glTexEnviv; +PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +PFNGLCOLOR4IVPROC glad_glColor4iv; +PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei; +PFNGLSPECIALIZESHADERPROC glad_glSpecializeShader; +PFNGLPIXELZOOMPROC glad_glPixelZoom; +PFNGLCLEARINDEXPROC glad_glClearIndex; +PFNGLCOLOR3UBPROC glad_glColor3ub; +PFNGLEVALMESH1PROC glad_glEvalMesh1; +PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; +PFNGLVERTEXP2UIPROC glad_glVertexP2ui; +PFNGLUNIFORM3DVPROC glad_glUniform3dv; +PFNGLARRAYELEMENTPROC glad_glArrayElement; +PFNGLLIGHTMODELFPROC glad_glLightModelf; +PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance; +PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; +PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +PFNGLCLEARCOLORPROC glad_glClearColor; +PFNGLGETNAMEDBUFFERPARAMETERIVPROC glad_glGetNamedBufferParameteriv; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv; +PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; +PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glad_glTextureStorage3DMultisample; +PFNGLINDEXSPROC glad_glIndexs; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +PFNGLLIGHTFPROC glad_glLightf; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +PFNGLMULTIDRAWARRAYSINDIRECTPROC glad_glMultiDrawArraysIndirect; +PFNGLGETPOINTERVPROC glad_glGetPointerv; +PFNGLNORMAL3BPROC glad_glNormal3b; +PFNGLCLEARACCUMPROC glad_glClearAccum; +PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +PFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines; +PFNGLRASTERPOS2IPROC glad_glRasterPos2i; +PFNGLDRAWARRAYSPROC glad_glDrawArrays; +PFNGLGETUNIFORMDVPROC glad_glGetUniformdv; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +PFNGLVERTEXP3UIPROC glad_glVertexP3ui; +PFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv; +PFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui; +PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +PFNGLACCUMPROC glad_glAccum; +PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +PFNGLFRUSTUMPROC glad_glFrustum; +PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; +PFNGLVERTEXATTRIBLFORMATPROC glad_glVertexAttribLFormat; +PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex; +PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; +PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glad_glTransformFeedbackBufferRange; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; +PFNGLCOLOR3BPROC glad_glColor3b; +PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; +PFNGLTEXTUREPARAMETERIIVPROC glad_glTextureParameterIiv; +PFNGLDEPTHFUNCPROC glad_glDepthFunc; +PFNGLTEXCOORD4IPROC glad_glTexCoord4i; +PFNGLRECTFVPROC glad_glRectfv; +PFNGLTEXCOORD1SPROC glad_glTexCoord1s; +PFNGLTEXENVFPROC glad_glTexEnvf; +PFNGLNORMAL3SPROC glad_glNormal3s; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +PFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f; +PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv; +PFNGLGETNAMEDBUFFERPOINTERVPROC glad_glGetNamedBufferPointerv; +PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; +PFNGLBLENDFUNCPROC glad_glBlendFunc; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +PFNGLTEXTUREPARAMETERIPROC glad_glTextureParameteri; +PFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv; +PFNGLVERTEX3DPROC glad_glVertex3d; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; +PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei; +PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv; +PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +PFNGLTEXCOORD4SPROC glad_glTexCoord4s; +PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glad_glGetProgramResourceLocationIndex; +PFNGLGETTEXTUREPARAMETERIVPROC glad_glGetTextureParameteriv; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +PFNGLCOLOR3UIPROC glad_glColor3ui; +PFNGLEDGEFLAGPROC glad_glEdgeFlag; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +PFNGLISSAMPLERPROC glad_glIsSampler; +PFNGLCOPYIMAGESUBDATAPROC glad_glCopyImageSubData; +PFNGLCOLOR4FVPROC glad_glColor4fv; +PFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d; +PFNGLCOLORP4UIVPROC glad_glColorP4uiv; +PFNGLCOPYTEXTURESUBIMAGE1DPROC glad_glCopyTextureSubImage1D; +PFNGLRENDERMODEPROC glad_glRenderMode; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv; +PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +PFNGLBLITNAMEDFRAMEBUFFERPROC glad_glBlitNamedFramebuffer; +PFNGLGETNMINMAXPROC glad_glGetnMinmax; +PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glad_glTextureStorage2DMultisample; +PFNGLCREATEFRAMEBUFFERSPROC glad_glCreateFramebuffers; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +PFNGLCOMPILESHADERPROC glad_glCompileShader; +PFNGLUNIFORM4FPROC glad_glUniform4f; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +PFNGLWAITSYNCPROC glad_glWaitSync; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv; +PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; +PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; +PFNGLGETTRANSFORMFEEDBACKIVPROC glad_glGetTransformFeedbackiv; +PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv; +PFNGLTEXCOORD1IPROC glad_glTexCoord1i; +PFNGLFLUSHPROC glad_glFlush; +PFNGLCOLOR4SVPROC glad_glColor4sv; +PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; +PFNGLPIXELMAPFVPROC glad_glPixelMapfv; +PFNGLVERTEX3SPROC glad_glVertex3s; +PFNGLENABLEIPROC glad_glEnablei; +PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; +PFNGLCOLOR3SVPROC glad_glColor3sv; +PFNGLPOPNAMEPROC glad_glPopName; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +PFNGLBINDSAMPLERSPROC glad_glBindSamplers; +PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; +PFNGLBUFFERDATAPROC glad_glBufferData; +PFNGLCLIPCONTROLPROC glad_glClipControl; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; +PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; +PFNGLCOLOR3BVPROC glad_glColor3bv; +PFNGLVERTEXARRAYVERTEXBUFFERSPROC glad_glVertexArrayVertexBuffers; +PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +PFNGLVERTEXBINDINGDIVISORPROC glad_glVertexBindingDivisor; +PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; +PFNGLGETNAMEDBUFFERPARAMETERI64VPROC glad_glGetNamedBufferParameteri64v; +PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glad_glNamedFramebufferReadBuffer; +PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; +PFNGLGETTEXTUREPARAMETERIUIVPROC glad_glGetTextureParameterIuiv; +PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +PFNGLVERTEX4FPROC glad_glVertex4f; +PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; +PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; +PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; +PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; +PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; +PFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i; +PFNGLINDEXUBPROC glad_glIndexub; +PFNGLNORMAL3DVPROC glad_glNormal3dv; +PFNGLINDEXMASKPROC glad_glIndexMask; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; +PFNGLCOLOR4USPROC glad_glColor4us; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +PFNGLGETNHISTOGRAMPROC glad_glGetnHistogram; +PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; +PFNGLROTATEDPROC glad_glRotated; +PFNGLCOLOR3IVPROC glad_glColor3iv; +PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback; +PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; +PFNGLUNIFORM4DVPROC glad_glUniform4dv; +PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glad_glGetNamedFramebufferParameteriv; +PFNGLVERTEX4IPROC glad_glVertex4i; +PFNGLGETTEXTURESUBIMAGEPROC glad_glGetTextureSubImage; +PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; +PFNGLCOLOR4BVPROC glad_glColor4bv; +PFNGLORTHOPROC glad_glOrtho; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +PFNGLINVALIDATEBUFFERSUBDATAPROC glad_glInvalidateBufferSubData; +PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +PFNGLCOLOR4UIVPROC glad_glColor4uiv; +PFNGLCOLOR3DVPROC glad_glColor3dv; +PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog; +PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +PFNGLINDEXDVPROC glad_glIndexdv; +PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; +PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glad_glNamedFramebufferParameteri; +PFNGLISPROGRAMPROC glad_glIsProgram; +PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +PFNGLFOGCOORDFVPROC glad_glFogCoordfv; +PFNGLFENCESYNCPROC glad_glFenceSync; +PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv; +PFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv; +PFNGLGETVERTEXARRAYINDEXED64IVPROC glad_glGetVertexArrayIndexed64iv; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance; +PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; +PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; +PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +PFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v; +PFNGLGETNMAPFVPROC glad_glGetnMapfv; +PFNGLGETNPIXELMAPFVPROC glad_glGetnPixelMapfv; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +PFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv; +PFNGLNAMEDFRAMEBUFFERTEXTUREPROC glad_glNamedFramebufferTexture; +PFNGLREADNPIXELSPROC glad_glReadnPixels; +PFNGLCULLFACEPROC glad_glCullFace; +PFNGLVERTEXATTRIBIFORMATPROC glad_glVertexAttribIFormat; +PFNGLTEXCOORD3SPROC glad_glTexCoord3s; +PFNGLVERTEX4DVPROC glad_glVertex4dv; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +PFNGLLINESTIPPLEPROC glad_glLineStipple; +PFNGLSCALEDPROC glad_glScaled; +PFNGLBINDTEXTUREUNITPROC glad_glBindTextureUnit; +PFNGLBINDSAMPLERPROC glad_glBindSampler; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +PFNGLUNIFORM1FVPROC glad_glUniform1fv; +PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +PFNGLLOADIDENTITYPROC glad_glLoadIdentity; +PFNGLBLENDCOLORPROC glad_glBlendColor; +PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; +PFNGLBINDBUFFERPROC glad_glBindBuffer; +PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; +PFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d; +PFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline; +PFNGLCLEARNAMEDFRAMEBUFFERFIPROC glad_glClearNamedFramebufferfi; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +PFNGLBITMAPPROC glad_glBitmap; +PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; +PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; +PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv; +PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glad_glInvalidateNamedFramebufferSubData; +PFNGLINDEXIVPROC glad_glIndexiv; +PFNGLPOPATTRIBPROC glad_glPopAttrib; +PFNGLINDEXDPROC glad_glIndexd; +PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +PFNGLFOGFVPROC glad_glFogfv; +PFNGLINITNAMESPROC glad_glInitNames; +PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; +PFNGLISBUFFERPROC glad_glIsBuffer; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; +PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +PFNGLGETNPOLYGONSTIPPLEPROC glad_glGetnPolygonStipple; +PFNGLISTEXTUREPROC glad_glIsTexture; +PFNGLUNIFORM1IVPROC glad_glUniform1iv; +PFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv; +PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; +PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; +PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; +PFNGLVERTEX3FVPROC glad_glVertex3fv; +PFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui; +PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup; +PFNGLTEXSTORAGE3DPROC glad_glTexStorage3D; +PFNGLSHADERSOURCEPROC glad_glShaderSource; +PFNGLEVALPOINT1PROC glad_glEvalPoint1; +PFNGLCOLOR4BPROC glad_glColor4b; +PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; +PFNGLREADPIXELSPROC glad_glReadPixels; +PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; +PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; +PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; +PFNGLINDEXUBVPROC glad_glIndexubv; +PFNGLISENABLEDIPROC glad_glIsEnabledi; +PFNGLSCISSORARRAYVPROC glad_glScissorArrayv; +PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; +PFNGLVERTEXARRAYATTRIBFORMATPROC glad_glVertexArrayAttribFormat; +PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; +PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +PFNGLLIGHTMODELIPROC glad_glLightModeli; +PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; +PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation; +PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName; +PFNGLCLEARDEPTHFPROC glad_glClearDepthf; +PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; +PFNGLDETACHSHADERPROC glad_glDetachShader; +PFNGLGETMAPFVPROC glad_glGetMapfv; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +PFNGLCOLOR3FVPROC glad_glColor3fv; +PFNGLVERTEXATTRIBFORMATPROC glad_glVertexAttribFormat; +PFNGLISENABLEDPROC glad_glIsEnabled; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv; +PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv; +PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; +PFNGLGETFLOATI_VPROC glad_glGetFloati_v; +PFNGLCLEARBUFFERSUBDATAPROC glad_glClearBufferSubData; +PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; +PFNGLMATERIALIVPROC glad_glMaterialiv; +PFNGLCOLORP3UIPROC glad_glColorP3ui; +PFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv; +PFNGLVERTEXARRAYATTRIBBINDINGPROC glad_glVertexArrayAttribBinding; +PFNGLCOLOR3IPROC glad_glColor3i; +PFNGLTEXBUFFERPROC glad_glTexBuffer; +PFNGLVERTEX4SPROC glad_glVertex4s; +PFNGLBLENDFUNCIPROC glad_glBlendFunci; +PFNGLGETQUERYBUFFEROBJECTUIVPROC glad_glGetQueryBufferObjectuiv; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +PFNGLMAP2DPROC glad_glMap2d; +PFNGLGETGRAPHICSRESETSTATUSPROC glad_glGetGraphicsResetStatus; +PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; +PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed; +PFNGLMULTMATRIXDPROC glad_glMultMatrixd; +PFNGLCLEARBUFFERDATAPROC glad_glClearBufferData; +PFNGLGETFLOATVPROC glad_glGetFloatv; +PFNGLRASTERPOS3SPROC glad_glRasterPos3s; +PFNGLVERTEX4FVPROC glad_glVertex4fv; +PFNGLMAPNAMEDBUFFERPROC glad_glMapNamedBuffer; +PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; +PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback; +PFNGLMATERIALFPROC glad_glMaterialf; +PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; +PFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v; +PFNGLGETQUERYBUFFEROBJECTUI64VPROC glad_glGetQueryBufferObjectui64v; +PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +PFNGLGETINTEGERVPROC glad_glGetIntegerv; +PFNGLEVALPOINT2PROC glad_glEvalPoint2; +PFNGLINDEXPOINTERPROC glad_glIndexPointer; +PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +PFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv; +PFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv; +PFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages; +PFNGLUNIFORM1DVPROC glad_glUniform1dv; +PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +PFNGLCOLOR3USVPROC glad_glColor3usv; +PFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv; +PFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f; +PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; +PFNGLCLEARNAMEDFRAMEBUFFERIVPROC glad_glClearNamedFramebufferiv; +PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; +PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; +PFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d; +PFNGLVERTEXARRAYATTRIBIFORMATPROC glad_glVertexArrayAttribIFormat; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +PFNGLCALLLISTPROC glad_glCallList; +PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; +PFNGLISQUERYPROC glad_glIsQuery; +PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv; +PFNGLCLEARNAMEDFRAMEBUFFERFVPROC glad_glClearNamedFramebufferfv; +PFNGLGETTEXTURELEVELPARAMETERIVPROC glad_glGetTextureLevelParameteriv; +PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; +PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; +PFNGLGETNPIXELMAPUSVPROC glad_glGetnPixelMapusv; +PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +PFNGLVERTEXARRAYVERTEXBUFFERPROC glad_glVertexArrayVertexBuffer; +PFNGLQUERYCOUNTERPROC glad_glQueryCounter; +PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +PFNGLHINTPROC glad_glHint; +PFNGLPOLYGONMODEPROC glad_glPolygonMode; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +PFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glad_glMultiDrawArraysIndirectCount; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +PFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i; +PFNGLTEXGENDVPROC glad_glTexGendv; +PFNGLFOGCOORDFPROC glad_glFogCoordf; +PFNGLFOGCOORDDPROC glad_glFogCoordd; +PFNGLRASTERPOS4IPROC glad_glRasterPos4i; +PFNGLGETERRORPROC glad_glGetError; +PFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui; +PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed; +PFNGLTEXTURESUBIMAGE2DPROC glad_glTextureSubImage2D; +PFNGLGETMAPDVPROC glad_glGetMapdv; +PFNGLTEXENVFVPROC glad_glTexEnvfv; +PFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline; +PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; +PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +PFNGLRECTDVPROC glad_glRectdv; +PFNGLCLEARSTENCILPROC glad_glClearStencil; +PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv; +PFNGLTEXTUREPARAMETERIUIVPROC glad_glTextureParameterIuiv; +PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; +PFNGLROTATEFPROC glad_glRotatef; +PFNGLCLEARNAMEDBUFFERSUBDATAPROC glad_glClearNamedBufferSubData; +PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; +PFNGLMAPGRID1DPROC glad_glMapGrid1d; +PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; +PFNGLISLISTPROC glad_glIsList; +PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf; +PFNGLBINDIMAGETEXTURESPROC glad_glBindImageTextures; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +PFNGLVERTEX2IPROC glad_glVertex2i; +PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; +PFNGLCOLORP3UIVPROC glad_glColorP3uiv; +PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; +PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback; +PFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv; +PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; +PFNGLCOLORP4UIPROC glad_glColorP4ui; +PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +PFNGLCOLORPOINTERPROC glad_glColorPointer; +PFNGLISSHADERPROC glad_glIsShader; +PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; +PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; +PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +PFNGLMEMORYBARRIERBYREGIONPROC glad_glMemoryBarrierByRegion; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +PFNGLGETTEXTUREPARAMETERIIVPROC glad_glGetTextureParameterIiv; +PFNGLCOLOR4SPROC glad_glColor4s; +PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +PFNGLLISTBASEPROC glad_glListBase; +PFNGLCOLOR3DPROC glad_glColor3d; +PFNGLTEXTUREBUFFERRANGEPROC glad_glTextureBufferRange; +PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glad_glGetCompressedTextureImage; +PFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer; +PFNGLUNIFORM1DPROC glad_glUniform1d; +PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +PFNGLUNIFORM3IVPROC glad_glUniform3iv; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +PFNGLPOLYGONOFFSETCLAMPPROC glad_glPolygonOffsetClamp; +PFNGLCOPYPIXELSPROC glad_glCopyPixels; +PFNGLINVALIDATEBUFFERDATAPROC glad_glInvalidateBufferData; +PFNGLVERTEX2SVPROC glad_glVertex2sv; +PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; +PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; +PFNGLENABLEVERTEXARRAYATTRIBPROC glad_glEnableVertexArrayAttrib; +PFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d; +PFNGLCOPYTEXTURESUBIMAGE3DPROC glad_glCopyTextureSubImage3D; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +PFNGLBINDVERTEXBUFFERSPROC glad_glBindVertexBuffers; +PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect; +PFNGLINVALIDATETEXIMAGEPROC glad_glInvalidateTexImage; +PFNGLCOLOR4UBPROC glad_glColor4ub; +PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +PFNGLNORMAL3BVPROC glad_glNormal3bv; +PFNGLATTACHSHADERPROC glad_glAttachShader; +PFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv; +PFNGLCALLLISTSPROC glad_glCallLists; +PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; +PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +PFNGLGETNUNIFORMDVPROC glad_glGetnUniformdv; +PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance; +PFNGLGETPROGRAMINTERFACEIVPROC glad_glGetProgramInterfaceiv; +PFNGLDELETESYNCPROC glad_glDeleteSync; +PFNGLGETSTRINGPROC glad_glGetString; +PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; +PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream; +PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +PFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv; +PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; +PFNGLDEPTHRANGEFPROC glad_glDepthRangef; +PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glad_glNamedFramebufferRenderbuffer; +PFNGLCREATERENDERBUFFERSPROC glad_glCreateRenderbuffers; +PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +PFNGLUNIFORM2UIPROC glad_glUniform2ui; +PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; +PFNGLUNIFORM3FPROC glad_glUniform3f; +PFNGLGENSAMPLERSPROC glad_glGenSamplers; +PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +PFNGLMATERIALIPROC glad_glMateriali; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glad_glDrawTransformFeedbackInstanced; +PFNGLPASSTHROUGHPROC glad_glPassThrough; +PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary; +PFNGLPOINTSIZEPROC glad_glPointSize; +PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv; +PFNGLCREATETEXTURESPROC glad_glCreateTextures; +PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; +PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +PFNGLCREATETRANSFORMFEEDBACKSPROC glad_glCreateTransformFeedbacks; +PFNGLCOPYTEXTURESUBIMAGE2DPROC glad_glCopyTextureSubImage2D; +PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; +PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +PFNGLNEWLISTPROC glad_glNewList; +PFNGLSHADERBINARYPROC glad_glShaderBinary; +PFNGLTEXCOORD2DPROC glad_glTexCoord2d; +PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; +PFNGLTEXTUREVIEWPROC glad_glTextureView; +PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv; +PFNGLTEXSTORAGE2DPROC glad_glTexStorage2D; +PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glad_glCheckNamedFramebufferStatus; +PFNGLBINDBUFFERSRANGEPROC glad_glBindBuffersRange; +PFNGLPIXELSTOREFPROC glad_glPixelStoref; +PFNGLTEXTUREPARAMETERFVPROC glad_glTextureParameterfv; +PFNGLDRAWELEMENTSPROC glad_glDrawElements; +PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; +PFNGLENDPROC glad_glEnd; +PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +PFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +PFNGLSCISSORINDEXEDPROC glad_glScissorIndexed; +PFNGLCOLOR3SPROC glad_glColor3s; +PFNGLSELECTBUFFERPROC glad_glSelectBuffer; +PFNGLRASTERPOS4FPROC glad_glRasterPos4f; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +PFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f; +PFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i; +PFNGLMATRIXMODEPROC glad_glMatrixMode; +PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +PFNGLTEXBUFFERRANGEPROC glad_glTexBufferRange; +PFNGLDRAWPIXELSPROC glad_glDrawPixels; +PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; +PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; +PFNGLVERTEX3DVPROC glad_glVertex3dv; +PFNGLLOADNAMEPROC glad_glLoadName; +PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +PFNGLSTENCILMASKPROC glad_glStencilMask; +PFNGLVERTEX3SVPROC glad_glVertex3sv; +PFNGLTEXCOORD1DPROC glad_glTexCoord1d; +PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; +PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +PFNGLDEPTHMASKPROC glad_glDepthMask; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +PFNGLGETPROGRAMRESOURCELOCATIONPROC glad_glGetProgramResourceLocation; +PFNGLPIXELSTOREIPROC glad_glPixelStorei; +PFNGLGETNCOLORTABLEPROC glad_glGetnColorTable; +PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; +PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; +PFNGLNORMAL3SVPROC glad_glNormal3sv; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +PFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv; +PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; +PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; +PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glad_glInvalidateNamedFramebufferData; +PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +PFNGLTEXCOORD1FPROC glad_glTexCoord1f; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +PFNGLDISABLEPROC glad_glDisable; +PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback; +PFNGLCOLOR4UBVPROC glad_glColor4ubv; +PFNGLVERTEXATTRIBBINDINGPROC glad_glVertexAttribBinding; +PFNGLVERTEX4IVPROC glad_glVertex4iv; +PFNGLMAPBUFFERPROC glad_glMapBuffer; +PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; +PFNGLENABLEPROC glad_glEnable; +PFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d; +PFNGLTEXSTORAGE1DPROC glad_glTexStorage1D; +PFNGLCLAMPCOLORPROC glad_glClampColor; +PFNGLRASTERPOS2SPROC glad_glRasterPos2s; +PFNGLUNIFORM3DPROC glad_glUniform3d; +PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +PFNGLRECTDPROC glad_glRectd; +PFNGLBINDTEXTURESPROC glad_glBindTextures; +PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; +PFNGLENDLISTPROC glad_glEndList; +PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; +PFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer; +PFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d; +PFNGLDELETELISTSPROC glad_glDeleteLists; +PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; +PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; +PFNGLTEXTUREBARRIERPROC glad_glTextureBarrier; +PFNGLFOGCOORDDVPROC glad_glFogCoorddv; +PFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv; +PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; +PFNGLGETSTRINGIPROC glad_glGetStringi; +PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; +PFNGLFRAMEBUFFERPARAMETERIPROC glad_glFramebufferParameteri; +PFNGLRECTSVPROC glad_glRectsv; +PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; +PFNGLTEXSTORAGE3DMULTISAMPLEPROC glad_glTexStorage3DMultisample; +PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; +PFNGLCOLOR3FPROC glad_glColor3f; +PFNGLISSYNCPROC glad_glIsSync; +PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glad_glDrawTransformFeedbackStreamInstanced; +PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +PFNGLVERTEX2FPROC glad_glVertex2f; +PFNGLGETNUNIFORMIVPROC glad_glGetnUniformiv; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +PFNGLCOPYNAMEDBUFFERSUBDATAPROC glad_glCopyNamedBufferSubData; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +PFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d; +PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; +PFNGLGETPROGRAMRESOURCEINDEXPROC glad_glGetProgramResourceIndex; +PFNGLUNIFORM1IPROC glad_glUniform1i; +PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +PFNGLPROGRAMBINARYPROC glad_glProgramBinary; +PFNGLNORMAL3FPROC glad_glNormal3f; +PFNGLPOPMATRIXPROC glad_glPopMatrix; +PFNGLGENLISTSPROC glad_glGenLists; +PFNGLCLIPPLANEPROC glad_glClipPlane; +PFNGLTEXTURESUBIMAGE3DPROC glad_glTextureSubImage3D; +PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +PFNGLFOGIPROC glad_glFogi; +PFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +PFNGLCOLOR3UBVPROC glad_glColor3ubv; +PFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv; +PFNGLDISPATCHCOMPUTEINDIRECTPROC glad_glDispatchComputeIndirect; +PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; +PFNGLBINDIMAGETEXTUREPROC glad_glBindImageTexture; +PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; +PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; +PFNGLUNIFORM2DPROC glad_glUniform2d; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +PFNGLGETVERTEXARRAYIVPROC glad_glGetVertexArrayiv; +PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glad_glTransformFeedbackBufferBase; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; +PFNGLSHADERSTORAGEBLOCKBINDINGPROC glad_glShaderStorageBlockBinding; +PFNGLUSEPROGRAMPROC glad_glUseProgram; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +PFNGLMATERIALFVPROC glad_glMaterialfv; +PFNGLGETLIGHTIVPROC glad_glGetLightiv; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +PFNGLNORMAL3IVPROC glad_glNormal3iv; +PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; +PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +PFNGLBEGINPROC glad_glBegin; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +PFNGLINVALIDATETEXSUBIMAGEPROC glad_glInvalidateTexSubImage; +PFNGLUNIFORM1UIPROC glad_glUniform1ui; +PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback; +PFNGLDELETESHADERPROC glad_glDeleteShader; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; +PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; +PFNGLGETNTEXIMAGEPROC glad_glGetnTexImage; +PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv; +PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; +PFNGLCREATEPROGRAMPIPELINESPROC glad_glCreateProgramPipelines; +PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; +PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; +PFNGLINDEXFVPROC glad_glIndexfv; +PFNGLGETTEXTURELEVELPARAMETERFVPROC glad_glGetTextureLevelParameterfv; +PFNGLCREATEBUFFERSPROC glad_glCreateBuffers; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glad_glCompressedTextureSubImage1D; +PFNGLCLEARPROC glad_glClear; +PFNGLBINDTEXTUREPROC glad_glBindTexture; +PFNGLUNIFORM4UIPROC glad_glUniform4ui; +PFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv; +PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; +PFNGLINDEXIPROC glad_glIndexi; +PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; +PFNGLCREATESHADERPROC glad_glCreateShader; +PFNGLCOLOR4UIPROC glad_glColor4ui; +PFNGLLINEWIDTHPROC glad_glLineWidth; +PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi; +PFNGLMULTMATRIXFPROC glad_glMultMatrixf; +PFNGLUNIFORM3FVPROC glad_glUniform3fv; +PFNGLENDQUERYPROC glad_glEndQuery; +PFNGLCOLOR3UIVPROC glad_glColor3uiv; +PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +PFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer; +PFNGLDISABLEVERTEXARRAYATTRIBPROC glad_glDisableVertexArrayAttrib; +PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; +PFNGLFINISHPROC glad_glFinish; +PFNGLTEXCOORD3IPROC glad_glTexCoord3i; +PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; +PFNGLTEXGENIVPROC glad_glTexGeniv; +PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; +PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; +PFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv; +PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; +PFNGLVERTEXARRAYATTRIBLFORMATPROC glad_glVertexArrayAttribLFormat; +PFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +PFNGLCOLOR4DVPROC glad_glColor4dv; +PFNGLNAMEDBUFFERDATAPROC glad_glNamedBufferData; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; +PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; +PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; +PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetNamedFramebufferAttachmentParameteriv; +PFNGLRECTIVPROC glad_glRectiv; +PFNGLTEXCOORD3FPROC glad_glTexCoord3f; +PFNGLRECTFPROC glad_glRectf; +PFNGLMAP2FPROC glad_glMap2f; +PFNGLMAPGRID2FPROC glad_glMapGrid2f; +PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; +PFNGLTEXTUREPARAMETERFPROC glad_glTextureParameterf; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +PFNGLCLEARTEXIMAGEPROC glad_glClearTexImage; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +PFNGLVERTEXARRAYELEMENTBUFFERPROC glad_glVertexArrayElementBuffer; +PFNGLGETNMAPIVPROC glad_glGetnMapiv; +PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +PFNGLGENERATETEXTUREMIPMAPPROC glad_glGenerateTextureMipmap; +PFNGLVERTEX2DPROC glad_glVertex2d; +PFNGLNORMALPOINTERPROC glad_glNormalPointer; +PFNGLTEXENVIPROC glad_glTexEnvi; +PFNGLUNIFORM2FVPROC glad_glUniform2fv; +PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +PFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv; +PFNGLNORMAL3FVPROC glad_glNormal3fv; +PFNGLVERTEX3IPROC glad_glVertex3i; +PFNGLNORMAL3IPROC glad_glNormal3i; +PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +PFNGLTRANSLATEDPROC glad_glTranslated; +PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ; +PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; +PFNGLNAMEDBUFFERSTORAGEPROC glad_glNamedBufferStorage; +PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; +PFNGLPUSHNAMEPROC glad_glPushName; +PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; +PFNGLTEXCOORD2FPROC glad_glTexCoord2f; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; +PFNGLGETTEXTUREPARAMETERFVPROC glad_glGetTextureParameterfv; +PFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv; +PFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv; +PFNGLSCISSORPROC glad_glScissor; +PFNGLDISPATCHCOMPUTEPROC glad_glDispatchCompute; +PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv; +PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; +PFNGLRECTSPROC glad_glRects; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; +PFNGLCREATEVERTEXARRAYSPROC glad_glCreateVertexArrays; +PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; +PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; +PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage; +PFNGLGETNCONVOLUTIONFILTERPROC glad_glGetnConvolutionFilter; +PFNGLCREATESAMPLERSPROC glad_glCreateSamplers; +PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glad_glCompressedTextureSubImage2D; +PFNGLGENBUFFERSPROC glad_glGenBuffers; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +PFNGLTEXTURESUBIMAGE1DPROC glad_glTextureSubImage1D; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +PFNGLVERTEX2IVPROC glad_glVertex2iv; +PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel; +PFNGLMAP1DPROC glad_glMap1d; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +PFNGLUNIFORM2DVPROC glad_glUniform2dv; +PFNGLTEXTUREBUFFERPROC glad_glTextureBuffer; +PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; +PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; +PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; +PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback; +PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; +PFNGLTEXCOORD2SPROC glad_glTexCoord2s; +PFNGLTEXCOORD2IPROC glad_glTexCoord2i; +PFNGLVERTEX3IVPROC glad_glVertex3iv; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +PFNGLNAMEDBUFFERSUBDATAPROC glad_glNamedBufferSubData; +PFNGLVERTEXARRAYBINDINGDIVISORPROC glad_glVertexArrayBindingDivisor; +PFNGLPUSHATTRIBPROC glad_glPushAttrib; +PFNGLNORMALP3UIPROC glad_glNormalP3ui; +PFNGLLIGHTMODELFVPROC glad_glLightModelfv; +PFNGLSCALEFPROC glad_glScalef; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; +PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; +PFNGLGETQUERYIVPROC glad_glGetQueryiv; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; +PFNGLRASTERPOS2FPROC glad_glRasterPos2f; +PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glad_glFlushMappedNamedBufferRange; +PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; +PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks; +PFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +PFNGLTEXGENFVPROC glad_glTexGenfv; +PFNGLUNIFORM1FPROC glad_glUniform1f; +PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +PFNGLGETTEXGENDVPROC glad_glGetTexGendv; +PFNGLCLEARNAMEDBUFFERDATAPROC glad_glClearNamedBufferData; +PFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv; +PFNGLLIGHTMODELIVPROC glad_glLightModeliv; +PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +PFNGLINDEXSVPROC glad_glIndexsv; +PFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv; +PFNGLGETTRANSFORMFEEDBACKI64_VPROC glad_glGetTransformFeedbacki64_v; +PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; +PFNGLPUSHMATRIXPROC glad_glPushMatrix; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +PFNGLVERTEX3FPROC glad_glVertex3f; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +PFNGLTEXTURESTORAGE3DPROC glad_glTextureStorage3D; +PFNGLRASTERPOS3FPROC glad_glRasterPos3f; +PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert; +PFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f; +PFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv; +PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv; +PFNGLCOLORMATERIALPROC glad_glColorMaterial; +PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect; +PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; +PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glad_glNamedFramebufferDrawBuffers; +PFNGLVERTEX2DVPROC glad_glVertex2dv; +PFNGLCOLORMASKIPROC glad_glColorMaski; +PFNGLTEXCOORD4FPROC glad_glTexCoord4f; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +PFNGLUNIFORM2IVPROC glad_glUniform2iv; +PFNGLUNIFORM4IPROC glad_glUniform4i; +PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glad_glNamedFramebufferTextureLayer; +PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; +PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; +PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glNamedRenderbufferStorageMultisample; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; +PFNGLUNIFORM4IVPROC glad_glUniform4iv; +PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; +PFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline; +PFNGLBINDVERTEXBUFFERPROC glad_glBindVertexBuffer; +PFNGLTEXGENDPROC glad_glTexGend; +PFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +PFNGLMAPGRID2DPROC glad_glMapGrid2d; +PFNGLGETNUNIFORMFVPROC glad_glGetnUniformfv; +PFNGLTEXTURESTORAGE2DPROC glad_glTextureStorage2D; +PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glad_glNamedFramebufferDrawBuffer; +PFNGLCLEARDEPTHPROC glad_glClearDepth; +PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv; +PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +PFNGLTEXTUREPARAMETERIVPROC glad_glTextureParameteriv; +PFNGLEVALMESH2PROC glad_glEvalMesh2; +int GLAD_GL_EXT_texture_filter_anisotropic; +int GLAD_GL_EXT_framebuffer_multisample; +int GLAD_GL_NV_texture_barrier; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT; +PFNGLTEXTUREBARRIERNVPROC glad_glTextureBarrierNV; +static void load_GL_VERSION_1_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_0) return; + glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); + glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); + glad_glHint = (PFNGLHINTPROC)load("glHint"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); + glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); + glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); + glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); + glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); + glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); + glad_glClear = (PFNGLCLEARPROC)load("glClear"); + glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); + glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); + glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); + glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); + glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); + glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); + glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); + glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); + glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); + glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); + glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); + glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); + glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); + glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); + glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); + glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); + glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); + glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); + glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); + glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); + glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); + glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); + glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); + glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); + glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); + glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); + glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); + glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); + glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); + glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); + glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); + glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); + glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); + glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); + glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); + glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); + glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); + glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); + glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); + glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); + glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); + glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); + glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); + glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); + glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); + glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); + glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); + glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); + glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); + glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); + glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); + glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); + glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); + glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); + glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); + glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); + glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); + glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); + glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); + glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); + glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); + glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); + glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); + glad_glEnd = (PFNGLENDPROC)load("glEnd"); + glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); + glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); + glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); + glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); + glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); + glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); + glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); + glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); + glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); + glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); + glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); + glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); + glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); + glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); + glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); + glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); + glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); + glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); + glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); + glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); + glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); + glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); + glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); + glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); + glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); + glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); + glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); + glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); + glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); + glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); + glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); + glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); + glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); + glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); + glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); + glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); + glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); + glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); + glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); + glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); + glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); + glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); + glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); + glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); + glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); + glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); + glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); + glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); + glad_glRects = (PFNGLRECTSPROC)load("glRects"); + glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); + glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); + glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); + glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); + glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); + glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); + glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); + glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); + glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); + glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); + glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); + glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); + glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); + glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); + glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); + glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); + glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); + glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); + glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); + glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); + glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); + glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); + glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); + glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); + glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); + glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); + glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); + glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); + glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); + glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); + glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); + glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); + glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); + glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); + glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); + glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); + glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); + glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); + glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); + glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); + glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); + glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); + glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); + glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); + glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); + glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); + glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); + glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); + glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); + glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); + glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); + glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); + glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); + glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); + glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); + glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); + glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); + glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); + glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); + glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); + glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); + glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); + glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); + glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); + glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); + glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); + glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); + glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); + glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); + glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); + glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); + glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); + glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); + glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); + glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); + glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); + glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); + glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); + glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); + glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); + glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); + glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); + glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); + glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); + glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); + glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); + glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); + glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); + glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); + glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); + glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); + glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); + glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); + glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); + glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); + glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); + glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); + glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); + glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); + glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); + glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); + glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); + glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); + glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); + glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); + glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); + glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); + glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); + glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); + glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); + glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); + glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); + glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); + glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); + glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); + glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); + glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); + glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); + glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); + glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); + glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); + glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); + glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); + glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); + glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); + glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); + glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); + glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); + glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); + glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); + glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); + glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); + glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); + glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); + glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); + glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); + glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); + glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); + glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); + glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); + glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); + glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); + glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); + glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); + glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); + glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); + glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); + glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); + glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); + glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); + glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); + glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); + glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); + glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); + glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); + glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); + glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); + glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); + glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); + glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); + glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); + glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); + glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); + glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); + glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); +} +static void load_GL_VERSION_1_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_1) return; + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); + glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); + glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); + glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); + glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); + glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); + glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); + glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); + glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); + glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); + glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); + glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); + glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); + glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); + glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); + glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); + glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); + glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); + glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); + glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); + glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); +} +static void load_GL_VERSION_1_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_2) return; + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); +} +static void load_GL_VERSION_1_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_3) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); + glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); + glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); + glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); + glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); + glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); + glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); + glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); + glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); + glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); + glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); + glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); + glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); + glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); + glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); + glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); + glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); + glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); + glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); + glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); + glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); + glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); + glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); + glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); + glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); + glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); + glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); + glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); + glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); + glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); + glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); + glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); + glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); + glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); + glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); + glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); + glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); + glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); + glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); + glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); + glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); +} +static void load_GL_VERSION_1_4(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_4) return; + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); + glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); + glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); + glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); + glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); + glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); + glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); + glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); + glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); + glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); + glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); + glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); + glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); + glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); + glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); + glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); + glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); + glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); + glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); + glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); + glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); + glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); + glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); + glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); + glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); + glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); + glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); + glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); + glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); + glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); + glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); + glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); + glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); + glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); + glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); + glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); + glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); + glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); + glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); + glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); + glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); + glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); + glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); + glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); + glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); +} +static void load_GL_VERSION_1_5(GLADloadproc load) { + if(!GLAD_GL_VERSION_1_5) return; + glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); + glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); + glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); + glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); + glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); + glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); + glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); + glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); + glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); +} +static void load_GL_VERSION_2_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_0) return; + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); + glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); + glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); + glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); + glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); + glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); + glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); + glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); + glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); + glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); + glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); + glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); + glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); + glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); + glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); + glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); + glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); + glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); + glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); + glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); + glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); + glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); + glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); + glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); + glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); + glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); + glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); + glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); + glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); + glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); + glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); + glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); +} +static void load_GL_VERSION_2_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_2_1) return; + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); +} +static void load_GL_VERSION_3_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_0) return; + glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); + glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); + glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); + glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); + glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); + glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); + glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); + glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); + glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); + glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); + glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); + glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); + glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); + glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); + glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); + glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); + glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); + glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); + glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); + glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); + glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); + glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); + glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); + glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); + glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); + glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); + glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); + glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); + glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); + glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); + glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); + glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); + glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); + glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); + glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); + glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); + glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); + glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); + glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); + glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); + glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); + glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); + glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); + glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); + glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); + glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); + glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); + glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); + glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); + glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); + glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); + glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); + glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); + glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); + glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); + glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); + glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); + glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); + glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); + glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); + glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); + glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); + glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); + glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); + glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); + glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); +} +static void load_GL_VERSION_3_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_1) return; + glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); + glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); + glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); + glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); + glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); + glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); + glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); + glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); + glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); + glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); + glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); + glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); +} +static void load_GL_VERSION_3_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_2) return; + glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex"); + glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex"); + glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex"); + glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex"); + glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex"); + glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); + glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); + glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); + glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); + glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); + glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); + glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); + glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); + glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); + glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture"); + glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample"); + glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample"); + glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv"); + glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski"); +} +static void load_GL_VERSION_3_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_3_3) return; + glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed"); + glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex"); + glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); + glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); + glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); + glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); + glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); + glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); + glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); + glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); + glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load("glSamplerParameterIiv"); + glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load("glSamplerParameterIuiv"); + glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); + glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load("glGetSamplerParameterIiv"); + glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); + glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load("glGetSamplerParameterIuiv"); + glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter"); + glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v"); + glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v"); + glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); + glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load("glVertexAttribP1ui"); + glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load("glVertexAttribP1uiv"); + glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load("glVertexAttribP2ui"); + glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load("glVertexAttribP2uiv"); + glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load("glVertexAttribP3ui"); + glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load("glVertexAttribP3uiv"); + glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load("glVertexAttribP4ui"); + glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load("glVertexAttribP4uiv"); + glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load("glVertexP2ui"); + glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load("glVertexP2uiv"); + glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load("glVertexP3ui"); + glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load("glVertexP3uiv"); + glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load("glVertexP4ui"); + glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load("glVertexP4uiv"); + glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load("glTexCoordP1ui"); + glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load("glTexCoordP1uiv"); + glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load("glTexCoordP2ui"); + glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load("glTexCoordP2uiv"); + glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load("glTexCoordP3ui"); + glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load("glTexCoordP3uiv"); + glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load("glTexCoordP4ui"); + glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("glTexCoordP4uiv"); + glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)load("glMultiTexCoordP1ui"); + glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)load("glMultiTexCoordP1uiv"); + glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)load("glMultiTexCoordP2ui"); + glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)load("glMultiTexCoordP2uiv"); + glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)load("glMultiTexCoordP3ui"); + glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)load("glMultiTexCoordP3uiv"); + glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)load("glMultiTexCoordP4ui"); + glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)load("glMultiTexCoordP4uiv"); + glad_glNormalP3ui = (PFNGLNORMALP3UIPROC)load("glNormalP3ui"); + glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC)load("glNormalP3uiv"); + glad_glColorP3ui = (PFNGLCOLORP3UIPROC)load("glColorP3ui"); + glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC)load("glColorP3uiv"); + glad_glColorP4ui = (PFNGLCOLORP4UIPROC)load("glColorP4ui"); + glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC)load("glColorP4uiv"); + glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); + glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); +} +static void load_GL_VERSION_4_0(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_0) return; + glad_glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)load("glMinSampleShading"); + glad_glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)load("glBlendEquationi"); + glad_glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)load("glBlendEquationSeparatei"); + glad_glBlendFunci = (PFNGLBLENDFUNCIPROC)load("glBlendFunci"); + glad_glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)load("glBlendFuncSeparatei"); + glad_glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)load("glDrawArraysIndirect"); + glad_glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)load("glDrawElementsIndirect"); + glad_glUniform1d = (PFNGLUNIFORM1DPROC)load("glUniform1d"); + glad_glUniform2d = (PFNGLUNIFORM2DPROC)load("glUniform2d"); + glad_glUniform3d = (PFNGLUNIFORM3DPROC)load("glUniform3d"); + glad_glUniform4d = (PFNGLUNIFORM4DPROC)load("glUniform4d"); + glad_glUniform1dv = (PFNGLUNIFORM1DVPROC)load("glUniform1dv"); + glad_glUniform2dv = (PFNGLUNIFORM2DVPROC)load("glUniform2dv"); + glad_glUniform3dv = (PFNGLUNIFORM3DVPROC)load("glUniform3dv"); + glad_glUniform4dv = (PFNGLUNIFORM4DVPROC)load("glUniform4dv"); + glad_glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)load("glUniformMatrix2dv"); + glad_glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)load("glUniformMatrix3dv"); + glad_glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)load("glUniformMatrix4dv"); + glad_glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)load("glUniformMatrix2x3dv"); + glad_glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)load("glUniformMatrix2x4dv"); + glad_glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)load("glUniformMatrix3x2dv"); + glad_glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)load("glUniformMatrix3x4dv"); + glad_glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)load("glUniformMatrix4x2dv"); + glad_glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)load("glUniformMatrix4x3dv"); + glad_glGetUniformdv = (PFNGLGETUNIFORMDVPROC)load("glGetUniformdv"); + glad_glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)load("glGetSubroutineUniformLocation"); + glad_glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)load("glGetSubroutineIndex"); + glad_glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)load("glGetActiveSubroutineUniformiv"); + glad_glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)load("glGetActiveSubroutineUniformName"); + glad_glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)load("glGetActiveSubroutineName"); + glad_glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)load("glUniformSubroutinesuiv"); + glad_glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)load("glGetUniformSubroutineuiv"); + glad_glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)load("glGetProgramStageiv"); + glad_glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)load("glPatchParameteri"); + glad_glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)load("glPatchParameterfv"); + glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); + glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); + glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); + glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); + glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); + glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); + glad_glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)load("glDrawTransformFeedback"); + glad_glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)load("glDrawTransformFeedbackStream"); + glad_glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)load("glBeginQueryIndexed"); + glad_glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)load("glEndQueryIndexed"); + glad_glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)load("glGetQueryIndexediv"); +} +static void load_GL_VERSION_4_1(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_1) return; + glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); + glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); + glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); + glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); + glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); + glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)load("glGetProgramBinary"); + glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC)load("glProgramBinary"); + glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); + glad_glUseProgramStages = (PFNGLUSEPROGRAMSTAGESPROC)load("glUseProgramStages"); + glad_glActiveShaderProgram = (PFNGLACTIVESHADERPROGRAMPROC)load("glActiveShaderProgram"); + glad_glCreateShaderProgramv = (PFNGLCREATESHADERPROGRAMVPROC)load("glCreateShaderProgramv"); + glad_glBindProgramPipeline = (PFNGLBINDPROGRAMPIPELINEPROC)load("glBindProgramPipeline"); + glad_glDeleteProgramPipelines = (PFNGLDELETEPROGRAMPIPELINESPROC)load("glDeleteProgramPipelines"); + glad_glGenProgramPipelines = (PFNGLGENPROGRAMPIPELINESPROC)load("glGenProgramPipelines"); + glad_glIsProgramPipeline = (PFNGLISPROGRAMPIPELINEPROC)load("glIsProgramPipeline"); + glad_glGetProgramPipelineiv = (PFNGLGETPROGRAMPIPELINEIVPROC)load("glGetProgramPipelineiv"); + glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); + glad_glProgramUniform1i = (PFNGLPROGRAMUNIFORM1IPROC)load("glProgramUniform1i"); + glad_glProgramUniform1iv = (PFNGLPROGRAMUNIFORM1IVPROC)load("glProgramUniform1iv"); + glad_glProgramUniform1f = (PFNGLPROGRAMUNIFORM1FPROC)load("glProgramUniform1f"); + glad_glProgramUniform1fv = (PFNGLPROGRAMUNIFORM1FVPROC)load("glProgramUniform1fv"); + glad_glProgramUniform1d = (PFNGLPROGRAMUNIFORM1DPROC)load("glProgramUniform1d"); + glad_glProgramUniform1dv = (PFNGLPROGRAMUNIFORM1DVPROC)load("glProgramUniform1dv"); + glad_glProgramUniform1ui = (PFNGLPROGRAMUNIFORM1UIPROC)load("glProgramUniform1ui"); + glad_glProgramUniform1uiv = (PFNGLPROGRAMUNIFORM1UIVPROC)load("glProgramUniform1uiv"); + glad_glProgramUniform2i = (PFNGLPROGRAMUNIFORM2IPROC)load("glProgramUniform2i"); + glad_glProgramUniform2iv = (PFNGLPROGRAMUNIFORM2IVPROC)load("glProgramUniform2iv"); + glad_glProgramUniform2f = (PFNGLPROGRAMUNIFORM2FPROC)load("glProgramUniform2f"); + glad_glProgramUniform2fv = (PFNGLPROGRAMUNIFORM2FVPROC)load("glProgramUniform2fv"); + glad_glProgramUniform2d = (PFNGLPROGRAMUNIFORM2DPROC)load("glProgramUniform2d"); + glad_glProgramUniform2dv = (PFNGLPROGRAMUNIFORM2DVPROC)load("glProgramUniform2dv"); + glad_glProgramUniform2ui = (PFNGLPROGRAMUNIFORM2UIPROC)load("glProgramUniform2ui"); + glad_glProgramUniform2uiv = (PFNGLPROGRAMUNIFORM2UIVPROC)load("glProgramUniform2uiv"); + glad_glProgramUniform3i = (PFNGLPROGRAMUNIFORM3IPROC)load("glProgramUniform3i"); + glad_glProgramUniform3iv = (PFNGLPROGRAMUNIFORM3IVPROC)load("glProgramUniform3iv"); + glad_glProgramUniform3f = (PFNGLPROGRAMUNIFORM3FPROC)load("glProgramUniform3f"); + glad_glProgramUniform3fv = (PFNGLPROGRAMUNIFORM3FVPROC)load("glProgramUniform3fv"); + glad_glProgramUniform3d = (PFNGLPROGRAMUNIFORM3DPROC)load("glProgramUniform3d"); + glad_glProgramUniform3dv = (PFNGLPROGRAMUNIFORM3DVPROC)load("glProgramUniform3dv"); + glad_glProgramUniform3ui = (PFNGLPROGRAMUNIFORM3UIPROC)load("glProgramUniform3ui"); + glad_glProgramUniform3uiv = (PFNGLPROGRAMUNIFORM3UIVPROC)load("glProgramUniform3uiv"); + glad_glProgramUniform4i = (PFNGLPROGRAMUNIFORM4IPROC)load("glProgramUniform4i"); + glad_glProgramUniform4iv = (PFNGLPROGRAMUNIFORM4IVPROC)load("glProgramUniform4iv"); + glad_glProgramUniform4f = (PFNGLPROGRAMUNIFORM4FPROC)load("glProgramUniform4f"); + glad_glProgramUniform4fv = (PFNGLPROGRAMUNIFORM4FVPROC)load("glProgramUniform4fv"); + glad_glProgramUniform4d = (PFNGLPROGRAMUNIFORM4DPROC)load("glProgramUniform4d"); + glad_glProgramUniform4dv = (PFNGLPROGRAMUNIFORM4DVPROC)load("glProgramUniform4dv"); + glad_glProgramUniform4ui = (PFNGLPROGRAMUNIFORM4UIPROC)load("glProgramUniform4ui"); + glad_glProgramUniform4uiv = (PFNGLPROGRAMUNIFORM4UIVPROC)load("glProgramUniform4uiv"); + glad_glProgramUniformMatrix2fv = (PFNGLPROGRAMUNIFORMMATRIX2FVPROC)load("glProgramUniformMatrix2fv"); + glad_glProgramUniformMatrix3fv = (PFNGLPROGRAMUNIFORMMATRIX3FVPROC)load("glProgramUniformMatrix3fv"); + glad_glProgramUniformMatrix4fv = (PFNGLPROGRAMUNIFORMMATRIX4FVPROC)load("glProgramUniformMatrix4fv"); + glad_glProgramUniformMatrix2dv = (PFNGLPROGRAMUNIFORMMATRIX2DVPROC)load("glProgramUniformMatrix2dv"); + glad_glProgramUniformMatrix3dv = (PFNGLPROGRAMUNIFORMMATRIX3DVPROC)load("glProgramUniformMatrix3dv"); + glad_glProgramUniformMatrix4dv = (PFNGLPROGRAMUNIFORMMATRIX4DVPROC)load("glProgramUniformMatrix4dv"); + glad_glProgramUniformMatrix2x3fv = (PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)load("glProgramUniformMatrix2x3fv"); + glad_glProgramUniformMatrix3x2fv = (PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)load("glProgramUniformMatrix3x2fv"); + glad_glProgramUniformMatrix2x4fv = (PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)load("glProgramUniformMatrix2x4fv"); + glad_glProgramUniformMatrix4x2fv = (PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)load("glProgramUniformMatrix4x2fv"); + glad_glProgramUniformMatrix3x4fv = (PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)load("glProgramUniformMatrix3x4fv"); + glad_glProgramUniformMatrix4x3fv = (PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)load("glProgramUniformMatrix4x3fv"); + glad_glProgramUniformMatrix2x3dv = (PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)load("glProgramUniformMatrix2x3dv"); + glad_glProgramUniformMatrix3x2dv = (PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)load("glProgramUniformMatrix3x2dv"); + glad_glProgramUniformMatrix2x4dv = (PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)load("glProgramUniformMatrix2x4dv"); + glad_glProgramUniformMatrix4x2dv = (PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)load("glProgramUniformMatrix4x2dv"); + glad_glProgramUniformMatrix3x4dv = (PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)load("glProgramUniformMatrix3x4dv"); + glad_glProgramUniformMatrix4x3dv = (PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)load("glProgramUniformMatrix4x3dv"); + glad_glValidateProgramPipeline = (PFNGLVALIDATEPROGRAMPIPELINEPROC)load("glValidateProgramPipeline"); + glad_glGetProgramPipelineInfoLog = (PFNGLGETPROGRAMPIPELINEINFOLOGPROC)load("glGetProgramPipelineInfoLog"); + glad_glVertexAttribL1d = (PFNGLVERTEXATTRIBL1DPROC)load("glVertexAttribL1d"); + glad_glVertexAttribL2d = (PFNGLVERTEXATTRIBL2DPROC)load("glVertexAttribL2d"); + glad_glVertexAttribL3d = (PFNGLVERTEXATTRIBL3DPROC)load("glVertexAttribL3d"); + glad_glVertexAttribL4d = (PFNGLVERTEXATTRIBL4DPROC)load("glVertexAttribL4d"); + glad_glVertexAttribL1dv = (PFNGLVERTEXATTRIBL1DVPROC)load("glVertexAttribL1dv"); + glad_glVertexAttribL2dv = (PFNGLVERTEXATTRIBL2DVPROC)load("glVertexAttribL2dv"); + glad_glVertexAttribL3dv = (PFNGLVERTEXATTRIBL3DVPROC)load("glVertexAttribL3dv"); + glad_glVertexAttribL4dv = (PFNGLVERTEXATTRIBL4DVPROC)load("glVertexAttribL4dv"); + glad_glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC)load("glVertexAttribLPointer"); + glad_glGetVertexAttribLdv = (PFNGLGETVERTEXATTRIBLDVPROC)load("glGetVertexAttribLdv"); + glad_glViewportArrayv = (PFNGLVIEWPORTARRAYVPROC)load("glViewportArrayv"); + glad_glViewportIndexedf = (PFNGLVIEWPORTINDEXEDFPROC)load("glViewportIndexedf"); + glad_glViewportIndexedfv = (PFNGLVIEWPORTINDEXEDFVPROC)load("glViewportIndexedfv"); + glad_glScissorArrayv = (PFNGLSCISSORARRAYVPROC)load("glScissorArrayv"); + glad_glScissorIndexed = (PFNGLSCISSORINDEXEDPROC)load("glScissorIndexed"); + glad_glScissorIndexedv = (PFNGLSCISSORINDEXEDVPROC)load("glScissorIndexedv"); + glad_glDepthRangeArrayv = (PFNGLDEPTHRANGEARRAYVPROC)load("glDepthRangeArrayv"); + glad_glDepthRangeIndexed = (PFNGLDEPTHRANGEINDEXEDPROC)load("glDepthRangeIndexed"); + glad_glGetFloati_v = (PFNGLGETFLOATI_VPROC)load("glGetFloati_v"); + glad_glGetDoublei_v = (PFNGLGETDOUBLEI_VPROC)load("glGetDoublei_v"); +} +static void load_GL_VERSION_4_2(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_2) return; + glad_glDrawArraysInstancedBaseInstance = (PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)load("glDrawArraysInstancedBaseInstance"); + glad_glDrawElementsInstancedBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)load("glDrawElementsInstancedBaseInstance"); + glad_glDrawElementsInstancedBaseVertexBaseInstance = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)load("glDrawElementsInstancedBaseVertexBaseInstance"); + glad_glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)load("glGetInternalformativ"); + glad_glGetActiveAtomicCounterBufferiv = (PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)load("glGetActiveAtomicCounterBufferiv"); + glad_glBindImageTexture = (PFNGLBINDIMAGETEXTUREPROC)load("glBindImageTexture"); + glad_glMemoryBarrier = (PFNGLMEMORYBARRIERPROC)load("glMemoryBarrier"); + glad_glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)load("glTexStorage1D"); + glad_glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)load("glTexStorage2D"); + glad_glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)load("glTexStorage3D"); + glad_glDrawTransformFeedbackInstanced = (PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)load("glDrawTransformFeedbackInstanced"); + glad_glDrawTransformFeedbackStreamInstanced = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)load("glDrawTransformFeedbackStreamInstanced"); +} +static void load_GL_VERSION_4_3(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_3) return; + glad_glClearBufferData = (PFNGLCLEARBUFFERDATAPROC)load("glClearBufferData"); + glad_glClearBufferSubData = (PFNGLCLEARBUFFERSUBDATAPROC)load("glClearBufferSubData"); + glad_glDispatchCompute = (PFNGLDISPATCHCOMPUTEPROC)load("glDispatchCompute"); + glad_glDispatchComputeIndirect = (PFNGLDISPATCHCOMPUTEINDIRECTPROC)load("glDispatchComputeIndirect"); + glad_glCopyImageSubData = (PFNGLCOPYIMAGESUBDATAPROC)load("glCopyImageSubData"); + glad_glFramebufferParameteri = (PFNGLFRAMEBUFFERPARAMETERIPROC)load("glFramebufferParameteri"); + glad_glGetFramebufferParameteriv = (PFNGLGETFRAMEBUFFERPARAMETERIVPROC)load("glGetFramebufferParameteriv"); + glad_glGetInternalformati64v = (PFNGLGETINTERNALFORMATI64VPROC)load("glGetInternalformati64v"); + glad_glInvalidateTexSubImage = (PFNGLINVALIDATETEXSUBIMAGEPROC)load("glInvalidateTexSubImage"); + glad_glInvalidateTexImage = (PFNGLINVALIDATETEXIMAGEPROC)load("glInvalidateTexImage"); + glad_glInvalidateBufferSubData = (PFNGLINVALIDATEBUFFERSUBDATAPROC)load("glInvalidateBufferSubData"); + glad_glInvalidateBufferData = (PFNGLINVALIDATEBUFFERDATAPROC)load("glInvalidateBufferData"); + glad_glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)load("glInvalidateFramebuffer"); + glad_glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)load("glInvalidateSubFramebuffer"); + glad_glMultiDrawArraysIndirect = (PFNGLMULTIDRAWARRAYSINDIRECTPROC)load("glMultiDrawArraysIndirect"); + glad_glMultiDrawElementsIndirect = (PFNGLMULTIDRAWELEMENTSINDIRECTPROC)load("glMultiDrawElementsIndirect"); + glad_glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC)load("glGetProgramInterfaceiv"); + glad_glGetProgramResourceIndex = (PFNGLGETPROGRAMRESOURCEINDEXPROC)load("glGetProgramResourceIndex"); + glad_glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC)load("glGetProgramResourceName"); + glad_glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC)load("glGetProgramResourceiv"); + glad_glGetProgramResourceLocation = (PFNGLGETPROGRAMRESOURCELOCATIONPROC)load("glGetProgramResourceLocation"); + glad_glGetProgramResourceLocationIndex = (PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)load("glGetProgramResourceLocationIndex"); + glad_glShaderStorageBlockBinding = (PFNGLSHADERSTORAGEBLOCKBINDINGPROC)load("glShaderStorageBlockBinding"); + glad_glTexBufferRange = (PFNGLTEXBUFFERRANGEPROC)load("glTexBufferRange"); + glad_glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)load("glTexStorage2DMultisample"); + glad_glTexStorage3DMultisample = (PFNGLTEXSTORAGE3DMULTISAMPLEPROC)load("glTexStorage3DMultisample"); + glad_glTextureView = (PFNGLTEXTUREVIEWPROC)load("glTextureView"); + glad_glBindVertexBuffer = (PFNGLBINDVERTEXBUFFERPROC)load("glBindVertexBuffer"); + glad_glVertexAttribFormat = (PFNGLVERTEXATTRIBFORMATPROC)load("glVertexAttribFormat"); + glad_glVertexAttribIFormat = (PFNGLVERTEXATTRIBIFORMATPROC)load("glVertexAttribIFormat"); + glad_glVertexAttribLFormat = (PFNGLVERTEXATTRIBLFORMATPROC)load("glVertexAttribLFormat"); + glad_glVertexAttribBinding = (PFNGLVERTEXATTRIBBINDINGPROC)load("glVertexAttribBinding"); + glad_glVertexBindingDivisor = (PFNGLVERTEXBINDINGDIVISORPROC)load("glVertexBindingDivisor"); + glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)load("glDebugMessageControl"); + glad_glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC)load("glDebugMessageInsert"); + glad_glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)load("glDebugMessageCallback"); + glad_glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC)load("glGetDebugMessageLog"); + glad_glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC)load("glPushDebugGroup"); + glad_glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC)load("glPopDebugGroup"); + glad_glObjectLabel = (PFNGLOBJECTLABELPROC)load("glObjectLabel"); + glad_glGetObjectLabel = (PFNGLGETOBJECTLABELPROC)load("glGetObjectLabel"); + glad_glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC)load("glObjectPtrLabel"); + glad_glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC)load("glGetObjectPtrLabel"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); +} +static void load_GL_VERSION_4_4(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_4) return; + glad_glBufferStorage = (PFNGLBUFFERSTORAGEPROC)load("glBufferStorage"); + glad_glClearTexImage = (PFNGLCLEARTEXIMAGEPROC)load("glClearTexImage"); + glad_glClearTexSubImage = (PFNGLCLEARTEXSUBIMAGEPROC)load("glClearTexSubImage"); + glad_glBindBuffersBase = (PFNGLBINDBUFFERSBASEPROC)load("glBindBuffersBase"); + glad_glBindBuffersRange = (PFNGLBINDBUFFERSRANGEPROC)load("glBindBuffersRange"); + glad_glBindTextures = (PFNGLBINDTEXTURESPROC)load("glBindTextures"); + glad_glBindSamplers = (PFNGLBINDSAMPLERSPROC)load("glBindSamplers"); + glad_glBindImageTextures = (PFNGLBINDIMAGETEXTURESPROC)load("glBindImageTextures"); + glad_glBindVertexBuffers = (PFNGLBINDVERTEXBUFFERSPROC)load("glBindVertexBuffers"); +} +static void load_GL_VERSION_4_5(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_5) return; + glad_glClipControl = (PFNGLCLIPCONTROLPROC)load("glClipControl"); + glad_glCreateTransformFeedbacks = (PFNGLCREATETRANSFORMFEEDBACKSPROC)load("glCreateTransformFeedbacks"); + glad_glTransformFeedbackBufferBase = (PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)load("glTransformFeedbackBufferBase"); + glad_glTransformFeedbackBufferRange = (PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)load("glTransformFeedbackBufferRange"); + glad_glGetTransformFeedbackiv = (PFNGLGETTRANSFORMFEEDBACKIVPROC)load("glGetTransformFeedbackiv"); + glad_glGetTransformFeedbacki_v = (PFNGLGETTRANSFORMFEEDBACKI_VPROC)load("glGetTransformFeedbacki_v"); + glad_glGetTransformFeedbacki64_v = (PFNGLGETTRANSFORMFEEDBACKI64_VPROC)load("glGetTransformFeedbacki64_v"); + glad_glCreateBuffers = (PFNGLCREATEBUFFERSPROC)load("glCreateBuffers"); + glad_glNamedBufferStorage = (PFNGLNAMEDBUFFERSTORAGEPROC)load("glNamedBufferStorage"); + glad_glNamedBufferData = (PFNGLNAMEDBUFFERDATAPROC)load("glNamedBufferData"); + glad_glNamedBufferSubData = (PFNGLNAMEDBUFFERSUBDATAPROC)load("glNamedBufferSubData"); + glad_glCopyNamedBufferSubData = (PFNGLCOPYNAMEDBUFFERSUBDATAPROC)load("glCopyNamedBufferSubData"); + glad_glClearNamedBufferData = (PFNGLCLEARNAMEDBUFFERDATAPROC)load("glClearNamedBufferData"); + glad_glClearNamedBufferSubData = (PFNGLCLEARNAMEDBUFFERSUBDATAPROC)load("glClearNamedBufferSubData"); + glad_glMapNamedBuffer = (PFNGLMAPNAMEDBUFFERPROC)load("glMapNamedBuffer"); + glad_glMapNamedBufferRange = (PFNGLMAPNAMEDBUFFERRANGEPROC)load("glMapNamedBufferRange"); + glad_glUnmapNamedBuffer = (PFNGLUNMAPNAMEDBUFFERPROC)load("glUnmapNamedBuffer"); + glad_glFlushMappedNamedBufferRange = (PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)load("glFlushMappedNamedBufferRange"); + glad_glGetNamedBufferParameteriv = (PFNGLGETNAMEDBUFFERPARAMETERIVPROC)load("glGetNamedBufferParameteriv"); + glad_glGetNamedBufferParameteri64v = (PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)load("glGetNamedBufferParameteri64v"); + glad_glGetNamedBufferPointerv = (PFNGLGETNAMEDBUFFERPOINTERVPROC)load("glGetNamedBufferPointerv"); + glad_glGetNamedBufferSubData = (PFNGLGETNAMEDBUFFERSUBDATAPROC)load("glGetNamedBufferSubData"); + glad_glCreateFramebuffers = (PFNGLCREATEFRAMEBUFFERSPROC)load("glCreateFramebuffers"); + glad_glNamedFramebufferRenderbuffer = (PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)load("glNamedFramebufferRenderbuffer"); + glad_glNamedFramebufferParameteri = (PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)load("glNamedFramebufferParameteri"); + glad_glNamedFramebufferTexture = (PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)load("glNamedFramebufferTexture"); + glad_glNamedFramebufferTextureLayer = (PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)load("glNamedFramebufferTextureLayer"); + glad_glNamedFramebufferDrawBuffer = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)load("glNamedFramebufferDrawBuffer"); + glad_glNamedFramebufferDrawBuffers = (PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)load("glNamedFramebufferDrawBuffers"); + glad_glNamedFramebufferReadBuffer = (PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)load("glNamedFramebufferReadBuffer"); + glad_glInvalidateNamedFramebufferData = (PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)load("glInvalidateNamedFramebufferData"); + glad_glInvalidateNamedFramebufferSubData = (PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)load("glInvalidateNamedFramebufferSubData"); + glad_glClearNamedFramebufferiv = (PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)load("glClearNamedFramebufferiv"); + glad_glClearNamedFramebufferuiv = (PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)load("glClearNamedFramebufferuiv"); + glad_glClearNamedFramebufferfv = (PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)load("glClearNamedFramebufferfv"); + glad_glClearNamedFramebufferfi = (PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)load("glClearNamedFramebufferfi"); + glad_glBlitNamedFramebuffer = (PFNGLBLITNAMEDFRAMEBUFFERPROC)load("glBlitNamedFramebuffer"); + glad_glCheckNamedFramebufferStatus = (PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)load("glCheckNamedFramebufferStatus"); + glad_glGetNamedFramebufferParameteriv = (PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)load("glGetNamedFramebufferParameteriv"); + glad_glGetNamedFramebufferAttachmentParameteriv = (PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetNamedFramebufferAttachmentParameteriv"); + glad_glCreateRenderbuffers = (PFNGLCREATERENDERBUFFERSPROC)load("glCreateRenderbuffers"); + glad_glNamedRenderbufferStorage = (PFNGLNAMEDRENDERBUFFERSTORAGEPROC)load("glNamedRenderbufferStorage"); + glad_glNamedRenderbufferStorageMultisample = (PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glNamedRenderbufferStorageMultisample"); + glad_glGetNamedRenderbufferParameteriv = (PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)load("glGetNamedRenderbufferParameteriv"); + glad_glCreateTextures = (PFNGLCREATETEXTURESPROC)load("glCreateTextures"); + glad_glTextureBuffer = (PFNGLTEXTUREBUFFERPROC)load("glTextureBuffer"); + glad_glTextureBufferRange = (PFNGLTEXTUREBUFFERRANGEPROC)load("glTextureBufferRange"); + glad_glTextureStorage1D = (PFNGLTEXTURESTORAGE1DPROC)load("glTextureStorage1D"); + glad_glTextureStorage2D = (PFNGLTEXTURESTORAGE2DPROC)load("glTextureStorage2D"); + glad_glTextureStorage3D = (PFNGLTEXTURESTORAGE3DPROC)load("glTextureStorage3D"); + glad_glTextureStorage2DMultisample = (PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)load("glTextureStorage2DMultisample"); + glad_glTextureStorage3DMultisample = (PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)load("glTextureStorage3DMultisample"); + glad_glTextureSubImage1D = (PFNGLTEXTURESUBIMAGE1DPROC)load("glTextureSubImage1D"); + glad_glTextureSubImage2D = (PFNGLTEXTURESUBIMAGE2DPROC)load("glTextureSubImage2D"); + glad_glTextureSubImage3D = (PFNGLTEXTURESUBIMAGE3DPROC)load("glTextureSubImage3D"); + glad_glCompressedTextureSubImage1D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)load("glCompressedTextureSubImage1D"); + glad_glCompressedTextureSubImage2D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)load("glCompressedTextureSubImage2D"); + glad_glCompressedTextureSubImage3D = (PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)load("glCompressedTextureSubImage3D"); + glad_glCopyTextureSubImage1D = (PFNGLCOPYTEXTURESUBIMAGE1DPROC)load("glCopyTextureSubImage1D"); + glad_glCopyTextureSubImage2D = (PFNGLCOPYTEXTURESUBIMAGE2DPROC)load("glCopyTextureSubImage2D"); + glad_glCopyTextureSubImage3D = (PFNGLCOPYTEXTURESUBIMAGE3DPROC)load("glCopyTextureSubImage3D"); + glad_glTextureParameterf = (PFNGLTEXTUREPARAMETERFPROC)load("glTextureParameterf"); + glad_glTextureParameterfv = (PFNGLTEXTUREPARAMETERFVPROC)load("glTextureParameterfv"); + glad_glTextureParameteri = (PFNGLTEXTUREPARAMETERIPROC)load("glTextureParameteri"); + glad_glTextureParameterIiv = (PFNGLTEXTUREPARAMETERIIVPROC)load("glTextureParameterIiv"); + glad_glTextureParameterIuiv = (PFNGLTEXTUREPARAMETERIUIVPROC)load("glTextureParameterIuiv"); + glad_glTextureParameteriv = (PFNGLTEXTUREPARAMETERIVPROC)load("glTextureParameteriv"); + glad_glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC)load("glGenerateTextureMipmap"); + glad_glBindTextureUnit = (PFNGLBINDTEXTUREUNITPROC)load("glBindTextureUnit"); + glad_glGetTextureImage = (PFNGLGETTEXTUREIMAGEPROC)load("glGetTextureImage"); + glad_glGetCompressedTextureImage = (PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)load("glGetCompressedTextureImage"); + glad_glGetTextureLevelParameterfv = (PFNGLGETTEXTURELEVELPARAMETERFVPROC)load("glGetTextureLevelParameterfv"); + glad_glGetTextureLevelParameteriv = (PFNGLGETTEXTURELEVELPARAMETERIVPROC)load("glGetTextureLevelParameteriv"); + glad_glGetTextureParameterfv = (PFNGLGETTEXTUREPARAMETERFVPROC)load("glGetTextureParameterfv"); + glad_glGetTextureParameterIiv = (PFNGLGETTEXTUREPARAMETERIIVPROC)load("glGetTextureParameterIiv"); + glad_glGetTextureParameterIuiv = (PFNGLGETTEXTUREPARAMETERIUIVPROC)load("glGetTextureParameterIuiv"); + glad_glGetTextureParameteriv = (PFNGLGETTEXTUREPARAMETERIVPROC)load("glGetTextureParameteriv"); + glad_glCreateVertexArrays = (PFNGLCREATEVERTEXARRAYSPROC)load("glCreateVertexArrays"); + glad_glDisableVertexArrayAttrib = (PFNGLDISABLEVERTEXARRAYATTRIBPROC)load("glDisableVertexArrayAttrib"); + glad_glEnableVertexArrayAttrib = (PFNGLENABLEVERTEXARRAYATTRIBPROC)load("glEnableVertexArrayAttrib"); + glad_glVertexArrayElementBuffer = (PFNGLVERTEXARRAYELEMENTBUFFERPROC)load("glVertexArrayElementBuffer"); + glad_glVertexArrayVertexBuffer = (PFNGLVERTEXARRAYVERTEXBUFFERPROC)load("glVertexArrayVertexBuffer"); + glad_glVertexArrayVertexBuffers = (PFNGLVERTEXARRAYVERTEXBUFFERSPROC)load("glVertexArrayVertexBuffers"); + glad_glVertexArrayAttribBinding = (PFNGLVERTEXARRAYATTRIBBINDINGPROC)load("glVertexArrayAttribBinding"); + glad_glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC)load("glVertexArrayAttribFormat"); + glad_glVertexArrayAttribIFormat = (PFNGLVERTEXARRAYATTRIBIFORMATPROC)load("glVertexArrayAttribIFormat"); + glad_glVertexArrayAttribLFormat = (PFNGLVERTEXARRAYATTRIBLFORMATPROC)load("glVertexArrayAttribLFormat"); + glad_glVertexArrayBindingDivisor = (PFNGLVERTEXARRAYBINDINGDIVISORPROC)load("glVertexArrayBindingDivisor"); + glad_glGetVertexArrayiv = (PFNGLGETVERTEXARRAYIVPROC)load("glGetVertexArrayiv"); + glad_glGetVertexArrayIndexediv = (PFNGLGETVERTEXARRAYINDEXEDIVPROC)load("glGetVertexArrayIndexediv"); + glad_glGetVertexArrayIndexed64iv = (PFNGLGETVERTEXARRAYINDEXED64IVPROC)load("glGetVertexArrayIndexed64iv"); + glad_glCreateSamplers = (PFNGLCREATESAMPLERSPROC)load("glCreateSamplers"); + glad_glCreateProgramPipelines = (PFNGLCREATEPROGRAMPIPELINESPROC)load("glCreateProgramPipelines"); + glad_glCreateQueries = (PFNGLCREATEQUERIESPROC)load("glCreateQueries"); + glad_glGetQueryBufferObjecti64v = (PFNGLGETQUERYBUFFEROBJECTI64VPROC)load("glGetQueryBufferObjecti64v"); + glad_glGetQueryBufferObjectiv = (PFNGLGETQUERYBUFFEROBJECTIVPROC)load("glGetQueryBufferObjectiv"); + glad_glGetQueryBufferObjectui64v = (PFNGLGETQUERYBUFFEROBJECTUI64VPROC)load("glGetQueryBufferObjectui64v"); + glad_glGetQueryBufferObjectuiv = (PFNGLGETQUERYBUFFEROBJECTUIVPROC)load("glGetQueryBufferObjectuiv"); + glad_glMemoryBarrierByRegion = (PFNGLMEMORYBARRIERBYREGIONPROC)load("glMemoryBarrierByRegion"); + glad_glGetTextureSubImage = (PFNGLGETTEXTURESUBIMAGEPROC)load("glGetTextureSubImage"); + glad_glGetCompressedTextureSubImage = (PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)load("glGetCompressedTextureSubImage"); + glad_glGetGraphicsResetStatus = (PFNGLGETGRAPHICSRESETSTATUSPROC)load("glGetGraphicsResetStatus"); + glad_glGetnCompressedTexImage = (PFNGLGETNCOMPRESSEDTEXIMAGEPROC)load("glGetnCompressedTexImage"); + glad_glGetnTexImage = (PFNGLGETNTEXIMAGEPROC)load("glGetnTexImage"); + glad_glGetnUniformdv = (PFNGLGETNUNIFORMDVPROC)load("glGetnUniformdv"); + glad_glGetnUniformfv = (PFNGLGETNUNIFORMFVPROC)load("glGetnUniformfv"); + glad_glGetnUniformiv = (PFNGLGETNUNIFORMIVPROC)load("glGetnUniformiv"); + glad_glGetnUniformuiv = (PFNGLGETNUNIFORMUIVPROC)load("glGetnUniformuiv"); + glad_glReadnPixels = (PFNGLREADNPIXELSPROC)load("glReadnPixels"); + glad_glGetnMapdv = (PFNGLGETNMAPDVPROC)load("glGetnMapdv"); + glad_glGetnMapfv = (PFNGLGETNMAPFVPROC)load("glGetnMapfv"); + glad_glGetnMapiv = (PFNGLGETNMAPIVPROC)load("glGetnMapiv"); + glad_glGetnPixelMapfv = (PFNGLGETNPIXELMAPFVPROC)load("glGetnPixelMapfv"); + glad_glGetnPixelMapuiv = (PFNGLGETNPIXELMAPUIVPROC)load("glGetnPixelMapuiv"); + glad_glGetnPixelMapusv = (PFNGLGETNPIXELMAPUSVPROC)load("glGetnPixelMapusv"); + glad_glGetnPolygonStipple = (PFNGLGETNPOLYGONSTIPPLEPROC)load("glGetnPolygonStipple"); + glad_glGetnColorTable = (PFNGLGETNCOLORTABLEPROC)load("glGetnColorTable"); + glad_glGetnConvolutionFilter = (PFNGLGETNCONVOLUTIONFILTERPROC)load("glGetnConvolutionFilter"); + glad_glGetnSeparableFilter = (PFNGLGETNSEPARABLEFILTERPROC)load("glGetnSeparableFilter"); + glad_glGetnHistogram = (PFNGLGETNHISTOGRAMPROC)load("glGetnHistogram"); + glad_glGetnMinmax = (PFNGLGETNMINMAXPROC)load("glGetnMinmax"); + glad_glTextureBarrier = (PFNGLTEXTUREBARRIERPROC)load("glTextureBarrier"); +} +static void load_GL_VERSION_4_6(GLADloadproc load) { + if(!GLAD_GL_VERSION_4_6) return; + glad_glSpecializeShader = (PFNGLSPECIALIZESHADERPROC)load("glSpecializeShader"); + glad_glMultiDrawArraysIndirectCount = (PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC)load("glMultiDrawArraysIndirectCount"); + glad_glMultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC)load("glMultiDrawElementsIndirectCount"); + glad_glPolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC)load("glPolygonOffsetClamp"); +} +static void load_GL_EXT_framebuffer_multisample(GLADloadproc load) { + if(!GLAD_GL_EXT_framebuffer_multisample) return; + glad_glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)load("glRenderbufferStorageMultisampleEXT"); +} +static void load_GL_NV_texture_barrier(GLADloadproc load) { + if(!GLAD_GL_NV_texture_barrier) return; + glad_glTextureBarrierNV = (PFNGLTEXTUREBARRIERNVPROC)load("glTextureBarrierNV"); +} +static int find_extensionsGL(void) { + if (!get_exts()) return 0; + GLAD_GL_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample"); + GLAD_GL_EXT_texture_filter_anisotropic = has_ext("GL_EXT_texture_filter_anisotropic"); + GLAD_GL_NV_texture_barrier = has_ext("GL_NV_texture_barrier"); + free_exts(); + return 1; +} + +static void find_coreGL(void) { + + /* Thank you @elmindreda + * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 + * https://github.com/glfw/glfw/blob/master/src/context.c#L36 + */ + int i, major, minor; + + const char* version; + const char* prefixes[] = { + "OpenGL ES-CM ", + "OpenGL ES-CL ", + "OpenGL ES ", + NULL + }; + + version = (const char*) glGetString(GL_VERSION); + if (!version) return; + + for (i = 0; prefixes[i]; i++) { + const size_t length = strlen(prefixes[i]); + if (strncmp(version, prefixes[i], length) == 0) { + version += length; + break; + } + } + +/* PR #18 */ +#ifdef _MSC_VER + sscanf_s(version, "%d.%d", &major, &minor); +#else + sscanf(version, "%d.%d", &major, &minor); +#endif + + GLVersion.major = major; GLVersion.minor = minor; + max_loaded_major = major; max_loaded_minor = minor; + GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; + GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; + GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; + GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; + GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; + GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; + GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; + GLAD_GL_VERSION_4_0 = (major == 4 && minor >= 0) || major > 4; + GLAD_GL_VERSION_4_1 = (major == 4 && minor >= 1) || major > 4; + GLAD_GL_VERSION_4_2 = (major == 4 && minor >= 2) || major > 4; + GLAD_GL_VERSION_4_3 = (major == 4 && minor >= 3) || major > 4; + GLAD_GL_VERSION_4_4 = (major == 4 && minor >= 4) || major > 4; + GLAD_GL_VERSION_4_5 = (major == 4 && minor >= 5) || major > 4; + GLAD_GL_VERSION_4_6 = (major == 4 && minor >= 6) || major > 4; + if (GLVersion.major > 4 || (GLVersion.major >= 4 && GLVersion.minor >= 6)) { + max_loaded_major = 4; + max_loaded_minor = 6; + } +} + +int gladLoadGLLoader(GLADloadproc load) { + GLVersion.major = 0; GLVersion.minor = 0; + glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); + if(glGetString == NULL) return 0; + if(glGetString(GL_VERSION) == NULL) return 0; + find_coreGL(); + load_GL_VERSION_1_0(load); + load_GL_VERSION_1_1(load); + load_GL_VERSION_1_2(load); + load_GL_VERSION_1_3(load); + load_GL_VERSION_1_4(load); + load_GL_VERSION_1_5(load); + load_GL_VERSION_2_0(load); + load_GL_VERSION_2_1(load); + load_GL_VERSION_3_0(load); + load_GL_VERSION_3_1(load); + load_GL_VERSION_3_2(load); + load_GL_VERSION_3_3(load); + load_GL_VERSION_4_0(load); + load_GL_VERSION_4_1(load); + load_GL_VERSION_4_2(load); + load_GL_VERSION_4_3(load); + load_GL_VERSION_4_4(load); + load_GL_VERSION_4_5(load); + load_GL_VERSION_4_6(load); + + if (!find_extensionsGL()) return 0; + load_GL_EXT_framebuffer_multisample(load); + load_GL_NV_texture_barrier(load); + return GLVersion.major != 0 || GLVersion.minor != 0; +} + diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glad.h b/share/dotfiles/.config/glava/glava_repo/glava/glad.h new file mode 100644 index 00000000..47687042 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glad.h @@ -0,0 +1,5183 @@ +/* + + OpenGL loader generated by glad 0.1.24a0 on Tue Sep 10 15:02:41 2019. + + Language/Generator: C/C++ + Specification: gl + APIs: gl=4.6 + Profile: compatibility + Extensions: + GL_EXT_framebuffer_multisample, + GL_EXT_texture_filter_anisotropic, + GL_NV_texture_barrier + Loader: True + Local files: True + Omit khrplatform: False + + Commandline: + --profile="compatibility" --api="gl=4.6" --generator="c" --spec="gl" --local-files --extensions="GL_EXT_framebuffer_multisample,GL_EXT_texture_filter_anisotropic,GL_NV_texture_barrier" + Online: + http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.6&extensions=GL_EXT_framebuffer_multisample&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_NV_texture_barrier +*/ + + +#ifndef __glad_h_ +#define __glad_h_ + +#ifdef __gl_h_ +#error OpenGL header already included, remove this include, glad already provides it +#endif +#define __gl_h_ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#ifndef NOMINMAX +#define NOMINMAX 1 +#endif +#include <windows.h> +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct gladGLversionStruct { + int major; + int minor; +}; + +typedef void* (* GLADloadproc)(const char *name); + +#ifndef GLAPI +# if defined(GLAD_GLAPI_EXPORT) +# if defined(_WIN32) || defined(__CYGWIN__) +# if defined(GLAD_GLAPI_EXPORT_BUILD) +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllexport)) extern +# else +# define GLAPI __declspec(dllexport) extern +# endif +# else +# if defined(__GNUC__) +# define GLAPI __attribute__ ((dllimport)) extern +# else +# define GLAPI __declspec(dllimport) extern +# endif +# endif +# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) +# define GLAPI __attribute__ ((visibility ("default"))) extern +# else +# define GLAPI extern +# endif +# else +# define GLAPI extern +# endif +#endif + +GLAPI struct gladGLversionStruct GLVersion; + +GLAPI int gladLoadGL(void); + +GLAPI int gladLoadGLLoader(GLADloadproc); + +#include "khrplatform.h" +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef khronos_int8_t GLbyte; +typedef khronos_uint8_t GLubyte; +typedef khronos_int16_t GLshort; +typedef khronos_uint16_t GLushort; +typedef int GLint; +typedef unsigned int GLuint; +typedef khronos_int32_t GLclampx; +typedef int GLsizei; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef double GLdouble; +typedef double GLclampd; +typedef void *GLeglClientBufferEXT; +typedef void *GLeglImageOES; +typedef char GLchar; +typedef char GLcharARB; +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +typedef khronos_uint16_t GLhalf; +typedef khronos_uint16_t GLhalfARB; +typedef khronos_int32_t GLfixed; +typedef khronos_intptr_t GLintptr; +typedef khronos_intptr_t GLintptrARB; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_ssize_t GLsizeiptrARB; +typedef khronos_int64_t GLint64; +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64; +typedef khronos_uint64_t GLuint64EXT; +typedef struct __GLsync *GLsync; +struct _cl_context; +struct _cl_event; +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +typedef unsigned short GLhalfNV; +typedef GLintptr GLvdpauSurfaceNV; +typedef void (APIENTRY *GLVULKANPROCNV)(void); +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_NONE 0 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_VIEWPORT 0x0BA2 +#define GL_DITHER 0x0BD0 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND 0x0BE2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_READ_BUFFER 0x0C02 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F +#define GL_TEXTURE 0x1702 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_STENCIL_INDEX 0x1901 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_REPEAT 0x2901 +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 +#define GL_ACCUM 0x0100 +#define GL_LOAD 0x0101 +#define GL_RETURN 0x0102 +#define GL_MULT 0x0103 +#define GL_ADD 0x0104 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LIST_MODE 0x0B30 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_SHADE_MODEL 0x0B54 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG 0x0B60 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_LOGIC_OP 0x0BF1 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_INDEX_MODE 0x0C30 +#define GL_RGBA_MODE 0x0C31 +#define GL_RENDER_MODE 0x0C40 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_FOG_HINT 0x0C54 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_INDEX_BITS 0x0D51 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_COLOR_INDEX 0x1900 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_BITMAP 0x1A00 +#define GL_RENDER 0x1C00 +#define GL_FEEDBACK 0x1C01 +#define GL_SELECT 0x1C02 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_ENV 0x2300 +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 +#define GL_CLAMP 0x2900 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_DOUBLE 0x140A +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_FUNC_SUBTRACT 0x800A +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC2_ALPHA 0x858A +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFF +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_INT_2_10_10_10_REV 0x8D9F +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F +#define GL_DISPLAY_LIST 0x82E7 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 +#define GL_CLEAR_TEXTURE 0x9365 +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +#define GL_SHADER_BINARY_FORMAT_SPIR_V 0x9551 +#define GL_SPIR_V_BINARY 0x9552 +#define GL_PARAMETER_BUFFER 0x80EE +#define GL_PARAMETER_BUFFER_BINDING 0x80EF +#define GL_CONTEXT_FLAG_NO_ERROR_BIT 0x00000008 +#define GL_VERTICES_SUBMITTED 0x82EE +#define GL_PRIMITIVES_SUBMITTED 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES 0x82F7 +#define GL_POLYGON_OFFSET_CLAMP 0x8E1B +#define GL_SPIR_V_EXTENSIONS 0x9553 +#define GL_NUM_SPIR_V_EXTENSIONS 0x9554 +#define GL_TEXTURE_MAX_ANISOTROPY 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY 0x84FF +#define GL_TRANSFORM_FEEDBACK_OVERFLOW 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW 0x82ED +#ifndef GL_VERSION_1_0 +#define GL_VERSION_1_0 1 +GLAPI int GLAD_GL_VERSION_1_0; +typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); +GLAPI PFNGLCULLFACEPROC glad_glCullFace; +#define glCullFace glad_glCullFace +typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); +GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; +#define glFrontFace glad_glFrontFace +typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); +GLAPI PFNGLHINTPROC glad_glHint; +#define glHint glad_glHint +typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); +GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; +#define glLineWidth glad_glLineWidth +typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); +GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; +#define glPointSize glad_glPointSize +typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); +GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; +#define glPolygonMode glad_glPolygonMode +typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLSCISSORPROC glad_glScissor; +#define glScissor glad_glScissor +typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); +GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +#define glTexParameterf glad_glTexParameterf +typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +#define glTexParameterfv glad_glTexParameterfv +typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +#define glTexParameteri glad_glTexParameteri +typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +#define glTexParameteriv glad_glTexParameteriv +typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; +#define glTexImage1D glad_glTexImage1D +typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +#define glTexImage2D glad_glTexImage2D +typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); +GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; +#define glDrawBuffer glad_glDrawBuffer +typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); +GLAPI PFNGLCLEARPROC glad_glClear; +#define glClear glad_glClear +typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; +#define glClearColor glad_glClearColor +typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); +GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; +#define glClearStencil glad_glClearStencil +typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); +GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; +#define glClearDepth glad_glClearDepth +typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); +GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; +#define glStencilMask glad_glStencilMask +typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI PFNGLCOLORMASKPROC glad_glColorMask; +#define glColorMask glad_glColorMask +typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); +GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; +#define glDepthMask glad_glDepthMask +typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); +GLAPI PFNGLDISABLEPROC glad_glDisable; +#define glDisable glad_glDisable +typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); +GLAPI PFNGLENABLEPROC glad_glEnable; +#define glEnable glad_glEnable +typedef void (APIENTRYP PFNGLFINISHPROC)(void); +GLAPI PFNGLFINISHPROC glad_glFinish; +#define glFinish glad_glFinish +typedef void (APIENTRYP PFNGLFLUSHPROC)(void); +GLAPI PFNGLFLUSHPROC glad_glFlush; +#define glFlush glad_glFlush +typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; +#define glBlendFunc glad_glBlendFunc +typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); +GLAPI PFNGLLOGICOPPROC glad_glLogicOp; +#define glLogicOp glad_glLogicOp +typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; +#define glStencilFunc glad_glStencilFunc +typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; +#define glStencilOp glad_glStencilOp +typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); +GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; +#define glDepthFunc glad_glDepthFunc +typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; +#define glPixelStoref glad_glPixelStoref +typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; +#define glPixelStorei glad_glPixelStorei +typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); +GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; +#define glReadBuffer glad_glReadBuffer +typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; +#define glReadPixels glad_glReadPixels +typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); +GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +#define glGetBooleanv glad_glGetBooleanv +typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); +GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; +#define glGetDoublev glad_glGetDoublev +typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); +GLAPI PFNGLGETERRORPROC glad_glGetError; +#define glGetError glad_glGetError +typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); +GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; +#define glGetFloatv glad_glGetFloatv +typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); +GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; +#define glGetIntegerv glad_glGetIntegerv +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); +GLAPI PFNGLGETSTRINGPROC glad_glGetString; +#define glGetString glad_glGetString +typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; +#define glGetTexImage glad_glGetTexImage +typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +#define glGetTexParameterfv glad_glGetTexParameterfv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +#define glGetTexParameteriv glad_glGetTexParameteriv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; +#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; +#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv +typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); +GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; +#define glIsEnabled glad_glIsEnabled +typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); +GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; +#define glDepthRange glad_glDepthRange +typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLVIEWPORTPROC glad_glViewport; +#define glViewport glad_glViewport +typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode); +GLAPI PFNGLNEWLISTPROC glad_glNewList; +#define glNewList glad_glNewList +typedef void (APIENTRYP PFNGLENDLISTPROC)(void); +GLAPI PFNGLENDLISTPROC glad_glEndList; +#define glEndList glad_glEndList +typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list); +GLAPI PFNGLCALLLISTPROC glad_glCallList; +#define glCallList glad_glCallList +typedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists); +GLAPI PFNGLCALLLISTSPROC glad_glCallLists; +#define glCallLists glad_glCallLists +typedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); +GLAPI PFNGLDELETELISTSPROC glad_glDeleteLists; +#define glDeleteLists glad_glDeleteLists +typedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range); +GLAPI PFNGLGENLISTSPROC glad_glGenLists; +#define glGenLists glad_glGenLists +typedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base); +GLAPI PFNGLLISTBASEPROC glad_glListBase; +#define glListBase glad_glListBase +typedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode); +GLAPI PFNGLBEGINPROC glad_glBegin; +#define glBegin glad_glBegin +typedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); +GLAPI PFNGLBITMAPPROC glad_glBitmap; +#define glBitmap glad_glBitmap +typedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLCOLOR3BPROC glad_glColor3b; +#define glColor3b glad_glColor3b +typedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR3BVPROC glad_glColor3bv; +#define glColor3bv glad_glColor3bv +typedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLCOLOR3DPROC glad_glColor3d; +#define glColor3d glad_glColor3d +typedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR3DVPROC glad_glColor3dv; +#define glColor3dv glad_glColor3dv +typedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLCOLOR3FPROC glad_glColor3f; +#define glColor3f glad_glColor3f +typedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR3FVPROC glad_glColor3fv; +#define glColor3fv glad_glColor3fv +typedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLCOLOR3IPROC glad_glColor3i; +#define glColor3i glad_glColor3i +typedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR3IVPROC glad_glColor3iv; +#define glColor3iv glad_glColor3iv +typedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLCOLOR3SPROC glad_glColor3s; +#define glColor3s glad_glColor3s +typedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR3SVPROC glad_glColor3sv; +#define glColor3sv glad_glColor3sv +typedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLCOLOR3UBPROC glad_glColor3ub; +#define glColor3ub glad_glColor3ub +typedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv; +#define glColor3ubv glad_glColor3ubv +typedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLCOLOR3UIPROC glad_glColor3ui; +#define glColor3ui glad_glColor3ui +typedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv; +#define glColor3uiv glad_glColor3uiv +typedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLCOLOR3USPROC glad_glColor3us; +#define glColor3us glad_glColor3us +typedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR3USVPROC glad_glColor3usv; +#define glColor3usv glad_glColor3usv +typedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI PFNGLCOLOR4BPROC glad_glColor4b; +#define glColor4b glad_glColor4b +typedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v); +GLAPI PFNGLCOLOR4BVPROC glad_glColor4bv; +#define glColor4bv glad_glColor4bv +typedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI PFNGLCOLOR4DPROC glad_glColor4d; +#define glColor4d glad_glColor4d +typedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v); +GLAPI PFNGLCOLOR4DVPROC glad_glColor4dv; +#define glColor4dv glad_glColor4dv +typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCOLOR4FPROC glad_glColor4f; +#define glColor4f glad_glColor4f +typedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v); +GLAPI PFNGLCOLOR4FVPROC glad_glColor4fv; +#define glColor4fv glad_glColor4fv +typedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); +GLAPI PFNGLCOLOR4IPROC glad_glColor4i; +#define glColor4i glad_glColor4i +typedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v); +GLAPI PFNGLCOLOR4IVPROC glad_glColor4iv; +#define glColor4iv glad_glColor4iv +typedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI PFNGLCOLOR4SPROC glad_glColor4s; +#define glColor4s glad_glColor4s +typedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v); +GLAPI PFNGLCOLOR4SVPROC glad_glColor4sv; +#define glColor4sv glad_glColor4sv +typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; +#define glColor4ub glad_glColor4ub +typedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v); +GLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv; +#define glColor4ubv glad_glColor4ubv +typedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI PFNGLCOLOR4UIPROC glad_glColor4ui; +#define glColor4ui glad_glColor4ui +typedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v); +GLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv; +#define glColor4uiv glad_glColor4uiv +typedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI PFNGLCOLOR4USPROC glad_glColor4us; +#define glColor4us glad_glColor4us +typedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v); +GLAPI PFNGLCOLOR4USVPROC glad_glColor4usv; +#define glColor4usv glad_glColor4usv +typedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag); +GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag; +#define glEdgeFlag glad_glEdgeFlag +typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag); +GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; +#define glEdgeFlagv glad_glEdgeFlagv +typedef void (APIENTRYP PFNGLENDPROC)(void); +GLAPI PFNGLENDPROC glad_glEnd; +#define glEnd glad_glEnd +typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c); +GLAPI PFNGLINDEXDPROC glad_glIndexd; +#define glIndexd glad_glIndexd +typedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c); +GLAPI PFNGLINDEXDVPROC glad_glIndexdv; +#define glIndexdv glad_glIndexdv +typedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c); +GLAPI PFNGLINDEXFPROC glad_glIndexf; +#define glIndexf glad_glIndexf +typedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c); +GLAPI PFNGLINDEXFVPROC glad_glIndexfv; +#define glIndexfv glad_glIndexfv +typedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c); +GLAPI PFNGLINDEXIPROC glad_glIndexi; +#define glIndexi glad_glIndexi +typedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c); +GLAPI PFNGLINDEXIVPROC glad_glIndexiv; +#define glIndexiv glad_glIndexiv +typedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c); +GLAPI PFNGLINDEXSPROC glad_glIndexs; +#define glIndexs glad_glIndexs +typedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c); +GLAPI PFNGLINDEXSVPROC glad_glIndexsv; +#define glIndexsv glad_glIndexsv +typedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI PFNGLNORMAL3BPROC glad_glNormal3b; +#define glNormal3b glad_glNormal3b +typedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v); +GLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv; +#define glNormal3bv glad_glNormal3bv +typedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI PFNGLNORMAL3DPROC glad_glNormal3d; +#define glNormal3d glad_glNormal3d +typedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v); +GLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv; +#define glNormal3dv glad_glNormal3dv +typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; +#define glNormal3f glad_glNormal3f +typedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v); +GLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv; +#define glNormal3fv glad_glNormal3fv +typedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); +GLAPI PFNGLNORMAL3IPROC glad_glNormal3i; +#define glNormal3i glad_glNormal3i +typedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v); +GLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv; +#define glNormal3iv glad_glNormal3iv +typedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); +GLAPI PFNGLNORMAL3SPROC glad_glNormal3s; +#define glNormal3s glad_glNormal3s +typedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v); +GLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv; +#define glNormal3sv glad_glNormal3sv +typedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d; +#define glRasterPos2d glad_glRasterPos2d +typedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; +#define glRasterPos2dv glad_glRasterPos2dv +typedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f; +#define glRasterPos2f glad_glRasterPos2f +typedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; +#define glRasterPos2fv glad_glRasterPos2fv +typedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i; +#define glRasterPos2i glad_glRasterPos2i +typedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; +#define glRasterPos2iv glad_glRasterPos2iv +typedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s; +#define glRasterPos2s glad_glRasterPos2s +typedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; +#define glRasterPos2sv glad_glRasterPos2sv +typedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d; +#define glRasterPos3d glad_glRasterPos3d +typedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; +#define glRasterPos3dv glad_glRasterPos3dv +typedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f; +#define glRasterPos3f glad_glRasterPos3f +typedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; +#define glRasterPos3fv glad_glRasterPos3fv +typedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i; +#define glRasterPos3i glad_glRasterPos3i +typedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; +#define glRasterPos3iv glad_glRasterPos3iv +typedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s; +#define glRasterPos3s glad_glRasterPos3s +typedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; +#define glRasterPos3sv glad_glRasterPos3sv +typedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d; +#define glRasterPos4d glad_glRasterPos4d +typedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v); +GLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; +#define glRasterPos4dv glad_glRasterPos4dv +typedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f; +#define glRasterPos4f glad_glRasterPos4f +typedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v); +GLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; +#define glRasterPos4fv glad_glRasterPos4fv +typedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i; +#define glRasterPos4i glad_glRasterPos4i +typedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v); +GLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; +#define glRasterPos4iv glad_glRasterPos4iv +typedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s; +#define glRasterPos4s glad_glRasterPos4s +typedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v); +GLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; +#define glRasterPos4sv glad_glRasterPos4sv +typedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +GLAPI PFNGLRECTDPROC glad_glRectd; +#define glRectd glad_glRectd +typedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2); +GLAPI PFNGLRECTDVPROC glad_glRectdv; +#define glRectdv glad_glRectdv +typedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +GLAPI PFNGLRECTFPROC glad_glRectf; +#define glRectf glad_glRectf +typedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2); +GLAPI PFNGLRECTFVPROC glad_glRectfv; +#define glRectfv glad_glRectfv +typedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); +GLAPI PFNGLRECTIPROC glad_glRecti; +#define glRecti glad_glRecti +typedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2); +GLAPI PFNGLRECTIVPROC glad_glRectiv; +#define glRectiv glad_glRectiv +typedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +GLAPI PFNGLRECTSPROC glad_glRects; +#define glRects glad_glRects +typedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2); +GLAPI PFNGLRECTSVPROC glad_glRectsv; +#define glRectsv glad_glRectsv +typedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s); +GLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d; +#define glTexCoord1d glad_glTexCoord1d +typedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; +#define glTexCoord1dv glad_glTexCoord1dv +typedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s); +GLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f; +#define glTexCoord1f glad_glTexCoord1f +typedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; +#define glTexCoord1fv glad_glTexCoord1fv +typedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s); +GLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i; +#define glTexCoord1i glad_glTexCoord1i +typedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; +#define glTexCoord1iv glad_glTexCoord1iv +typedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s); +GLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s; +#define glTexCoord1s glad_glTexCoord1s +typedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; +#define glTexCoord1sv glad_glTexCoord1sv +typedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); +GLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d; +#define glTexCoord2d glad_glTexCoord2d +typedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; +#define glTexCoord2dv glad_glTexCoord2dv +typedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); +GLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f; +#define glTexCoord2f glad_glTexCoord2f +typedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; +#define glTexCoord2fv glad_glTexCoord2fv +typedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t); +GLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i; +#define glTexCoord2i glad_glTexCoord2i +typedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; +#define glTexCoord2iv glad_glTexCoord2iv +typedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); +GLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s; +#define glTexCoord2s glad_glTexCoord2s +typedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; +#define glTexCoord2sv glad_glTexCoord2sv +typedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d; +#define glTexCoord3d glad_glTexCoord3d +typedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; +#define glTexCoord3dv glad_glTexCoord3dv +typedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLTEXCOORD3FPROC glad_glTexCoord3f; +#define glTexCoord3f glad_glTexCoord3f +typedef void (APIENTRYP PFNGLTEXCOORD3FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; +#define glTexCoord3fv glad_glTexCoord3fv +typedef void (APIENTRYP PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); +GLAPI PFNGLTEXCOORD3IPROC glad_glTexCoord3i; +#define glTexCoord3i glad_glTexCoord3i +typedef void (APIENTRYP PFNGLTEXCOORD3IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; +#define glTexCoord3iv glad_glTexCoord3iv +typedef void (APIENTRYP PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); +GLAPI PFNGLTEXCOORD3SPROC glad_glTexCoord3s; +#define glTexCoord3s glad_glTexCoord3s +typedef void (APIENTRYP PFNGLTEXCOORD3SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; +#define glTexCoord3sv glad_glTexCoord3sv +typedef void (APIENTRYP PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLTEXCOORD4DPROC glad_glTexCoord4d; +#define glTexCoord4d glad_glTexCoord4d +typedef void (APIENTRYP PFNGLTEXCOORD4DVPROC)(const GLdouble *v); +GLAPI PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; +#define glTexCoord4dv glad_glTexCoord4dv +typedef void (APIENTRYP PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLTEXCOORD4FPROC glad_glTexCoord4f; +#define glTexCoord4f glad_glTexCoord4f +typedef void (APIENTRYP PFNGLTEXCOORD4FVPROC)(const GLfloat *v); +GLAPI PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; +#define glTexCoord4fv glad_glTexCoord4fv +typedef void (APIENTRYP PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLTEXCOORD4IPROC glad_glTexCoord4i; +#define glTexCoord4i glad_glTexCoord4i +typedef void (APIENTRYP PFNGLTEXCOORD4IVPROC)(const GLint *v); +GLAPI PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; +#define glTexCoord4iv glad_glTexCoord4iv +typedef void (APIENTRYP PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLTEXCOORD4SPROC glad_glTexCoord4s; +#define glTexCoord4s glad_glTexCoord4s +typedef void (APIENTRYP PFNGLTEXCOORD4SVPROC)(const GLshort *v); +GLAPI PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; +#define glTexCoord4sv glad_glTexCoord4sv +typedef void (APIENTRYP PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLVERTEX2DPROC glad_glVertex2d; +#define glVertex2d glad_glVertex2d +typedef void (APIENTRYP PFNGLVERTEX2DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX2DVPROC glad_glVertex2dv; +#define glVertex2dv glad_glVertex2dv +typedef void (APIENTRYP PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLVERTEX2FPROC glad_glVertex2f; +#define glVertex2f glad_glVertex2f +typedef void (APIENTRYP PFNGLVERTEX2FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX2FVPROC glad_glVertex2fv; +#define glVertex2fv glad_glVertex2fv +typedef void (APIENTRYP PFNGLVERTEX2IPROC)(GLint x, GLint y); +GLAPI PFNGLVERTEX2IPROC glad_glVertex2i; +#define glVertex2i glad_glVertex2i +typedef void (APIENTRYP PFNGLVERTEX2IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX2IVPROC glad_glVertex2iv; +#define glVertex2iv glad_glVertex2iv +typedef void (APIENTRYP PFNGLVERTEX2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLVERTEX2SPROC glad_glVertex2s; +#define glVertex2s glad_glVertex2s +typedef void (APIENTRYP PFNGLVERTEX2SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX2SVPROC glad_glVertex2sv; +#define glVertex2sv glad_glVertex2sv +typedef void (APIENTRYP PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEX3DPROC glad_glVertex3d; +#define glVertex3d glad_glVertex3d +typedef void (APIENTRYP PFNGLVERTEX3DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX3DVPROC glad_glVertex3dv; +#define glVertex3dv glad_glVertex3dv +typedef void (APIENTRYP PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEX3FPROC glad_glVertex3f; +#define glVertex3f glad_glVertex3f +typedef void (APIENTRYP PFNGLVERTEX3FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX3FVPROC glad_glVertex3fv; +#define glVertex3fv glad_glVertex3fv +typedef void (APIENTRYP PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLVERTEX3IPROC glad_glVertex3i; +#define glVertex3i glad_glVertex3i +typedef void (APIENTRYP PFNGLVERTEX3IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX3IVPROC glad_glVertex3iv; +#define glVertex3iv glad_glVertex3iv +typedef void (APIENTRYP PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEX3SPROC glad_glVertex3s; +#define glVertex3s glad_glVertex3s +typedef void (APIENTRYP PFNGLVERTEX3SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX3SVPROC glad_glVertex3sv; +#define glVertex3sv glad_glVertex3sv +typedef void (APIENTRYP PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEX4DPROC glad_glVertex4d; +#define glVertex4d glad_glVertex4d +typedef void (APIENTRYP PFNGLVERTEX4DVPROC)(const GLdouble *v); +GLAPI PFNGLVERTEX4DVPROC glad_glVertex4dv; +#define glVertex4dv glad_glVertex4dv +typedef void (APIENTRYP PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEX4FPROC glad_glVertex4f; +#define glVertex4f glad_glVertex4f +typedef void (APIENTRYP PFNGLVERTEX4FVPROC)(const GLfloat *v); +GLAPI PFNGLVERTEX4FVPROC glad_glVertex4fv; +#define glVertex4fv glad_glVertex4fv +typedef void (APIENTRYP PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLVERTEX4IPROC glad_glVertex4i; +#define glVertex4i glad_glVertex4i +typedef void (APIENTRYP PFNGLVERTEX4IVPROC)(const GLint *v); +GLAPI PFNGLVERTEX4IVPROC glad_glVertex4iv; +#define glVertex4iv glad_glVertex4iv +typedef void (APIENTRYP PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEX4SPROC glad_glVertex4s; +#define glVertex4s glad_glVertex4s +typedef void (APIENTRYP PFNGLVERTEX4SVPROC)(const GLshort *v); +GLAPI PFNGLVERTEX4SVPROC glad_glVertex4sv; +#define glVertex4sv glad_glVertex4sv +typedef void (APIENTRYP PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble *equation); +GLAPI PFNGLCLIPPLANEPROC glad_glClipPlane; +#define glClipPlane glad_glClipPlane +typedef void (APIENTRYP PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); +GLAPI PFNGLCOLORMATERIALPROC glad_glColorMaterial; +#define glColorMaterial glad_glColorMaterial +typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLFOGFPROC glad_glFogf; +#define glFogf glad_glFogf +typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLFOGFVPROC glad_glFogfv; +#define glFogfv glad_glFogfv +typedef void (APIENTRYP PFNGLFOGIPROC)(GLenum pname, GLint param); +GLAPI PFNGLFOGIPROC glad_glFogi; +#define glFogi glad_glFogi +typedef void (APIENTRYP PFNGLFOGIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLFOGIVPROC glad_glFogiv; +#define glFogiv glad_glFogiv +typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTFPROC glad_glLightf; +#define glLightf glad_glLightf +typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTFVPROC glad_glLightfv; +#define glLightfv glad_glLightfv +typedef void (APIENTRYP PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); +GLAPI PFNGLLIGHTIPROC glad_glLighti; +#define glLighti glad_glLighti +typedef void (APIENTRYP PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTIVPROC glad_glLightiv; +#define glLightiv glad_glLightiv +typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; +#define glLightModelf glad_glLightModelf +typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; +#define glLightModelfv glad_glLightModelfv +typedef void (APIENTRYP PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); +GLAPI PFNGLLIGHTMODELIPROC glad_glLightModeli; +#define glLightModeli glad_glLightModeli +typedef void (APIENTRYP PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLLIGHTMODELIVPROC glad_glLightModeliv; +#define glLightModeliv glad_glLightModeliv +typedef void (APIENTRYP PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); +GLAPI PFNGLLINESTIPPLEPROC glad_glLineStipple; +#define glLineStipple glad_glLineStipple +typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); +GLAPI PFNGLMATERIALFPROC glad_glMaterialf; +#define glMaterialf glad_glMaterialf +typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); +GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; +#define glMaterialfv glad_glMaterialfv +typedef void (APIENTRYP PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); +GLAPI PFNGLMATERIALIPROC glad_glMateriali; +#define glMateriali glad_glMateriali +typedef void (APIENTRYP PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint *params); +GLAPI PFNGLMATERIALIVPROC glad_glMaterialiv; +#define glMaterialiv glad_glMaterialiv +typedef void (APIENTRYP PFNGLPOLYGONSTIPPLEPROC)(const GLubyte *mask); +GLAPI PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; +#define glPolygonStipple glad_glPolygonStipple +typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); +GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; +#define glShadeModel glad_glShadeModel +typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); +GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; +#define glTexEnvf glad_glTexEnvf +typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; +#define glTexEnvfv glad_glTexEnvfv +typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; +#define glTexEnvi glad_glTexEnvi +typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; +#define glTexEnviv glad_glTexEnviv +typedef void (APIENTRYP PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); +GLAPI PFNGLTEXGENDPROC glad_glTexGend; +#define glTexGend glad_glTexGend +typedef void (APIENTRYP PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble *params); +GLAPI PFNGLTEXGENDVPROC glad_glTexGendv; +#define glTexGendv glad_glTexGendv +typedef void (APIENTRYP PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); +GLAPI PFNGLTEXGENFPROC glad_glTexGenf; +#define glTexGenf glad_glTexGenf +typedef void (APIENTRYP PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat *params); +GLAPI PFNGLTEXGENFVPROC glad_glTexGenfv; +#define glTexGenfv glad_glTexGenfv +typedef void (APIENTRYP PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); +GLAPI PFNGLTEXGENIPROC glad_glTexGeni; +#define glTexGeni glad_glTexGeni +typedef void (APIENTRYP PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint *params); +GLAPI PFNGLTEXGENIVPROC glad_glTexGeniv; +#define glTexGeniv glad_glTexGeniv +typedef void (APIENTRYP PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat *buffer); +GLAPI PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; +#define glFeedbackBuffer glad_glFeedbackBuffer +typedef void (APIENTRYP PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint *buffer); +GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer; +#define glSelectBuffer glad_glSelectBuffer +typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode); +GLAPI PFNGLRENDERMODEPROC glad_glRenderMode; +#define glRenderMode glad_glRenderMode +typedef void (APIENTRYP PFNGLINITNAMESPROC)(void); +GLAPI PFNGLINITNAMESPROC glad_glInitNames; +#define glInitNames glad_glInitNames +typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name); +GLAPI PFNGLLOADNAMEPROC glad_glLoadName; +#define glLoadName glad_glLoadName +typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token); +GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough; +#define glPassThrough glad_glPassThrough +typedef void (APIENTRYP PFNGLPOPNAMEPROC)(void); +GLAPI PFNGLPOPNAMEPROC glad_glPopName; +#define glPopName glad_glPopName +typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name); +GLAPI PFNGLPUSHNAMEPROC glad_glPushName; +#define glPushName glad_glPushName +typedef void (APIENTRYP PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLCLEARACCUMPROC glad_glClearAccum; +#define glClearAccum glad_glClearAccum +typedef void (APIENTRYP PFNGLCLEARINDEXPROC)(GLfloat c); +GLAPI PFNGLCLEARINDEXPROC glad_glClearIndex; +#define glClearIndex glad_glClearIndex +typedef void (APIENTRYP PFNGLINDEXMASKPROC)(GLuint mask); +GLAPI PFNGLINDEXMASKPROC glad_glIndexMask; +#define glIndexMask glad_glIndexMask +typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value); +GLAPI PFNGLACCUMPROC glad_glAccum; +#define glAccum glad_glAccum +typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(void); +GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib; +#define glPopAttrib glad_glPopAttrib +typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHATTRIBPROC glad_glPushAttrib; +#define glPushAttrib glad_glPushAttrib +typedef void (APIENTRYP PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI PFNGLMAP1DPROC glad_glMap1d; +#define glMap1d glad_glMap1d +typedef void (APIENTRYP PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI PFNGLMAP1FPROC glad_glMap1f; +#define glMap1f glad_glMap1f +typedef void (APIENTRYP PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI PFNGLMAP2DPROC glad_glMap2d; +#define glMap2d glad_glMap2d +typedef void (APIENTRYP PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +GLAPI PFNGLMAP2FPROC glad_glMap2f; +#define glMap2f glad_glMap2f +typedef void (APIENTRYP PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); +GLAPI PFNGLMAPGRID1DPROC glad_glMapGrid1d; +#define glMapGrid1d glad_glMapGrid1d +typedef void (APIENTRYP PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); +GLAPI PFNGLMAPGRID1FPROC glad_glMapGrid1f; +#define glMapGrid1f glad_glMapGrid1f +typedef void (APIENTRYP PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +GLAPI PFNGLMAPGRID2DPROC glad_glMapGrid2d; +#define glMapGrid2d glad_glMapGrid2d +typedef void (APIENTRYP PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +GLAPI PFNGLMAPGRID2FPROC glad_glMapGrid2f; +#define glMapGrid2f glad_glMapGrid2f +typedef void (APIENTRYP PFNGLEVALCOORD1DPROC)(GLdouble u); +GLAPI PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; +#define glEvalCoord1d glad_glEvalCoord1d +typedef void (APIENTRYP PFNGLEVALCOORD1DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; +#define glEvalCoord1dv glad_glEvalCoord1dv +typedef void (APIENTRYP PFNGLEVALCOORD1FPROC)(GLfloat u); +GLAPI PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; +#define glEvalCoord1f glad_glEvalCoord1f +typedef void (APIENTRYP PFNGLEVALCOORD1FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; +#define glEvalCoord1fv glad_glEvalCoord1fv +typedef void (APIENTRYP PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); +GLAPI PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; +#define glEvalCoord2d glad_glEvalCoord2d +typedef void (APIENTRYP PFNGLEVALCOORD2DVPROC)(const GLdouble *u); +GLAPI PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; +#define glEvalCoord2dv glad_glEvalCoord2dv +typedef void (APIENTRYP PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); +GLAPI PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; +#define glEvalCoord2f glad_glEvalCoord2f +typedef void (APIENTRYP PFNGLEVALCOORD2FVPROC)(const GLfloat *u); +GLAPI PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; +#define glEvalCoord2fv glad_glEvalCoord2fv +typedef void (APIENTRYP PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); +GLAPI PFNGLEVALMESH1PROC glad_glEvalMesh1; +#define glEvalMesh1 glad_glEvalMesh1 +typedef void (APIENTRYP PFNGLEVALPOINT1PROC)(GLint i); +GLAPI PFNGLEVALPOINT1PROC glad_glEvalPoint1; +#define glEvalPoint1 glad_glEvalPoint1 +typedef void (APIENTRYP PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +GLAPI PFNGLEVALMESH2PROC glad_glEvalMesh2; +#define glEvalMesh2 glad_glEvalMesh2 +typedef void (APIENTRYP PFNGLEVALPOINT2PROC)(GLint i, GLint j); +GLAPI PFNGLEVALPOINT2PROC glad_glEvalPoint2; +#define glEvalPoint2 glad_glEvalPoint2 +typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); +GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; +#define glAlphaFunc glad_glAlphaFunc +typedef void (APIENTRYP PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); +GLAPI PFNGLPIXELZOOMPROC glad_glPixelZoom; +#define glPixelZoom glad_glPixelZoom +typedef void (APIENTRYP PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; +#define glPixelTransferf glad_glPixelTransferf +typedef void (APIENTRYP PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; +#define glPixelTransferi glad_glPixelTransferi +typedef void (APIENTRYP PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat *values); +GLAPI PFNGLPIXELMAPFVPROC glad_glPixelMapfv; +#define glPixelMapfv glad_glPixelMapfv +typedef void (APIENTRYP PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint *values); +GLAPI PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; +#define glPixelMapuiv glad_glPixelMapuiv +typedef void (APIENTRYP PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort *values); +GLAPI PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; +#define glPixelMapusv glad_glPixelMapusv +typedef void (APIENTRYP PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +GLAPI PFNGLCOPYPIXELSPROC glad_glCopyPixels; +#define glCopyPixels glad_glCopyPixels +typedef void (APIENTRYP PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLDRAWPIXELSPROC glad_glDrawPixels; +#define glDrawPixels glad_glDrawPixels +typedef void (APIENTRYP PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble *equation); +GLAPI PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; +#define glGetClipPlane glad_glGetClipPlane +typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); +GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; +#define glGetLightfv glad_glGetLightfv +typedef void (APIENTRYP PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint *params); +GLAPI PFNGLGETLIGHTIVPROC glad_glGetLightiv; +#define glGetLightiv glad_glGetLightiv +typedef void (APIENTRYP PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble *v); +GLAPI PFNGLGETMAPDVPROC glad_glGetMapdv; +#define glGetMapdv glad_glGetMapdv +typedef void (APIENTRYP PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat *v); +GLAPI PFNGLGETMAPFVPROC glad_glGetMapfv; +#define glGetMapfv glad_glGetMapfv +typedef void (APIENTRYP PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint *v); +GLAPI PFNGLGETMAPIVPROC glad_glGetMapiv; +#define glGetMapiv glad_glGetMapiv +typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); +GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; +#define glGetMaterialfv glad_glGetMaterialfv +typedef void (APIENTRYP PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint *params); +GLAPI PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; +#define glGetMaterialiv glad_glGetMaterialiv +typedef void (APIENTRYP PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat *values); +GLAPI PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; +#define glGetPixelMapfv glad_glGetPixelMapfv +typedef void (APIENTRYP PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint *values); +GLAPI PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; +#define glGetPixelMapuiv glad_glGetPixelMapuiv +typedef void (APIENTRYP PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort *values); +GLAPI PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; +#define glGetPixelMapusv glad_glGetPixelMapusv +typedef void (APIENTRYP PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte *mask); +GLAPI PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; +#define glGetPolygonStipple glad_glGetPolygonStipple +typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; +#define glGetTexEnvfv glad_glGetTexEnvfv +typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; +#define glGetTexEnviv glad_glGetTexEnviv +typedef void (APIENTRYP PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble *params); +GLAPI PFNGLGETTEXGENDVPROC glad_glGetTexGendv; +#define glGetTexGendv glad_glGetTexGendv +typedef void (APIENTRYP PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; +#define glGetTexGenfv glad_glGetTexGenfv +typedef void (APIENTRYP PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; +#define glGetTexGeniv glad_glGetTexGeniv +typedef GLboolean (APIENTRYP PFNGLISLISTPROC)(GLuint list); +GLAPI PFNGLISLISTPROC glad_glIsList; +#define glIsList glad_glIsList +typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLFRUSTUMPROC glad_glFrustum; +#define glFrustum glad_glFrustum +typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void); +GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; +#define glLoadIdentity glad_glLoadIdentity +typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; +#define glLoadMatrixf glad_glLoadMatrixf +typedef void (APIENTRYP PFNGLLOADMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; +#define glLoadMatrixd glad_glLoadMatrixd +typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); +GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; +#define glMatrixMode glad_glMatrixMode +typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; +#define glMultMatrixf glad_glMultMatrixf +typedef void (APIENTRYP PFNGLMULTMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd; +#define glMultMatrixd glad_glMultMatrixd +typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI PFNGLORTHOPROC glad_glOrtho; +#define glOrtho glad_glOrtho +typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(void); +GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix; +#define glPopMatrix glad_glPopMatrix +typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(void); +GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix; +#define glPushMatrix glad_glPushMatrix +typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLROTATEDPROC glad_glRotated; +#define glRotated glad_glRotated +typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLROTATEFPROC glad_glRotatef; +#define glRotatef glad_glRotatef +typedef void (APIENTRYP PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLSCALEDPROC glad_glScaled; +#define glScaled glad_glScaled +typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLSCALEFPROC glad_glScalef; +#define glScalef glad_glScalef +typedef void (APIENTRYP PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLTRANSLATEDPROC glad_glTranslated; +#define glTranslated glad_glTranslated +typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; +#define glTranslatef glad_glTranslatef +#endif +#ifndef GL_VERSION_1_1 +#define GL_VERSION_1_1 1 +GLAPI int GLAD_GL_VERSION_1_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; +#define glDrawArrays glad_glDrawArrays +typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; +#define glDrawElements glad_glDrawElements +typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); +GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; +#define glGetPointerv glad_glGetPointerv +typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +#define glPolygonOffset glad_glPolygonOffset +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; +#define glCopyTexImage1D glad_glCopyTexImage1D +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +#define glCopyTexImage2D glad_glCopyTexImage2D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; +#define glCopyTexSubImage1D glad_glCopyTexSubImage1D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +#define glCopyTexSubImage2D glad_glCopyTexSubImage2D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; +#define glTexSubImage1D glad_glTexSubImage1D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +#define glTexSubImage2D glad_glTexSubImage2D +typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; +#define glBindTexture glad_glBindTexture +typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); +GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +#define glDeleteTextures glad_glDeleteTextures +typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); +GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; +#define glGenTextures glad_glGenTextures +typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); +GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; +#define glIsTexture glad_glIsTexture +typedef void (APIENTRYP PFNGLARRAYELEMENTPROC)(GLint i); +GLAPI PFNGLARRAYELEMENTPROC glad_glArrayElement; +#define glArrayElement glad_glArrayElement +typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; +#define glColorPointer glad_glColorPointer +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; +#define glDisableClientState glad_glDisableClientState +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void *pointer); +GLAPI PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; +#define glEdgeFlagPointer glad_glEdgeFlagPointer +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); +GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; +#define glEnableClientState glad_glEnableClientState +typedef void (APIENTRYP PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLINDEXPOINTERPROC glad_glIndexPointer; +#define glIndexPointer glad_glIndexPointer +typedef void (APIENTRYP PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void *pointer); +GLAPI PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; +#define glInterleavedArrays glad_glInterleavedArrays +typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; +#define glNormalPointer glad_glNormalPointer +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; +#define glTexCoordPointer glad_glTexCoordPointer +typedef void (APIENTRYP PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXPOINTERPROC glad_glVertexPointer; +#define glVertexPointer glad_glVertexPointer +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; +#define glAreTexturesResident glad_glAreTexturesResident +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint *textures, const GLfloat *priorities); +GLAPI PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; +#define glPrioritizeTextures glad_glPrioritizeTextures +typedef void (APIENTRYP PFNGLINDEXUBPROC)(GLubyte c); +GLAPI PFNGLINDEXUBPROC glad_glIndexub; +#define glIndexub glad_glIndexub +typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c); +GLAPI PFNGLINDEXUBVPROC glad_glIndexubv; +#define glIndexubv glad_glIndexubv +typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(void); +GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; +#define glPopClientAttrib glad_glPopClientAttrib +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); +GLAPI PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; +#define glPushClientAttrib glad_glPushClientAttrib +#endif +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +GLAPI int GLAD_GL_VERSION_1_2; +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; +#define glDrawRangeElements glad_glDrawRangeElements +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; +#define glTexImage3D glad_glTexImage3D +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; +#define glTexSubImage3D glad_glTexSubImage3D +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; +#define glCopyTexSubImage3D glad_glCopyTexSubImage3D +#endif +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +GLAPI int GLAD_GL_VERSION_1_3; +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +#define glActiveTexture glad_glActiveTexture +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +#define glSampleCoverage glad_glSampleCoverage +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; +#define glCompressedTexImage3D glad_glCompressedTexImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +#define glCompressedTexImage2D glad_glCompressedTexImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; +#define glCompressedTexImage1D glad_glCompressedTexImage1D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; +#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; +#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); +GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; +#define glGetCompressedTexImage glad_glGetCompressedTexImage +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); +GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; +#define glClientActiveTexture glad_glClientActiveTexture +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); +GLAPI PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; +#define glMultiTexCoord1d glad_glMultiTexCoord1d +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; +#define glMultiTexCoord1dv glad_glMultiTexCoord1dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); +GLAPI PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; +#define glMultiTexCoord1f glad_glMultiTexCoord1f +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; +#define glMultiTexCoord1fv glad_glMultiTexCoord1fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); +GLAPI PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; +#define glMultiTexCoord1i glad_glMultiTexCoord1i +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; +#define glMultiTexCoord1iv glad_glMultiTexCoord1iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); +GLAPI PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; +#define glMultiTexCoord1s glad_glMultiTexCoord1s +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; +#define glMultiTexCoord1sv glad_glMultiTexCoord1sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); +GLAPI PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; +#define glMultiTexCoord2d glad_glMultiTexCoord2d +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; +#define glMultiTexCoord2dv glad_glMultiTexCoord2dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); +GLAPI PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; +#define glMultiTexCoord2f glad_glMultiTexCoord2f +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; +#define glMultiTexCoord2fv glad_glMultiTexCoord2fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); +GLAPI PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; +#define glMultiTexCoord2i glad_glMultiTexCoord2i +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; +#define glMultiTexCoord2iv glad_glMultiTexCoord2iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); +GLAPI PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; +#define glMultiTexCoord2s glad_glMultiTexCoord2s +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; +#define glMultiTexCoord2sv glad_glMultiTexCoord2sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; +#define glMultiTexCoord3d glad_glMultiTexCoord3d +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; +#define glMultiTexCoord3dv glad_glMultiTexCoord3dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; +#define glMultiTexCoord3f glad_glMultiTexCoord3f +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; +#define glMultiTexCoord3fv glad_glMultiTexCoord3fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); +GLAPI PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; +#define glMultiTexCoord3i glad_glMultiTexCoord3i +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; +#define glMultiTexCoord3iv glad_glMultiTexCoord3iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; +#define glMultiTexCoord3s glad_glMultiTexCoord3s +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; +#define glMultiTexCoord3sv glad_glMultiTexCoord3sv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; +#define glMultiTexCoord4d glad_glMultiTexCoord4d +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble *v); +GLAPI PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; +#define glMultiTexCoord4dv glad_glMultiTexCoord4dv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; +#define glMultiTexCoord4f glad_glMultiTexCoord4f +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat *v); +GLAPI PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; +#define glMultiTexCoord4fv glad_glMultiTexCoord4fv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; +#define glMultiTexCoord4i glad_glMultiTexCoord4i +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint *v); +GLAPI PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; +#define glMultiTexCoord4iv glad_glMultiTexCoord4iv +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; +#define glMultiTexCoord4s glad_glMultiTexCoord4s +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort *v); +GLAPI PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; +#define glMultiTexCoord4sv glad_glMultiTexCoord4sv +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; +#define glLoadTransposeMatrixf glad_glLoadTransposeMatrixf +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; +#define glLoadTransposeMatrixd glad_glLoadTransposeMatrixd +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; +#define glMultTransposeMatrixf glad_glMultTransposeMatrixf +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble *m); +GLAPI PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; +#define glMultTransposeMatrixd glad_glMultTransposeMatrixd +#endif +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +GLAPI int GLAD_GL_VERSION_1_4; +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +#define glBlendFuncSeparate glad_glBlendFuncSeparate +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; +#define glMultiDrawArrays glad_glMultiDrawArrays +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; +#define glMultiDrawElements glad_glMultiDrawElements +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); +GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; +#define glPointParameterf glad_glPointParameterf +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); +GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; +#define glPointParameterfv glad_glPointParameterfv +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); +GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; +#define glPointParameteri glad_glPointParameteri +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); +GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; +#define glPointParameteriv glad_glPointParameteriv +typedef void (APIENTRYP PFNGLFOGCOORDFPROC)(GLfloat coord); +GLAPI PFNGLFOGCOORDFPROC glad_glFogCoordf; +#define glFogCoordf glad_glFogCoordf +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC)(const GLfloat *coord); +GLAPI PFNGLFOGCOORDFVPROC glad_glFogCoordfv; +#define glFogCoordfv glad_glFogCoordfv +typedef void (APIENTRYP PFNGLFOGCOORDDPROC)(GLdouble coord); +GLAPI PFNGLFOGCOORDDPROC glad_glFogCoordd; +#define glFogCoordd glad_glFogCoordd +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC)(const GLdouble *coord); +GLAPI PFNGLFOGCOORDDVPROC glad_glFogCoorddv; +#define glFogCoorddv glad_glFogCoorddv +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; +#define glFogCoordPointer glad_glFogCoordPointer +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +GLAPI PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; +#define glSecondaryColor3b glad_glSecondaryColor3b +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte *v); +GLAPI PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; +#define glSecondaryColor3bv glad_glSecondaryColor3bv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +GLAPI PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; +#define glSecondaryColor3d glad_glSecondaryColor3d +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble *v); +GLAPI PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; +#define glSecondaryColor3dv glad_glSecondaryColor3dv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +GLAPI PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; +#define glSecondaryColor3f glad_glSecondaryColor3f +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat *v); +GLAPI PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; +#define glSecondaryColor3fv glad_glSecondaryColor3fv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); +GLAPI PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; +#define glSecondaryColor3i glad_glSecondaryColor3i +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC)(const GLint *v); +GLAPI PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; +#define glSecondaryColor3iv glad_glSecondaryColor3iv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +GLAPI PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; +#define glSecondaryColor3s glad_glSecondaryColor3s +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC)(const GLshort *v); +GLAPI PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; +#define glSecondaryColor3sv glad_glSecondaryColor3sv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +GLAPI PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; +#define glSecondaryColor3ub glad_glSecondaryColor3ub +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte *v); +GLAPI PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; +#define glSecondaryColor3ubv glad_glSecondaryColor3ubv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +GLAPI PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; +#define glSecondaryColor3ui glad_glSecondaryColor3ui +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint *v); +GLAPI PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; +#define glSecondaryColor3uiv glad_glSecondaryColor3uiv +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +GLAPI PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; +#define glSecondaryColor3us glad_glSecondaryColor3us +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC)(const GLushort *v); +GLAPI PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; +#define glSecondaryColor3usv glad_glSecondaryColor3usv +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; +#define glSecondaryColorPointer glad_glSecondaryColorPointer +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); +GLAPI PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; +#define glWindowPos2d glad_glWindowPos2d +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; +#define glWindowPos2dv glad_glWindowPos2dv +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); +GLAPI PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; +#define glWindowPos2f glad_glWindowPos2f +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; +#define glWindowPos2fv glad_glWindowPos2fv +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); +GLAPI PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; +#define glWindowPos2i glad_glWindowPos2i +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; +#define glWindowPos2iv glad_glWindowPos2iv +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); +GLAPI PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; +#define glWindowPos2s glad_glWindowPos2s +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; +#define glWindowPos2sv glad_glWindowPos2sv +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; +#define glWindowPos3d glad_glWindowPos3d +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC)(const GLdouble *v); +GLAPI PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; +#define glWindowPos3dv glad_glWindowPos3dv +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; +#define glWindowPos3f glad_glWindowPos3f +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC)(const GLfloat *v); +GLAPI PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; +#define glWindowPos3fv glad_glWindowPos3fv +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); +GLAPI PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; +#define glWindowPos3i glad_glWindowPos3i +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC)(const GLint *v); +GLAPI PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; +#define glWindowPos3iv glad_glWindowPos3iv +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); +GLAPI PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; +#define glWindowPos3s glad_glWindowPos3s +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC)(const GLshort *v); +GLAPI PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; +#define glWindowPos3sv glad_glWindowPos3sv +typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; +#define glBlendColor glad_glBlendColor +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); +GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +#define glBlendEquation glad_glBlendEquation +#endif +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +GLAPI int GLAD_GL_VERSION_1_5; +typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; +#define glGenQueries glad_glGenQueries +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); +GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; +#define glDeleteQueries glad_glDeleteQueries +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); +GLAPI PFNGLISQUERYPROC glad_glIsQuery; +#define glIsQuery glad_glIsQuery +typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); +GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; +#define glBeginQuery glad_glBeginQuery +typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); +GLAPI PFNGLENDQUERYPROC glad_glEndQuery; +#define glEndQuery glad_glEndQuery +typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; +#define glGetQueryiv glad_glGetQueryiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; +#define glGetQueryObjectiv glad_glGetQueryObjectiv +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); +GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; +#define glGetQueryObjectuiv glad_glGetQueryObjectuiv +typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; +#define glBindBuffer glad_glBindBuffer +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); +GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +#define glDeleteBuffers glad_glDeleteBuffers +typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); +GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; +#define glGenBuffers glad_glGenBuffers +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); +GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; +#define glIsBuffer glad_glIsBuffer +typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; +#define glBufferData glad_glBufferData +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +#define glBufferSubData glad_glBufferSubData +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; +#define glGetBufferSubData glad_glGetBufferSubData +typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); +GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; +#define glMapBuffer glad_glMapBuffer +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); +GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; +#define glUnmapBuffer glad_glUnmapBuffer +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +#define glGetBufferParameteriv glad_glGetBufferParameteriv +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); +GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; +#define glGetBufferPointerv glad_glGetBufferPointerv +#endif +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +GLAPI int GLAD_GL_VERSION_2_0; +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +#define glBlendEquationSeparate glad_glBlendEquationSeparate +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); +GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; +#define glDrawBuffers glad_glDrawBuffers +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +#define glStencilOpSeparate glad_glStencilOpSeparate +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +#define glStencilFuncSeparate glad_glStencilFuncSeparate +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +#define glStencilMaskSeparate glad_glStencilMaskSeparate +typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; +#define glAttachShader glad_glAttachShader +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); +GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +#define glBindAttribLocation glad_glBindAttribLocation +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); +GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; +#define glCompileShader glad_glCompileShader +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); +GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +#define glCreateProgram glad_glCreateProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); +GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; +#define glCreateShader glad_glCreateShader +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); +GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +#define glDeleteProgram glad_glDeleteProgram +typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); +GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; +#define glDeleteShader glad_glDeleteShader +typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; +#define glDetachShader glad_glDetachShader +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +#define glDisableVertexAttribArray glad_glDisableVertexAttribArray +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +#define glEnableVertexAttribArray glad_glEnableVertexAttribArray +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +#define glGetActiveAttrib glad_glGetActiveAttrib +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +#define glGetActiveUniform glad_glGetActiveUniform +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +#define glGetAttachedShaders glad_glGetAttachedShaders +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +#define glGetAttribLocation glad_glGetAttribLocation +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +#define glGetProgramiv glad_glGetProgramiv +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +#define glGetProgramInfoLog glad_glGetProgramInfoLog +typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); +GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; +#define glGetShaderiv glad_glGetShaderiv +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +#define glGetShaderInfoLog glad_glGetShaderInfoLog +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +#define glGetShaderSource glad_glGetShaderSource +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +#define glGetUniformLocation glad_glGetUniformLocation +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); +GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +#define glGetUniformfv glad_glGetUniformfv +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); +GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +#define glGetUniformiv glad_glGetUniformiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); +GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; +#define glGetVertexAttribdv glad_glGetVertexAttribdv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); +GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +#define glGetVertexAttribfv glad_glGetVertexAttribfv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +#define glGetVertexAttribiv glad_glGetVertexAttribiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); +GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); +GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; +#define glIsProgram glad_glIsProgram +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); +GLAPI PFNGLISSHADERPROC glad_glIsShader; +#define glIsShader glad_glIsShader +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); +GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; +#define glLinkProgram glad_glLinkProgram +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; +#define glShaderSource glad_glShaderSource +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); +GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; +#define glUseProgram glad_glUseProgram +typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; +#define glUniform1f glad_glUniform1f +typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; +#define glUniform2f glad_glUniform2f +typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; +#define glUniform3f glad_glUniform3f +typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; +#define glUniform4f glad_glUniform4f +typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; +#define glUniform1i glad_glUniform1i +typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; +#define glUniform2i glad_glUniform2i +typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; +#define glUniform3i glad_glUniform3i +typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; +#define glUniform4i glad_glUniform4i +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; +#define glUniform1fv glad_glUniform1fv +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; +#define glUniform2fv glad_glUniform2fv +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; +#define glUniform3fv glad_glUniform3fv +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; +#define glUniform4fv glad_glUniform4fv +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; +#define glUniform1iv glad_glUniform1iv +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; +#define glUniform2iv glad_glUniform2iv +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; +#define glUniform3iv glad_glUniform3iv +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; +#define glUniform4iv glad_glUniform4iv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +#define glUniformMatrix2fv glad_glUniformMatrix2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +#define glUniformMatrix3fv glad_glUniformMatrix3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +#define glUniformMatrix4fv glad_glUniformMatrix4fv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); +GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +#define glValidateProgram glad_glValidateProgram +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); +GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; +#define glVertexAttrib1d glad_glVertexAttrib1d +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; +#define glVertexAttrib1dv glad_glVertexAttrib1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +#define glVertexAttrib1f glad_glVertexAttrib1f +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +#define glVertexAttrib1fv glad_glVertexAttrib1fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); +GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; +#define glVertexAttrib1s glad_glVertexAttrib1s +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; +#define glVertexAttrib1sv glad_glVertexAttrib1sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); +GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; +#define glVertexAttrib2d glad_glVertexAttrib2d +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; +#define glVertexAttrib2dv glad_glVertexAttrib2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +#define glVertexAttrib2f glad_glVertexAttrib2f +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +#define glVertexAttrib2fv glad_glVertexAttrib2fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); +GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; +#define glVertexAttrib2s glad_glVertexAttrib2s +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; +#define glVertexAttrib2sv glad_glVertexAttrib2sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; +#define glVertexAttrib3d glad_glVertexAttrib3d +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; +#define glVertexAttrib3dv glad_glVertexAttrib3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +#define glVertexAttrib3f glad_glVertexAttrib3f +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +#define glVertexAttrib3fv glad_glVertexAttrib3fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; +#define glVertexAttrib3s glad_glVertexAttrib3s +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; +#define glVertexAttrib3sv glad_glVertexAttrib3sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; +#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; +#define glVertexAttrib4Niv glad_glVertexAttrib4Niv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; +#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; +#define glVertexAttrib4Nub glad_glVertexAttrib4Nub +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; +#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; +#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; +#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; +#define glVertexAttrib4bv glad_glVertexAttrib4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; +#define glVertexAttrib4d glad_glVertexAttrib4d +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; +#define glVertexAttrib4dv glad_glVertexAttrib4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +#define glVertexAttrib4f glad_glVertexAttrib4f +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +#define glVertexAttrib4fv glad_glVertexAttrib4fv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; +#define glVertexAttrib4iv glad_glVertexAttrib4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; +#define glVertexAttrib4s glad_glVertexAttrib4s +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; +#define glVertexAttrib4sv glad_glVertexAttrib4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; +#define glVertexAttrib4ubv glad_glVertexAttrib4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; +#define glVertexAttrib4uiv glad_glVertexAttrib4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; +#define glVertexAttrib4usv glad_glVertexAttrib4usv +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +#define glVertexAttribPointer glad_glVertexAttribPointer +#endif +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +GLAPI int GLAD_GL_VERSION_2_1; +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; +#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; +#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; +#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; +#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; +#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; +#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv +#endif +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +GLAPI int GLAD_GL_VERSION_3_0; +typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; +#define glColorMaski glad_glColorMaski +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); +GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; +#define glGetBooleani_v glad_glGetBooleani_v +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); +GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; +#define glGetIntegeri_v glad_glGetIntegeri_v +typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); +GLAPI PFNGLENABLEIPROC glad_glEnablei; +#define glEnablei glad_glEnablei +typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); +GLAPI PFNGLDISABLEIPROC glad_glDisablei; +#define glDisablei glad_glDisablei +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); +GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; +#define glIsEnabledi glad_glIsEnabledi +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); +GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; +#define glBeginTransformFeedback glad_glBeginTransformFeedback +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); +GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; +#define glEndTransformFeedback glad_glEndTransformFeedback +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; +#define glBindBufferRange glad_glBindBufferRange +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); +GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; +#define glBindBufferBase glad_glBindBufferBase +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; +#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; +#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); +GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; +#define glClampColor glad_glClampColor +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); +GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; +#define glBeginConditionalRender glad_glBeginConditionalRender +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); +GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; +#define glEndConditionalRender glad_glEndConditionalRender +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; +#define glVertexAttribIPointer glad_glVertexAttribIPointer +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; +#define glGetVertexAttribIiv glad_glGetVertexAttribIiv +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); +GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; +#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); +GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; +#define glVertexAttribI1i glad_glVertexAttribI1i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); +GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; +#define glVertexAttribI2i glad_glVertexAttribI2i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); +GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; +#define glVertexAttribI3i glad_glVertexAttribI3i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; +#define glVertexAttribI4i glad_glVertexAttribI4i +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); +GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; +#define glVertexAttribI1ui glad_glVertexAttribI1ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); +GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; +#define glVertexAttribI2ui glad_glVertexAttribI2ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; +#define glVertexAttribI3ui glad_glVertexAttribI3ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; +#define glVertexAttribI4ui glad_glVertexAttribI4ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; +#define glVertexAttribI1iv glad_glVertexAttribI1iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; +#define glVertexAttribI2iv glad_glVertexAttribI2iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; +#define glVertexAttribI3iv glad_glVertexAttribI3iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; +#define glVertexAttribI4iv glad_glVertexAttribI4iv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; +#define glVertexAttribI1uiv glad_glVertexAttribI1uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; +#define glVertexAttribI2uiv glad_glVertexAttribI2uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; +#define glVertexAttribI3uiv glad_glVertexAttribI3uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); +GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; +#define glVertexAttribI4uiv glad_glVertexAttribI4uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); +GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; +#define glVertexAttribI4bv glad_glVertexAttribI4bv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); +GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; +#define glVertexAttribI4sv glad_glVertexAttribI4sv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); +GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; +#define glVertexAttribI4ubv glad_glVertexAttribI4ubv +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); +GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; +#define glVertexAttribI4usv glad_glVertexAttribI4usv +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); +GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; +#define glGetUniformuiv glad_glGetUniformuiv +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); +GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; +#define glBindFragDataLocation glad_glBindFragDataLocation +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; +#define glGetFragDataLocation glad_glGetFragDataLocation +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); +GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; +#define glUniform1ui glad_glUniform1ui +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); +GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; +#define glUniform2ui glad_glUniform2ui +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; +#define glUniform3ui glad_glUniform3ui +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; +#define glUniform4ui glad_glUniform4ui +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; +#define glUniform1uiv glad_glUniform1uiv +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; +#define glUniform2uiv glad_glUniform2uiv +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; +#define glUniform3uiv glad_glUniform3uiv +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; +#define glUniform4uiv glad_glUniform4uiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); +GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; +#define glTexParameterIiv glad_glTexParameterIiv +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); +GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; +#define glTexParameterIuiv glad_glTexParameterIuiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; +#define glGetTexParameterIiv glad_glGetTexParameterIiv +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); +GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; +#define glGetTexParameterIuiv glad_glGetTexParameterIuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; +#define glClearBufferiv glad_glClearBufferiv +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; +#define glClearBufferuiv glad_glClearBufferuiv +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; +#define glClearBufferfv glad_glClearBufferfv +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; +#define glClearBufferfi glad_glClearBufferfi +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); +GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; +#define glGetStringi glad_glGetStringi +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); +GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +#define glIsRenderbuffer glad_glIsRenderbuffer +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); +GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +#define glBindRenderbuffer glad_glBindRenderbuffer +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); +GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +#define glDeleteRenderbuffers glad_glDeleteRenderbuffers +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); +GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +#define glGenRenderbuffers glad_glGenRenderbuffers +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +#define glRenderbufferStorage glad_glRenderbufferStorage +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); +GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +#define glIsFramebuffer glad_glIsFramebuffer +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +#define glBindFramebuffer glad_glBindFramebuffer +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); +GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +#define glDeleteFramebuffers glad_glDeleteFramebuffers +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); +GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +#define glGenFramebuffers glad_glGenFramebuffers +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); +GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +#define glCheckFramebufferStatus glad_glCheckFramebufferStatus +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; +#define glFramebufferTexture1D glad_glFramebufferTexture1D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +#define glFramebufferTexture2D glad_glFramebufferTexture2D +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; +#define glFramebufferTexture3D glad_glFramebufferTexture3D +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); +GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +#define glGenerateMipmap glad_glGenerateMipmap +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; +#define glBlitFramebuffer glad_glBlitFramebuffer +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; +#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; +#define glFramebufferTextureLayer glad_glFramebufferTextureLayer +typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; +#define glMapBufferRange glad_glMapBufferRange +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; +#define glFlushMappedBufferRange glad_glFlushMappedBufferRange +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); +GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; +#define glBindVertexArray glad_glBindVertexArray +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); +GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; +#define glDeleteVertexArrays glad_glDeleteVertexArrays +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); +GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; +#define glGenVertexArrays glad_glGenVertexArrays +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); +GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; +#define glIsVertexArray glad_glIsVertexArray +#endif +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +GLAPI int GLAD_GL_VERSION_3_1; +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; +#define glDrawArraysInstanced glad_glDrawArraysInstanced +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; +#define glDrawElementsInstanced glad_glDrawElementsInstanced +typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); +GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; +#define glTexBuffer glad_glTexBuffer +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); +GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; +#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; +#define glCopyBufferSubData glad_glCopyBufferSubData +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; +#define glGetUniformIndices glad_glGetUniformIndices +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; +#define glGetActiveUniformsiv glad_glGetActiveUniformsiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; +#define glGetActiveUniformName glad_glGetActiveUniformName +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); +GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; +#define glGetUniformBlockIndex glad_glGetUniformBlockIndex +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; +#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; +#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; +#define glUniformBlockBinding glad_glUniformBlockBinding +#endif +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +GLAPI int GLAD_GL_VERSION_3_2; +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; +#define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; +#define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; +#define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; +#define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); +GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; +#define glProvokingVertex glad_glProvokingVertex +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); +GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; +#define glFenceSync glad_glFenceSync +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync sync); +GLAPI PFNGLISSYNCPROC glad_glIsSync; +#define glIsSync glad_glIsSync +typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); +GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; +#define glDeleteSync glad_glDeleteSync +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; +#define glClientWaitSync glad_glClientWaitSync +typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; +#define glWaitSync glad_glWaitSync +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); +GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; +#define glGetInteger64v glad_glGetInteger64v +typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; +#define glGetSynciv glad_glGetSynciv +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); +GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; +#define glGetInteger64i_v glad_glGetInteger64i_v +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); +GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; +#define glGetBufferParameteri64v glad_glGetBufferParameteri64v +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; +#define glFramebufferTexture glad_glFramebufferTexture +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; +#define glTexImage2DMultisample glad_glTexImage2DMultisample +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; +#define glTexImage3DMultisample glad_glTexImage3DMultisample +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat *val); +GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; +#define glGetMultisamplefv glad_glGetMultisamplefv +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); +GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; +#define glSampleMaski glad_glSampleMaski +#endif +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +GLAPI int GLAD_GL_VERSION_3_3; +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; +#define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar *name); +GLAPI PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; +#define glGetFragDataIndex glad_glGetFragDataIndex +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); +GLAPI PFNGLGENSAMPLERSPROC glad_glGenSamplers; +#define glGenSamplers glad_glGenSamplers +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); +GLAPI PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; +#define glDeleteSamplers glad_glDeleteSamplers +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); +GLAPI PFNGLISSAMPLERPROC glad_glIsSampler; +#define glIsSampler glad_glIsSampler +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); +GLAPI PFNGLBINDSAMPLERPROC glad_glBindSampler; +#define glBindSampler glad_glBindSampler +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); +GLAPI PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; +#define glSamplerParameteri glad_glSamplerParameteri +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +GLAPI PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; +#define glSamplerParameteriv glad_glSamplerParameteriv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); +GLAPI PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; +#define glSamplerParameterf glad_glSamplerParameterf +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; +#define glSamplerParameterfv glad_glSamplerParameterfv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint *param); +GLAPI PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; +#define glSamplerParameterIiv glad_glSamplerParameterIiv +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint *param); +GLAPI PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; +#define glSamplerParameterIuiv glad_glSamplerParameterIuiv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; +#define glGetSamplerParameteriv glad_glGetSamplerParameteriv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; +#define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); +GLAPI PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; +#define glGetSamplerParameterfv glad_glGetSamplerParameterfv +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint *params); +GLAPI PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; +#define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); +GLAPI PFNGLQUERYCOUNTERPROC glad_glQueryCounter; +#define glQueryCounter glad_glQueryCounter +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 *params); +GLAPI PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; +#define glGetQueryObjecti64v glad_glGetQueryObjecti64v +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 *params); +GLAPI PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; +#define glGetQueryObjectui64v glad_glGetQueryObjectui64v +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); +GLAPI PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; +#define glVertexAttribDivisor glad_glVertexAttribDivisor +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; +#define glVertexAttribP1ui glad_glVertexAttribP1ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; +#define glVertexAttribP1uiv glad_glVertexAttribP1uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; +#define glVertexAttribP2ui glad_glVertexAttribP2ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; +#define glVertexAttribP2uiv glad_glVertexAttribP2uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; +#define glVertexAttribP3ui glad_glVertexAttribP3ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; +#define glVertexAttribP3uiv glad_glVertexAttribP3uiv +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; +#define glVertexAttribP4ui glad_glVertexAttribP4ui +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; +#define glVertexAttribP4uiv glad_glVertexAttribP4uiv +typedef void (APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP2UIPROC glad_glVertexP2ui; +#define glVertexP2ui glad_glVertexP2ui +typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; +#define glVertexP2uiv glad_glVertexP2uiv +typedef void (APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP3UIPROC glad_glVertexP3ui; +#define glVertexP3ui glad_glVertexP3ui +typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; +#define glVertexP3uiv glad_glVertexP3uiv +typedef void (APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); +GLAPI PFNGLVERTEXP4UIPROC glad_glVertexP4ui; +#define glVertexP4ui glad_glVertexP4ui +typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); +GLAPI PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; +#define glVertexP4uiv glad_glVertexP4uiv +typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; +#define glTexCoordP1ui glad_glTexCoordP1ui +typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; +#define glTexCoordP1uiv glad_glTexCoordP1uiv +typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; +#define glTexCoordP2ui glad_glTexCoordP2ui +typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; +#define glTexCoordP2uiv glad_glTexCoordP2uiv +typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; +#define glTexCoordP3ui glad_glTexCoordP3ui +typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; +#define glTexCoordP3uiv glad_glTexCoordP3uiv +typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; +#define glTexCoordP4ui glad_glTexCoordP4ui +typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; +#define glTexCoordP4uiv glad_glTexCoordP4uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; +#define glMultiTexCoordP1ui glad_glMultiTexCoordP1ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; +#define glMultiTexCoordP1uiv glad_glMultiTexCoordP1uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; +#define glMultiTexCoordP2ui glad_glMultiTexCoordP2ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; +#define glMultiTexCoordP2uiv glad_glMultiTexCoordP2uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; +#define glMultiTexCoordP3ui glad_glMultiTexCoordP3ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; +#define glMultiTexCoordP3uiv glad_glMultiTexCoordP3uiv +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); +GLAPI PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; +#define glMultiTexCoordP4ui glad_glMultiTexCoordP4ui +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); +GLAPI PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; +#define glMultiTexCoordP4uiv glad_glMultiTexCoordP4uiv +typedef void (APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); +GLAPI PFNGLNORMALP3UIPROC glad_glNormalP3ui; +#define glNormalP3ui glad_glNormalP3ui +typedef void (APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); +GLAPI PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; +#define glNormalP3uiv glad_glNormalP3uiv +typedef void (APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLCOLORP3UIPROC glad_glColorP3ui; +#define glColorP3ui glad_glColorP3ui +typedef void (APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLCOLORP3UIVPROC glad_glColorP3uiv; +#define glColorP3uiv glad_glColorP3uiv +typedef void (APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLCOLORP4UIPROC glad_glColorP4ui; +#define glColorP4ui glad_glColorP4ui +typedef void (APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLCOLORP4UIVPROC glad_glColorP4uiv; +#define glColorP4uiv glad_glColorP4uiv +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); +GLAPI PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; +#define glSecondaryColorP3ui glad_glSecondaryColorP3ui +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint *color); +GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; +#define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv +#endif +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +GLAPI int GLAD_GL_VERSION_4_0; +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC)(GLfloat value); +GLAPI PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading; +#define glMinSampleShading glad_glMinSampleShading +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC)(GLuint buf, GLenum mode); +GLAPI PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi; +#define glBlendEquationi glad_glBlendEquationi +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC)(GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei; +#define glBlendEquationSeparatei glad_glBlendEquationSeparatei +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC)(GLuint buf, GLenum src, GLenum dst); +GLAPI PFNGLBLENDFUNCIPROC glad_glBlendFunci; +#define glBlendFunci glad_glBlendFunci +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei; +#define glBlendFuncSeparatei glad_glBlendFuncSeparatei +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC)(GLenum mode, const void *indirect); +GLAPI PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect; +#define glDrawArraysIndirect glad_glDrawArraysIndirect +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC)(GLenum mode, GLenum type, const void *indirect); +GLAPI PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect; +#define glDrawElementsIndirect glad_glDrawElementsIndirect +typedef void (APIENTRYP PFNGLUNIFORM1DPROC)(GLint location, GLdouble x); +GLAPI PFNGLUNIFORM1DPROC glad_glUniform1d; +#define glUniform1d glad_glUniform1d +typedef void (APIENTRYP PFNGLUNIFORM2DPROC)(GLint location, GLdouble x, GLdouble y); +GLAPI PFNGLUNIFORM2DPROC glad_glUniform2d; +#define glUniform2d glad_glUniform2d +typedef void (APIENTRYP PFNGLUNIFORM3DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLUNIFORM3DPROC glad_glUniform3d; +#define glUniform3d glad_glUniform3d +typedef void (APIENTRYP PFNGLUNIFORM4DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLUNIFORM4DPROC glad_glUniform4d; +#define glUniform4d glad_glUniform4d +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM1DVPROC glad_glUniform1dv; +#define glUniform1dv glad_glUniform1dv +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM2DVPROC glad_glUniform2dv; +#define glUniform2dv glad_glUniform2dv +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM3DVPROC glad_glUniform3dv; +#define glUniform3dv glad_glUniform3dv +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC)(GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLUNIFORM4DVPROC glad_glUniform4dv; +#define glUniform4dv glad_glUniform4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv; +#define glUniformMatrix2dv glad_glUniformMatrix2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv; +#define glUniformMatrix3dv glad_glUniformMatrix3dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv; +#define glUniformMatrix4dv glad_glUniformMatrix4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv; +#define glUniformMatrix2x3dv glad_glUniformMatrix2x3dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv; +#define glUniformMatrix2x4dv glad_glUniformMatrix2x4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv; +#define glUniformMatrix3x2dv glad_glUniformMatrix3x2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv; +#define glUniformMatrix3x4dv glad_glUniformMatrix3x4dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv; +#define glUniformMatrix4x2dv glad_glUniformMatrix4x2dv +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv; +#define glUniformMatrix4x3dv glad_glUniformMatrix4x3dv +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC)(GLuint program, GLint location, GLdouble *params); +GLAPI PFNGLGETUNIFORMDVPROC glad_glGetUniformdv; +#define glGetUniformdv glad_glGetUniformdv +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)(GLuint program, GLenum shadertype, const GLchar *name); +GLAPI PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation; +#define glGetSubroutineUniformLocation glad_glGetSubroutineUniformLocation +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC)(GLuint program, GLenum shadertype, const GLchar *name); +GLAPI PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex; +#define glGetSubroutineIndex glad_glGetSubroutineIndex +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv; +#define glGetActiveSubroutineUniformiv glad_glGetActiveSubroutineUniformiv +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName; +#define glGetActiveSubroutineUniformName glad_glGetActiveSubroutineUniformName +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName; +#define glGetActiveSubroutineName glad_glGetActiveSubroutineName +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC)(GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv; +#define glUniformSubroutinesuiv glad_glUniformSubroutinesuiv +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC)(GLenum shadertype, GLint location, GLuint *params); +GLAPI PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv; +#define glGetUniformSubroutineuiv glad_glGetUniformSubroutineuiv +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC)(GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv; +#define glGetProgramStageiv glad_glGetProgramStageiv +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC)(GLenum pname, GLint value); +GLAPI PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri; +#define glPatchParameteri glad_glPatchParameteri +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC)(GLenum pname, const GLfloat *values); +GLAPI PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv; +#define glPatchParameterfv glad_glPatchParameterfv +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC)(GLenum target, GLuint id); +GLAPI PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback; +#define glBindTransformFeedback glad_glBindTransformFeedback +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC)(GLsizei n, const GLuint *ids); +GLAPI PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks; +#define glDeleteTransformFeedbacks glad_glDeleteTransformFeedbacks +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks; +#define glGenTransformFeedbacks glad_glGenTransformFeedbacks +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC)(GLuint id); +GLAPI PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback; +#define glIsTransformFeedback glad_glIsTransformFeedback +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC)(void); +GLAPI PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback; +#define glPauseTransformFeedback glad_glPauseTransformFeedback +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC)(void); +GLAPI PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback; +#define glResumeTransformFeedback glad_glResumeTransformFeedback +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC)(GLenum mode, GLuint id); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback; +#define glDrawTransformFeedback glad_glDrawTransformFeedback +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)(GLenum mode, GLuint id, GLuint stream); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream; +#define glDrawTransformFeedbackStream glad_glDrawTransformFeedbackStream +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC)(GLenum target, GLuint index, GLuint id); +GLAPI PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed; +#define glBeginQueryIndexed glad_glBeginQueryIndexed +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC)(GLenum target, GLuint index); +GLAPI PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed; +#define glEndQueryIndexed glad_glEndQueryIndexed +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC)(GLenum target, GLuint index, GLenum pname, GLint *params); +GLAPI PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv; +#define glGetQueryIndexediv glad_glGetQueryIndexediv +#endif +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +GLAPI int GLAD_GL_VERSION_4_1; +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void); +GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; +#define glReleaseShaderCompiler glad_glReleaseShaderCompiler +typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI PFNGLSHADERBINARYPROC glad_glShaderBinary; +#define glShaderBinary glad_glShaderBinary +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; +#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); +GLAPI PFNGLDEPTHRANGEFPROC glad_glDepthRangef; +#define glDepthRangef glad_glDepthRangef +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d); +GLAPI PFNGLCLEARDEPTHFPROC glad_glClearDepthf; +#define glClearDepthf glad_glClearDepthf +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GLAPI PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary; +#define glGetProgramBinary glad_glGetProgramBinary +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC)(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI PFNGLPROGRAMBINARYPROC glad_glProgramBinary; +#define glProgramBinary glad_glProgramBinary +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC)(GLuint program, GLenum pname, GLint value); +GLAPI PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri; +#define glProgramParameteri glad_glProgramParameteri +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC)(GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI PFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages; +#define glUseProgramStages glad_glUseProgramStages +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC)(GLuint pipeline, GLuint program); +GLAPI PFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram; +#define glActiveShaderProgram glad_glActiveShaderProgram +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC)(GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI PFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv; +#define glCreateShaderProgramv glad_glCreateShaderProgramv +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline; +#define glBindProgramPipeline glad_glBindProgramPipeline +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC)(GLsizei n, const GLuint *pipelines); +GLAPI PFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines; +#define glDeleteProgramPipelines glad_glDeleteProgramPipelines +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC)(GLsizei n, GLuint *pipelines); +GLAPI PFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines; +#define glGenProgramPipelines glad_glGenProgramPipelines +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline; +#define glIsProgramPipeline glad_glIsProgramPipeline +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC)(GLuint pipeline, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv; +#define glGetProgramPipelineiv glad_glGetProgramPipelineiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC)(GLuint program, GLint location, GLint v0); +GLAPI PFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i; +#define glProgramUniform1i glad_glProgramUniform1i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv; +#define glProgramUniform1iv glad_glProgramUniform1iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC)(GLuint program, GLint location, GLfloat v0); +GLAPI PFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f; +#define glProgramUniform1f glad_glProgramUniform1f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv; +#define glProgramUniform1fv glad_glProgramUniform1fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC)(GLuint program, GLint location, GLdouble v0); +GLAPI PFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d; +#define glProgramUniform1d glad_glProgramUniform1d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv; +#define glProgramUniform1dv glad_glProgramUniform1dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC)(GLuint program, GLint location, GLuint v0); +GLAPI PFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui; +#define glProgramUniform1ui glad_glProgramUniform1ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv; +#define glProgramUniform1uiv glad_glProgramUniform1uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC)(GLuint program, GLint location, GLint v0, GLint v1); +GLAPI PFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i; +#define glProgramUniform2i glad_glProgramUniform2i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv; +#define glProgramUniform2iv glad_glProgramUniform2iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI PFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f; +#define glProgramUniform2f glad_glProgramUniform2f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv; +#define glProgramUniform2fv glad_glProgramUniform2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI PFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d; +#define glProgramUniform2d glad_glProgramUniform2d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv; +#define glProgramUniform2dv glad_glProgramUniform2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI PFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui; +#define glProgramUniform2ui glad_glProgramUniform2ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv; +#define glProgramUniform2uiv glad_glProgramUniform2uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI PFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i; +#define glProgramUniform3i glad_glProgramUniform3i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv; +#define glProgramUniform3iv glad_glProgramUniform3iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI PFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f; +#define glProgramUniform3f glad_glProgramUniform3f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv; +#define glProgramUniform3fv glad_glProgramUniform3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI PFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d; +#define glProgramUniform3d glad_glProgramUniform3d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv; +#define glProgramUniform3dv glad_glProgramUniform3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI PFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui; +#define glProgramUniform3ui glad_glProgramUniform3ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv; +#define glProgramUniform3uiv glad_glProgramUniform3uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI PFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i; +#define glProgramUniform4i glad_glProgramUniform4i +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC)(GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI PFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv; +#define glProgramUniform4iv glad_glProgramUniform4iv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI PFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f; +#define glProgramUniform4f glad_glProgramUniform4f +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC)(GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv; +#define glProgramUniform4fv glad_glProgramUniform4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC)(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI PFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d; +#define glProgramUniform4d glad_glProgramUniform4d +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC)(GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv; +#define glProgramUniform4dv glad_glProgramUniform4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI PFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui; +#define glProgramUniform4ui glad_glProgramUniform4ui +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC)(GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI PFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv; +#define glProgramUniform4uiv glad_glProgramUniform4uiv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv; +#define glProgramUniformMatrix2fv glad_glProgramUniformMatrix2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv; +#define glProgramUniformMatrix3fv glad_glProgramUniformMatrix3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv; +#define glProgramUniformMatrix4fv glad_glProgramUniformMatrix4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv; +#define glProgramUniformMatrix2dv glad_glProgramUniformMatrix2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv; +#define glProgramUniformMatrix3dv glad_glProgramUniformMatrix3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv; +#define glProgramUniformMatrix4dv glad_glProgramUniformMatrix4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv; +#define glProgramUniformMatrix2x3fv glad_glProgramUniformMatrix2x3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv; +#define glProgramUniformMatrix3x2fv glad_glProgramUniformMatrix3x2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv; +#define glProgramUniformMatrix2x4fv glad_glProgramUniformMatrix2x4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv; +#define glProgramUniformMatrix4x2fv glad_glProgramUniformMatrix4x2fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv; +#define glProgramUniformMatrix3x4fv glad_glProgramUniformMatrix3x4fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv; +#define glProgramUniformMatrix4x3fv glad_glProgramUniformMatrix4x3fv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv; +#define glProgramUniformMatrix2x3dv glad_glProgramUniformMatrix2x3dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv; +#define glProgramUniformMatrix3x2dv glad_glProgramUniformMatrix3x2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv; +#define glProgramUniformMatrix2x4dv glad_glProgramUniformMatrix2x4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv; +#define glProgramUniformMatrix4x2dv glad_glProgramUniformMatrix4x2dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv; +#define glProgramUniformMatrix3x4dv glad_glProgramUniformMatrix3x4dv +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv; +#define glProgramUniformMatrix4x3dv glad_glProgramUniformMatrix4x3dv +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC)(GLuint pipeline); +GLAPI PFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline; +#define glValidateProgramPipeline glad_glValidateProgramPipeline +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI PFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog; +#define glGetProgramPipelineInfoLog glad_glGetProgramPipelineInfoLog +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC)(GLuint index, GLdouble x); +GLAPI PFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d; +#define glVertexAttribL1d glad_glVertexAttribL1d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC)(GLuint index, GLdouble x, GLdouble y); +GLAPI PFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d; +#define glVertexAttribL2d glad_glVertexAttribL2d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI PFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d; +#define glVertexAttribL3d glad_glVertexAttribL3d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI PFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d; +#define glVertexAttribL4d glad_glVertexAttribL4d +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv; +#define glVertexAttribL1dv glad_glVertexAttribL1dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv; +#define glVertexAttribL2dv glad_glVertexAttribL2dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv; +#define glVertexAttribL3dv glad_glVertexAttribL3dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC)(GLuint index, const GLdouble *v); +GLAPI PFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv; +#define glVertexAttribL4dv glad_glVertexAttribL4dv +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI PFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer; +#define glVertexAttribLPointer glad_glVertexAttribLPointer +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC)(GLuint index, GLenum pname, GLdouble *params); +GLAPI PFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv; +#define glGetVertexAttribLdv glad_glGetVertexAttribLdv +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC)(GLuint first, GLsizei count, const GLfloat *v); +GLAPI PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv; +#define glViewportArrayv glad_glViewportArrayv +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf; +#define glViewportIndexedf glad_glViewportIndexedf +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC)(GLuint index, const GLfloat *v); +GLAPI PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv; +#define glViewportIndexedfv glad_glViewportIndexedfv +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC)(GLuint first, GLsizei count, const GLint *v); +GLAPI PFNGLSCISSORARRAYVPROC glad_glScissorArrayv; +#define glScissorArrayv glad_glScissorArrayv +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC)(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI PFNGLSCISSORINDEXEDPROC glad_glScissorIndexed; +#define glScissorIndexed glad_glScissorIndexed +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC)(GLuint index, const GLint *v); +GLAPI PFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv; +#define glScissorIndexedv glad_glScissorIndexedv +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC)(GLuint first, GLsizei count, const GLdouble *v); +GLAPI PFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv; +#define glDepthRangeArrayv glad_glDepthRangeArrayv +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC)(GLuint index, GLdouble n, GLdouble f); +GLAPI PFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed; +#define glDepthRangeIndexed glad_glDepthRangeIndexed +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC)(GLenum target, GLuint index, GLfloat *data); +GLAPI PFNGLGETFLOATI_VPROC glad_glGetFloati_v; +#define glGetFloati_v glad_glGetFloati_v +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC)(GLenum target, GLuint index, GLdouble *data); +GLAPI PFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v; +#define glGetDoublei_v glad_glGetDoublei_v +#endif +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 +GLAPI int GLAD_GL_VERSION_4_2; +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance; +#define glDrawArraysInstancedBaseInstance glad_glDrawArraysInstancedBaseInstance +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance; +#define glDrawElementsInstancedBaseInstance glad_glDrawElementsInstancedBaseInstance +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance; +#define glDrawElementsInstancedBaseVertexBaseInstance glad_glDrawElementsInstancedBaseVertexBaseInstance +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ; +#define glGetInternalformativ glad_glGetInternalformativ +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +GLAPI PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glad_glGetActiveAtomicCounterBufferiv; +#define glGetActiveAtomicCounterBufferiv glad_glGetActiveAtomicCounterBufferiv +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI PFNGLBINDIMAGETEXTUREPROC glad_glBindImageTexture; +#define glBindImageTexture glad_glBindImageTexture +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC)(GLbitfield barriers); +GLAPI PFNGLMEMORYBARRIERPROC glad_glMemoryBarrier; +#define glMemoryBarrier glad_glMemoryBarrier +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI PFNGLTEXSTORAGE1DPROC glad_glTexStorage1D; +#define glTexStorage1D glad_glTexStorage1D +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLTEXSTORAGE2DPROC glad_glTexStorage2D; +#define glTexStorage2D glad_glTexStorage2D +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI PFNGLTEXSTORAGE3DPROC glad_glTexStorage3D; +#define glTexStorage3D glad_glTexStorage3D +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)(GLenum mode, GLuint id, GLsizei instancecount); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glad_glDrawTransformFeedbackInstanced; +#define glDrawTransformFeedbackInstanced glad_glDrawTransformFeedbackInstanced +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +GLAPI PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glad_glDrawTransformFeedbackStreamInstanced; +#define glDrawTransformFeedbackStreamInstanced glad_glDrawTransformFeedbackStreamInstanced +#endif +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +GLAPI int GLAD_GL_VERSION_4_3; +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC)(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARBUFFERDATAPROC glad_glClearBufferData; +#define glClearBufferData glad_glClearBufferData +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC)(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARBUFFERSUBDATAPROC glad_glClearBufferSubData; +#define glClearBufferSubData glad_glClearBufferSubData +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI PFNGLDISPATCHCOMPUTEPROC glad_glDispatchCompute; +#define glDispatchCompute glad_glDispatchCompute +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC)(GLintptr indirect); +GLAPI PFNGLDISPATCHCOMPUTEINDIRECTPROC glad_glDispatchComputeIndirect; +#define glDispatchComputeIndirect glad_glDispatchComputeIndirect +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC)(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI PFNGLCOPYIMAGESUBDATAPROC glad_glCopyImageSubData; +#define glCopyImageSubData glad_glCopyImageSubData +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +GLAPI PFNGLFRAMEBUFFERPARAMETERIPROC glad_glFramebufferParameteri; +#define glFramebufferParameteri glad_glFramebufferParameteri +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); +GLAPI PFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv; +#define glGetFramebufferParameteriv glad_glGetFramebufferParameteriv +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI PFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v; +#define glGetInternalformati64v glad_glGetInternalformati64v +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI PFNGLINVALIDATETEXSUBIMAGEPROC glad_glInvalidateTexSubImage; +#define glInvalidateTexSubImage glad_glInvalidateTexSubImage +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC)(GLuint texture, GLint level); +GLAPI PFNGLINVALIDATETEXIMAGEPROC glad_glInvalidateTexImage; +#define glInvalidateTexImage glad_glInvalidateTexImage +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC)(GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI PFNGLINVALIDATEBUFFERSUBDATAPROC glad_glInvalidateBufferSubData; +#define glInvalidateBufferSubData glad_glInvalidateBufferSubData +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer); +GLAPI PFNGLINVALIDATEBUFFERDATAPROC glad_glInvalidateBufferData; +#define glInvalidateBufferData glad_glInvalidateBufferData +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI PFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer; +#define glInvalidateFramebuffer glad_glInvalidateFramebuffer +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer; +#define glInvalidateSubFramebuffer glad_glInvalidateSubFramebuffer +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC)(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI PFNGLMULTIDRAWARRAYSINDIRECTPROC glad_glMultiDrawArraysIndirect; +#define glMultiDrawArraysIndirect glad_glMultiDrawArraysIndirect +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC)(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI PFNGLMULTIDRAWELEMENTSINDIRECTPROC glad_glMultiDrawElementsIndirect; +#define glMultiDrawElementsIndirect glad_glMultiDrawElementsIndirect +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC)(GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI PFNGLGETPROGRAMINTERFACEIVPROC glad_glGetProgramInterfaceiv; +#define glGetProgramInterfaceiv glad_glGetProgramInterfaceiv +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC)(GLuint program, GLenum programInterface, const GLchar *name); +GLAPI PFNGLGETPROGRAMRESOURCEINDEXPROC glad_glGetProgramResourceIndex; +#define glGetProgramResourceIndex glad_glGetProgramResourceIndex +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC)(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI PFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName; +#define glGetProgramResourceName glad_glGetProgramResourceName +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC)(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI PFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv; +#define glGetProgramResourceiv glad_glGetProgramResourceiv +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC)(GLuint program, GLenum programInterface, const GLchar *name); +GLAPI PFNGLGETPROGRAMRESOURCELOCATIONPROC glad_glGetProgramResourceLocation; +#define glGetProgramResourceLocation glad_glGetProgramResourceLocation +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)(GLuint program, GLenum programInterface, const GLchar *name); +GLAPI PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glad_glGetProgramResourceLocationIndex; +#define glGetProgramResourceLocationIndex glad_glGetProgramResourceLocationIndex +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC)(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +GLAPI PFNGLSHADERSTORAGEBLOCKBINDINGPROC glad_glShaderStorageBlockBinding; +#define glShaderStorageBlockBinding glad_glShaderStorageBlockBinding +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC)(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI PFNGLTEXBUFFERRANGEPROC glad_glTexBufferRange; +#define glTexBufferRange glad_glTexBufferRange +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXSTORAGE2DMULTISAMPLEPROC glad_glTexStorage2DMultisample; +#define glTexStorage2DMultisample glad_glTexStorage2DMultisample +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXSTORAGE3DMULTISAMPLEPROC glad_glTexStorage3DMultisample; +#define glTexStorage3DMultisample glad_glTexStorage3DMultisample +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC)(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +GLAPI PFNGLTEXTUREVIEWPROC glad_glTextureView; +#define glTextureView glad_glTextureView +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC)(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI PFNGLBINDVERTEXBUFFERPROC glad_glBindVertexBuffer; +#define glBindVertexBuffer glad_glBindVertexBuffer +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC)(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI PFNGLVERTEXATTRIBFORMATPROC glad_glVertexAttribFormat; +#define glVertexAttribFormat glad_glVertexAttribFormat +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC)(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI PFNGLVERTEXATTRIBIFORMATPROC glad_glVertexAttribIFormat; +#define glVertexAttribIFormat glad_glVertexAttribIFormat +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC)(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI PFNGLVERTEXATTRIBLFORMATPROC glad_glVertexAttribLFormat; +#define glVertexAttribLFormat glad_glVertexAttribLFormat +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC)(GLuint attribindex, GLuint bindingindex); +GLAPI PFNGLVERTEXATTRIBBINDINGPROC glad_glVertexAttribBinding; +#define glVertexAttribBinding glad_glVertexAttribBinding +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC)(GLuint bindingindex, GLuint divisor); +GLAPI PFNGLVERTEXBINDINGDIVISORPROC glad_glVertexBindingDivisor; +#define glVertexBindingDivisor glad_glVertexBindingDivisor +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl; +#define glDebugMessageControl glad_glDebugMessageControl +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert; +#define glDebugMessageInsert glad_glDebugMessageInsert +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback, const void *userParam); +GLAPI PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback; +#define glDebugMessageCallback glad_glDebugMessageCallback +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog; +#define glGetDebugMessageLog glad_glGetDebugMessageLog +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup; +#define glPushDebugGroup glad_glPushDebugGroup +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC)(void); +GLAPI PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup; +#define glPopDebugGroup glad_glPopDebugGroup +typedef void (APIENTRYP PFNGLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTLABELPROC glad_glObjectLabel; +#define glObjectLabel glad_glObjectLabel +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel; +#define glGetObjectLabel glad_glGetObjectLabel +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC)(const void *ptr, GLsizei length, const GLchar *label); +GLAPI PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel; +#define glObjectPtrLabel glad_glObjectPtrLabel +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC)(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel; +#define glGetObjectPtrLabel glad_glGetObjectPtrLabel +#endif +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 +GLAPI int GLAD_GL_VERSION_4_4; +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC)(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI PFNGLBUFFERSTORAGEPROC glad_glBufferStorage; +#define glBufferStorage glad_glBufferStorage +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC)(GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARTEXIMAGEPROC glad_glClearTexImage; +#define glClearTexImage glad_glClearTexImage +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage; +#define glClearTexSubImage glad_glClearTexSubImage +typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC)(GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +GLAPI PFNGLBINDBUFFERSBASEPROC glad_glBindBuffersBase; +#define glBindBuffersBase glad_glBindBuffersBase +typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC)(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +GLAPI PFNGLBINDBUFFERSRANGEPROC glad_glBindBuffersRange; +#define glBindBuffersRange glad_glBindBuffersRange +typedef void (APIENTRYP PFNGLBINDTEXTURESPROC)(GLuint first, GLsizei count, const GLuint *textures); +GLAPI PFNGLBINDTEXTURESPROC glad_glBindTextures; +#define glBindTextures glad_glBindTextures +typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC)(GLuint first, GLsizei count, const GLuint *samplers); +GLAPI PFNGLBINDSAMPLERSPROC glad_glBindSamplers; +#define glBindSamplers glad_glBindSamplers +typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC)(GLuint first, GLsizei count, const GLuint *textures); +GLAPI PFNGLBINDIMAGETEXTURESPROC glad_glBindImageTextures; +#define glBindImageTextures glad_glBindImageTextures +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC)(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI PFNGLBINDVERTEXBUFFERSPROC glad_glBindVertexBuffers; +#define glBindVertexBuffers glad_glBindVertexBuffers +#endif +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +GLAPI int GLAD_GL_VERSION_4_5; +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC)(GLenum origin, GLenum depth); +GLAPI PFNGLCLIPCONTROLPROC glad_glClipControl; +#define glClipControl glad_glClipControl +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC)(GLsizei n, GLuint *ids); +GLAPI PFNGLCREATETRANSFORMFEEDBACKSPROC glad_glCreateTransformFeedbacks; +#define glCreateTransformFeedbacks glad_glCreateTransformFeedbacks +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)(GLuint xfb, GLuint index, GLuint buffer); +GLAPI PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glad_glTransformFeedbackBufferBase; +#define glTransformFeedbackBufferBase glad_glTransformFeedbackBufferBase +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glad_glTransformFeedbackBufferRange; +#define glTransformFeedbackBufferRange glad_glTransformFeedbackBufferRange +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC)(GLuint xfb, GLenum pname, GLint *param); +GLAPI PFNGLGETTRANSFORMFEEDBACKIVPROC glad_glGetTransformFeedbackiv; +#define glGetTransformFeedbackiv glad_glGetTransformFeedbackiv +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC)(GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI PFNGLGETTRANSFORMFEEDBACKI_VPROC glad_glGetTransformFeedbacki_v; +#define glGetTransformFeedbacki_v glad_glGetTransformFeedbacki_v +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC)(GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI PFNGLGETTRANSFORMFEEDBACKI64_VPROC glad_glGetTransformFeedbacki64_v; +#define glGetTransformFeedbacki64_v glad_glGetTransformFeedbacki64_v +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC)(GLsizei n, GLuint *buffers); +GLAPI PFNGLCREATEBUFFERSPROC glad_glCreateBuffers; +#define glCreateBuffers glad_glCreateBuffers +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC)(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI PFNGLNAMEDBUFFERSTORAGEPROC glad_glNamedBufferStorage; +#define glNamedBufferStorage glad_glNamedBufferStorage +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC)(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI PFNGLNAMEDBUFFERDATAPROC glad_glNamedBufferData; +#define glNamedBufferData glad_glNamedBufferData +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC)(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI PFNGLNAMEDBUFFERSUBDATAPROC glad_glNamedBufferSubData; +#define glNamedBufferSubData glad_glNamedBufferSubData +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC)(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI PFNGLCOPYNAMEDBUFFERSUBDATAPROC glad_glCopyNamedBufferSubData; +#define glCopyNamedBufferSubData glad_glCopyNamedBufferSubData +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC)(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARNAMEDBUFFERDATAPROC glad_glClearNamedBufferData; +#define glClearNamedBufferData glad_glClearNamedBufferData +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC)(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI PFNGLCLEARNAMEDBUFFERSUBDATAPROC glad_glClearNamedBufferSubData; +#define glClearNamedBufferSubData glad_glClearNamedBufferSubData +typedef void * (APIENTRYP PFNGLMAPNAMEDBUFFERPROC)(GLuint buffer, GLenum access); +GLAPI PFNGLMAPNAMEDBUFFERPROC glad_glMapNamedBuffer; +#define glMapNamedBuffer glad_glMapNamedBuffer +typedef void * (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC)(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI PFNGLMAPNAMEDBUFFERRANGEPROC glad_glMapNamedBufferRange; +#define glMapNamedBufferRange glad_glMapNamedBufferRange +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC)(GLuint buffer); +GLAPI PFNGLUNMAPNAMEDBUFFERPROC glad_glUnmapNamedBuffer; +#define glUnmapNamedBuffer glad_glUnmapNamedBuffer +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)(GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glad_glFlushMappedNamedBufferRange; +#define glFlushMappedNamedBufferRange glad_glFlushMappedNamedBufferRange +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC)(GLuint buffer, GLenum pname, GLint *params); +GLAPI PFNGLGETNAMEDBUFFERPARAMETERIVPROC glad_glGetNamedBufferParameteriv; +#define glGetNamedBufferParameteriv glad_glGetNamedBufferParameteriv +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)(GLuint buffer, GLenum pname, GLint64 *params); +GLAPI PFNGLGETNAMEDBUFFERPARAMETERI64VPROC glad_glGetNamedBufferParameteri64v; +#define glGetNamedBufferParameteri64v glad_glGetNamedBufferParameteri64v +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC)(GLuint buffer, GLenum pname, void **params); +GLAPI PFNGLGETNAMEDBUFFERPOINTERVPROC glad_glGetNamedBufferPointerv; +#define glGetNamedBufferPointerv glad_glGetNamedBufferPointerv +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC)(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI PFNGLGETNAMEDBUFFERSUBDATAPROC glad_glGetNamedBufferSubData; +#define glGetNamedBufferSubData glad_glGetNamedBufferSubData +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); +GLAPI PFNGLCREATEFRAMEBUFFERSPROC glad_glCreateFramebuffers; +#define glCreateFramebuffers glad_glCreateFramebuffers +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glad_glNamedFramebufferRenderbuffer; +#define glNamedFramebufferRenderbuffer glad_glNamedFramebufferRenderbuffer +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)(GLuint framebuffer, GLenum pname, GLint param); +GLAPI PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glad_glNamedFramebufferParameteri; +#define glNamedFramebufferParameteri glad_glNamedFramebufferParameteri +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI PFNGLNAMEDFRAMEBUFFERTEXTUREPROC glad_glNamedFramebufferTexture; +#define glNamedFramebufferTexture glad_glNamedFramebufferTexture +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glad_glNamedFramebufferTextureLayer; +#define glNamedFramebufferTextureLayer glad_glNamedFramebufferTextureLayer +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)(GLuint framebuffer, GLenum buf); +GLAPI PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glad_glNamedFramebufferDrawBuffer; +#define glNamedFramebufferDrawBuffer glad_glNamedFramebufferDrawBuffer +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)(GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glad_glNamedFramebufferDrawBuffers; +#define glNamedFramebufferDrawBuffers glad_glNamedFramebufferDrawBuffers +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)(GLuint framebuffer, GLenum src); +GLAPI PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glad_glNamedFramebufferReadBuffer; +#define glNamedFramebufferReadBuffer glad_glNamedFramebufferReadBuffer +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glad_glInvalidateNamedFramebufferData; +#define glInvalidateNamedFramebufferData glad_glInvalidateNamedFramebufferData +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glad_glInvalidateNamedFramebufferSubData; +#define glInvalidateNamedFramebufferSubData glad_glInvalidateNamedFramebufferSubData +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI PFNGLCLEARNAMEDFRAMEBUFFERIVPROC glad_glClearNamedFramebufferiv; +#define glClearNamedFramebufferiv glad_glClearNamedFramebufferiv +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glad_glClearNamedFramebufferuiv; +#define glClearNamedFramebufferuiv glad_glClearNamedFramebufferuiv +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI PFNGLCLEARNAMEDFRAMEBUFFERFVPROC glad_glClearNamedFramebufferfv; +#define glClearNamedFramebufferfv glad_glClearNamedFramebufferfv +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI PFNGLCLEARNAMEDFRAMEBUFFERFIPROC glad_glClearNamedFramebufferfi; +#define glClearNamedFramebufferfi glad_glClearNamedFramebufferfi +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC)(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI PFNGLBLITNAMEDFRAMEBUFFERPROC glad_glBlitNamedFramebuffer; +#define glBlitNamedFramebuffer glad_glBlitNamedFramebuffer +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)(GLuint framebuffer, GLenum target); +GLAPI PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glad_glCheckNamedFramebufferStatus; +#define glCheckNamedFramebufferStatus glad_glCheckNamedFramebufferStatus +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)(GLuint framebuffer, GLenum pname, GLint *param); +GLAPI PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glad_glGetNamedFramebufferParameteriv; +#define glGetNamedFramebufferParameteriv glad_glGetNamedFramebufferParameteriv +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetNamedFramebufferAttachmentParameteriv; +#define glGetNamedFramebufferAttachmentParameteriv glad_glGetNamedFramebufferAttachmentParameteriv +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); +GLAPI PFNGLCREATERENDERBUFFERSPROC glad_glCreateRenderbuffers; +#define glCreateRenderbuffers glad_glCreateRenderbuffers +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC)(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLNAMEDRENDERBUFFERSTORAGEPROC glad_glNamedRenderbufferStorage; +#define glNamedRenderbufferStorage glad_glNamedRenderbufferStorage +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glNamedRenderbufferStorageMultisample; +#define glNamedRenderbufferStorageMultisample glad_glNamedRenderbufferStorageMultisample +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)(GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glad_glGetNamedRenderbufferParameteriv; +#define glGetNamedRenderbufferParameteriv glad_glGetNamedRenderbufferParameteriv +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC)(GLenum target, GLsizei n, GLuint *textures); +GLAPI PFNGLCREATETEXTURESPROC glad_glCreateTextures; +#define glCreateTextures glad_glCreateTextures +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC)(GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI PFNGLTEXTUREBUFFERPROC glad_glTextureBuffer; +#define glTextureBuffer glad_glTextureBuffer +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC)(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI PFNGLTEXTUREBUFFERRANGEPROC glad_glTextureBufferRange; +#define glTextureBufferRange glad_glTextureBufferRange +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC)(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI PFNGLTEXTURESTORAGE1DPROC glad_glTextureStorage1D; +#define glTextureStorage1D glad_glTextureStorage1D +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC)(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLTEXTURESTORAGE2DPROC glad_glTextureStorage2D; +#define glTextureStorage2D glad_glTextureStorage2D +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC)(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI PFNGLTEXTURESTORAGE3DPROC glad_glTextureStorage3D; +#define glTextureStorage3D glad_glTextureStorage3D +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glad_glTextureStorage2DMultisample; +#define glTextureStorage2DMultisample glad_glTextureStorage2DMultisample +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glad_glTextureStorage3DMultisample; +#define glTextureStorage3DMultisample glad_glTextureStorage3DMultisample +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC)(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXTURESUBIMAGE1DPROC glad_glTextureSubImage1D; +#define glTextureSubImage1D glad_glTextureSubImage1D +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXTURESUBIMAGE2DPROC glad_glTextureSubImage2D; +#define glTextureSubImage2D glad_glTextureSubImage2D +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI PFNGLTEXTURESUBIMAGE3DPROC glad_glTextureSubImage3D; +#define glTextureSubImage3D glad_glTextureSubImage3D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glad_glCompressedTextureSubImage1D; +#define glCompressedTextureSubImage1D glad_glCompressedTextureSubImage1D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glad_glCompressedTextureSubImage2D; +#define glCompressedTextureSubImage2D glad_glCompressedTextureSubImage2D +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glad_glCompressedTextureSubImage3D; +#define glCompressedTextureSubImage3D glad_glCompressedTextureSubImage3D +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC)(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI PFNGLCOPYTEXTURESUBIMAGE1DPROC glad_glCopyTextureSubImage1D; +#define glCopyTextureSubImage1D glad_glCopyTextureSubImage1D +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXTURESUBIMAGE2DPROC glad_glCopyTextureSubImage2D; +#define glCopyTextureSubImage2D glad_glCopyTextureSubImage2D +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI PFNGLCOPYTEXTURESUBIMAGE3DPROC glad_glCopyTextureSubImage3D; +#define glCopyTextureSubImage3D glad_glCopyTextureSubImage3D +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC)(GLuint texture, GLenum pname, GLfloat param); +GLAPI PFNGLTEXTUREPARAMETERFPROC glad_glTextureParameterf; +#define glTextureParameterf glad_glTextureParameterf +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC)(GLuint texture, GLenum pname, const GLfloat *param); +GLAPI PFNGLTEXTUREPARAMETERFVPROC glad_glTextureParameterfv; +#define glTextureParameterfv glad_glTextureParameterfv +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC)(GLuint texture, GLenum pname, GLint param); +GLAPI PFNGLTEXTUREPARAMETERIPROC glad_glTextureParameteri; +#define glTextureParameteri glad_glTextureParameteri +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC)(GLuint texture, GLenum pname, const GLint *params); +GLAPI PFNGLTEXTUREPARAMETERIIVPROC glad_glTextureParameterIiv; +#define glTextureParameterIiv glad_glTextureParameterIiv +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC)(GLuint texture, GLenum pname, const GLuint *params); +GLAPI PFNGLTEXTUREPARAMETERIUIVPROC glad_glTextureParameterIuiv; +#define glTextureParameterIuiv glad_glTextureParameterIuiv +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC)(GLuint texture, GLenum pname, const GLint *param); +GLAPI PFNGLTEXTUREPARAMETERIVPROC glad_glTextureParameteriv; +#define glTextureParameteriv glad_glTextureParameteriv +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC)(GLuint texture); +GLAPI PFNGLGENERATETEXTUREMIPMAPPROC glad_glGenerateTextureMipmap; +#define glGenerateTextureMipmap glad_glGenerateTextureMipmap +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC)(GLuint unit, GLuint texture); +GLAPI PFNGLBINDTEXTUREUNITPROC glad_glBindTextureUnit; +#define glBindTextureUnit glad_glBindTextureUnit +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC)(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETTEXTUREIMAGEPROC glad_glGetTextureImage; +#define glGetTextureImage glad_glGetTextureImage +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)(GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glad_glGetCompressedTextureImage; +#define glGetCompressedTextureImage glad_glGetCompressedTextureImage +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC)(GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXTURELEVELPARAMETERFVPROC glad_glGetTextureLevelParameterfv; +#define glGetTextureLevelParameterfv glad_glGetTextureLevelParameterfv +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC)(GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXTURELEVELPARAMETERIVPROC glad_glGetTextureLevelParameteriv; +#define glGetTextureLevelParameteriv glad_glGetTextureLevelParameteriv +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC)(GLuint texture, GLenum pname, GLfloat *params); +GLAPI PFNGLGETTEXTUREPARAMETERFVPROC glad_glGetTextureParameterfv; +#define glGetTextureParameterfv glad_glGetTextureParameterfv +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC)(GLuint texture, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXTUREPARAMETERIIVPROC glad_glGetTextureParameterIiv; +#define glGetTextureParameterIiv glad_glGetTextureParameterIiv +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC)(GLuint texture, GLenum pname, GLuint *params); +GLAPI PFNGLGETTEXTUREPARAMETERIUIVPROC glad_glGetTextureParameterIuiv; +#define glGetTextureParameterIuiv glad_glGetTextureParameterIuiv +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC)(GLuint texture, GLenum pname, GLint *params); +GLAPI PFNGLGETTEXTUREPARAMETERIVPROC glad_glGetTextureParameteriv; +#define glGetTextureParameteriv glad_glGetTextureParameteriv +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); +GLAPI PFNGLCREATEVERTEXARRAYSPROC glad_glCreateVertexArrays; +#define glCreateVertexArrays glad_glCreateVertexArrays +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC)(GLuint vaobj, GLuint index); +GLAPI PFNGLDISABLEVERTEXARRAYATTRIBPROC glad_glDisableVertexArrayAttrib; +#define glDisableVertexArrayAttrib glad_glDisableVertexArrayAttrib +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC)(GLuint vaobj, GLuint index); +GLAPI PFNGLENABLEVERTEXARRAYATTRIBPROC glad_glEnableVertexArrayAttrib; +#define glEnableVertexArrayAttrib glad_glEnableVertexArrayAttrib +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC)(GLuint vaobj, GLuint buffer); +GLAPI PFNGLVERTEXARRAYELEMENTBUFFERPROC glad_glVertexArrayElementBuffer; +#define glVertexArrayElementBuffer glad_glVertexArrayElementBuffer +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC)(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI PFNGLVERTEXARRAYVERTEXBUFFERPROC glad_glVertexArrayVertexBuffer; +#define glVertexArrayVertexBuffer glad_glVertexArrayVertexBuffer +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC)(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI PFNGLVERTEXARRAYVERTEXBUFFERSPROC glad_glVertexArrayVertexBuffers; +#define glVertexArrayVertexBuffers glad_glVertexArrayVertexBuffers +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC)(GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI PFNGLVERTEXARRAYATTRIBBINDINGPROC glad_glVertexArrayAttribBinding; +#define glVertexArrayAttribBinding glad_glVertexArrayAttribBinding +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC)(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI PFNGLVERTEXARRAYATTRIBFORMATPROC glad_glVertexArrayAttribFormat; +#define glVertexArrayAttribFormat glad_glVertexArrayAttribFormat +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC)(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI PFNGLVERTEXARRAYATTRIBIFORMATPROC glad_glVertexArrayAttribIFormat; +#define glVertexArrayAttribIFormat glad_glVertexArrayAttribIFormat +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC)(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI PFNGLVERTEXARRAYATTRIBLFORMATPROC glad_glVertexArrayAttribLFormat; +#define glVertexArrayAttribLFormat glad_glVertexArrayAttribLFormat +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC)(GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI PFNGLVERTEXARRAYBINDINGDIVISORPROC glad_glVertexArrayBindingDivisor; +#define glVertexArrayBindingDivisor glad_glVertexArrayBindingDivisor +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC)(GLuint vaobj, GLenum pname, GLint *param); +GLAPI PFNGLGETVERTEXARRAYIVPROC glad_glGetVertexArrayiv; +#define glGetVertexArrayiv glad_glGetVertexArrayiv +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC)(GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI PFNGLGETVERTEXARRAYINDEXEDIVPROC glad_glGetVertexArrayIndexediv; +#define glGetVertexArrayIndexediv glad_glGetVertexArrayIndexediv +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC)(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI PFNGLGETVERTEXARRAYINDEXED64IVPROC glad_glGetVertexArrayIndexed64iv; +#define glGetVertexArrayIndexed64iv glad_glGetVertexArrayIndexed64iv +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC)(GLsizei n, GLuint *samplers); +GLAPI PFNGLCREATESAMPLERSPROC glad_glCreateSamplers; +#define glCreateSamplers glad_glCreateSamplers +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC)(GLsizei n, GLuint *pipelines); +GLAPI PFNGLCREATEPROGRAMPIPELINESPROC glad_glCreateProgramPipelines; +#define glCreateProgramPipelines glad_glCreateProgramPipelines +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC)(GLenum target, GLsizei n, GLuint *ids); +GLAPI PFNGLCREATEQUERIESPROC glad_glCreateQueries; +#define glCreateQueries glad_glCreateQueries +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC)(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI PFNGLGETQUERYBUFFEROBJECTI64VPROC glad_glGetQueryBufferObjecti64v; +#define glGetQueryBufferObjecti64v glad_glGetQueryBufferObjecti64v +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC)(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI PFNGLGETQUERYBUFFEROBJECTIVPROC glad_glGetQueryBufferObjectiv; +#define glGetQueryBufferObjectiv glad_glGetQueryBufferObjectiv +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC)(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI PFNGLGETQUERYBUFFEROBJECTUI64VPROC glad_glGetQueryBufferObjectui64v; +#define glGetQueryBufferObjectui64v glad_glGetQueryBufferObjectui64v +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC)(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI PFNGLGETQUERYBUFFEROBJECTUIVPROC glad_glGetQueryBufferObjectuiv; +#define glGetQueryBufferObjectuiv glad_glGetQueryBufferObjectuiv +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC)(GLbitfield barriers); +GLAPI PFNGLMEMORYBARRIERBYREGIONPROC glad_glMemoryBarrierByRegion; +#define glMemoryBarrierByRegion glad_glMemoryBarrierByRegion +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETTEXTURESUBIMAGEPROC glad_glGetTextureSubImage; +#define glGetTextureSubImage glad_glGetTextureSubImage +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage; +#define glGetCompressedTextureSubImage glad_glGetCompressedTextureSubImage +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC)(void); +GLAPI PFNGLGETGRAPHICSRESETSTATUSPROC glad_glGetGraphicsResetStatus; +#define glGetGraphicsResetStatus glad_glGetGraphicsResetStatus +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETNCOMPRESSEDTEXIMAGEPROC glad_glGetnCompressedTexImage; +#define glGetnCompressedTexImage glad_glGetnCompressedTexImage +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI PFNGLGETNTEXIMAGEPROC glad_glGetnTexImage; +#define glGetnTexImage glad_glGetnTexImage +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC)(GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI PFNGLGETNUNIFORMDVPROC glad_glGetnUniformdv; +#define glGetnUniformdv glad_glGetnUniformdv +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI PFNGLGETNUNIFORMFVPROC glad_glGetnUniformfv; +#define glGetnUniformfv glad_glGetnUniformfv +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC)(GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI PFNGLGETNUNIFORMIVPROC glad_glGetnUniformiv; +#define glGetnUniformiv glad_glGetnUniformiv +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC)(GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv; +#define glGetnUniformuiv glad_glGetnUniformuiv +typedef void (APIENTRYP PFNGLREADNPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI PFNGLREADNPIXELSPROC glad_glReadnPixels; +#define glReadnPixels glad_glReadnPixels +typedef void (APIENTRYP PFNGLGETNMAPDVPROC)(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI PFNGLGETNMAPDVPROC glad_glGetnMapdv; +#define glGetnMapdv glad_glGetnMapdv +typedef void (APIENTRYP PFNGLGETNMAPFVPROC)(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI PFNGLGETNMAPFVPROC glad_glGetnMapfv; +#define glGetnMapfv glad_glGetnMapfv +typedef void (APIENTRYP PFNGLGETNMAPIVPROC)(GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI PFNGLGETNMAPIVPROC glad_glGetnMapiv; +#define glGetnMapiv glad_glGetnMapiv +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC)(GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI PFNGLGETNPIXELMAPFVPROC glad_glGetnPixelMapfv; +#define glGetnPixelMapfv glad_glGetnPixelMapfv +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC)(GLenum map, GLsizei bufSize, GLuint *values); +GLAPI PFNGLGETNPIXELMAPUIVPROC glad_glGetnPixelMapuiv; +#define glGetnPixelMapuiv glad_glGetnPixelMapuiv +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC)(GLenum map, GLsizei bufSize, GLushort *values); +GLAPI PFNGLGETNPIXELMAPUSVPROC glad_glGetnPixelMapusv; +#define glGetnPixelMapusv glad_glGetnPixelMapusv +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC)(GLsizei bufSize, GLubyte *pattern); +GLAPI PFNGLGETNPOLYGONSTIPPLEPROC glad_glGetnPolygonStipple; +#define glGetnPolygonStipple glad_glGetnPolygonStipple +typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI PFNGLGETNCOLORTABLEPROC glad_glGetnColorTable; +#define glGetnColorTable glad_glGetnColorTable +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI PFNGLGETNCONVOLUTIONFILTERPROC glad_glGetnConvolutionFilter; +#define glGetnConvolutionFilter glad_glGetnConvolutionFilter +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI PFNGLGETNSEPARABLEFILTERPROC glad_glGetnSeparableFilter; +#define glGetnSeparableFilter glad_glGetnSeparableFilter +typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI PFNGLGETNHISTOGRAMPROC glad_glGetnHistogram; +#define glGetnHistogram glad_glGetnHistogram +typedef void (APIENTRYP PFNGLGETNMINMAXPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI PFNGLGETNMINMAXPROC glad_glGetnMinmax; +#define glGetnMinmax glad_glGetnMinmax +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC)(void); +GLAPI PFNGLTEXTUREBARRIERPROC glad_glTextureBarrier; +#define glTextureBarrier glad_glTextureBarrier +#endif +#ifndef GL_VERSION_4_6 +#define GL_VERSION_4_6 1 +GLAPI int GLAD_GL_VERSION_4_6; +typedef void (APIENTRYP PFNGLSPECIALIZESHADERPROC)(GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue); +GLAPI PFNGLSPECIALIZESHADERPROC glad_glSpecializeShader; +#define glSpecializeShader glad_glSpecializeShader +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC)(GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glad_glMultiDrawArraysIndirectCount; +#define glMultiDrawArraysIndirectCount glad_glMultiDrawArraysIndirectCount +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC)(GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glad_glMultiDrawElementsIndirectCount; +#define glMultiDrawElementsIndirectCount glad_glMultiDrawElementsIndirectCount +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC)(GLfloat factor, GLfloat units, GLfloat clamp); +GLAPI PFNGLPOLYGONOFFSETCLAMPPROC glad_glPolygonOffsetClamp; +#define glPolygonOffsetClamp glad_glPolygonOffsetClamp +#endif +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 +GLAPI int GLAD_GL_EXT_framebuffer_multisample; +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT; +#define glRenderbufferStorageMultisampleEXT glad_glRenderbufferStorageMultisampleEXT +#endif +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +GLAPI int GLAD_GL_EXT_texture_filter_anisotropic; +#endif +#ifndef GL_NV_texture_barrier +#define GL_NV_texture_barrier 1 +GLAPI int GLAD_GL_NV_texture_barrier; +typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC)(void); +GLAPI PFNGLTEXTUREBARRIERNVPROC glad_glTextureBarrierNV; +#define glTextureBarrierNV glad_glTextureBarrierNV +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glava.c b/share/dotfiles/.config/glava/glava_repo/glava/glava.c new file mode 100644 index 00000000..c779153a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glava.c @@ -0,0 +1,577 @@ +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <unistd.h> +#include <limits.h> +#include <getopt.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include "fifo.h" +#include "pulse_input.h" +#include "render.h" +#include "xwin.h" + +#ifdef GLAD_DEBUG +#define GLAVA_RELEASE_TYPE_PREFIX "debug, " +#else +#define GLAVA_RELEASE_TYPE_PREFIX "stable, " +#endif +#ifdef GLAVA_STANDALONE +#define GLAVA_RELEASE_TYPE_BUILD "standalone" +#elif GLAVA_UNIX +#define GLAVA_RELEASE_TYPE_BUILD "unix/fhs" +#elif GLAVA_OSX +#define GLAVA_RELEASE_TYPE_BUILD "osx" +#else +#define GLAVA_RELEASE_TYPE_BUILD "?" +#endif +#define GLAVA_RELEASE_TYPE GLAVA_RELEASE_TYPE_PREFIX GLAVA_RELEASE_TYPE_BUILD + +#define FORMAT(...) \ + ({ \ + char* buf = malloc(PATH_MAX); \ + snprintf(buf, PATH_MAX, __VA_ARGS__); \ + buf; \ + }) + +#define ENV(e, ...) \ + ({ \ + const char* _e = getenv(e); \ + if (!_e) \ + _e = FORMAT(__VA_ARGS__); \ + _e; \ + }) + +#ifdef GLAVA_STANDALONE +#define SHADER_INSTALL_PATH "../shaders/glava" +#define SHADER_USER_PATH "userconf" +/* FHS compliant systems */ +#elif defined(__unix__) || defined(GLAVA_UNIX) +#ifndef SHADER_INSTALL_PATH +#define SHADER_INSTALL_PATH "/etc/xdg/glava" +#endif +#define SHADER_USER_PATH FORMAT("%s/glava", ENV("XDG_CONFIG_HOME", "%s/.config", ENV("HOME", "/home"))) +/* OSX */ +#elif (defined(__APPLE__) && defined(__MACH__)) || defined(GLAVA_OSX) +#ifndef SHADER_INSTALL_PATH +#define SHADER_INSTALL_PATH "/Library/glava" +#endif +#define SHADER_USER_PATH FORMAT("%s/Library/Preferences/glava", ENV("HOME", "/")) +#else +#error "Unsupported target system" +#endif + +#ifndef ACCESSPERMS +#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ +#endif + +static volatile bool reload = false; + +__attribute__((noreturn, visibility("default"))) void glava_return_builtin(void) { exit(EXIT_SUCCESS); } +__attribute__((noreturn, visibility("default"))) void glava_abort_builtin (void) { exit(EXIT_FAILURE); } +__attribute__((noreturn, visibility("default"))) void (*glava_return) (void) = glava_return_builtin; +__attribute__((noreturn, visibility("default"))) void (*glava_abort) (void) = glava_abort_builtin; + +/* Copy installed shaders/configuration from the installed location + (usually /etc/xdg). Modules (folders) will be linked instead of + copied. */ +static void copy_cfg(const char* path, const char* dest, bool verbose) { + size_t + sl = strlen(path), + tl = strlen(dest), + pgsz = (size_t) getpagesize(); /* optimal buffer size */ + DIR* dir = opendir(path); + if (!dir) { + fprintf(stderr, "'%s' does not exist\n", path); + glava_abort(); + } + + umask(~(S_IRWXU | S_IRGRP | S_IROTH | S_IXGRP | S_IXOTH)); + if (mkdir(dest, ACCESSPERMS) && errno != EEXIST) { + fprintf(stderr, "could not create directory '%s': %s\n", dest, strerror(errno)); + glava_abort(); + } + + struct dirent* d; + while ((d = readdir(dir)) != NULL) { + if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) + continue; + int type = 0; + size_t + dl = strlen(d->d_name), + pl = sl + dl + 2, + fl = tl + dl + 2; + char p[pl], f[fl]; + snprintf(p, pl, "%s/%s", path, d->d_name); + snprintf(f, fl, "%s/%s", dest, d->d_name); + + if (d->d_type != DT_UNKNOWN) /* don't bother with stat if we already have the type */ + type = d->d_type == DT_REG ? 1 : (d->d_type == DT_DIR ? 2 : 0); + else { + struct stat st; + if (lstat(p, &st)) { + fprintf(stderr, "failed to stat '%s': %s\n", p, strerror(errno)); + } else + type = S_ISREG(st.st_mode) ? 1 : (S_ISDIR(st.st_mode) ? 2 : 0); + } + + switch (type) { + case 1: { + int source = -1, dest = -1; + uint8_t buf[pgsz]; + ssize_t r, t, w, a; + if (!strncmp(p, "env_", 4)) + break; + if ((source = open(p, O_RDONLY)) < 0) { + fprintf(stderr, "failed to open (source) '%s': %s\n", p, strerror(errno)); + goto cleanup; + } + if ((dest = open(f, O_TRUNC | O_WRONLY | O_CREAT, ACCESSPERMS)) < 0) { + fprintf(stderr, "failed to open (destination) '%s': %s\n", f, strerror(errno)); + goto cleanup; + } + for (t = 0; (r = read(source, buf, pgsz)) > 0; t += r) { + for (a = 0; a < r && (w = write(dest, buf + a, r - a)) > 0; a += w); + if (w < 0) { + fprintf(stderr, "error while writing '%s': %s\n", f, strerror(errno)); + goto cleanup; + } + } + if (r < 0) { + fprintf(stderr, "error while reading '%s': %s\n", p, strerror(errno)); + goto cleanup; + } + if (verbose) + printf("copy '%s' -> '%s'\n", p, f); + cleanup: + if (source > 0) close(source); + if (dest > 0) close(dest); + } + break; + case 2: + if (symlink(p, f) && errno != EEXIST) + fprintf(stderr, "failed to symlink '%s' -> '%s': %s\n", p, f, strerror(errno)); + else if (verbose) + printf("symlink '%s' -> '%s'\n", p, f); + break; + } + } + closedir(dir); +} + +#define GLAVA_VERSION_STRING "GLava (glava) " GLAVA_VERSION " (" GLAVA_RELEASE_TYPE ")" + +static const char* help_str = + "Usage: %s [OPTIONS]...\n" + "Opens a window with an OpenGL context to draw an audio visualizer.\n" + "\n" + "Available arguments:\n" + "-h, --help show this help and exit\n" + "-v, --verbose enables printing of detailed information about execution\n" + "-d, --desktop enables running glava as a desktop window by detecting the\n" + " desktop environment and setting the appropriate properties\n" + " automatically. Can override properties in \"rc.glsl\".\n" + "-r, --request=REQUEST evaluates the specified request after loading \"rc.glsl\".\n" + "-m, --force-mod=NAME forces the specified module to load instead, ignoring any\n" + " `#request mod` instances in the entry point.\n" + "-e, --entry=FILE specifies the name of the file to look for when loading shaders,\n" + " by default this is \"rc.glsl\".\n" + "-C, --copy-config creates copies and symbolic links in the user configuration\n" + " directory for glava, copying any files in the root directory\n" + " of the installed shader directory, and linking any modules.\n" + "-b, --backend specifies a window creation backend to use. By default, the most\n" + " appropriate backend will be used for the underlying windowing\n" + " system.\n" + "-a, --audio=BACKEND specifies an audio input backend to use.\n" + "-p, --pipe[=BIND[:TYPE]] binds value(s) to be read from stdin. The input my be read using\n" + " `@name` or `@name:default` syntax within shader sources.\n" + " A stream of inputs (each overriding the previous) must be\n" + " assigned with the `name = value` syntax and separated by\n" + " newline (\'\\n\') characters.\n" + "-V, --version print application version and exit\n" + "\n" + "The REQUEST argument is evaluated identically to the \'#request\' preprocessor directive\n" + "in GLSL files.\n" + "\n" + "The FILE argument may be any file path. All specified file paths are relative to the\n" + "active configuration root (usually ~/.config/glava if present).\n" + "\n" + "The BACKEND argument may be any of the following strings (for this particular build):\n" + "%s" + "\n" + "The BIND argument must a valid GLSL identifier." + "\n" + "The TYPE argument must be a valid GLSL type. If `--pipe` is used without a \n" + "type argument, the default type is `vec4` (type used for RGBA colors).\n" + "\n" + GLAVA_VERSION_STRING "\n"; + +static const char* opt_str = "dhvVe:Cm:b:r:a:i::p::"; +static struct option p_opts[] = { + {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, 'v'}, + {"desktop", no_argument, 0, 'd'}, + {"audio", required_argument, 0, 'a'}, + {"request", required_argument, 0, 'r'}, + {"entry", required_argument, 0, 'e'}, + {"force-mod", required_argument, 0, 'm'}, + {"copy-config", no_argument, 0, 'C'}, + {"backend", required_argument, 0, 'b'}, + {"pipe", optional_argument, 0, 'p'}, + {"stdin", optional_argument, 0, 'i'}, + {"version", no_argument, 0, 'V'}, + #ifdef GLAVA_DEBUG + {"run-tests", no_argument, 0, 'T'}, + #endif + {0, 0, 0, 0 } +}; + +#define append_buf(buf, sz_store, ...) \ + ({ \ + buf = realloc(buf, ++(*sz_store) * sizeof(*buf)); \ + buf[*sz_store - 1] = __VA_ARGS__; \ + }) + +/* Wait for glava_renderer target texture to be initialized and valid */ +__attribute__((visibility("default"))) +void glava_wait(glava_handle* ref) { + while(__atomic_load_n(ref, __ATOMIC_SEQ_CST) == NULL) { + /* Edge case: handle has not been assigned */ + struct timespec tv = { + .tv_sec = 0, .tv_nsec = 10 * 1000000 + }; + nanosleep(&tv, NULL); + } + pthread_mutex_lock(&(*ref)->lock); + while ((*ref)->flag == false) + pthread_cond_wait(&(*ref)->cond, &(*ref)->lock); + pthread_mutex_unlock(&(*ref)->lock); +} + +__attribute__((visibility("default"))) +unsigned int glava_tex(glava_handle r) { + return r->off_tex; +} + +/* Atomic size request */ +__attribute__((visibility("default"))) +void glava_sizereq(glava_handle r, int x, int y, int w, int h) { + r->sizereq = (typeof(r->sizereq)) { .x = x, .y = y, .w = w, .h = h }; + __atomic_store_n(&r->sizereq_flag, GLAVA_REQ_RESIZE, __ATOMIC_SEQ_CST); +} + +/* Atomic terminate request */ +__attribute__((visibility("default"))) +void glava_terminate(glava_handle* ref) { + glava_handle store = __atomic_exchange_n(ref, NULL, __ATOMIC_SEQ_CST); + if (store) + __atomic_store_n(&store->alive, false, __ATOMIC_SEQ_CST); +} + +/* Atomic reload request */ +__attribute__((visibility("default"))) +void glava_reload(glava_handle* ref) { + glava_handle store = __atomic_exchange_n(ref, NULL, __ATOMIC_SEQ_CST); + if (store) { + __atomic_store_n(&reload, true, __ATOMIC_SEQ_CST); + __atomic_store_n(&store->alive, false, __ATOMIC_SEQ_CST); + } +} + + +/* Main entry */ +__attribute__((visibility("default"))) +void glava_entry(int argc, char** argv, glava_handle* ret) { + + /* Evaluate these macros only once, since they allocate */ + const char + * install_path = SHADER_INSTALL_PATH, + * user_path = SHADER_USER_PATH, + * entry = "rc.glsl", + * force = NULL, + * backend = NULL, + * audio_impl_name = "pulseaudio"; + const char* system_shader_paths[] = { user_path, install_path, NULL }; + int stdin_type = STDIN_TYPE_NONE; + + char** requests = malloc(1); + size_t requests_sz = 0; + struct rd_bind* binds = malloc(1); + size_t binds_sz = 0; + + bool verbose = false, copy_mode = false, desktop = false, test = false; + + int c, idx; + while ((c = getopt_long(argc, argv, opt_str, p_opts, &idx)) != -1) { + switch (c) { + case 'v': verbose = true; break; + case 'C': copy_mode = true; break; + case 'd': desktop = true; break; + case 'r': append_buf(requests, &requests_sz, optarg); break; + case 'e': entry = optarg; break; + case 'm': force = optarg; break; + case 'b': backend = optarg; break; + case 'a': audio_impl_name = optarg; break; + case '?': glava_abort(); break; + case 'V': + puts(GLAVA_VERSION_STRING); + glava_return(); + break; + default: + case 'h': { + char buf[2048]; + size_t bsz = 0; + for (size_t t = 0; t < audio_impls_idx; ++t) + bsz += snprintf(buf + bsz, sizeof(buf) - bsz, "\t\"%s\"%s\n", audio_impls[t]->name, + !strcmp(audio_impls[t]->name, audio_impl_name) ? " (default)" : ""); + printf(help_str, argc > 0 ? argv[0] : "glava", buf); + glava_return(); + break; + } + case 'p': { + if (stdin_type != STDIN_TYPE_NONE) goto conflict_error; + char* parsed_name = NULL; + const char* parsed_type = NULL; + if (optarg) { + size_t in_sz = strlen(optarg); + int sep = -1; + for (size_t t = 0; t < in_sz; ++t) { + switch (optarg[t]) { + case ' ': optarg[t] = '\0'; goto after; + case ':': sep = (int) t; break; + } + } + after: + if (sep >= 0) { + parsed_type = optarg + sep + 1; + optarg[sep] = '\0'; + } + parsed_name = optarg; + } else parsed_name = PIPE_DEFAULT; + if (*parsed_name == '\0') { + fprintf(stderr, "Error: invalid pipe binding name: \"%s\"\n" + "Zero length names are not permitted.\n", parsed_name); + glava_abort(); + } + for (char* c = parsed_name; *c != '\0'; ++c) { + switch (*c) { + case '0' ... '9': + if (c == parsed_name) { + fprintf(stderr, "Error: invalid pipe binding name: \"%s\" ('%c')\n" + "Valid names may not start with a number.\n", parsed_name, *c); + glava_abort(); + } + case 'a' ... 'z': + case 'A' ... 'Z': + case '_': continue; + default: + fprintf(stderr, "Error: invalid pipe binding name: \"%s\" ('%c')\n" + "Valid names may only contain [a..z], [A..Z], [0..9] " + "and '_' characters.\n", parsed_name, *c); + glava_abort(); + } + } + for (size_t t = 0; t < binds_sz; ++t) { + if (!strcmp(binds[t].name, parsed_name)) { + fprintf(stderr, "Error: attempted to re-bind pipe argument: \"%s\"\n", parsed_name); + glava_abort(); + } + } + int type = -1; + if (parsed_type == NULL || strlen(parsed_type) == 0) { + type = STDIN_TYPE_VEC4; + parsed_type = bind_types[STDIN_TYPE_VEC4].n; + } else { + for (size_t t = 0 ; bind_types[t].n != NULL; ++t) { + if (!strcmp(bind_types[t].n, parsed_type)) { + type = bind_types[t].i; + parsed_type = bind_types[t].n; + break; + } + } + } + if (type == -1) { + fprintf(stderr, "Error: Unsupported `--pipe` GLSL type: \"%s\"\n", parsed_type); + glava_abort(); + } + struct rd_bind bd = { + .name = parsed_name, + .type = type, + .stype = parsed_type + }; + append_buf(binds, &binds_sz, bd); + break; + } + case 'i': { + if (binds_sz > 0) goto conflict_error; + fprintf(stderr, "Warning: `--stdin` is deprecated and will be " + "removed in a future release, use `--pipe` instead. \n"); + stdin_type = -1; + if (optarg == NULL) { + stdin_type = STDIN_TYPE_VEC4; + } else { + for (size_t t = 0 ; bind_types[t].n != NULL; ++t) { + if (!strcmp(bind_types[t].n, optarg)) { + stdin_type = bind_types[t].i; + break; + } + } + } + if (stdin_type == -1) { + fprintf(stderr, "Error: Unsupported `--stdin` GLSL type: \"%s\"\n", optarg); + glava_abort(); + } + break; + } + conflict_error: + fprintf(stderr, "Error: cannot use `--pipe` and `--stdin` together\n"); + glava_abort(); + #ifdef GLAVA_DEBUG + case 'T': { + entry = "test_rc.glsl"; + test = true; + } + #endif + } + } + + if (copy_mode) { + copy_cfg(install_path, user_path, verbose); + glava_return(); + } + + /* Handle `--force` argument as a request override */ + if (force) { + const size_t bsz = 5 + strlen(force); + char* force_req_buf = malloc(bsz); + snprintf(force_req_buf, bsz, "mod %s", force); + append_buf(requests, &requests_sz, force_req_buf); + } + + /* Null terminate array arguments */ + append_buf(requests, &requests_sz, NULL); + append_buf(binds, &binds_sz, (struct rd_bind) { .name = NULL }); + + float* b0, * b1, * lb, * rb; + size_t t; + struct audio_data audio; + struct audio_impl* impl = NULL; + pthread_t thread; + int return_status; + + for (t = 0; t < audio_impls_idx; ++t) { + if (!strcmp(audio_impls[t]->name, audio_impl_name)) { + impl = audio_impls[t]; + break; + } + } + + if (!impl) { + fprintf(stderr, "The specified audio backend (\"%s\") is not available.\n", audio_impl_name); + glava_abort(); + } + +instantiate: {} + glava_renderer* rd = rd_new(system_shader_paths, entry, (const char**) requests, + backend, binds, stdin_type, desktop, verbose, test); + if (ret) + __atomic_store_n(ret, rd, __ATOMIC_SEQ_CST); + + b0 = malloc(rd->bufsize_request * sizeof(float)); + b1 = malloc(rd->bufsize_request * sizeof(float)); + lb = malloc(rd->bufsize_request * sizeof(float)); + rb = malloc(rd->bufsize_request * sizeof(float)); + for (t = 0; t < rd->bufsize_request; ++t) { + b0[t] = 0.0F; + b1[t] = 0.0F; + } + + audio = (struct audio_data) { + .source = ({ + char* src = NULL; + if (rd->audio_source_request && strcmp(rd->audio_source_request, "auto") != 0) { + src = strdup(rd->audio_source_request); + } + src; + }), + .rate = (unsigned int) rd->rate_request, + .format = -1, + .terminate = 0, + .channels = rd->mirror_input ? 1 : 2, + .audio_out_r = b0, + .audio_out_l = b1, + .mutex = PTHREAD_MUTEX_INITIALIZER, + .audio_buf_sz = rd->bufsize_request, + .sample_sz = rd->samplesize_request, + .modified = false + }; + + impl->init(&audio); + + if (verbose) printf("Using audio source: %s\n", audio.source); + + pthread_create(&thread, NULL, impl->entry, (void*) &audio); + while (__atomic_load_n(&rd->alive, __ATOMIC_SEQ_CST)) { + + rd_time(rd); /* update timer for this frame */ + + bool modified; /* if the audio buffer has been updated by the streaming thread */ + + /* lock the audio mutex and read our data */ + pthread_mutex_lock(&audio.mutex); + modified = audio.modified; + if (modified) { + /* create our own copies of the audio buffers, so the streaming + thread can continue to append to it */ + memcpy(lb, (void*) audio.audio_out_l, rd->bufsize_request * sizeof(float)); + memcpy(rb, (void*) audio.audio_out_r, rd->bufsize_request * sizeof(float)); + audio.modified = false; /* set this flag to false until the next time we read */ + } + pthread_mutex_unlock(&audio.mutex); + + bool ret = rd_update(rd, lb, rb, rd->bufsize_request, modified); + + if (!ret) { + /* Sleep for 50ms and then attempt to render again */ + struct timespec tv = { + .tv_sec = 0, .tv_nsec = 50 * 1000000 + }; + nanosleep(&tv, NULL); + } + #ifdef GLAVA_DEBUG + if (ret && rd_get_test_mode(rd)) + break; + #endif + } + + #ifdef GLAVA_DEBUG + if (rd_get_test_mode(rd)) { + if (rd_test_evaluate(rd)) { + fprintf(stderr, "Test results did not match expected output\n"); + fflush(stderr); + glava_abort(); + } + } + #endif + + audio.terminate = 1; + if ((return_status = pthread_join(thread, NULL))) { + fprintf(stderr, "Failed to join with audio thread: %s\n", strerror(return_status)); + } + + free(audio.source); + free(b0); + free(b1); + free(lb); + free(rb); + rd_destroy(rd); + if (__atomic_exchange_n(&reload, false, __ATOMIC_SEQ_CST)) + goto instantiate; +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glava.h b/share/dotfiles/.config/glava/glava_repo/glava/glava.h new file mode 100644 index 00000000..570abc3f --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glava.h @@ -0,0 +1,27 @@ +#ifndef _GLAVA_H +#define _GLAVA_H + +#include <stdbool.h> +#include <stdint.h> +#include <pthread.h> + +#define GLAVA_REQ_NONE 0 +#define GLAVA_REQ_RESIZE 1 + +struct gl_data; +struct glava_renderer; + +/* External API */ + +typedef struct glava_renderer* volatile glava_handle; +__attribute__((noreturn, visibility("default"))) void (*glava_abort) (void); +__attribute__((noreturn, visibility("default"))) void (*glava_return) (void); +__attribute__((visibility("default"))) void glava_assign_external_ctx (void* ctx); +__attribute__((visibility("default"))) void glava_entry (int argc, char** argv, glava_handle* ret); +__attribute__((visibility("default"))) void glava_terminate (glava_handle* ref); +__attribute__((visibility("default"))) void glava_reload (glava_handle* ref); +__attribute__((visibility("default"))) void glava_sizereq (glava_handle r, int x, int y, int w, int h); +__attribute__((visibility("default"))) void glava_wait (glava_handle* ref); +__attribute__((visibility("default"))) unsigned int glava_tex (glava_handle r); + +#endif /* _GLAVA_H */ diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glfw_wcb.c b/share/dotfiles/.config/glava/glava_repo/glava/glfw_wcb.c new file mode 100644 index 00000000..791bfe16 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glfw_wcb.c @@ -0,0 +1,151 @@ + +/* GLFW window and OpenGL context creation. */ + +#ifdef GLAVA_GLFW + +#define GLAVA_RDX11 + +#include <stdlib.h> +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +#include <errno.h> + +#include <X11/Xlib.h> + +#include <glad/glad.h> +#include <GLFW/glfw3.h> + +#include "render.h" +#include "xwin.h" + +#define GLFW_EXPOSE_NATIVE_X11 + +/* Hack to make GLFW 3.1 headers work with GLava. We don't use the context APIs from GLFW, but + the old headers require one of them to be selected for exposure in glfw3native.h. */ +#if GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR <= 1 +#define GLFW_EXPOSE_NATIVE_GLX +#endif +#include <GLFW/glfw3native.h> + +/* Fixes for old GLFW versions */ +#ifndef GLFW_TRUE +#define GLFW_TRUE GL_TRUE +#endif +#ifndef GLFW_FALSE +#define GLFW_FALSE GL_FALSE +#endif + +#define DECL_WINDOW_HINT(F, H) \ + static void F(bool var) { glfwWindowHint(H, var); } +#define DECL_WINDOW_HINT_STUB(F) \ + static void F(bool _) { fprintf(stderr, "Warning: " #F " not implemented for GLFW backend\n"); } + +static void init(void) { + if (!glfwInit()) { + fprintf(stderr, "glfwInit(): failed\n"); + abort(); + } + + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_FLOATING, GLFW_FALSE); + glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); +} + + +DECL_WINDOW_HINT(set_floating, GLFW_FLOATING); +DECL_WINDOW_HINT(set_decorated, GLFW_DECORATED); +DECL_WINDOW_HINT(set_focused, GLFW_FOCUSED); +#ifdef GLFW_MAXIMIZED +DECL_WINDOW_HINT(set_maximized, GLFW_MAXIMIZED); +#else +DECL_WINDOW_HINT_STUB(set_maximized); +#endif + +extern struct gl_wcb wcb_glfw; + +static bool offscreen(void) { return false; } + +static void* create_and_bind(const char* name, const char* class, + const char* type, const char** states, + size_t states_sz, + int d, int h, + int x, int y, + int version_major, int version_minor, + bool clickthrough, bool offscreen) { + + GLFWwindow* w; + + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, version_major); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, version_minor); + + if (!(w = glfwCreateWindow(d, h, class, NULL, NULL))) { + fprintf(stderr, "glfwCreateWindow(): failed\n"); + glfwTerminate(); + return NULL; + } + + if (type) + xwin_settype(&wcb_glfw, w, type); + + for (size_t t = 0; t < states_sz; ++t) + xwin_addstate(&wcb_glfw, w, states[t]); + + glfwSetWindowPos(w, x, y); + glfwMakeContextCurrent(w); + + if (!glad_instantiated) { + gladLoadGL(); + glad_instantiated = true; + } + + return w; +} + +static void set_transparent(bool transparent) { + #ifdef GLFW_TRANSPARENT_FRAMEBUFFER + glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, transparent ? GLFW_TRUE : GLFW_FALSE); + #elif GLFW_TRANSPARENT + glfwWindowHint(GLFW_TRANSPARENT, transparent ? GLFW_TRUE : GLFW_FALSE); + #else + if (transparent) + fprintf(stderr, "Warning: the linked version of GLFW3 does not have transparency support" + " (GLFW_TRANSPARENT[_FRAMEBUFFER])!\n"); + #endif +} + +static void set_geometry(GLFWwindow* w, int x, int y, int d, int h) { + glfwSetWindowPos(w, x, y); + glfwSetWindowSize(w, d, h); +} + +static void set_visible(GLFWwindow* w, bool visible) { + if (visible) glfwShowWindow(w); + else glfwHideWindow(w); +} + +static void swap_buffers(GLFWwindow* w) { + glfwSwapBuffers(w); + glfwPollEvents(); +} + +static Display* get_x11_display(void) { return glfwGetX11Display(); } +static Window get_x11_window (GLFWwindow* w) { return glfwGetX11Window(w); } +static bool should_close (GLFWwindow* w) { return glfwWindowShouldClose(w); } +static bool should_render (GLFWwindow* w) { return true; } +static bool bg_changed (GLFWwindow* w) { return false; } +static void get_fbsize (GLFWwindow* w, int* d, int* h) { glfwGetFramebufferSize(w, d, h); } +static void get_pos (GLFWwindow* w, int* x, int* y) { glfwGetWindowPos(w, x, y); } +static double get_time (GLFWwindow* w) { return glfwGetTime(); } +static void set_time (GLFWwindow* w, double time) { glfwSetTime(time); } +static void set_swap (int i) { glfwSwapInterval(i); } +static void raise (GLFWwindow* w) { glfwShowWindow(w); } +static void destroy (GLFWwindow* w) { glfwDestroyWindow(w); } +static void terminate (void) { glfwTerminate(); } + +static const char* get_environment(void) { return xwin_detect_wm(&wcb_glfw); } + +WCB_ATTACH("glfw", wcb_glfw); + +#endif /* GLAVA_GLFW */ diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.c b/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.c new file mode 100644 index 00000000..8f53d25b --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.c @@ -0,0 +1,738 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdarg.h> +#include <errno.h> +#include <string.h> +#include <dirent.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +#include "glava.h" +#include "render.h" +#include "glsl_ext.h" + +#define LINE_START 0 +#define GLSL 1 +#define MACRO 2 +#define REQUEST 3 +#define INCLUDE 4 +#define COLOR 5 +#define DEFINE 6 +#define BIND 7 +#define EXPAND 8 + +struct sbuf { + char* buf; + size_t at; /* index of final null character */ + size_t bsize; /* actual buffer size */ +}; + +#define append(sbuf, str) n_append(sbuf, strlen(str), str) + +static inline void expand_for(struct sbuf* sbuf, size_t len) { + bool resize = false; + while (len + 1 > sbuf->bsize - sbuf->at) { + sbuf->bsize *= 2; + resize = true; + } + if (resize) + sbuf->buf = realloc(sbuf->buf, sbuf->bsize); +} + +/* append 'n' bytes from 'str' to the resizable buffer */ +static void n_append(struct sbuf* sbuf, size_t len, const char* str) { + expand_for(sbuf, len); + memcpy(sbuf->buf + sbuf->at, str, len); + sbuf->at += len; + sbuf->buf[sbuf->at] = '\0'; +} + +#define s_append(sbuf, fmt, ...) se_append(sbuf, 64, fmt, __VA_ARGS__) + +/* append the formatted string to the resizable buffer, where elen is extra space for formatted chars */ +static void se_append(struct sbuf* sbuf, size_t elen, const char* fmt, ...) { + size_t space = strlen(fmt) + elen; + expand_for(sbuf, space); + va_list args; + va_start(args, fmt); + int written; + if ((written = vsnprintf(sbuf->buf + sbuf->at, space, fmt, args)) < 0) + glava_abort(); + sbuf->at += written; + va_end(args); +} + +#define parse_error(line, f, fmt, ...) \ + do { \ + fprintf(stderr, "[%s:%d] " fmt "\n", f, (int) line, __VA_ARGS__); \ + glava_abort(); \ + } while (0) + +#define parse_error_s(line, f, s) \ + do { \ + fprintf(stderr, "[%s:%d] " s "\n", f, (int) line); \ + glava_abort(); \ + } while (0) + +struct schar { + char* buf; + size_t sz; +}; + +bool ext_parse_color(const char* str, size_t elem_sz, float** results) { + size_t t, len = strlen(str), i = 0, s = 0; + uint8_t elem_bytes[elem_sz]; + /* Ignore '0x' prefix, if present */ + if (len >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) { + len -= 2; + str += 2; + } + for (t = 0; t < len && t < 8; ++t) { + char c = str[t]; + uint8_t b; + /* obtain value from character */ + switch (c) { + case 'a' ... 'f': b = (c - 'a') + 10; break; + case 'A' ... 'F': b = (c - 'A') + 10; break; + case '0' ... '9': b = c - '0'; break; + default: return false; + } + elem_bytes[s] = b; + if (s >= elem_sz - 1) { /* advance to next element */ + uint32_t e = 0; /* component storage */ + /* mask storage with input data */ + for (size_t v = 0; v < elem_sz; ++v) { + e |= (uint32_t) elem_bytes[v] << (((elem_sz - 1) - v) * 4); + } + /* convert to [0, 1] as floating point value */ + *results[i] = (float) e / (float) ((1 << (elem_sz * 4)) - 1); + s = 0; + ++i; + } else { /* advance character */ + ++s; + } + } + return true; +} + +static void free_after(struct glsl_ext* ext, void* ptr) { + ++ext->destruct_sz; + ext->destruct = realloc(ext->destruct, sizeof(void*) * ext->destruct_sz); + ext->destruct[ext->destruct_sz - 1] = ptr; +} + +static void inherit(struct glsl_ext* parent, struct glsl_ext* child) { + free_after(parent, child->processed); + parent->destruct = realloc(parent->destruct, sizeof(void*) * (parent->destruct_sz + child->destruct_sz)); + memcpy(parent->destruct + parent->destruct_sz, child->destruct, sizeof(void*) * child->destruct_sz); + parent->destruct_sz += child->destruct_sz; + free(child->destruct); +} + +/* handle raw arguments for #include and #request directives */ +static struct schar directive(struct glsl_ext* ext, char** args, + size_t args_sz, int state, + size_t line, const char* f) { + switch (state) { + case DEFINE: { + /* Workaround for re-defining macros in GLSL. By default this is generally an error in most + compilers/drivers, but we would prefer to override (non-function) definitions instead. + + Due to how this directive is parsed, the macro itself is still emitted afterwards. */ + if (args_sz == 0) { + parse_error_s(line, f, "No arguments provided to #define directive!"); + } + size_t bsz = (strlen(args[0]) * 3) + 64; + struct schar ret = { .buf = malloc(bsz) }; + int r = snprintf(ret.buf, bsz, "#ifdef %1$s\n#undef %1$s\n#endif\n", args[0]); + if (r < 0) + glava_abort(); + ret.sz = r; + free_after(ext, ret.buf); + return ret; + } + case INCLUDE: { + if (args_sz == 0) { + parse_error_s(line, f, "No arguments provided to #include directive!"); + } + char* target = args[0]; + + /* Handle `:` config specifier */ + size_t tsz = strlen(target); + if (tsz && target[0] == ':' && ext->cfd) { + target = &target[1]; + ext->cd = ext->cfd; + } + /* Handle `@` default specifier */ + if (tsz && target[0] == '@') { + if (!ext->dd) { + parse_error_s(line, f, "encountered '@' path specifier while no default " + "directory is available in the current context"); + } + target = &target[1]; + ext->cd = ext->dd; + } + + char path[strlen(ext->cd) + tsz + 2]; + snprintf(path, sizeof(path) / sizeof(char), "%s/%s", ext->cd, target); + + int fd = open(path, O_RDONLY); + if (fd == -1) + parse_error(line, f, "failed to load GLSL shader source " + "specified by #include directive '%s': %s\n", + path, strerror(errno)); + + struct stat st; + fstat(fd, &st); + + char* map = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (!map) + parse_error(line, f, "failed to map GLSL shader source " + "specified by #include directive '%s': %s\n", + path, strerror(errno)); + + struct glsl_ext next = { + .source = map, + .source_len = st.st_size, + .cd = ext->cd, + .cfd = ext->cfd, + .dd = ext->dd, + .handlers = ext->handlers, + .binds = ext->binds, + .ss_lookup = ext->ss_lookup, + .ss_len = ext->ss_len, + .efuncs = ext->efuncs + }; + + /* recursively process */ + ext_process(&next, target); + inherit(ext, &next); + munmap(map, st.st_size); + close(fd); + + ext->ss_lookup = next.ss_lookup; + + struct schar ret = { + .buf = next.processed, + .sz = next.p_len + }; + + return ret; + } + case REQUEST: { + if (args_sz > 0) { + char* request = args[0]; + + struct request_handler* handler; + bool found = false; + size_t t; + for (t = 0; (handler = &ext->handlers[t])->name != NULL; ++t) { + if(!strcmp(handler->name, request)) { + found = true; + void** processed_args = malloc(strlen(handler->fmt) * sizeof(void*)); + + char c; + size_t i; + for (i = 0; (c = handler->fmt[i]) != '\0'; ++i) { + if (args_sz <= 1 + i) + parse_error(line, f, + "failed to execute request '%s': expected format '%s'\n", + request, handler->fmt); + char* raw = args[1 + i]; + switch (c) { + case 'i': { + int v = (int) strtol(raw, NULL, 0); + processed_args[i] = malloc(sizeof(int)); + *(int*) processed_args[i] = v; + break; + } + case 'f': { + float f = strtof(raw, NULL); + processed_args[i] = malloc(sizeof(float)); + *(float*) processed_args[i] = f; + break; + } + case 's': { *(char**) &processed_args[i] = raw; break; } + case 'b': { + bool v; + if (!strcmp(raw, "true")) { + v = true; + } else if (!strcmp(raw, "false")) { + v = false; + } else if (strlen(raw) == 1) { + switch (raw[0]) { + case 't': { v = true; break; } + case 'f': { v = false; break; } + case '1': { v = true; break; } + case '0': { v = false; break; } + default: + parse_error_s(line, f, "tried to parse invalid " + "raw string into a boolean"); + } + } else + parse_error_s(line, f, "tried to parse invalid " + "raw string into a boolean"); + processed_args[i] = malloc(sizeof(bool)); + *(bool*) processed_args[i] = v; + break; + } + } + } + + handler->handler(request, processed_args); + + for (i = 0; (c = handler->fmt[i]) != '\0'; ++i) + if (c != 's') + free(processed_args[i]); + free(processed_args); + } + } + if (!found) + parse_error(line, f, "unknown request type '%s'", request); + } + goto return_empty; + } + case EXPAND: { + if (args_sz >= 2) { + char* fmacro = args[0]; + size_t fmacro_sz = strlen(fmacro); + char* arg = args[1]; + size_t expand_n = 0; + bool match = false; + if (ext->efuncs) { + for (size_t t = 0; ext->efuncs[t].name != NULL; ++t) { + if (!strcmp(arg, ext->efuncs[t].name)) { + expand_n = ext->efuncs[t].call(); + match = true; + break; + } + } + } + + if (!match) + parse_error(line, f, "#expand directive specified invalid input \"%s\"", arg); + + /* (2 {paren} + 1 {semicolon} + 1 {newline} + 4 {input buf} + macro) * expand + 1 */ + size_t bsz = ((8 + fmacro_sz) * expand_n) + 1; + struct schar ret = { .buf = malloc(bsz) }; + int r = 0; + for (size_t t = 0; t < expand_n; ++t) { + int sr = snprintf(ret.buf + r, bsz - r, "%s(%d);\n", args[0], (int) t); + if (sr >= 0) + r += sr; + else + parse_error(line, f, "internal formatting error (snprintf returned %d)", sr); + } + ret.sz = r; + free_after(ext, ret.buf); + return ret; + } else + parse_error(line, f, "#expand directive missing arguments, " + "requires 2 identifiers (got %d)\n", (int) args_sz); + goto return_empty; + } + return_empty: + default: return (struct schar) { .buf = NULL, .sz = 0 }; + } +} + +/* state machine parser */ +void ext_process(struct glsl_ext* ext, const char* f) { + + ext->destruct = malloc(1); + ext->destruct_sz = 0; + + if (!ext->ss_lookup) { + ext->ss_lookup = malloc(sizeof(ext->ss_lookup[0])); + ext->ss_len_s = 0; + ext->ss_len = &ext->ss_len_s; + ext->ss_own = true; + } else ext->ss_own = false; + + ext->ss_lookup = realloc(ext->ss_lookup, sizeof(ext->ss_lookup[0]) * ++(*ext->ss_len)); + int ss_cur = *ext->ss_len - 1; + ext->ss_lookup[ss_cur] = strdup(f); + + struct sbuf sbuf = { + .buf = malloc(256), + .at = 0, + .bsize = 256 + }; + + size_t source_len = ext->source_len; + size_t t; + char at; + int state = LINE_START; + size_t macro_start_idx = 0, arg_start_idx = 0, cbuf_idx, bbuf_idx, b_restart; + size_t line = 1; + bool quoted = false, arg_start = false, b_sep = false, b_spc = false, b_pre = true; + int b_br = 0; + char cbuf[9]; + char bbuf[256]; + char** args = malloc(sizeof(char*)); + size_t args_sz = 0; + + bool prev_slash = false, comment = false, comment_line = false, prev_asterix = false, + prev_escape = false, string = false, skip_color_start = false; + + se_append(&sbuf, 32, "#line 1 %d\n", ss_cur); + + for (t = 0; t <= source_len; ++t) { + at = source_len == t ? '\0' : ext->source[t]; + if (at == '\n') + ++line; + switch (state) { + case LINE_START: { /* processing start of line */ + switch (at) { + case '#': { + macro_start_idx = t; + state = MACRO; + continue; + } + case '\n': + if (comment && comment_line) { + comment = false; + comment_line = false; + } + case '\t': + case ' ': + goto copy; + default: state = GLSL; + /* let execution continue into next state */ + } + } + case GLSL: { /* copying GLSL source or unrelated preprocessor syntax */ + switch (at) { + case '"': + if (!comment && !prev_escape) + string = !string; + goto normal_char; + case '\\': + if (!comment) { + prev_escape = !prev_escape; + prev_asterix = false; + prev_slash = false; + goto copy; + } else goto normal_char; + case '/': + if (!comment) { + if (prev_slash) { + comment = true; + comment_line = true; + prev_slash = false; + } else prev_slash = true; + } else if (!comment_line) { + if (prev_asterix) { + comment = false; + prev_asterix = false; + } + } + prev_escape = false; + goto copy; + case '*': + if (!comment) { + if (prev_slash) { + comment = true; + prev_slash = false; + } + } else prev_asterix = true; + prev_escape = false; + goto copy; + case '#': { + /* handle hex color syntax */ + if (!comment && !string && !skip_color_start) { + if (ext->source[t + 1] == '#') { + skip_color_start = true; + goto normal_char; + } + state = COLOR; + cbuf_idx = 0; + continue; + } else { + skip_color_start = false; + goto normal_char; + } + } + case '@': { + /* handle bind syntax */ + if (!comment && !string && ext->binds != NULL) { + state = BIND; + b_sep = false; + b_spc = false; + b_pre = true; + b_br = 0; + b_restart = 0; + bbuf_idx = 0; + continue; + } else goto normal_char; + } + case '\n': + if (comment && comment_line) { + comment = false; + comment_line = false; + } + state = LINE_START; + normal_char: + default: + prev_asterix = false; + prev_slash = false; + prev_escape = false; + goto copy; + } + } + case COLOR: { /* parse hex color syntax (#ffffffff -> vec4(1.0, 1.0, 1.0, 1.0)) */ + switch (at) { + case 'a' ... 'z': + case 'A' ... 'Z': + case '0' ... '9': { + cbuf[cbuf_idx] = at; + ++cbuf_idx; + if (cbuf_idx >= 8) + goto emit_color; + else continue; + } + emit_color: + default: + cbuf[cbuf_idx] = '\0'; /* null terminate */ + float r = 0.0F, g = 0.0F, b = 0.0F, a = 1.0F; + if (ext_parse_color(cbuf, 2, (float*[]) { &r, &g, &b, &a })) { + se_append(&sbuf, 64, " vec4(%.6f, %.6f, %.6f, %.6f) ", r, g, b, a); + } else { + parse_error(line, f, "Invalid color format '#%s' while " + "parsing GLSL color syntax extension", cbuf); + } + state = at == '\n' ? LINE_START : GLSL; + if (cbuf_idx >= 8) + continue; + else goto copy; /* copy character if it ended the sequence */ + } + } + case BIND: { /* parse bind syntax (@name:default -> __IN_name | default)*/ + switch (at) { + default: + if (b_br > 0) goto handle_bind; /* store characters in braces */ + else goto emit_bind; /* emit on unexpected char outside braces */ + case '(': + if (b_sep && !b_spc) { + ++b_br; goto handle_bind; /* inc. brace level */ + } else goto emit_bind; /* emit if wrong context: `@sym(`, `@(` (no ':') */ + case ')': + /* start emitting on unexpected ')': `@sym:v)`, `@s)` */ + if (b_br <= 0 || !b_sep) goto emit_bind; + else { + --b_br; + if (b_br <= 0) b_spc = true; + goto handle_bind; /* dec. brace level */ + } + case ' ': if (b_br <= 0) b_spc = true; /* flag a non-braced space */ + case '#': case '+': case '-': + case '!': case '~': case '&': + if (b_sep && (b_br > 0 || b_pre)) + goto handle_bind; /* handle precede syntax only for defaults */ + else goto emit_bind; /* if encountered, skip to emit */ + case ':': + if (!b_sep) b_restart = t; + b_sep = true; + handle_bind: /* use character for binding syntax */ + case 'a' ... 'z': + case 'A' ... 'Z': + case '0' ... '9': + case '_': { + if (b_spc && at != ')') + goto emit_bind; /* skip non-braced characters after space: `@sym:vec4 c` */ + if (b_sep && at != ':') + b_pre = false; + bbuf[bbuf_idx] = at; + ++bbuf_idx; + if (bbuf_idx >= sizeof(bbuf) - 1) + goto emit_bind; /* start emitting if buffer was filled */ + else continue; + } + emit_bind: /* end binding syntax with current char */ + case '\n': + case '\0': { + const char* parsed_name = NULL; + const char* parsed_default = NULL; + bbuf[bbuf_idx] = '\0'; /* null terminate */ + int sep = -1; + for (size_t p = 0; p < bbuf_idx; ++p) + if (bbuf[p] == ':') sep = p; + if (sep >= 0) { + parsed_default = bbuf + sep + 1; + bbuf[sep] = '\0'; + } + parsed_name = bbuf; + bool m = false; + for (struct rd_bind* bd = ext->binds; bd->name != NULL; ++bd) { + if (!strcmp(parsed_name, bd->name)) { + se_append(&sbuf, 128, " _IN_%s ", parsed_name); + m = true; + break; + } + } + if (!m) { + if (parsed_default && b_restart > 0) { + /* To emit the default, we push back the cursor to where it starts + and simply resume parsing from a normal context. */ + t = b_restart; + } else parse_error(line, f, + "Unexpected `--pipe` binding name '@%s' while parsing GLSL." + " Try assigning a default or binding the value.", parsed_name); + } + state = GLSL; + continue; + } + } + } + /* emit contents from start of macro to current index and resume regular parsing*/ + #define skip_macro() \ + do { \ + n_append(&sbuf, t - macro_start_idx, &ext->source[macro_start_idx]); \ + state = at == '\n' ? LINE_START : GLSL; \ + goto copy; \ + } while (0) + case MACRO: { /* processing start of macro */ + switch (at) { + case '\n': + case ' ': + case '\t': + case '\0': { /* end parsing directive */ + + #define DIRECTIVE_CMP(lower, upper) \ + (!strncmp("#" lower, &ext->source[macro_start_idx], t - macro_start_idx) \ + || !strncmp("#" upper, &ext->source[macro_start_idx], t - macro_start_idx)) + #define DIRECTIVE_CASE(lower, upper) \ + ({ if (state == MACRO && DIRECTIVE_CMP(#lower, #upper)) \ + { state = upper; goto prepare_arg_parse; } }) + + DIRECTIVE_CASE(request, REQUEST); + DIRECTIVE_CASE(include, INCLUDE); + DIRECTIVE_CASE(define, DEFINE); + DIRECTIVE_CASE(expand, EXPAND); + + /* no match */ + if (state == MACRO) skip_macro(); + #undef DIRECTIVE_CMP + #undef DIRECTIVE_CASE + prepare_arg_parse: + { + arg_start_idx = t + 1; + arg_start = true; + args_sz = 0; + *args = NULL; + } + } + case '0' ... '9': + /* digits at the start of an identifier are not legal */ + if (macro_start_idx == t - 1) + goto macro_parse_error; + case 'a' ... 'z': + case 'A' ... 'Z': + continue; + default: + macro_parse_error: + /* invalid char, malformed! */ + parse_error(line, f, "Unexpected character '%c' while parsing GLSL directive", at); + } + } + /* scope-violating macro to copy the result of the currently parsed argument */ + #define copy_arg(end) \ + do { if (end - arg_start_idx > 0) { \ + ++args_sz; \ + args = realloc(args, sizeof(char*) * args_sz); \ + args[args_sz - 1] = malloc((end - arg_start_idx) + 1); \ + memcpy(args[args_sz - 1], &ext->source[arg_start_idx], end - arg_start_idx); \ + args[args_sz - 1][end - arg_start_idx] = '\0'; \ + } } while (0) + case REQUEST: + case INCLUDE: + case DEFINE: + case EXPAND: { + switch (at) { + case ' ': + case '\t': + case '\n': + case '\0': + if (!quoted) { + /* end arg */ + copy_arg(t); + arg_start = true; + arg_start_idx = t + 1; + } else arg_start = false; + + if (at == '\n' || at == '\0' || state == DEFINE) { + /* end directive */ + size_t a; + struct schar r = directive(ext, args, args_sz, state, line, f); + for (a = 0; a < args_sz; ++a) { + free(args[a]); + } + args_sz = 0; + /* if something was returned (ie. included file), paste the results */ + if (r.buf) { + n_append(&sbuf, r.sz, r.buf); + append(&sbuf, "\n"); + se_append(&sbuf, 48, "#line %d %d\n", line, ss_cur); + } + if (state == DEFINE) skip_macro(); + else state = LINE_START; + } + break; + case '(': + if (state != DEFINE || args_sz != 0) goto arg; /* only handle first arg of #define */ + skip_macro(); /* ignore macro functions */ + case '"': + if (state == DEFINE) goto arg; /* do not handle quoting for #define */ + if (quoted) { + /* end arg */ + copy_arg(t); + quoted = false; + arg_start = true; + arg_start_idx = t + 1; + } else if (arg_start) { + ++arg_start_idx; + quoted = true; + } else arg_start = false; + break; + default: { + arg: arg_start = false; + } + } + + continue; + } + #undef copy_arg + } + copy: + if (at != '\0') + n_append(&sbuf, 1, &at); + } + ext->processed = sbuf.buf; + ext->p_len = sbuf.at; + + if (args) { + for (t = 0; t < args_sz; ++t) { + free(args[t]); + } + free(args); + } +} + +void ext_free(struct glsl_ext* ext) { + size_t t; + free(ext->processed); + if (ext->ss_own) { + for (t = 0; t < ext->ss_len_s; ++t) + free(ext->ss_lookup[t]); + free(ext->ss_lookup); + } + for (t = 0; t < ext->destruct_sz; ++t) + free(ext->destruct[t]); + free(ext->destruct); +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.h b/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.h new file mode 100644 index 00000000..4f059047 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glsl_ext.h @@ -0,0 +1,68 @@ +#ifndef GLSL_EXT_H +#define GLSL_EXT_H + +#include <stdlib.h> +#include <stdbool.h> + +struct request_handler { + const char* name; + /* + handler format: + 'i' - signed integer (void* -> int*) + 'f' - float (void* -> float*) + 's' - string (void* -> const char*) + 'b' - bool (void* -> bool*) + + example: + + .fmt = "sii" // takes a string, and then two integers + .fmt = "ffb" // takes two floats, then a boolean + */ + const char* fmt; + #if defined(__clang__) + void (^handler)(const char* name, void** args); + #elif defined(__GNUC__) || defined(__GNUG__) + void (*handler)(const char* name, void** args); + #else + #error "no nested function/block syntax available" + #endif +}; + +struct glsl_ext_efunc { + char* name; + #if defined(__clang__) + size_t (^call)(void); + #elif defined(__GNUC__) || defined(__GNUG__) + size_t (*call)(void); + #else + #error "no nested function/block syntax available" + #endif +}; + +struct glsl_ext { + char* processed; /* OUT: null terminated processed source */ + size_t p_len; /* OUT: length of processed buffer, excluding null char */ + const char* source; /* IN: raw data passed via ext_process */ + size_t source_len; /* IN: raw source len */ + const char* cd; /* IN: current directory */ + const char* cfd; /* IN: config directory, if NULL it is assumed to cd */ + const char* dd; /* IN: default directory */ + struct rd_bind* binds; /* OPT IN: --pipe binds */ + struct glsl_ext_efunc* efuncs; /* OPT IN: `#expand` binds */ + void** destruct; /* internal */ + size_t destruct_sz; /* internal */ + char** ss_lookup; /* source-string lookup table */ + size_t* ss_len; + size_t ss_len_s; + bool ss_own; + + /* IN: NULL (where the last element's 'name' member is NULL) terminated + array of request handlers */ + struct request_handler* handlers; +}; + +void ext_process(struct glsl_ext* ext, const char* f); +void ext_free (struct glsl_ext* ext); +bool ext_parse_color(const char* hex, size_t elem_sz, float** results); + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glava/glx_wcb.c b/share/dotfiles/.config/glava/glava_repo/glava/glx_wcb.c new file mode 100644 index 00000000..0134d264 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/glx_wcb.c @@ -0,0 +1,665 @@ + +/* Xlib window creation and GLX context creation backend */ + +#ifdef GLAVA_GLX + +#define GLAVA_RDX11 + +#include <stdlib.h> +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +#include <errno.h> +#include <math.h> +#include <time.h> + +#include <dlfcn.h> + +#include <X11/Xlib.h> +#include <X11/extensions/Xrender.h> +#include <X11/extensions/shape.h> +#include <X11/Xatom.h> + +#include "glad.h" + +#include "render.h" +#include "xwin.h" + +typedef struct __GLXcontextRec* GLXContext; +typedef XID GLXPixmap; +typedef XID GLXDrawable; + +typedef void (*__GLXextFuncPtr)(void); + +/* GLX 1.3 and later */ +typedef struct __GLXFBConfigRec* GLXFBConfig; +typedef XID GLXFBConfigID; +typedef XID GLXContextID; +typedef XID GLXWindow; +typedef XID GLXPbuffer; + +/* + * Tokens for glXChooseVisual and glXGetConfig: + */ +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 + +/* + * Error codes returned by glXGetConfig: + */ +#define GLX_BAD_SCREEN 1 +#define GLX_BAD_ATTRIBUTE 2 +#define GLX_NO_EXTENSION 3 +#define GLX_BAD_VISUAL 4 +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + +/* + * GLX 1.1 and later: + */ +#define GLX_VENDOR 1 +#define GLX_VERSION 2 +#define GLX_EXTENSIONS 3 + + +/* + * GLX 1.3 and later: + */ +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 + +/* + * GLX 1.4 and later: + */ +#define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ +#define GLX_SAMPLES 0x186a1 /*100001*/ + +/* glXCreateContextAttribsARB extension definitions */ + +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 + +typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*); +typedef void (*glXSwapIntervalEXTProc) (Display*, GLXDrawable, int); + +GLXFBConfig* (*glXChooseFBConfig) (Display* dpy, int screen, const int* attribList, int* nitems); +XVisualInfo* (*glXGetVisualFromFBConfig)(Display* dpy, GLXFBConfig config); +int (*glXGetFBConfigAttrib) (Display* dpy, GLXFBConfig config, int attribute, int *value ); +Bool (*glXMakeCurrent) (Display* dpy, GLXDrawable drawable, GLXContext ctx); +GLXDrawable (*glXGetCurrentDrawable) (void); +__GLXextFuncPtr (*glXGetProcAddressARB) (const GLubyte *); +void (*glXSwapBuffers) (Display* dpy, GLXDrawable drawable); +void (*glXDestroyContext) (Display* dpy, GLXContext ctx); +Bool (*glXQueryVersion) (Display* dpy, int* major, int* minor); +GLXPixmap (*glXCreateGLXPixmap) (Display* dpy, XVisualInfo* vis, Pixmap pixmap); + +extern struct gl_wcb wcb_glx; + +static Display* display; + +static int swap; + +static bool floating, decorated, focused, maximized, transparent; + +struct glxwin { + Window w; + GLXContext context; + double time; + bool should_close, should_render, bg_changed, clickthrough, offscreen; + char override_state; + Pixmap off_pixmap; + GLXPixmap off_glxpm; +}; + +static Atom ATOM__MOTIF_WM_HINTS, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM__NET_ACTIVE_WINDOW, ATOM__XROOTPMAP_ID; + +static GLXContext sharelist_ctx; +static bool sharelist_assigned = false; + +static bool offscreen(void) { + return sharelist_assigned; +} + +/* Public function that can be called before GLava instantiation for offscreen rendering hooks */ +/* This hook resides here since it relies on GLX functionality. */ +__attribute__((visibility("default"))) void glava_assign_external_ctx(void* ctx) { + sharelist_ctx = (GLXContext) ctx; + sharelist_assigned = true; +} + +static void* resolve_f(const char* symbol, void* gl) { + void* s = NULL; + if (gl) s = dlsym(gl, symbol); + if (!s) { + fprintf(stderr, "Failed to resolve GLX symbol: `%s`\n", symbol); + glava_abort(); + } + return s; +} + +static void init(void) { + /* XQuartz */ + #ifdef __APPLE__ + static const char *dl_names[] = { + "../Frameworks/OpenGL.framework/OpenGL", + "/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/OpenGL", + "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" + }; + #else + static const char *dl_names[] = {"libGL.so.1", "libGL.so"}; + #endif + + display = XOpenDisplay(NULL); + if (!display) { + fprintf(stderr, "XOpenDisplay(): could not establish connection to X11 server\n"); + abort(); + } + floating = false; + decorated = true; + focused = false; + maximized = false; + transparent = false; + + void* hgl = NULL; + for(size_t i = 0; i < (sizeof(dl_names) / sizeof(dl_names[0])) && hgl == NULL; ++i) + hgl = dlopen(dl_names[1], RTLD_LAZY); + + if (!hgl) { + fprintf(stderr, "Failed to load GLX functions (libGL and libGLX do not exist!)\n"); + glava_abort(); + } + + #define resolve(name) do { name = (typeof(name)) resolve_f(#name, hgl); } while (0) + #define intern(name, only_if_exists) \ + do { ATOM_##name = XInternAtom(display, #name, only_if_exists); } while (0) + + resolve(glXChooseFBConfig); + resolve(glXGetVisualFromFBConfig); + resolve(glXGetFBConfigAttrib); + resolve(glXMakeCurrent); + resolve(glXGetCurrentDrawable); + resolve(glXGetProcAddressARB); + resolve(glXSwapBuffers); + resolve(glXDestroyContext); + resolve(glXQueryVersion); + resolve(glXCreateGLXPixmap); + + intern(_MOTIF_WM_HINTS, false); + intern(WM_DELETE_WINDOW, true); + intern(WM_PROTOCOLS, true); + intern(_NET_ACTIVE_WINDOW, false); + intern(_XROOTPMAP_ID, false); + + #undef intern + #undef resolve +} + +static void apply_decorations(Window w) { + if (!decorated) { + struct { + unsigned long flags, functions, decorations; + long input_mode; + unsigned long status; + } hints; + + hints.flags = 2; + hints.decorations = 0; + + XChangeProperty(display, w, ATOM__MOTIF_WM_HINTS, ATOM__MOTIF_WM_HINTS, 32, PropModeReplace, + (unsigned char*) &hints, sizeof(hints) / sizeof(long)); + } +} + +static bool find_parent(Window w, Window* parent) { + Window root, *children = NULL; + unsigned int num_children; + + if(!XQueryTree(display, w, &root, parent, &children, &num_children)) + return false; + + if (children) + XFree(children); + + return *parent != None; +} + +static void apply_clickthrough(struct glxwin* w) { + if (w->clickthrough) { + int ignored; + if (XShapeQueryExtension(display, &ignored, &ignored)) { + Window root = DefaultRootWindow(display); + Window win = w->w; + while (win != None) { + Region region; + if ((region = XCreateRegion())) { + XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet); + XDestroyRegion(region); + } + Window parent; + find_parent(win, &parent); + win = (parent == root ? None : parent); + } + } else { + fprintf(stderr, "Warning: XShape extension not available\n"); + } + } +} + +static void process_events(struct glxwin* w) { + while (XPending(display) > 0) { + XEvent ev; + XNextEvent(display, &ev); + switch (ev.type) { + case ClientMessage: + if (ev.xclient.message_type == ATOM_WM_PROTOCOLS + && ev.xclient.data.l[0] == ATOM_WM_DELETE_WINDOW) { + w->should_close = true; + } + break; + case MapNotify: + apply_clickthrough(w); + XFlush(display); + break; + case VisibilityNotify: + switch (ev.xvisibility.state) { + case VisibilityFullyObscured: + w->should_render = false; + break; + case VisibilityUnobscured: + case VisibilityPartiallyObscured: + w->should_render = true; + break; + default: + fprintf(stderr, "Invalid VisibilityNotify event state (%d)\n", ev.xvisibility.state); + break; + } + break; + case PropertyNotify: + if (ev.xproperty.atom == ATOM__XROOTPMAP_ID) { + w->bg_changed = true; + } + break; + default: break; + } + } +} + +static void* create_and_bind(const char* name, const char* class, + const char* type, const char** states, + size_t states_sz, + int d, int h, + int x, int y, + int version_major, int version_minor, + bool clickthrough, bool off) { + + /* Assume offscreen rendering if hook has been used */ + if (offscreen()) + off = true; + + struct glxwin* w = malloc(sizeof(struct glxwin)); + *w = (struct glxwin) { + .override_state = '\0', + .time = 0.0, + .should_close = false, + .should_render = true, + .bg_changed = false, + .clickthrough = false, + .offscreen = off + }; + + XVisualInfo* vi; + XSetWindowAttributes attr = {}; + GLXFBConfig* fbc; + int fb_sz, best = -1, samp = -1; + + int glx_minor, glx_major; + glXQueryVersion(display, &glx_minor, &glx_major); + if (glx_major <= 1 && glx_minor < 4) { + fprintf(stderr, + "\nGLX extension version mismatch on the current display (1.4+ required, %d.%d available)\n" + "This is usually due to an outdated X server or graphics drivers.\n\n", + glx_minor, glx_major); + glava_abort(); + } + + static int gl_attrs[] = { + GLX_X_RENDERABLE, True, + GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, + GLX_RENDER_TYPE, GLX_RGBA_BIT, + GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, + GLX_DOUBLEBUFFER, True, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + None + }; + + int context_attrs[] = { + GLX_CONTEXT_MAJOR_VERSION_ARB, version_major, + GLX_CONTEXT_MINOR_VERSION_ARB, version_minor, + // GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, + None + }; + + fbc = glXChooseFBConfig(display, DefaultScreen(display), gl_attrs, &fb_sz); + if (!fbc) { + fprintf(stderr, + "\nFailed to obtain a GLX frame buffer that supports OpenGL %d.%d.\n" + "This is usually due to running on very old hardware or not having appropriate drivers.\n\n" + "glXChooseFBConfig(): failed with attrs " + "(GLX_CONTEXT_MAJOR_VERSION_ARB, GLX_CONTEXT_MINOR_VERSION_ARB)\n\n", + version_major, version_minor); + glava_abort(); + } + + for (int t = 0; t < fb_sz; ++t) { + XVisualInfo* xvi = glXGetVisualFromFBConfig(display, fbc[t]); + if (xvi) { + int samp_buf, samples; + glXGetFBConfigAttrib(display, fbc[t], GLX_SAMPLE_BUFFERS, &samp_buf); + glXGetFBConfigAttrib(display, fbc[t], GLX_SAMPLES, &samples ); + XRenderPictFormat* fmt = XRenderFindVisualFormat(display, xvi->visual); + + if (!fmt || (transparent ? fmt->direct.alphaMask == 0 : fmt->direct.alphaMask != 0)) + continue; + + if (best < 0 || (samp_buf && samples > samp)) { + best = t; + samp = samples; + } + XFree(xvi); + } + } + + if (best == -1) { + fprintf(stderr, "Could not find suitable format for FBConfig\n"); + abort(); + } + + GLXFBConfig config = fbc[best]; + XFree(fbc); + + vi = glXGetVisualFromFBConfig(display, config); + + attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vi->visual, AllocNone); + attr.event_mask = ExposureMask | KeyPressMask | StructureNotifyMask; + attr.event_mask |= PropertyChangeMask | VisibilityChangeMask; + attr.background_pixmap = None; + attr.border_pixel = 0; + + unsigned long vmask = CWColormap | CWEventMask | CWBackPixmap | CWBorderPixel; + if (type[0] == '!') { + vmask |= CWOverrideRedirect; + attr.override_redirect = true; + w->override_state = type[1]; + } + + if (!(w->w = XCreateWindow(display, DefaultRootWindow(display)/**xwin_get_desktop_layer(&wcb_glx)*/, + x, y, d, h, 0, + vi->depth, InputOutput, vi->visual, + vmask, &attr))) { + fprintf(stderr, "XCreateWindow(): failed\n"); + abort(); + } + + bool desktop = false; + + if (type) + desktop = xwin_settype(&wcb_glx, w, type); + + for (size_t t = 0; t < states_sz; ++t) + xwin_addstate(&wcb_glx, w, states[t]); + + if (floating) xwin_addstate(&wcb_glx, w, "above"); + if (maximized) { + xwin_addstate(&wcb_glx, w, "maximized_horz"); + xwin_addstate(&wcb_glx, w, "maximized_vert"); + } + + XSetClassHint(display, w->w, &((XClassHint) { .res_name = (char*) class, .res_class = (char*) class })); + + apply_decorations(w->w); + + XStoreName(display, w->w, name); + + XSetWMProtocols(display, w->w, &ATOM_WM_DELETE_WINDOW, 1); + + /* Eliminate the window's effective region */ + w->clickthrough = desktop || clickthrough; + apply_clickthrough(w); + + glXCreateContextAttribsARBProc glXCreateContextAttribsARB = NULL; + glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL; + glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) + glXGetProcAddressARB((const GLubyte*) "glXCreateContextAttribsARB"); + glXSwapIntervalEXT = (glXSwapIntervalEXTProc) + glXGetProcAddressARB((const GLubyte*) "glXSwapIntervalEXT"); + + if (!glXCreateContextAttribsARB) { + fprintf(stderr, "glXGetProcAddressARB(\"glXCreateContextAttribsARB\"): failed\n"); + abort(); + } + + if (!(w->context = glXCreateContextAttribsARB(display, config, sharelist_assigned ? sharelist_ctx : 0, True, context_attrs))) { + fprintf(stderr, "glXCreateContextAttribsARB(): failed\n"); + abort(); + } + + XSync(display, False); + + if (w->offscreen) { + w->off_pixmap = XCreatePixmap(display, w->w, d, h, + DefaultDepth(display, DefaultScreen(display))); + w->off_glxpm = glXCreateGLXPixmap(display, vi, w->off_pixmap); + glXMakeCurrent(display, w->off_glxpm, w->context); + } else + glXMakeCurrent(display, w->w, w->context); + + if (!glad_instantiated) { + gladLoadGL(); + glad_instantiated = true; + } + + GLXDrawable drawable = glXGetCurrentDrawable(); + + if (glXSwapIntervalEXT) glXSwapIntervalEXT(display, drawable, swap); + + if (!transparent) + XSelectInput(display, DefaultRootWindow(display), PropertyChangeMask); + + XFree(vi); + + return w; +} + +static void raise(struct glxwin* w) { + if (w->override_state == '\0') { + XClientMessageEvent ev = { + .type = ClientMessage, + .serial = 0, + .send_event = true, + .display = display, + .window = w->w, + .message_type = ATOM__NET_ACTIVE_WINDOW, + .format = 32, + .data = { .l = { + [0] = 1, /* source indication -- `1` when coming from an application */ + [1] = 0, /* timestamp -- `0` to (attempt to) ignore */ + [2] = w->w /* requestor's currently active window -- `0` for none */ + } + } + }; + /* Send the client message as defined by EWMH standards (usually works) */ + XSendEvent(display, DefaultRootWindow(display), false, StructureNotifyMask, (XEvent*) &ev); + } + /* Raise the client in the X11 stacking order (sometimes works, can be blocked by the WM) */ + XRaiseWindow(display, w->w); + XFlush(display); +} + +static void set_swap (int _swap) { swap = _swap; } +static void set_floating (bool _floating) { floating = _floating; } +static void set_decorated (bool _decorated) { decorated = _decorated; } +static void set_focused (bool _focused) { focused = _focused; } +static void set_maximized (bool _maximized) { maximized = _maximized; } +static void set_transparent(bool _transparent) { transparent = _transparent; } + +static void set_geometry(struct glxwin* w, int x, int y, int d, int h) { + XMoveResizeWindow(display, w->w, x, y, (unsigned int) d, (unsigned int) h); +} + +static void set_visible(struct glxwin* w, bool visible) { + if (w->offscreen) + return; + if (visible) { + XMapWindow(display, w->w); + switch (w->override_state) { + case '+': XRaiseWindow(display, w->w); break; + case '-': XLowerWindow(display, w->w); break; + default: break; + } + XFlush(display); + } + else XUnmapWindow(display, w->w); +} + +static bool should_close (struct glxwin* w) { return w->should_close; } +static bool bg_changed (struct glxwin* w) { return w->bg_changed; } +static bool should_render(struct glxwin* w) { + if (w->offscreen) + return true; + /* For nearly all window managers, windows are 'minimized' by unmapping parent windows. + VisibilityNotify events are not sent in these instances, so we have to read window + attributes to see if our window isn't viewable. */ + XWindowAttributes attrs; + XGetWindowAttributes(display, w->w, &attrs); + process_events(w); + return w->should_render && attrs.map_state == IsViewable; +} + +static void swap_buffers(struct glxwin* w) { + if (w->offscreen) + glXSwapBuffers(display, w->off_glxpm); + else + glXSwapBuffers(display, w->w); + process_events(w); +} + +static void get_fbsize(struct glxwin* w, int* d, int* h) { + XWindowAttributes a; + XGetWindowAttributes(display, w->w, &a); + *d = a.width; + *h = a.height; +} + +static void get_pos(struct glxwin* w, int* x, int* y) { + Window _ignored; + XTranslateCoordinates(display, w->w, DefaultRootWindow(display), 0, 0, x, y, &_ignored); +} + +static double get_timert(void) { + struct timespec tv; + if (clock_gettime(CLOCK_REALTIME, &tv)) { + fprintf(stderr, "clock_gettime(CLOCK_REALTIME, ...): %s\n", strerror(errno)); + } + return (double) tv.tv_sec + ((double) tv.tv_nsec / 1000000000.0); +} + +static void destroy(struct glxwin* w) { + glXMakeCurrent(display, None, NULL); /* release context */ + glXDestroyContext(display, w->context); + /* Some picking around indicates the GLX pixmap (for offscreen rendering) is + actually associated with the X pixmap and simply returns a handle, so we + do not have to free the GLX pixmap. */ + if (w->offscreen) + XFreePixmap(display, w->off_pixmap); + XDestroyWindow(display, w->w); + free(w); +} + +static void terminate(void) { + XCloseDisplay(display); +} + +static double get_time (struct glxwin* w) { return get_timert() - w->time; } +static void set_time (struct glxwin* w, double time) { w->time = get_timert() - time; } +static Display* get_x11_display(struct glxwin* w) { return display; } +static Window get_x11_window (struct glxwin* w) { return w->w; } + +static const char* get_environment(void) { return xwin_detect_wm(&wcb_glx); } + +WCB_ATTACH("glx", wcb_glx); + +#endif /* GLAVA_GLX */ diff --git a/share/dotfiles/.config/glava/glava_repo/glava/khrplatform.h b/share/dotfiles/.config/glava/glava_repo/glava/khrplatform.h new file mode 100644 index 00000000..975bbffe --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/khrplatform.h @@ -0,0 +1,282 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include <KHR/khrplatform.h> + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using <stdint.h> + */ +#include <stdint.h> +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using <inttypes.h> + */ +#include <inttypes.h> +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include <stdint.h> +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.c b/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.c new file mode 100644 index 00000000..c5994542 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.c @@ -0,0 +1,192 @@ +#include <stdio.h> +#include <stdbool.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <pulse/simple.h> +#include <pulse/error.h> +#include <pulse/pulseaudio.h> + +#include "fifo.h" + +static pa_mainloop* m_pulseaudio_mainloop; + +static void cb(__attribute__((unused)) pa_context* pulseaudio_context, + const pa_server_info* i, + void* userdata) { + + /* Obtain default sink name */ + struct audio_data* audio = (struct audio_data*) userdata; + audio->source = malloc(sizeof(char) * 1024); + + strcpy(audio->source,i->default_sink_name); + + /* Append `.monitor` suffix */ + audio->source = strcat(audio->source, ".monitor"); + + /* Quiting mainloop */ + pa_context_disconnect(pulseaudio_context); + pa_context_unref(pulseaudio_context); + pa_mainloop_quit(m_pulseaudio_mainloop, 0); + pa_mainloop_free(m_pulseaudio_mainloop); +} + + +static void pulseaudio_context_state_callback(pa_context* pulseaudio_context, void* userdata) { + + /* Ensure loop is ready */ + switch (pa_context_get_state(pulseaudio_context)) { + case PA_CONTEXT_UNCONNECTED: break; + case PA_CONTEXT_CONNECTING: break; + case PA_CONTEXT_AUTHORIZING: break; + case PA_CONTEXT_SETTING_NAME: break; + case PA_CONTEXT_READY: /* extract default sink name */ + pa_operation_unref(pa_context_get_server_info(pulseaudio_context, cb, userdata)); + break; + case PA_CONTEXT_FAILED: + printf("failed to connect to pulseaudio server\n"); + exit(EXIT_FAILURE); + break; + case PA_CONTEXT_TERMINATED: + pa_mainloop_quit(m_pulseaudio_mainloop, 0); + break; + } +} + + +static void init(struct audio_data* audio) { + + if (audio->source) return; + + pa_mainloop_api* mainloop_api; + pa_context* pulseaudio_context; + int ret; + + /* Create a mainloop API and connection to the default server */ + m_pulseaudio_mainloop = pa_mainloop_new(); + + mainloop_api = pa_mainloop_get_api(m_pulseaudio_mainloop); + pulseaudio_context = pa_context_new(mainloop_api, "glava device list"); + + + /* Connect to the PA server */ + pa_context_connect(pulseaudio_context, NULL, PA_CONTEXT_NOFLAGS, + NULL); + + /* Define a callback so the server will tell us its state */ + pa_context_set_state_callback(pulseaudio_context, + pulseaudio_context_state_callback, + (void*)audio); + + /* Start mainloop to get default sink */ + + /* Start with one non blocking iteration in case pulseaudio is not able to run */ + if (!(ret = pa_mainloop_iterate(m_pulseaudio_mainloop, 0, &ret))){ + printf("Could not open pulseaudio mainloop to " + "find default device name: %d\n" + "check if pulseaudio is running\n", + ret); + + exit(EXIT_FAILURE); + } + + pa_mainloop_run(m_pulseaudio_mainloop, &ret); +} + +/* Sample format for native 'float' type */ +#ifndef __STDC_IEC_559__ +#error "IEC 60559 standard unsupported on target system" +#endif + +#ifdef __ORDER_LITTLE_ENDIAN__ +#define FSAMPLE_FORMAT PA_SAMPLE_FLOAT32LE +#elif __ORDER_BIG_ENDIAN__ +#define FSAMPLE_FORMAT PA_SAMPLE_FLOAT32BE +#else +#error "Unsupported float format (requires 32 bit IEEE (little or big endian) floating point support)" +#endif + +static void* entry(void* data) { + struct audio_data* audio = (struct audio_data*) data; + int i, n; + size_t ssz = audio->sample_sz; + float buf[ssz / 2]; + + const pa_sample_spec ss = { + .format = FSAMPLE_FORMAT, + .rate = audio->rate, + .channels = 2 + }; + const pa_buffer_attr pb = { + .maxlength = (uint32_t) -1, + .fragsize = ssz + }; + + pa_simple* s = NULL; + int error; + + if (!(s = pa_simple_new(NULL, "glava", PA_STREAM_RECORD, + audio->source, "audio for glava", + &ss, NULL, &pb, &error))) { + fprintf(stderr, __FILE__ ": Could not open pulseaudio source: %s, %s. " + "To find a list of your pulseaudio sources run 'pacmd list-sources'\n", + audio->source, pa_strerror(error)); + exit(EXIT_FAILURE); + } + + n = 0; + + float* bl = (float*) audio->audio_out_l; + float* br = (float*) audio->audio_out_r; + size_t fsz = audio->audio_buf_sz; + + while (1) { + + /* Record some data ... */ + if (pa_simple_read(s, buf, sizeof(buf), &error) < 0) { + fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error)); + exit(EXIT_FAILURE); + } + + pthread_mutex_lock(&audio->mutex); + + /* progressing the audio buffer, making space for new write */ + + memmove(bl, &bl[ssz / 4], (fsz - (ssz / 4)) * sizeof(float)); + memmove(br, &br[ssz / 4], (fsz - (ssz / 4)) * sizeof(float)); + + /* sorting out channels */ + + for (n = 0, i = 0; i < ssz / 2; i += 2) { + + /* size_t idx = (i / 2) + (at * (BUFSIZE / 2)); */ + + int idx = (fsz - (ssz / 4)) + n; + + if (audio->channels == 1) { + float sample = (buf[i] + buf[i + 1]) / 2; + bl[idx] = sample; + br[idx] = sample; + } + + /* stereo storing channels in buffer */ + if (audio->channels == 2) { + bl[idx] = buf[i]; + br[idx] = buf[i + 1]; + } + ++n; + } + audio->modified = true; + + pthread_mutex_unlock(&audio->mutex); + + if (audio->terminate == 1) { + pa_simple_free(s); + break; + } + } + + return 0; +} + +AUDIO_ATTACH(pulseaudio); diff --git a/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.h b/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.h new file mode 100644 index 00000000..dda7039c --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/pulse_input.h @@ -0,0 +1,10 @@ + +#ifndef PULSE_INPUT_H +#define PULSE_INPUT_H + +#include "fifo.h" + +void get_pulse_default_sink(struct audio_data* audio); +void* input_pulse(void* data); + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glava/render.c b/share/dotfiles/.config/glava/glava_repo/glava/render.c new file mode 100644 index 00000000..6ce39529 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/render.c @@ -0,0 +1,2490 @@ +#include <stdlib.h> +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +#include <errno.h> +#include <dirent.h> +#include <math.h> +#include <time.h> +#include <pthread.h> + +#include <sys/ioctl.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +#include "glad.h" + +#include "render.h" +#include "xwin.h" +#include "glsl_ext.h" + +typeof(bind_types) bind_types = { + [STDIN_TYPE_NONE] = { .n = "NONE", .i = STDIN_TYPE_NONE }, + [STDIN_TYPE_INT] = { .n = "int", .i = STDIN_TYPE_INT }, + [STDIN_TYPE_FLOAT] = { .n = "float", .i = STDIN_TYPE_FLOAT }, + [STDIN_TYPE_BOOL] = { .n = "bool", .i = STDIN_TYPE_BOOL }, + [STDIN_TYPE_VEC2] = { .n = "vec2", .i = STDIN_TYPE_VEC2 }, + [STDIN_TYPE_VEC3] = { .n = "vec3", .i = STDIN_TYPE_VEC3 }, + [STDIN_TYPE_VEC4] = { .n = "vec4", .i = STDIN_TYPE_VEC4 }, + {} +}; + +/* The following macros are some black magic that allow the use of + by-reference C closures in both Clang and GCC. Their behaviour + differs slightly so please read up on both nested GCC functions + and Clang blocks if you are going to use these. */ + +#if defined(__clang__) +#define MUTABLE __block +#define INLINE(t, x) MUTABLE __auto_type x = ^t +#else +#define MUTABLE +#define INLINE(t, x) t x +#endif + +#if defined(__clang__) +static void* block_storage; +#define RHANDLER(name, args, ...) \ + ({ block_storage = ^(const char* name, void** args) __VA_ARGS__; \ + (typeof(^(const char* name, void** args) __VA_ARGS__)) block_storage; }) +#define CLOSURE(ret, ...) ({ block_storage = ^ret __VA_ARGS__; \ + (typeof(^ret __VA_ARGS__)) block_storage; }) +#elif defined(__GNUC__) || defined(__GNUG__) +#define RHANDLER(name, args, ...) \ + ({ void _handler(const char* name, void** args) __VA_ARGS__ _handler; }) +#define CLOSURE(ret, ...) ({ ret _handler __VA_ARGS__; _handler; }) +#else +#error "no nested function/block syntax available" +#endif + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 +#define swap(a, b) do { __auto_type tmp = a; a = b; b = tmp; } while (0) + +#define IB_START_LEFT 0 +#define IB_END_LEFT 1 +#define IB_START_RIGHT 2 +#define IB_END_RIGHT 3 +#define IB_WORK_LEFT 4 +#define IB_WORK_RIGHT 5 + +/* Only a single vertex shader is needed, since all rendering + is done in the fragment shader over a fullscreen quad */ +#define VERTEX_SHADER_SRC \ + "layout(location = 0) in vec3 pos; void main() { gl_Position = vec4(pos.x, pos.y, 0.0F, 1.0F); }" + +/* Should be defined from meson */ +#ifndef GLAVA_RESOURCE_PATH +#define GLAVA_RESOURCE_PATH "../resources/" +#endif + +bool glad_instantiated = false; +struct gl_wcb* wcbs[2] = {}; +static size_t wcbs_idx = 0; + +static inline void register_wcb(struct gl_wcb* wcb) { wcbs[wcbs_idx++] = wcb; } + +#define DECL_WCB(N) \ + do { \ + extern struct gl_wcb N; \ + register_wcb(&N); \ + } while (0) + +/* GLSL bind source */ + +struct gl_bind_src { + const char* name; + int type; + int src_type; +}; + +/* Function that can be applied to uniform binds */ + +struct gl_transform { + const char* name; + int type; + void (*apply)(struct gl_data*, void**, void* data); + bool opt; /* true if the transform is a post-FFT transformation */ +}; + +/* Data for sampler1D */ + +struct gl_sampler_data { + float* buf; + size_t sz; +}; + +/* Per-bind data containing the framebuffer and 1D texture to render + for smoothing or averaging output */ + +struct sm_fb { + GLuint fbo, tex; +}; + +/* Per-bind data containing the framebuffer and textures gravity output. + There are multiple output framebuffers for GLSL frame averaging */ +struct gr_fb { + struct sm_fb* out; + size_t out_sz; + size_t out_idx; +}; + +/* GLSL uniform bind */ + +struct gl_bind { + const char* name; + GLuint uniform; + int type; + int src_type; + void (**transformations)(struct gl_data*, void**, void* data); + size_t t_sz; + struct sm_fb sm, av, gr_store; + struct gr_fb gr; + bool optimize_fft; +}; + +/* GL screen framebuffer object */ + +struct gl_sfbo { + GLuint fbo, tex, shader, stdin_uniform; + bool indirect, nativeonly; + const char* name; + struct gl_bind* binds; + GLuint* pipe_uniforms; + size_t binds_sz; +}; + +/* data for screen-space overlay (quad) */ + +struct overlay_data { + GLuint vbuf, vao; +}; + +struct gl_data { + struct gl_sfbo* stages; + struct overlay_data overlay; + GLuint audio_tex_r, audio_tex_l, bg_tex, sm_prog, av_prog, gr_prog, p_prog; + size_t stages_sz, bufscale, avg_frames; + void* w; + struct gl_wcb* wcb; + int lww, lwh, lwx, lwy; /* last window dimensions */ + int rate; /* framerate */ + double tcounter; + float time, timecycle; + int fcounter, ucounter, kcounter; + bool print_fps, avg_window, interpolate, interpolate_glsl, force_geometry, + force_raised, copy_desktop, smooth_pass, premultiply_alpha, check_fullscreen, + clickthrough, mirror_input, accel_fft; + void** t_data; + size_t t_count; + float gravity_step, target_spu, fr, ur, smooth_distance, smooth_ratio, + smooth_factor, fft_scale, fft_cutoff; + struct { + float r, g, b, a; + } clear_color; + float* interpolate_buf[6]; + int geometry[4]; + int stdin_type; + struct rd_bind* binds; + GLuint bg_prog, bg_utex, bg_screen; + bool bg_setup; + GLuint sm_utex, sm_usz, sm_uw, + gr_utex, gr_udiff, + p_utex; + GLuint* av_utex; + bool test_mode; + struct gl_sfbo off_sfbo; + #ifdef GLAVA_DEBUG + struct { + float r, g, b, a; + } test_eval_color; + bool debug_verbose; + bool assigned_debug_cb; + #endif +}; + +bool rd_get_test_mode(struct glava_renderer* r) { + struct gl_data* gl = r->gl; + return gl->test_mode; +} + +/* load shader file */ +static GLuint shaderload(const char* rpath, + GLenum type, + const char* shader, + const char* config, + const char* defaults, + struct request_handler* handlers, + int shader_version, + bool raw, + bool* skipped, + struct gl_data* gl) { + + size_t s_len = strlen(shader); + + /* Path buffer for error message mapping */ + char path[raw ? 2 : strlen(rpath) + s_len + 2]; + if (raw) { + path[0] = '*'; + path[1] = '\0'; + } + struct stat st; + int fd = -1; + if (!raw) { + snprintf(path, sizeof(path) / sizeof(char), "%s/%s", shader, rpath); + fd = open(path, O_RDONLY); + if (fd == -1) { + fprintf(stderr, "failed to load shader '%s': %s\n", path, strerror(errno)); + return 0; + } + fstat(fd, &st); + } + + GLint max_uniforms; + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_uniforms); + + const GLchar* map = raw ? shader : mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + + char* bind_header = malloc(1); + bind_header[0] = '\0'; + size_t bh_idx = 0; + + const char* fmt = "uniform %s _IN_%s;\n"; + + /* Construct pipe binding header (containing uniforms) */ + for (struct rd_bind* bd = gl->binds; bd->name != NULL; ++bd) { + size_t inc = snprintf(NULL, 0, fmt, bd->stype, bd->name); + bind_header = realloc(bind_header, bh_idx + inc + 1); + snprintf(bind_header + bh_idx, inc + 1, fmt, bd->stype, bd->name); + bh_idx += inc; + } + + /* Append to header entries with a #define for each `#expand` control */ + MUTABLE char* efmt_header = malloc(1); + MUTABLE size_t efmt_idx = 0; + INLINE(void, append_efmt)(const char* n, size_t v) { + size_t inc = snprintf(NULL, 0, "#define %s %d\n", n, (int) v); + efmt_header = realloc(efmt_header, efmt_idx + inc + 1); + snprintf(efmt_header + efmt_idx, inc + 1, "#define %s %d\n", n, (int) v); + efmt_idx += inc; + }; + + /* Create `#expand` header entry, using the above closure */ + #define EBIND(n, v) \ + ({ \ + struct glsl_ext_efunc ret = \ + { .name = n, .call = CLOSURE(size_t, (void) { return v; })}; \ + append_efmt(n, v); \ + ret; \ + }) + + struct glsl_ext_efunc efuncs[] = { + EBIND("_AVG_FRAMES", gl->avg_frames ), + EBIND("_AVG_WINDOW", (int) gl->avg_window ), + EBIND("_USE_ALPHA", 1 ), + EBIND("_PREMULTIPLY_ALPHA", gl->premultiply_alpha ? 1 : 0), + EBIND("_CHANNELS", gl->mirror_input ? 1 : 2 ), + EBIND("_UNIFORM_LIMIT", (int) max_uniforms ), + EBIND("_PRE_SMOOTHED_AUDIO", gl->smooth_pass ? 1 : 0 ), + { .name = NULL } + }; + #undef EBIND + + size_t pad = bh_idx + efmt_idx; + + struct glsl_ext ext = { + .source = raw ? NULL : map, + .source_len = raw ? 0 : st.st_size, + .cd = shader, + .cfd = config, + .dd = defaults, + .handlers = handlers, + .processed = (char*) (raw ? shader : NULL), + .p_len = raw ? s_len : 0, + .binds = gl->binds, + .efuncs = efuncs + }; + + /* If this is raw input, skip processing */ + if (!raw) ext_process(&ext, rpath); + + /* Format GLSL header with defines, pipe bindings, and expand constants. */ + static const GLchar* header_fmt = + "#version %d\n" + "#define _SMOOTH_FACTOR %.6f\n" + "#define USE_STDIN %d\n" + "#if USE_STDIN == 1\n" + "uniform %s STDIN;\n" + "#endif\n" "%s\n" "%s"; + + size_t blen = strlen(header_fmt) + 32 + pad; + GLchar* buf = malloc((blen * sizeof(GLchar*)) + ext.p_len); + int written = snprintf(buf, blen, header_fmt, (int) shader_version, + (double) gl->smooth_factor, gl->stdin_type != STDIN_TYPE_NONE, + bind_types[gl->stdin_type].n, bind_header, efmt_header); + if (written < 0) { + fprintf(stderr, "snprintf() encoding error while prepending header to shader '%s'\n", path); + return 0; + } + memcpy(buf + written, ext.processed, ext.p_len); + if (!raw) munmap((void*) map, st.st_size); + + GLuint s = glCreateShader(type); + GLint sl = (GLint) (ext.p_len + written); + glShaderSource(s, 1, (const GLchar* const*) &buf, &sl); + switch (glGetError()) { + case GL_INVALID_VALUE: + fprintf(stderr, "invalid value while loading shader source\n"); + glava_abort(); + return 0; + case GL_INVALID_OPERATION: + fprintf(stderr, "invalid operation while loading shader source\n"); + glava_abort(); + return 0; + default: {} + } + glCompileShader(s); + GLint ret, ilen; + glGetShaderiv(s, GL_COMPILE_STATUS, &ret); + if (ret == GL_FALSE) { + glGetShaderiv(s, GL_INFO_LOG_LENGTH, &ilen); + if (ilen) { + GLchar* ebuf = malloc(sizeof(GLchar) * ilen); + glGetShaderInfoLog(s, ilen, NULL, ebuf); + + /* check for `#error __disablestage` and flag `*skipped` accordingly */ + if (skipped != NULL) { + bool last = false; + static const char* skip_keyword = "__disablestage"; + size_t sksz = sizeof(skip_keyword); + for(size_t t = 0; t < (size_t) ilen; ++t) { + if (ebuf[t] == '_') { + if (last && !strncmp(ebuf + t - 1, skip_keyword, sksz)) { + *skipped = true; + goto free_ebuf; + } else last = true; + } else last = false; + } + } + + fprintf(stderr, "Shader compilation failed for '%s':\n", path); + int ln_start = 0, col_start = 0; + for (int i = 0; i < ilen; ++i) { + switch (ebuf[i]) { + newline: + case '\n': { + int ret = -1, sz = (i - ln_start) + 1; + char fmt[] = { '%', '0' + (sz > 9 ? 9 : sz), 'd', '\0' }; + if (ext.ss_lookup && sscanf(ebuf + ln_start, fmt, &ret) > 0) { + fprintf(stderr, "\"%s\":", ext.ss_lookup[ret]); + } + sz -= col_start - ln_start; + if (sz > 0) + fwrite(ebuf + col_start, sizeof(GLchar), sz, stderr); + ln_start = i + 1; + col_start = ln_start; + break; + } + case ':': + if (col_start <= ln_start) + col_start = i + 1; + default: + if (i == ilen - 1) goto newline; + break; + + } + } + #ifdef GLAVA_DEBUG + if (gl->debug_verbose) { + fprintf(stderr, "Processed shader source for '%s':\n", path); + fwrite(buf, sizeof(GLchar), sl, stderr); + } + #endif + + free_ebuf: + free(ebuf); + return 0; + } else { + fprintf(stderr, "Shader compilation failed for '%s', but no info was available\n", path); + return 0; + } + } + + if (!raw) ext_free(&ext); + free(buf); + close(fd); + return s; +} + +/* link shaders */ +#define shaderlink(...) shaderlink_f((GLuint[]) {__VA_ARGS__, 0}) +static GLuint shaderlink_f(GLuint* arr) { + GLuint f, p; + int i = 0; + + if ((p = glCreateProgram()) == 0) { + fprintf(stderr, "failed to create program\n"); + abort(); + } + + while ((f = arr[i++]) != 0) { + glAttachShader(p, f); + switch (glGetError()) { + case GL_INVALID_VALUE: + fprintf(stderr, "tried to pass invalid value to glAttachShader\n"); + return 0; + case GL_INVALID_OPERATION: + fprintf(stderr, "shader is already attached, or argument types " + "were invalid when calling glAttachShader\n"); + return 0; + default: {} + } + } + glLinkProgram(p); + GLint ret, ilen; + glGetProgramiv(p, GL_LINK_STATUS, &ret); + if (ret == GL_FALSE) { + glGetProgramiv(p, GL_INFO_LOG_LENGTH, &ilen); + if (ilen) { + GLchar buf[ilen]; + glGetProgramInfoLog(p, ilen, NULL, buf); + fprintf(stderr, "Shader linking failed for program %d:\n", (int) p); + fwrite(buf, sizeof(GLchar), ilen - 1, stderr); + return 0; + } else { + fprintf(stderr, "Shader linking failed for program %d, but no info was available\n", (int) p); + return 0; + } + } + return p; +} + +/* load shaders */ +#define shaderbuild(gl, shader_path, c, d, r, v, s, ...) \ + shaderbuild_f(gl, shader_path, c, d, r, v, s, (const char*[]) {__VA_ARGS__, 0}) +static GLuint shaderbuild_f(struct gl_data* gl, + const char* shader_path, + const char* config, const char* defaults, + struct request_handler* handlers, + int shader_version, + bool* skipped, + const char** arr) { + if (skipped) *skipped = false; + const char* str; + int i = 0, sz = 0, t; + while ((str = arr[i++]) != NULL) ++sz; + GLuint shaders[sz + 2]; + shaders[sz + 1] = 0; + for (i = 0; i < sz; ++i) { + const char* path = arr[i]; + size_t len = strlen(path); + for (t = len - 2; t >= 0; --t) { + if (path[t] == '.') { + if (!strcmp(path + t + 1, "frag") || !strcmp(path + t + 1, "glsl")) { + if (!(shaders[i] = shaderload(path, GL_FRAGMENT_SHADER, + shader_path, config, defaults, handlers, + shader_version, false, skipped, gl))) { + return 0; + } + } else if (!strcmp(path + t + 1, "vert")) { + fprintf(stderr, "shaderbuild(): vertex shaders not allowed: %s\n", path); + abort(); + } else { + fprintf(stderr, "shaderbuild(): invalid file extension: %s\n", path); + abort(); + } + break; + } + } + } + /* load builtin vertex shader */ + shaders[sz] = shaderload(NULL, GL_VERTEX_SHADER, VERTEX_SHADER_SRC, + NULL, NULL, handlers, shader_version, true, NULL, gl); + fflush(stdout); + return shaderlink_f(shaders); +} + +static GLuint create_1d_tex() { + GLuint tex; + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_1D, tex); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT); + return tex; +} + +static void update_1d_tex(GLuint tex, size_t w, float* data) { + glBindTexture(GL_TEXTURE_1D, tex); + glTexImage1D(GL_TEXTURE_1D, 0, GL_R16, w, 0, GL_RED, GL_FLOAT, data); +} + +#define BIND_VEC2 0 +#define BIND_VEC3 1 +#define BIND_VEC4 2 +#define BIND_IVEC2 3 +#define BIND_IVEC3 4 +#define BIND_IVEC4 5 +#define BIND_INT 6 +#define BIND_FLOAT 7 +#define BIND_SAMPLER1D 8 +#define BIND_SAMPLER2D 9 + +/* setup screen framebuffer object and its texture */ + +static void setup_sfbo(struct gl_sfbo* s, int w, int h) { + GLuint tex = s->indirect ? s->tex : ({ glGenTextures(1, &s->tex); s->tex; }); + GLuint fbo = s->indirect ? s->fbo : ({ glGenFramebuffers(1, &s->fbo); s->fbo; }); + s->indirect = true; + /* bind texture and setup space */ + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); + + /* setup and bind framebuffer to texture */ + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); + switch (glCheckFramebufferStatus(GL_FRAMEBUFFER)) { + case GL_FRAMEBUFFER_COMPLETE: break; + default: + fprintf(stderr, "error in frambuffer state\n"); + abort(); + } + glBindFramebuffer(GL_FRAMEBUFFER, 0); +} + +static void overlay(struct overlay_data* d) { + GLfloat buf[18]; + buf[0] = -1.0f; buf[1] = -1.0f; buf[2] = 0.0f; + buf[3] = 1.0f; buf[4] = -1.0f; buf[5] = 0.0f; + buf[6] = -1.0f; buf[7] = 1.0f; buf[8] = 0.0f; + + buf[9] = 1.0f; buf[10] = 1.0f; buf[11] = 0.0f; + buf[12] = 1.0f; buf[13] = -1.0f; buf[14] = 0.0f; + buf[15] = -1.0f; buf[16] = 1.0f; buf[17] = 0.0f; + + glGenBuffers(1, &d->vbuf); + glBindBuffer(GL_ARRAY_BUFFER, d->vbuf); + glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 18, buf, GL_STATIC_DRAW); + + glGenVertexArrays(1, &d->vao); + glBindVertexArray(d->vao); + + glEnableVertexAttribArray(0); + glBindBuffer(GL_ARRAY_BUFFER, d->vbuf); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*) 0); + glDisableVertexAttribArray(0); + + glBindVertexArray(0); +} + +static void drawoverlay(const struct overlay_data* d) { + glBindVertexArray(d->vao); + glEnableVertexAttribArray(0); + glDrawArrays(GL_TRIANGLES, 0, 6); + glDisableVertexAttribArray(0); + glBindVertexArray(0); +} + +#define TRANSFORM_NONE 0 +#define TRANSFORM_FFT 1 +#define TRANSFORM_WINDOW 2 + +#ifdef GLAD_DEBUG + +struct err_msg { + GLenum code; + const char* msg; + const char* cname; +}; + +#define CODE(c) .code = c, .cname = #c + +static const struct err_msg err_lookup[] = { + { CODE(GL_INVALID_ENUM), .msg = "Invalid enum parameter" }, + { CODE(GL_INVALID_VALUE), .msg = "Invalid value parameter" }, + { CODE(GL_INVALID_OPERATION), .msg = "Invalid operation" }, + { CODE(GL_STACK_OVERFLOW), .msg = "Stack overflow" }, + { CODE(GL_STACK_UNDERFLOW), .msg = "Stack underflow" }, + { CODE(GL_OUT_OF_MEMORY), .msg = "Out of memory" }, + { CODE(GL_INVALID_FRAMEBUFFER_OPERATION), .msg = "Out of memory" }, + #ifdef GL_CONTEXT_LOSS + { CODE(GL_CONTEXT_LOSS), .msg = "Context loss (graphics device or driver reset?)" } + #endif +}; + +#undef CODE + +static void glad_debugcb(const char* name, void *funcptr, int len_args, ...) { + GLenum err = glad_glGetError(); + + if (err != GL_NO_ERROR) { + const char* cname = "?", * msg = "Unknown error code"; + for (size_t t = 0; t < sizeof(err_lookup) / sizeof(struct err_msg); ++t) { + if (err_lookup[t].code == err) { + cname = err_lookup[t].cname; + msg = err_lookup[t].msg; + break; + } + } + fprintf(stderr, "glGetError(): %d (%s) in %s: '%s'\n", + (int) err, cname, name, msg); + abort(); + } +} +#endif + +#define SHADER_EXT_VERT "vert" +#define SHADER_EXT_FRAG "frag" + +static struct gl_bind_src bind_sources[] = { + #define SRC_PREV 0 + { .name = "prev", .type = BIND_SAMPLER2D, .src_type = SRC_PREV }, + #define SRC_AUDIO_L 1 + { .name = "audio_l", .type = BIND_SAMPLER1D, .src_type = SRC_AUDIO_L }, + #define SRC_AUDIO_R 2 + { .name = "audio_r", .type = BIND_SAMPLER1D, .src_type = SRC_AUDIO_R }, + #define SRC_AUDIO_SZ 3 + { .name = "audio_sz", .type = BIND_INT, .src_type = SRC_AUDIO_SZ }, + #define SRC_SCREEN 4 + { .name = "screen", .type = BIND_IVEC2, .src_type = SRC_SCREEN }, + #define SRC_TIME 5 + { .name = "time", .type = BIND_FLOAT, .src_type = SRC_SCREEN } +}; + +#define window(t, sz) (0.53836 - (0.46164 * cos(TWOPI * (double) t / (double) sz))) +#define window_frame(t, sz) (0.6 - (0.4 * cos(TWOPI * (double) t / (double) sz))) +#define ALLOC_ONCE(u, udata, sz) \ + if (*udata == NULL) { \ + u = calloc(sz, sizeof(typeof(*u))); \ + *udata = u; \ + } else u = (typeof(u)) *udata; + +/* type generic clamp/min/max, like in GLSL */ + +#define clamp(v, min, max) \ + ({ \ + __auto_type _v = v; \ + if (_v < min) _v = min; \ + else if (_v > max) _v = max; \ + _v; \ + }) + +#define min(a0, b0) \ + ({ \ + __auto_type _a = a0; \ + __auto_type _b = b0; \ + _a < _b ? _a : _b; \ + }) + +#define max(a0, b0) \ + ({ \ + __auto_type _a = a0; \ + __auto_type _b = b0; \ + _a > _b ? _a : _b; \ + }) + +#define E 2.7182818284590452353 + +void transform_smooth(struct gl_data* d, void** _, void* data) { + struct gl_sampler_data* s = (struct gl_sampler_data*) data; + float* b = s->buf; + size_t + sz = s->sz, + asz = (size_t) ceil(s->sz / d->smooth_ratio); + for (int t = 0; t < asz; ++t) { + float + db = log(t), /* buffer index on log scale */ + avg = 0; /* adj value averages (weighted) */ + /* Calculate real indexes for sampling at this position, since the + distance is specified in scalar values */ + int smin = (int) floor(powf(E, max(db - d->smooth_distance, 0))); + int smax = min((int) ceil(powf(E, db + d->smooth_distance)), (int) sz - 1); + int count = 0; + for (int s = smin; s <= smax; ++s) { + if (b[s]) { + avg += b[s] /* / abs(powf(10, db + (t - s))) */; + count++; + } + } + avg /= count; + b[t] = avg; + } +} + +void transform_gravity(struct gl_data* d, void** udata, void* data) { + struct gl_sampler_data* s = (struct gl_sampler_data*) data; + float* b = s->buf; + size_t sz = s->sz, t; + + float* applied; + ALLOC_ONCE(applied, udata, sz); + + float g = d->gravity_step * (1.0F / d->ur); + + for (t = 0; t < sz; ++t) { + if (b[t] >= applied[t]) { + applied[t] = b[t] - g; + } else applied[t] -= g; + b[t] = applied[t]; + } +} + +void transform_average(struct gl_data* d, void** udata, void* data) { + + struct gl_sampler_data* s = (struct gl_sampler_data*) data; + float* b = s->buf; + size_t sz = s->sz, t, f; + size_t tsz = sz * d->avg_frames; + float v; + bool use_window = d->avg_window; + + float* bufs; + ALLOC_ONCE(bufs, udata, tsz); + + /* TODO: optimize into circle buffer */ + memmove(bufs, &bufs[sz], (tsz - sz) * sizeof(float)); + memcpy(&bufs[tsz - sz], b, sz * sizeof(float)); + + #define DO_AVG(w) \ + do { \ + for (t = 0; t < sz; ++t) { \ + v = 0.0F; \ + for (f = 0; f < d->avg_frames; ++f) { \ + v += w * bufs[(f * sz) + t]; \ + } \ + b[t] = v / d->avg_frames; \ + } \ + } while (0) + + if (use_window) + DO_AVG(window_frame(f, d->avg_frames - 1)); + else + DO_AVG(1); + + #undef DO_AVG +} + +void transform_wrange(struct gl_data* d, void** _, void* data) { + struct gl_sampler_data* s = (struct gl_sampler_data*) data; + float* b = s->buf; + size_t sz = s->sz, t; + for (t = 0; t < sz; ++t) { + b[t] += 1.0F; + b[t] /= 2.0F; + } +} + +void transform_fft(struct gl_data* d, void** _, void* in) { + struct gl_sampler_data* s = (struct gl_sampler_data*) in; + float* data = s->buf; + unsigned long nn = (unsigned long) (s->sz / 2); + + unsigned long n, mmax, m, j, istep, i; + float wtemp, wr, wpr, wpi, wi, theta; + float tempr, tempi; + + /* apply window */ + for (i = 0; i < s->sz; ++i) { + data[i] *= window(i, s->sz - 1); + } + + /* reverse-binary reindexing */ + n = nn << 1; + j = 1; + for (i = 1; i < n; i += 2) { + if (j > i) { + swap(data[j-1], data[i-1]); + swap(data[j], data[i]); + } + m = nn; + while (m >= 2 && j > m) { + j -= m; + m >>= 1; + } + j += m; + }; + + /* here begins the Danielson-Lanczos section */ + mmax = 2; + while (n > mmax) { + istep = mmax << 1; + theta = -(2 * M_PI / mmax); + wtemp = sin(0.5 * theta); + wpr = -2.0 * wtemp * wtemp; + wpi = sin(theta); + wr = 1.0; + wi = 0.0; + for (m = 1; m < mmax; m += 2) { + for (i = m; i <= n; i += istep) { + j= i + mmax; + tempr = wr * data[j-1] - wi * data[j]; + tempi = wr * data[j] + wi * data[j-1]; + + data[j-1] = data[i-1] - tempr; + data[j] = data[i] - tempi; + data[i-1] += tempr; + data[i] += tempi; + } + wtemp = wr; + wr += wr * wpr - wi * wpi; + wi += wi * wpr + wtemp * wpi; + } + mmax = istep; + } + + /* abs and log scale */ + for (n = 0; n < s->sz; ++n) { + if (data[n] < 0.0F) data[n] = -data[n]; + data[n] = log(data[n] + 1) / 3; + data[n] *= max((((float) n / (float) s->sz) * d->fft_scale) + (1.0F - d->fft_cutoff), 1.0F); + } +} + +static struct gl_transform transform_functions[] = { + { .name = "window", .type = BIND_SAMPLER1D, .apply = NULL }, + { .name = "fft", .type = BIND_SAMPLER1D, .apply = transform_fft }, + { .name = "wrange", .type = BIND_SAMPLER1D, .apply = transform_wrange }, + { .name = "avg", .type = BIND_SAMPLER1D, .apply = NULL }, + { .name = "gravity", .type = BIND_SAMPLER1D, .apply = NULL }, + { .name = "smooth", .type = BIND_SAMPLER1D, .apply = transform_smooth } +}; + +static struct gl_bind_src* lookup_bind_src(const char* str) { + for (size_t t = 0; t < sizeof(bind_sources) / sizeof(struct gl_bind_src); ++t) { + if (!strcmp(bind_sources[t].name, str)) { + return &bind_sources[t]; + } + } + return NULL; +} + +struct glava_renderer* rd_new(const char** paths, const char* entry, + const char** requests, const char* force_backend, + struct rd_bind* bindings, int stdin_type, + bool auto_desktop, bool verbose, + bool test_mode) { + + xwin_wait_for_wm(); + + MUTABLE glava_renderer* r = malloc(sizeof(struct glava_renderer)); + *r = (struct glava_renderer) { + .alive = true, + .mirror_input = false, + .gl = malloc(sizeof(struct gl_data)), + .bufsize_request = 8192, + .rate_request = 22000, + .samplesize_request = 1024, + .audio_source_request = NULL, + .off_tex = 0, + .lock = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, + .sizereq_flag = 0, + .flag = false + }; + + pthread_mutex_lock(&r->lock); + + MUTABLE struct gl_data* gl = r->gl; + *gl = (struct gl_data) { + .w = NULL, + .wcb = NULL, + .stages = NULL, + .rate = 0, + .tcounter = 0.0, + .fcounter = 0, + .ucounter = 0, + .kcounter = 0, + .time = 0.0F, + .timecycle = 60.0F, + .fr = 1.0F, + .ur = 1.0F, + .print_fps = true, + .bufscale = 1, + .avg_frames = 6, + .avg_window = true, + .gravity_step = 4.2, + .interpolate = true, + .interpolate_glsl = false, + .force_geometry = false, + .force_raised = false, + .smooth_factor = 0.025, + .smooth_distance = 0.01, + .smooth_ratio = 4, + .bg_tex = 0, + .sm_prog = 0, + .av_prog = 0, + .gr_prog = 0, + .p_prog = 0, + .copy_desktop = true, + .premultiply_alpha = true, + .mirror_input = false, + .accel_fft = true, + .check_fullscreen = false, + .smooth_pass = true, + .fft_scale = 10.2F, + .fft_cutoff = 0.3F, + .geometry = { 0, 0, 500, 400 }, + .clear_color = { 0.0F, 0.0F, 0.0F, 0.0F }, + .interpolate_buf = { [0] = NULL }, + .clickthrough = false, + .stdin_type = stdin_type, + .binds = bindings, + .bg_setup = false, + .test_mode = test_mode, + .off_sfbo = { + .name = "test", + .shader = 0, + .indirect = false, + .nativeonly = false, + .binds = NULL, + .binds_sz = 0 + }, + #ifdef GLAVA_DEBUG + .test_eval_color = { 0.0F, 0.0F, 0.0F, 0.0F }, + .debug_verbose = verbose, + .assigned_debug_cb = false, + #endif + }; + + bool forced = force_backend != NULL; + const char* backend = force_backend; + + /* Window creation backend interfaces */ + + if (wcbs_idx == 0) { + #ifdef GLAVA_GLFW + DECL_WCB(wcb_glfw); + #endif + #ifdef GLAVA_GLX + DECL_WCB(wcb_glx); + #endif + } + + #ifdef GLAVA_GLFW + if (!forced) backend = "glfw"; + #endif + + #ifdef GLAVA_GLX + if (!forced && getenv("DISPLAY")) { + backend = "glx"; + } + #endif + + if (!backend) { + fprintf(stderr, "No backend available for the active windowing system\n"); + if (wcbs_idx == 0) { + fprintf(stderr, "None have been compiled into this build.\n"); + } else { + fprintf(stderr, "Available backends:\n"); + for (size_t t = 0; t < wcbs_idx; ++t) { + fprintf(stderr, "\t\"%s\"\n", wcbs[t]->name); + } + } + glava_abort(); + } + + if (verbose) printf("Using backend: '%s'\n", backend); + + for (size_t t = 0; t < wcbs_idx; ++t) { + if (wcbs[t]->name && !strcmp(wcbs[t]->name, backend)) { + gl->wcb = wcbs[t]; + break; + } + }; + + if (!gl->wcb) { + fprintf(stderr, "Invalid window creation backend selected: '%s'\n", backend); + glava_abort(); + } + + #ifdef GLAD_DEBUG + if (verbose) printf("Assigning debug callback\n"); + if (!gl->assigned_debug_cb) { + glad_set_post_callback(glad_debugcb); + gl->assigned_debug_cb = true; + } + #endif + + gl->wcb->init(); + + MUTABLE int + shader_version = 330, + context_version_major = 3, + context_version_minor = 3; + MUTABLE const char* module = NULL; + const char* wintitle_default = "GLava"; + MUTABLE char* xwintype = NULL, * wintitle = (char*) wintitle_default; + MUTABLE char** xwinstates = malloc(1); + MUTABLE size_t xwinstates_sz = 0; + bool loading_module = true, loading_smooth_pass = false, loading_presets = false; + MUTABLE struct gl_sfbo* current = NULL; + MUTABLE size_t t_count = 0; + + #define WINDOW_HINT(request) \ + { .name = "set" #request, .fmt = "b", \ + .handler = RHANDLER(name, args, { gl->wcb->set_##request(*(bool*) args[0]); }) } + + struct request_handler handlers[] = { + { .name = "setopacity", .fmt = "s", + .handler = RHANDLER(name, args, { + bool native_opacity = !strcmp("native", (char*) args[0]); + + gl->premultiply_alpha = native_opacity; + + gl->wcb->set_transparent(native_opacity); + + if (!strcmp("xroot", (char*) args[0])) + gl->copy_desktop = true; + else + gl->copy_desktop = false; + + if (!gl->copy_desktop && !native_opacity && strcmp("none", (char*) args[0])) { + fprintf(stderr, "Invalid opacity option: '%s'\n", (char*) args[0]); + glava_abort(); + } + }) + }, + { .name = "setmirror", .fmt = "b", + .handler = RHANDLER(name, args, { + r->mirror_input = *(bool*) args[0]; + gl->mirror_input = *(bool*) args[0]; + }) + }, + { .name = "setfullscreencheck", .fmt = "b", + .handler = RHANDLER(name, args, { gl->check_fullscreen = *(bool*) args[0]; }) + }, + { .name = "setbg", .fmt = "s", + .handler = RHANDLER(name, args, { + float* results[] = { + &gl->clear_color.r, + &gl->clear_color.g, + &gl->clear_color.b, + &gl->clear_color.a + }; + if (!ext_parse_color((char*) args[0], 2, results)) { + fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]); + glava_abort(); + } + }) + }, + #ifdef GLAVA_DEBUG + { .name = "settesteval", .fmt = "s", + .handler = RHANDLER(name, args, { + float* results[] = { + &gl->test_eval_color.r, + &gl->test_eval_color.g, + &gl->test_eval_color.b, + &gl->test_eval_color.a + }; + if (!ext_parse_color((char*) args[0], 2, results)) { + fprintf(stderr, "Invalid value for `setbg` request: '%s'\n", (char*) args[0]); + glava_abort(); + } + }) + }, + #endif + { .name = "setbgf", .fmt = "ffff", + .handler = RHANDLER(name, args, { + gl->clear_color.r = *(float*) args[0]; + gl->clear_color.g = *(float*) args[1]; + gl->clear_color.b = *(float*) args[2]; + gl->clear_color.a = *(float*) args[3]; + }) + }, + { .name = "mod", .fmt = "s", + .handler = RHANDLER(name, args, { + if (loading_module) { + if (module != NULL) free((char*) module); + size_t len = strlen((char*) args[0]); + char* str = malloc(sizeof(char) * (len + 1)); + strcpy(str, (char*) args[0]); + module = str; + } + }) + }, + { .name = "nativeonly", .fmt = "b", + .handler = RHANDLER(name, args, { + fprintf(stderr, "WARNING: `nativeonly` is deprecated," + " use `#if PREMULTIPLY_ALPHA == 1`!\n"); + if (current) + current->nativeonly = *(bool*) args[0]; + else { + fprintf(stderr, "`nativeonly` request needs module context\n"); + glava_abort(); + } + }) + }, + WINDOW_HINT(floating), + WINDOW_HINT(decorated), + WINDOW_HINT(focused), + WINDOW_HINT(maximized), + { .name = "setversion", .fmt = "ii", + .handler = RHANDLER(name, args, { + context_version_major = *(int*) args[0]; + context_version_minor = *(int*) args[1]; + }) + }, + { .name = "setgeometry", .fmt = "iiii", + .handler = RHANDLER(name, args, { + gl->geometry[0] = *(int*) args[0]; + gl->geometry[1] = *(int*) args[1]; + gl->geometry[2] = *(int*) args[2]; + gl->geometry[3] = *(int*) args[3]; + }) + }, + { .name = "addxwinstate", .fmt = "s", + .handler = RHANDLER(name, args, { + if (!auto_desktop || loading_presets) { + ++xwinstates_sz; + xwinstates = realloc(xwinstates, sizeof(*xwinstates) * xwinstates_sz); + xwinstates[xwinstates_sz - 1] = strdup((char*) args[0]); + } + }) + }, + { .name = "setsource", .fmt = "s", + .handler = RHANDLER(name, args, { + if (r->audio_source_request) free(r->audio_source_request); + r->audio_source_request = strdup((char*) args[0]); }) }, + { .name = "setclickthrough", .fmt = "b", + .handler = RHANDLER(name, args, { gl->clickthrough = *(bool*) args[0]; }) }, + { .name = "setforcegeometry", .fmt = "b", + .handler = RHANDLER(name, args, { gl->force_geometry = *(bool*) args[0]; }) }, + { .name = "setforceraised", .fmt = "b", + .handler = RHANDLER(name, args, { gl->force_raised = *(bool*) args[0]; }) }, + { .name = "setxwintype", .fmt = "s", + .handler = RHANDLER(name, args, { + if (xwintype) free(xwintype); + xwintype = strdup((char*) args[0]); }) }, + { .name = "setshaderversion", .fmt = "i", + .handler = RHANDLER(name, args, { shader_version = *(int*) args[0]; }) }, + { .name = "setswap", .fmt = "i", + .handler = RHANDLER(name, args, { gl->wcb->set_swap(*(int*) args[0]); }) }, + { .name = "setframerate", .fmt = "i", + .handler = RHANDLER(name, args, { gl->rate = *(int*) args[0]; }) }, + { .name = "setprintframes", .fmt = "b", + .handler = RHANDLER(name, args, { gl->print_fps = *(bool*) args[0]; }) }, + { .name = "settitle", .fmt = "s", + .handler = RHANDLER(name, args, { + if (wintitle && wintitle != wintitle_default) free((char*) wintitle); + wintitle = strdup((char*) args[0]); }) }, + { .name = "setbufsize", .fmt = "i", + .handler = RHANDLER(name, args, { r->bufsize_request = *(int*) args[0]; }) }, + { .name = "setbufscale", .fmt = "i", + .handler = RHANDLER(name, args, { gl->bufscale = *(int*) args[0]; }) }, + { .name = "setsamplerate", .fmt = "i", + .handler = RHANDLER(name, args, { r->rate_request = *(int*) args[0]; }) }, + { .name = "setsamplesize", .fmt = "i", + .handler = RHANDLER(name, args, { r->samplesize_request = *(int*) args[0]; }) }, + { .name = "setaccelfft", .fmt = "b", + .handler = RHANDLER(name, args, { gl->accel_fft = *(bool*) args[0]; }) }, + { .name = "setavgframes", .fmt = "i", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->avg_frames = *(int*) args[0]; }) }, + { .name = "setavgwindow", .fmt = "b", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->avg_window = *(bool*) args[0]; }) }, + { .name = "setgravitystep", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->gravity_step = *(float*) args[0]; }) }, + { .name = "setsmoothpass", .fmt = "b", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->smooth_pass = *(bool*) args[0]; }) }, + { .name = "setsmoothfactor", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->smooth_factor = *(float*) args[0]; }) }, + { .name = "setsmooth", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->smooth_distance = *(float*) args[0]; }) }, + { .name = "setsmoothratio", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->smooth_ratio = *(float*) args[0]; }) }, + { .name = "setinterpolate", .fmt = "b", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->interpolate = *(bool*) args[0]; }) }, + { .name = "setfftscale", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->fft_scale = *(float*) args[0];}) }, + { .name = "setfftcutoff", .fmt = "f", + .handler = RHANDLER(name, args, { + if (!loading_smooth_pass) gl->fft_cutoff = *(float*) args[0];}) }, + { .name = "timecycle", .fmt = "f", + .handler = RHANDLER(name, args, { gl->timecycle = *(float*) args[0]; }) }, + { .name = "transform", .fmt = "ss", + .handler = RHANDLER(name, args, { + size_t t; + struct gl_bind* bind = NULL; + for (t = 0; t < current->binds_sz; ++t) { + if (!strcmp(current->binds[t].name, (const char*) args[0])) { + bind = ¤t->binds[t]; + break; + } + } + if (!bind) { + fprintf(stderr, "Cannot add transformation to uniform '%s':" + " uniform does not exist! (%d present in this unit)\n", + (const char*) args[0], (int) current->binds_sz); + glava_abort(); + } + struct gl_transform* tran = NULL; + for (t = 0; t < sizeof(transform_functions) / sizeof(struct gl_transform); ++t) { + if (!strcmp(transform_functions[t].name, (const char*) args[1])) { + tran = &transform_functions[t]; + break; + } + } + if (!tran) { + fprintf(stderr, "Cannot add transformation '%s' to uniform '%s':" + " transform function does not exist!\n", + (const char*) args[1], (const char*) args[0]); + glava_abort(); + } + if (tran->type != bind->type) { + fprintf(stderr, "Cannot apply '%s' to uniform '%s': mismatching types\n", + (const char*) args[1], (const char*) args[0]); + glava_abort(); + } + ++bind->t_sz; + bind->transformations = + realloc(bind->transformations, bind->t_sz * sizeof(void (*)(void*))); + bind->transformations[bind->t_sz - 1] = tran->apply; + ++t_count; + /* Edge case (for backwards compatibility): gravity and average is implied + by fft, reserve storage pointers for these operations */ + if (!strcmp(transform_functions[t].name, "fft")) { + t_count += 2; + } + static const char* fmt = "WARNING: using \"%s\" transform explicitly " + "is deprecated (no-op); implied from \"fft\" transform.\n"; + if (!strcmp(transform_functions[t].name, "gravity")) { + static bool gravity_warn = false; + if (!gravity_warn) { + fprintf(stderr, fmt, transform_functions[t].name); + gravity_warn = true; + } + } + if (!strcmp(transform_functions[t].name, "avg")) { + static bool avg_warn = false; + if (!avg_warn) { + fprintf(stderr, fmt, transform_functions[t].name); + avg_warn = true; + } + } + if (!strcmp(transform_functions[t].name, "window")) { + static bool avg_warn = false; + if (!avg_warn) { + fprintf(stderr, fmt, transform_functions[t].name); + avg_warn = true; + } + } + }) + }, + { .name = "uniform", .fmt = "ss", + .handler = RHANDLER(name, args, { + if (!current) { + fprintf(stderr, "Cannot bind uniform '%s' outside of a context" + " (load a module first!)\n", (const char*) args[0]); + glava_abort(); + } + struct gl_bind_src* src = lookup_bind_src((const char*) args[0]); + if (!src) { + fprintf(stderr, "Cannot bind uniform '%s': bind type does not exist!\n", + (const char*) args[0]); + glava_abort(); + } + ++current->binds_sz; + current->binds = realloc(current->binds, current->binds_sz * sizeof(struct gl_bind)); + current->binds[current->binds_sz - 1] = (struct gl_bind) { + .name = strdup((const char*) args[1]), + .type = src->type, + .src_type = src->src_type, + .transformations = malloc(1), + .t_sz = 0, + .gr = { .out = NULL }, + .optimize_fft = false + }; + }) + }, + { .name = NULL } + }; + + #undef WINDOW_WINT + + /* Find entry point in data directory list. The first entry point found will indicate + the path to use for future shader files and modules. Generally, user configuration + directories will be populated with symlinks to the installed modules. */ + + const char* data = NULL; + const char* dd = NULL; /* defaults dir (system) */ + const char* env = gl->wcb->get_environment(); + size_t d_len = 0, e_len = 0; + + for (const char** i = paths; (data = *i) != NULL; ++i) dd = data; + for (const char** i = paths; (data = *i) != NULL; ++i) { + d_len = strlen(data); + e_len = env ? strlen(env) : 0; + size_t se_len = strlen(entry); + /* '/' + \0 + "env_" + ".glsl" = 11 char padding, min 7 for "default" */ + size_t bsz = se_len + 11; + if (d_len > e_len && d_len >= 7) bsz += d_len; + else if (e_len >= 7) bsz += e_len; + else bsz += 7; + char se_buf[bsz]; + snprintf(se_buf, bsz, "%s/%s", data, entry); + + struct stat st; + + int fd = open(se_buf, O_RDONLY); + if (fd == -1) { + /* If the file exists but there was an error opening it, complain and exit */ + if (errno != ENOENT && + errno != ENOTDIR && + errno != ELOOP ) { + fprintf(stderr, "Failed to load entry '%s': %s\n", se_buf, strerror(errno)); + glava_abort(); + } else continue; + } + fstat(fd, &st); + + const char* map = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + + struct glsl_ext ext = { + .source = map, + .source_len = st.st_size, + .cd = data, + .handlers = handlers + }; + + ext_process(&ext, se_buf); + ext_free(&ext); + + munmap((void*) map, st.st_size); + close(fd); + + if (auto_desktop) { + if (env) { + snprintf(se_buf, bsz, "%s/env_%s.glsl", dd, env); + fd = open(se_buf, O_RDONLY); + if (fd == -1) { + if (errno != ENOENT && + errno != ENOTDIR && + errno != ELOOP) { + fprintf(stderr, "Failed to load desktop environment specific presets " + "at '%s': %s\n", se_buf, strerror(errno)); + glava_abort(); + } else { + if (verbose) + printf("No presets for current desktop environment (\"%s\"), " + "using default presets for embedding\n", env); + snprintf(se_buf, bsz, "%s/env_default.glsl", data); + fd = open(se_buf, O_RDONLY); + if (fd == -1) { + fprintf(stderr, "Failed to load default presets at '%s': %s\n", + se_buf, strerror(errno)); + glava_abort(); + } + } + } + fstat(fd, &st); + map = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + + ext.source = map; + ext.source_len = st.st_size; + + loading_presets = true; + ext_process(&ext, se_buf); + ext_free(&ext); + loading_presets = false; + + munmap((void*) map, st.st_size); + close(fd); + } else { + fprintf(stderr, "Failed to detect the desktop environment! " + "Is the window manager EWMH compliant?"); + } + } + + break; + } + + { + struct glsl_ext ext = { + .cd = data, + .handlers = handlers + }; + + const char* req; + char fbuf[64]; + int idx = 1; + for (const char** i = requests; (req = *i) != NULL; ++i) { + size_t rlen = strlen(req) + 16; + char* rbuf = malloc(rlen); + rlen = snprintf(rbuf, rlen, "#request %s", req); + snprintf(fbuf, sizeof(fbuf), "[request arg %d]", idx); + ext.source = rbuf; + ext.source_len = rlen; + ext_process(&ext, fbuf); + ext_free(&ext); + ++idx; + } + } + + if (!module) { + fprintf(stderr, + "No module was selected, edit '%s' to load " + "a module with `#request mod [name]`\n", + entry); + glava_abort(); + } + + gl->w = gl->wcb->create_and_bind( + wintitle, "GLava", xwintype, (const char**) xwinstates, xwinstates_sz, + gl->geometry[2], gl->geometry[3], gl->geometry[0], gl->geometry[1], + context_version_major, context_version_minor, gl->clickthrough, test_mode); + if (!gl->w) abort(); + + for (size_t t = 0; t < xwinstates_sz; ++t) + free(xwinstates[t]); + + if (xwintype) free(xwintype); + if (xwinstates) free(xwinstates); + if (wintitle && wintitle != wintitle_default) free(wintitle); + + xwin_assign_icon_bmp(gl->wcb, gl->w, GLAVA_RESOURCE_PATH "/glava.bmp"); + + glDisable(GL_DEPTH_TEST); + glDisable(GL_DEPTH_CLAMP); + glDisable(GL_CULL_FACE); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_MULTISAMPLE); + glDisable(GL_LINE_SMOOTH); + + if (!gl->premultiply_alpha) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + size_t m_len = strlen(module); + size_t bsz = d_len + m_len + 2; + char shaders[bsz]; /* module pack path to use */ + snprintf(shaders, bsz, "%s/%s", data, module); + + if (verbose) printf("Loading module: '%s'\n", module); + + free((void*) module); + loading_module = false; + + /* Iterate through shader passes in the shader directory and build textures, framebuffers, and + shader programs with each fragment shader. */ + + struct gl_sfbo* stages = NULL; + size_t count = 0; + + { + char buf[32]; + DIR* dir = opendir(shaders); + if (dir == NULL) { + fprintf(stderr, "shaders folder '%s' does not exist!", shaders); + } else { + closedir(dir); + struct dirent* d; + size_t idx = 1; + bool found; + do { + found = false; + + dir = opendir(shaders); + while ((d = readdir(dir)) != NULL) { + if (d->d_type == DT_REG || d->d_type == DT_UNKNOWN) { + snprintf(buf, sizeof(buf), "%d." SHADER_EXT_FRAG, (int) idx); + if (!strcmp(buf, d->d_name)) { + if (verbose) printf("found GLSL stage: '%s'\n", d->d_name); + ++count; + found = true; + } + } + } + closedir(dir); + ++idx; + } while (found); + + stages = malloc(sizeof(struct gl_sfbo) * count); + + size_t pipe_binds_len = 0; + + for (struct rd_bind* bd = gl->binds; bd->name != NULL; ++bd) + ++pipe_binds_len; + + idx = 1; + do { + found = false; + + dir = opendir(shaders); + while ((d = readdir(dir)) != NULL) { + if (d->d_type == DT_REG || d->d_type == DT_UNKNOWN) { + snprintf(buf, sizeof(buf), "%d." SHADER_EXT_FRAG, (int) idx); + if (!strcmp(buf, d->d_name)) { + if (verbose) printf("compiling: '%s'\n", d->d_name); + + struct gl_sfbo* s = &stages[idx - 1]; + *s = (struct gl_sfbo) { + .name = strdup(d->d_name), + .shader = 0, + .indirect = false, + .nativeonly = false, + .binds = malloc(1), + .binds_sz = 0, + .pipe_uniforms = malloc(sizeof(GLuint) * pipe_binds_len) + }; + + current = s; + bool skip; + GLuint id = shaderbuild(gl, shaders, data, dd, + handlers, shader_version, &skip, d->d_name); + if (skip && verbose) printf("disabled: '%s'\n", d->d_name); + /* check for compilation failure */ + if (!id && !skip) + glava_abort(); + + s->shader = id; + + if (id) { + /* Only setup a framebuffer and texture if this isn't the final step, + as it can rendered directly */ + if (idx != count) { + int w, h; + gl->wcb->get_fbsize(gl->w, &w, &h); + setup_sfbo(&stages[idx - 1], w, h); + } + + glUseProgram(id); + + /* Setup uniform bindings */ + size_t b; + for (b = 0; b < s->binds_sz; ++b) { + s->binds[b].uniform = glGetUniformLocation(id, s->binds[b].name); + } + if (gl->stdin_type != STDIN_TYPE_NONE) { + s->stdin_uniform = glGetUniformLocation(id, "STDIN"); + } + size_t u = 0; + for (struct rd_bind* bd = gl->binds; bd->name != NULL; ++bd) { + char buf[128]; + if (snprintf(buf, 128, "_IN_%s", bd->name) > 0) { + s->pipe_uniforms[u] = glGetUniformLocation(id, buf); + } else { + fprintf(stderr, "failed to format binding: \"%s\"\n", bd->name); + glava_abort(); + } + ++u; + } + glBindFragDataLocation(id, 1, "fragment"); + glUseProgram(0); + } + + found = true; + } + } + } + closedir(dir); + ++idx; + } while (found); + } + } + + gl->stages = stages; + gl->stages_sz = count; + + if (gl->test_mode || gl->wcb->offscreen()) { + int w, h; + gl->wcb->get_fbsize(gl->w, &w, &h); + setup_sfbo(&gl->off_sfbo, w, h); + r->off_tex = gl->off_sfbo.tex; + r->flag = true; + pthread_cond_signal(&r->cond); + pthread_mutex_unlock(&r->lock); + } + + { + struct gl_sfbo* final = NULL; + for (size_t t = 0; t < gl->stages_sz; ++t) { + if (gl->stages[t].shader && (gl->premultiply_alpha || !gl->stages[t].nativeonly)) { + final = &gl->stages[t]; + } + } + /* Use dirct rendering on final pass */ + if (final) final->indirect = false; + } + + /* Compile various audio processing shaders */ + + { + const char* util_folder = "util"; + size_t u_len = strlen(util_folder); + size_t usz = d_len + u_len + 2; + char util[usz]; /* module pack path to use */ + snprintf(util, usz, "%s/%s", data, util_folder); + + /* Compile smooth pass shader */ + loading_smooth_pass = true; + if (!(gl->sm_prog = shaderbuild(gl, util, data, dd, handlers, shader_version, + NULL, "smooth_pass.frag"))) + glava_abort(); + gl->sm_utex = glGetUniformLocation(gl->sm_prog, "tex"); + gl->sm_usz = glGetUniformLocation(gl->sm_prog, "sz"); + gl->sm_uw = glGetUniformLocation(gl->sm_prog, "w"); + glBindFragDataLocation(gl->sm_prog, 1, "fragment"); + loading_smooth_pass = false; + + if (gl->accel_fft) { + /* Compile gravity pass shader */ + if (!(gl->gr_prog = shaderbuild(gl, util, data, dd, handlers, shader_version, + NULL, "gravity_pass.frag"))) + glava_abort(); + gl->gr_utex = glGetUniformLocation(gl->gr_prog, "tex"); + gl->gr_udiff = glGetUniformLocation(gl->gr_prog, "diff"); + + /* Compile averaging shader */ + if (!(gl->av_prog = shaderbuild(gl, util, data, dd, handlers, shader_version, + NULL, "average_pass.frag"))) + glava_abort(); + char buf[6]; + gl->av_utex = malloc(sizeof(GLuint) * gl->avg_frames); + for (size_t t = 0; t < gl->avg_frames; ++t) { + snprintf(buf, sizeof(buf), "t%d", (int) t); + gl->av_utex[t] = glGetUniformLocation(gl->av_prog, buf); + } + + /* Compile pass shader (straight 1D texture map) */ + if (!(gl->p_prog = shaderbuild(gl, util, data, dd, handlers, shader_version, + NULL, "pass.frag"))) + glava_abort(); + gl->p_utex = glGetUniformLocation(gl->p_prog, "tex"); + } + } + + /* Compile averaging shader */ + + /* target seconds per update */ + gl->target_spu = (float) (r->samplesize_request / 4) / (float) r->rate_request; + + gl->audio_tex_r = create_1d_tex(); + gl->audio_tex_l = create_1d_tex(); + + if (gl->interpolate) { + /* Allocate six buffers at once */ + size_t isz = (r->bufsize_request / gl->bufscale); + float* ibuf = malloc(isz * 6 * sizeof(float)); + + gl->interpolate_buf[IB_START_LEFT ] = &ibuf[isz * IB_START_LEFT ]; /* left channel keyframe start */ + gl->interpolate_buf[IB_END_LEFT ] = &ibuf[isz * IB_END_LEFT ]; /* left channel keyframe end */ + gl->interpolate_buf[IB_START_RIGHT] = &ibuf[isz * IB_START_RIGHT]; /* right channel keyframe start */ + gl->interpolate_buf[IB_END_RIGHT ] = &ibuf[isz * IB_END_RIGHT ]; /* right channel keyframe end */ + gl->interpolate_buf[IB_WORK_LEFT ] = &ibuf[isz * IB_WORK_LEFT ]; /* left interpolation results */ + gl->interpolate_buf[IB_WORK_RIGHT ] = &ibuf[isz * IB_WORK_RIGHT ]; /* right interpolation results */ + } + + gl->t_data = malloc(sizeof(void*) * t_count); + gl->t_count = t_count; + for (size_t t = 0; t < t_count; ++t) { + gl->t_data[t] = NULL; + } + + overlay(&gl->overlay); + + glClearColor(gl->clear_color.r, gl->clear_color.g, gl->clear_color.b, gl->clear_color.a); + + gl->wcb->set_visible(gl->w, true); + + return r; +} + +static void bind_1d_fbo(struct sm_fb* sm, size_t sz) { + if (sm->tex == 0) { + glGenTextures(1, &sm->tex); + glGenFramebuffers(1, &sm->fbo); + + /* 1D texture parameters */ + glBindTexture(GL_TEXTURE_1D, sm->tex); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexImage1D(GL_TEXTURE_1D, 0, GL_R16, sz, 0, GL_RED, GL_FLOAT, NULL); + + /* setup and bind framebuffer to texture */ + glBindFramebuffer(GL_FRAMEBUFFER, sm->fbo); + glFramebufferTexture1D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,\ + GL_TEXTURE_1D, sm->tex, 0); + + switch (glCheckFramebufferStatus(GL_FRAMEBUFFER)) { + case GL_FRAMEBUFFER_COMPLETE: break; + default: + fprintf(stderr, "error in frambuffer state\n"); + glava_abort(); + } + } else { + /* Just bind our data if it was already allocated and setup */ + glBindFramebuffer(GL_FRAMEBUFFER, sm->fbo); + } +} + +void rd_time(struct glava_renderer* r) { + struct gl_data* gl = r->gl; + + gl->wcb->set_time(gl->w, 0.0); /* reset time for measuring this frame */ +} + +bool rd_update(struct glava_renderer* r, float* lb, float* rb, size_t bsz, bool modified) { + struct gl_data* gl = r->gl; + size_t t, a, fbsz = bsz * sizeof(float); + + if (gl->wcb->should_close(gl->w)) { + r->alive = false; + return true; + } + + /* Stop rendering if the backend has some reason not to render (minimized, obscured) */ + if (!gl->wcb->should_render(gl->w)) + return false; + + /* Stop rendering when fullscreen windows are focused */ + if (gl->check_fullscreen && !xwin_should_render(gl->wcb, gl->w)) + return false; + + /* Force disable interpolation if the update rate is close to or higher than the frame rate */ + float uratio = (gl->ur / gl->fr); /* update : framerate ratio */ + MUTABLE bool old_interpolate = gl->interpolate; + gl->interpolate = uratio <= 0.9F ? old_interpolate : false; + + /* Perform buffer scaling */ + size_t nsz = gl->bufscale > 1 ? (bsz / gl->bufscale) : 0; + float nlb[nsz], nrb[nsz]; + if (gl->bufscale > 1) { + float accum; + for (t = 0; t < nsz; ++t) { + accum = 0.0F; + for (a = 0; a < gl->bufscale; ++a) { + accum += lb[(t * gl->bufscale) + a]; + } + accum /= (float) gl->bufscale; + nlb[t] = accum; + } + for (t = 0; t < nsz; ++t) { + accum = 0.0F; + for (a = 0; a < gl->bufscale; ++a) { + accum += rb[(t * gl->bufscale) + a]; + } + accum /= (float) gl->bufscale; + nrb[t] = accum; + } + lb = nlb; + rb = nrb; + bsz = nsz; + fbsz = bsz * sizeof(float); + } + + /* Linear interpolation */ + float * ilb = NULL, * irb = NULL; + if (gl->interpolate) { + ilb = gl->interpolate_buf[IB_WORK_LEFT ]; + irb = gl->interpolate_buf[IB_WORK_RIGHT]; + for (t = 0; t < bsz; ++t) { + /* Obtain start/end values at this index for left & right buffers */ + float + ilbs = gl->interpolate_buf[IB_START_LEFT ][t], + ilbe = gl->interpolate_buf[IB_END_LEFT ][t], + irbs = gl->interpolate_buf[IB_START_RIGHT][t], + irbe = gl->interpolate_buf[IB_END_RIGHT ][t], + mod = uratio * gl->kcounter; /* modifier for this frame */ + if (mod > 1.0F) mod = 1.0F; + ilb[t] = ilbs + ((ilbe - ilbs) * mod); + irb[t] = irbs + ((irbe - irbs) * mod); + } + } + + /* Handle external resize requests */ + if (gl->wcb->offscreen()) { + if (__atomic_exchange_n(&r->sizereq_flag, GLAVA_REQ_NONE, __ATOMIC_SEQ_CST) == GLAVA_REQ_RESIZE) + gl->wcb->set_geometry(gl->w, r->sizereq.x, r->sizereq.y, r->sizereq.w, r->sizereq.h); + } + + int ww, wh, wx, wy; + gl->wcb->get_fbsize(gl->w, &ww, &wh); + gl->wcb->get_pos(gl->w, &wx, &wy); + + /* Resize screen textures if needed */ + if (ww != gl->lww || wh != gl->lwh) { + for (t = 0; t < gl->stages_sz; ++t) { + if (gl->stages[t].indirect) { + setup_sfbo(&gl->stages[t], ww, wh); + } + } + if (gl->test_mode || gl->wcb->offscreen()) + setup_sfbo(&gl->off_sfbo, ww, wh); + } + + /* Resize and grab new background data if needed */ + if (gl->copy_desktop && (gl->wcb->bg_changed(gl->w) + || ww != gl->lww || wh != gl->lwh + || wx != gl->lwx || wy != gl->lwy)) { + gl->bg_tex = xwin_copyglbg(r, gl->bg_tex); + } + + gl->lwx = wx; + gl->lwy = wy; + gl->lww = ww; + gl->lwh = wh; + + glViewport(0, 0, ww, wh); + + static char stdin_buf_store[128] = {}; + static char* stdin_buf = stdin_buf_store; + static int stdin_select = STDIN_TYPE_NONE; + static size_t stdin_idx = 0; + static bool stdin_uniform_ready = false; + static size_t stdin_bind_off = 0; + static char* stdin_name = NULL; + static size_t stdin_name_len = 0; + static bool pipe_eof = false; + static union { + bool b; + int i; + float f[4]; + } stdin_parsed; + + /* Parse stdin data, if nessecary */ + if (!pipe_eof && (gl->stdin_type != STDIN_TYPE_NONE || gl->binds[0].name != NULL)) { + int c, n, p; + setvbuf(stdin, NULL, _IOLBF, 64); + + fd_set fds; + FD_ZERO(&fds); + FD_SET(STDIN_FILENO, &fds); + struct timeval timeout = { 0, 0 }; + n = select(1, &fds, NULL, NULL, &timeout); + + for (p = 0; n > 0; ++p) { + c = getchar(); + if (stdin_idx >= (sizeof(stdin_buf_store) / sizeof(*stdin_buf_store)) - 1) + break; + if (c != EOF && c != '\n') + stdin_buf[stdin_idx++] = c; + else { + if (stdin_idx == 0) + goto reset; + stdin_buf[stdin_idx] = '\0'; + + stdin_select = gl->stdin_type; + + if (gl->stdin_type == STDIN_TYPE_NONE) { + bool v = false; + bool valid = false; + while (*stdin_buf == ' ') ++stdin_buf; /* advance to first char */ + for (int h = 0; stdin_buf[h] != '\0'; ++h) { + int l; + if (!v && stdin_buf[h] == '=') { + for (l = h - 1; l >= 0; --l) + if (stdin_buf[l] != ' ') + break; + stdin_name = stdin_buf; + stdin_name_len = l + 1; + v = true; + } else if (v && stdin_buf[h] != ' ') { + stdin_buf += h; + for (l = strlen(stdin_buf) - 1; stdin_buf[l] == ' '; --l); + stdin_buf[l + 1] = '\0'; + valid = true; + break; + } + } + if ((stdin_name && stdin_name[0] == '\0') || (!valid && !v)) { + /* no assignment, just a default value */ + stdin_name = PIPE_DEFAULT; + stdin_name_len = 0; + valid = true; + } + if (!valid) { + fprintf(stderr, "Bad assignment format for \"%s\"\n", stdin_buf); + goto reset; + } + bool bound = false; + size_t u = 0; + for (struct rd_bind* bd = gl->binds; bd->name != NULL; ++bd) { + if (!strncmp(bd->name, stdin_name, stdin_name_len)) { + bound = true; + stdin_bind_off = u; + stdin_select = bd->type; + break; + } + ++u; + } + if (!bound) { + fprintf(stderr, "Variable name not bound: \"%.*s\"\n", + (int) stdin_name_len, stdin_name); + stdin_select = STDIN_TYPE_NONE; + } + } + + switch (stdin_select) { + case STDIN_TYPE_BOOL: + if (!strcmp("true", stdin_buf) || + !strcmp("TRUE", stdin_buf) || + !strcmp("True", stdin_buf) || + !strcmp("1", stdin_buf)) { + stdin_parsed.b = true; + stdin_uniform_ready = true; + } else if (!strcmp("false", stdin_buf) || + !strcmp("FALSE", stdin_buf) || + !strcmp("False", stdin_buf) || + !strcmp("0", stdin_buf)) { + stdin_parsed.b = false; + stdin_uniform_ready = true; + } else { + fprintf(stderr, "Bad format for boolean: \"%s\"\n", stdin_buf); + } + break; + case STDIN_TYPE_INT: + errno = 0; + stdin_parsed.i = (int) strtol(stdin_buf, NULL, 10); + if (errno != ERANGE) stdin_uniform_ready = true; + break; + case STDIN_TYPE_FLOAT: + errno = 0; + stdin_parsed.f[0] = strtof(stdin_buf, NULL); + if (errno != ERANGE) stdin_uniform_ready = true; + break; + case STDIN_TYPE_VEC2: + if (EOF != sscanf(stdin_buf, "%f,%f", + &stdin_parsed.f[0], &stdin_parsed.f[1])) + stdin_uniform_ready = true; + break; + case STDIN_TYPE_VEC3: + if (EOF != sscanf(stdin_buf, "%f,%f,%f", + &stdin_parsed.f[0], &stdin_parsed.f[1], + &stdin_parsed.f[2])) + stdin_uniform_ready = true; + break; + case STDIN_TYPE_VEC4: + if (stdin_buf[0] == '#') { + stdin_parsed.f[0] = 0.0F; + stdin_parsed.f[1] = 0.0F; + stdin_parsed.f[2] = 0.0F; + stdin_parsed.f[3] = 1.0F; + float* ptrs[] = { + &stdin_parsed.f[0], &stdin_parsed.f[1], + &stdin_parsed.f[2], &stdin_parsed.f[3] + }; + if (ext_parse_color(stdin_buf + 1, 2, ptrs)) { + stdin_uniform_ready = true; + } else fprintf(stderr, "Bad format for color string: \"%s\"\n", stdin_buf); + } else if (EOF != sscanf(stdin_buf, "%f,%f,%f,%f", + &stdin_parsed.f[0], &stdin_parsed.f[1], + &stdin_parsed.f[2], &stdin_parsed.f[3])) + stdin_uniform_ready = true; + break; + default: break; + } + reset: + stdin_buf = stdin_buf_store; + stdin_buf[0] = '\0'; + stdin_idx = 0; + break; + + if (c == EOF) { + pipe_eof = true; + break; + } + }; + } + } + + struct gl_sfbo* prev = NULL; + + /* Iterate through each rendering stage (shader) */ + + for (t = 0; t < gl->stages_sz; ++t) { + + MUTABLE bool load_flags_s[64] = { [ 0 ... 63 ] = false }; + MUTABLE bool* load_flags = load_flags_s; /* Load flags for each texture position */ + + /* Current shader program */ + struct gl_sfbo* current = &gl->stages[t]; + + if (!current->shader || (current->nativeonly && !gl->premultiply_alpha)) + continue; + + /* Bind framebuffer if this is not the final pass */ + if (current->indirect) + glBindFramebuffer(GL_FRAMEBUFFER, current->fbo); + else if (gl->test_mode || gl->wcb->offscreen()) + glBindFramebuffer(GL_FRAMEBUFFER, gl->off_sfbo.fbo); + + glClear(GL_COLOR_BUFFER_BIT); + + if (!current->indirect && gl->copy_desktop) { + /* Shader to flip texture and override alpha channel. + This is embedded since we don't need any GLSL preprocessing here */ + static const char* frag_shader = + "uniform sampler2D tex;" "\n" + "uniform ivec2 screen;" "\n" + "out vec4 fragment;" "\n" + "in vec4 gl_FragCoord;" "\n" + "void main() {" "\n" + " fragment = texelFetch(tex, ivec2(gl_FragCoord.x, " "\n" + " screen.y - gl_FragCoord.y), 0);" "\n" + " fragment.a = 1.0F;" "\n" + "}" "\n"; + if (!gl->bg_setup) { + gl->bg_prog = shaderlink(shaderload(NULL, GL_VERTEX_SHADER, VERTEX_SHADER_SRC, + NULL, NULL, NULL, 330, true, NULL, gl), + shaderload(NULL, GL_FRAGMENT_SHADER, frag_shader, + NULL, NULL, NULL, 330, true, NULL, gl)); + gl->bg_utex = glGetUniformLocation(gl->bg_prog, "tex"); + gl->bg_screen = glGetUniformLocation(gl->bg_prog, "screen"); + glBindFragDataLocation(gl->bg_prog, 1, "fragment"); + gl->bg_setup = true; + } + glUseProgram(gl->bg_prog); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, gl->bg_tex); + glUniform2i(gl->bg_screen, (GLint) ww, (GLint) wh); + glUniform1i(gl->bg_utex, 0); + /* We need to disable blending, we might read in bogus alpha values due + to how we obtain the background texture (format is four byte `rgb_`, + where the last value is skipped) */ + if (!gl->premultiply_alpha) glDisable(GL_BLEND); + drawoverlay(&gl->overlay); + if (!gl->premultiply_alpha) glEnable(GL_BLEND); + glUseProgram(0); + } + + /* Select the program associated with this pass */ + glUseProgram(current->shader); + + /* Pass uniform if one has been parsed */ + if (stdin_uniform_ready) { + GLuint handle = gl->stdin_type != STDIN_TYPE_NONE ? current->stdin_uniform : + current->pipe_uniforms[stdin_bind_off]; + switch (stdin_select) { + case STDIN_TYPE_BOOL: + glUniform1i(handle, (int) stdin_parsed.b); + break; + case STDIN_TYPE_INT: + glUniform1i(handle, stdin_parsed.i); + break; + case STDIN_TYPE_FLOAT: + glUniform1f(handle, stdin_parsed.f[0]); + break; + case STDIN_TYPE_VEC2: + glUniform2f(handle, + stdin_parsed.f[0], stdin_parsed.f[1]); + break; + case STDIN_TYPE_VEC3: + glUniform3f(handle, + stdin_parsed.f[0], stdin_parsed.f[1], + stdin_parsed.f[2]); + break; + case STDIN_TYPE_VEC4: + glUniform4f(handle, + stdin_parsed.f[0], stdin_parsed.f[1], + stdin_parsed.f[2], stdin_parsed.f[3]); + break; + default: break; + } + stdin_uniform_ready = false; + } + + bool prev_bound = false; + + /* Iterate through each uniform binding, transforming and passing the + data into the shader. */ + + MUTABLE size_t b, c = 0; + for (b = 0; b < current->binds_sz; ++b) { + struct gl_bind* bind = ¤t->binds[b]; + + /* Handle transformations and bindings for 1D samplers */ + INLINE(void, handle_audio)(GLuint tex, float* buf, float* ubuf, + size_t sz, int offset, bool audio) { + if (load_flags[offset]) + goto bind_uniform; + load_flags[offset] = true; + + bool set_opt = false; /* if bind->optimize_fft was set this frame */ + + /* Only apply transformations if the buffers we were given are newly copied */ + if (modified) { + size_t t, tm = 0; + struct gl_sampler_data d = { + .buf = buf, .sz = sz + }; + + for (t = 0; t < bind->t_sz; ++t) { + void (*apply)(struct gl_data*, void**, void*) = bind->transformations[t]; + if (apply != NULL) { + if (gl->accel_fft) { + if (apply == transform_fft && !bind->optimize_fft) { + bind->optimize_fft = true; + set_opt = true; + tm = t; + } else { + /* Valid transformation after fft, no longer worth + pushing to the GPU. */ + if (bind->optimize_fft) { + transform_fft(gl, &gl->t_data[c - 1], &d); + transform_gravity(gl, &gl->t_data[c + 1], &d); + transform_average(gl, &gl->t_data[c + 2], &d); + c += 2; + bind->optimize_fft = false; + set_opt = false; + } + apply(gl, &gl->t_data[c], &d); + } + } else { + apply(gl, &gl->t_data[c], &d); + if (apply == transform_fft) { + transform_gravity(gl, &gl->t_data[c + 1], &d); + transform_average(gl, &gl->t_data[c + 2], &d); + c += 2; + } + } + } + ++c; /* Index for transformation data (note: change if new + transform types are added) */ + } + if (set_opt) { + /* Force CPU interpolation off if we are pushing fft to the GPU, + as it requires the buffer data on system memory is updated with + transformation data (and is quite slow) */ + if (old_interpolate) + gl->interpolate_glsl = true; + old_interpolate = false; + gl->interpolate = false; + /* Minor microptimization: truncate transforms if we're optimizing + the tailing FFT transform type, since we don't actually apply + them at this point. */ + bind->t_sz = tm; + } + } + + /* TODO: remove and replace with GLSL FFT */ + if (bind->optimize_fft) { + transform_fft(gl, &gl->t_data[c], + &((struct gl_sampler_data) { .buf = buf, .sz = sz } )); + } + + glActiveTexture(GL_TEXTURE0 + offset); + + /* Update texture with our data */ + update_1d_tex(tex, sz, gl->interpolate ? (ubuf ? ubuf : buf) : buf); + + /* Apply audio-specific transformations in GLSL, if enabled */ + if (bind->optimize_fft) { + struct sm_fb* av = &bind->av; + struct sm_fb* gr_store = &bind->gr_store; + struct gr_fb* gr = &bind->gr; + if (modified) { + if (gr->out == NULL) { + gr->out = calloc(gl->avg_frames, sizeof(struct sm_fb)); + gr->out_sz = gl->avg_frames; + } + bind_1d_fbo(gr_store, sz); + + /* Do the gravity storage computation with GL_MAX */ + glUseProgram(gl->p_prog); + glActiveTexture(GL_TEXTURE0 + offset); + glBindTexture(GL_TEXTURE_1D, tex); + glUniform1i(gl->p_utex, offset); + if (gl->premultiply_alpha) glEnable(GL_BLEND); + glBlendEquation(GL_MAX); + glViewport(0, 0, sz, 1); + drawoverlay(&gl->overlay); + glViewport(0, 0, ww, wh); + glBlendEquation(GL_FUNC_ADD); + if (gl->premultiply_alpha) glDisable(GL_BLEND); + tex = gr_store->tex; + + /* We are using this barrier extension so we can apply + transformations in-place using a single texture buffer. + Without this, we would need to double-buffer our textures + and perform pointless copies. */ + glTextureBarrierNV(); + + /* Apply gravity */ + glUseProgram(gl->gr_prog); + glActiveTexture(GL_TEXTURE0 + offset); + glBindTexture(GL_TEXTURE_1D, tex); + glUniform1i(gl->gr_utex, offset); + glUniform1f(gl->gr_udiff, gl->gravity_step * (1.0F / gl->ur)); + if (!gl->premultiply_alpha) glDisable(GL_BLEND); + glViewport(0, 0, sz, 1); + drawoverlay(&gl->overlay); + glViewport(0, 0, ww, wh); + + if (gl->avg_frames > 1) { + + /* Write gravity buffer to output frames as if they are a + circular buffer. This prevents needless texture shifts */ + struct sm_fb* out_frame = &gr->out[gr->out_idx]; + bind_1d_fbo(out_frame, sz); + glUseProgram(gl->p_prog); + glActiveTexture(GL_TEXTURE0 + offset); + glBindTexture(GL_TEXTURE_1D, tex); + glUniform1i(gl->p_utex, offset); + glViewport(0, 0, sz, 1); + drawoverlay(&gl->overlay); + glViewport(0, 0, ww, wh); + + /* Read circular buffer into averaging shader */ + bind_1d_fbo(av, sz); + glUseProgram(gl->av_prog); + for (int t = 0; t < (int) gr->out_sz; ++t) { + GLuint c_off = offset + 1 + t; + glActiveTexture(GL_TEXTURE0 + c_off); + /* Textures are bound in descending order, such that + t0 is the most recent, and t[max - 1] is the last. */ + int fr = gr->out_idx - t; + if (fr < 0) + fr = gr->out_sz + fr; + glBindTexture(GL_TEXTURE_1D, gr->out[fr].tex); + glUniform1i(gl->av_utex[t], c_off); + } + glViewport(0, 0, sz, 1); + drawoverlay(&gl->overlay); + glViewport(0, 0, ww, wh); + ++gr->out_idx; + if (gr->out_idx >= gr->out_sz) + gr->out_idx = 0; + tex = av->tex; + } + if (!gl->premultiply_alpha) glEnable(GL_BLEND); + + } else { + /* No audio buffer update; use last average result */ + if (gl->avg_frames > 1) + tex = av->tex; + } + } + + /* Apply pre-smoothing shader pass if configured */ + if (audio && gl->smooth_pass) { + + /* Allocate and setup our per-bind data, if needed */ + struct sm_fb* sm = &bind->sm; + bind_1d_fbo(sm, sz); + + glUseProgram(gl->sm_prog); + glActiveTexture(GL_TEXTURE0 + offset); + glBindTexture(GL_TEXTURE_1D, tex); + glUniform1i(gl->sm_uw, sz); /* target texture width */ + glUniform1i(gl->sm_usz, sz); /* source texture width */ + glUniform1i(gl->sm_utex, offset); + if (!gl->premultiply_alpha) glDisable(GL_BLEND); + glViewport(0, 0, sz, 1); + drawoverlay(&gl->overlay); + glViewport(0, 0, ww, wh); + if (!gl->premultiply_alpha) glEnable(GL_BLEND); + + /* Return state */ + glUseProgram(current->shader); + if (current->indirect) + glBindFramebuffer(GL_FRAMEBUFFER, current->fbo); + else if (gl->test_mode || gl->wcb->offscreen()) + glBindFramebuffer(GL_FRAMEBUFFER, gl->off_sfbo.fbo); + else glBindFramebuffer(GL_FRAMEBUFFER, 0); + + tex = sm->tex; /* replace input texture with our processed one */ + } + + glActiveTexture(GL_TEXTURE0 + offset); + glBindTexture(GL_TEXTURE_1D, tex); + bind_uniform: + glUniform1i(bind->uniform, offset); + }; /* <-- this pesky semicolon is only required in clang because of how blocks work */ + + /* Handle each binding source; only bother to handle transformations + for 1D samplers, since that's the only transformation type that + (currently) exists. */ + switch (bind->src_type) { + case SRC_PREV: + /* bind texture and pass it to the shader uniform if we need to pass + the sampler from the previous pass */ + if (!prev_bound && prev != NULL) { + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, prev->tex); + prev_bound = true; + } + glUniform1i(bind->uniform, 0); + break; + case SRC_AUDIO_L: handle_audio(gl->audio_tex_l, lb, ilb, bsz, 1, true); break; + case SRC_AUDIO_R: handle_audio(gl->audio_tex_r, rb, irb, bsz, 2, true); break; + case SRC_AUDIO_SZ: glUniform1i(bind->uniform, bsz); break; + case SRC_SCREEN: glUniform2i(bind->uniform, (GLint) ww, (GLint) wh); break; + case SRC_TIME: glUniform1f(bind->uniform, (GLfloat) gl->time); break; + } + } + + drawoverlay(&gl->overlay); /* Fullscreen quad (actually just two triangles) */ + + /* Reset some state */ + if (current->indirect) { + if (gl->test_mode || gl->wcb->offscreen()) + glBindFramebuffer(GL_FRAMEBUFFER, gl->off_sfbo.fbo); + else + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + glUseProgram(0); + + prev = current; + } + + /* Push and copy buffer if we need to interpolate from it later */ + if (gl->interpolate && modified) { + memcpy(gl->interpolate_buf[IB_START_LEFT ], gl->interpolate_buf[IB_END_LEFT ], fbsz); + memcpy(gl->interpolate_buf[IB_START_RIGHT], gl->interpolate_buf[IB_END_RIGHT], fbsz); + memcpy(gl->interpolate_buf[IB_END_LEFT ], lb, fbsz); + memcpy(gl->interpolate_buf[IB_END_RIGHT ], rb, fbsz); + } + + /* Swap buffers, handle events, etc. (vsync is potentially included here, too) */ + gl->wcb->swap_buffers(gl->w); + + double duration = gl->wcb->get_time(gl->w); /* frame execution time */ + + /* Handling sleeping (to meet target framerate) */ + if (gl->rate > 0) { + double target = 1.0 / (double) gl->rate; /* 1 / freq = time per frame */ + if (duration < target) { + double sleep = target - duration; + struct timespec tv = { + .tv_sec = (time_t) floor(sleep), + .tv_nsec = (long) (double) ((sleep - floor(sleep)) * 1000000000.0) + }; + nanosleep(&tv, NULL); + duration = target; /* update duration to reflect our sleep time */ + } + } + + /* Handle counters and print FPS counter (if needed) */ + + ++gl->time; /* shader uniform time value */ + if (gl->time >= gl->timecycle) + gl->time -= gl->timecycle; + ++gl->fcounter; /* increment frame counter */ + if (modified) { /* if this is an update/key frame */ + ++gl->ucounter; /* increment update frame counter */ + gl->kcounter = 0; /* reset keyframe counter (for interpolation) */ + } else ++gl->kcounter; /* increment keyframe counter otherwise */ + gl->tcounter += duration; /* timer counter, measuring when a >1s has occurred */ + if (gl->tcounter >= 1.0) { + gl->fr = gl->fcounter / gl->tcounter; /* frame rate (FPS) */ + gl->ur = gl->ucounter / gl->tcounter; /* update rate (UPS) */ + if (gl->print_fps) { /* print FPS */ + #ifdef GLAVA_DEBUG + printf("FPS: %.2f, UPS: %.2f, time: %.2f\n", + (double) gl->fr, (double) gl->ur, (double) gl->time); + #else + printf("FPS: %.2f, UPS: %.2f\n", + (double) gl->fr, (double) gl->ur); + #endif + } + gl->tcounter = 0; /* reset timer */ + gl->fcounter = 0; /* reset frame counter */ + gl->ucounter = 0; /* reset update counter */ + + /* Refresh window position and size if we are forcing it */ + if (gl->force_geometry) { + gl->wcb->set_geometry(gl->w, + gl->geometry[0], gl->geometry[1], + gl->geometry[2], gl->geometry[3]); + } + + if (gl->force_raised) { + gl->wcb->raise(gl->w); + } + } + + /* Restore interpolation settings */ + gl->interpolate = old_interpolate; + + return true; +} + +#ifdef GLAVA_DEBUG +bool rd_test_evaluate(struct glava_renderer* r) { + int w, h; + struct gl_data* gl = r->gl; + gl->wcb->get_fbsize(gl->w, &w, &h); + printf("Reading pixels from final framebuffer (%dx%d)\n", w, h); + float margin = 1.0 / (255.0F * 2.0F); + float eval[4] = { + gl->test_eval_color.r, + gl->test_eval_color.g, + gl->test_eval_color.b, + gl->test_eval_color.a + }; + bool err = false; + for (int x = 0; x < w; ++x) { + for (int y = 0; y < h; ++y) { + float ret[4]; + glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, &ret); + if (ret[0] < eval[0] - margin || ret[0] > eval[0] + margin || + ret[1] < eval[1] - margin || ret[1] > eval[1] + margin || + ret[2] < eval[2] - margin || ret[2] > eval[2] + margin || + ret[3] < eval[3] - margin || ret[3] > eval[3] + margin) { + fprintf(stderr, "px (%d,%d) failed test, (%f,%f,%f,%f)" + " is not within margins for (%f,%f,%f,%f)\n", + x, y, + (double) ret[0], (double) ret[1], (double) ret[2], (double) ret[3], + (double) eval[0], (double) eval[1], (double) eval[2], (double) eval[3]); + err = true; + goto end_test; + } + } + } +end_test: + return err; +} +#endif + +void* rd_get_impl_window (struct glava_renderer* r) { return r->gl->w; } +struct gl_wcb* rd_get_wcb (struct glava_renderer* r) { return r->gl->wcb; } + +void rd_destroy(struct glava_renderer* r) { + r->gl->wcb->destroy(r->gl->w); + if (r->gl->interpolate_buf[0]) free(r->gl->interpolate_buf[0]); + size_t t, b; + if (r->gl->t_data) { + for (t = 0; t < r->gl->t_count; ++t) { + if (r->gl->t_data[t]) + free(r->gl->t_data[t]); + } + free(r->gl->t_data); + } + for (t = 0; t < r->gl->stages_sz; ++t) { + struct gl_sfbo* stage = &r->gl->stages[t]; + for (b = 0; b < stage->binds_sz; ++b) { + struct gl_bind* bind = &stage->binds[b]; + free(bind->transformations); + if (bind->gr.out != NULL) + free(bind->gr.out); + free((char*) bind->name); /* strdup */ + } + free(stage->binds); + free((char*) stage->name); /* strdup */ + } + if (r->gl->av_utex) + free(r->gl->av_utex); + free(r->gl->stages); + r->gl->wcb->terminate(); + free(r->gl); + if (r->audio_source_request) + free(r->audio_source_request); + free(r); +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava/render.h b/share/dotfiles/.config/glava/glava_repo/glava/render.h new file mode 100644 index 00000000..b96fafda --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/render.h @@ -0,0 +1,139 @@ + +#ifndef RENDER_H +#define RENDER_H + +#include <stdbool.h> +#include <stdint.h> +#include <pthread.h> +#include "glava.h" + +typedef struct glava_renderer { + volatile bool alive; + bool mirror_input; + size_t bufsize_request, rate_request, samplesize_request; + char* audio_source_request; + unsigned int off_tex; /* final GL texture for offscreen rendering */ + pthread_mutex_t lock; /* lock for reading from offscreen texture */ + pthread_cond_t cond; /* cond for reading from offscreen texture */ + bool flag; /* vadility flag for reading from offscreen tecture */ + volatile struct { + int x, y, w, h; + } sizereq; + volatile int sizereq_flag; + struct gl_data* gl; +} glava_renderer; + +extern const struct { + const char* n; + int i; +} bind_types[]; +extern bool glad_instantiated; + +#define STDIN_TYPE_NONE 0 +#define STDIN_TYPE_INT 1 +#define STDIN_TYPE_FLOAT 2 +#define STDIN_TYPE_BOOL 3 +#define STDIN_TYPE_VEC2 4 +#define STDIN_TYPE_VEC3 5 +#define STDIN_TYPE_VEC4 6 + +#define PIPE_DEFAULT "_" + +struct rd_bind { + const char* name; + const char* stype; + int type; +}; + +#ifdef GLAVA_DEBUG +bool rd_get_test_mode (struct glava_renderer*); +bool rd_test_evaluate (struct glava_renderer*); +#endif + +struct glava_renderer* rd_new (const char** paths, const char* entry, + const char** requests, const char* force_backend, + struct rd_bind* bindings, int stdin_type, + bool auto_desktop, bool verbose, + bool test_mode); +bool rd_update (struct glava_renderer*, float* lb, float* rb, + size_t bsz, bool modified); +void rd_destroy (struct glava_renderer*); +void rd_time (struct glava_renderer*); +void* rd_get_impl_window(struct glava_renderer*); +struct gl_wcb* rd_get_wcb (struct glava_renderer*); + +/* gl_wcb - OpenGL Window Creation Backend interface */ +struct gl_wcb { + const char* name; + bool (*offscreen) (void); + void (*init) (void); + void* (*create_and_bind)(const char* name, const char* class, + const char* type, const char** states, + size_t states_sz, + int w, int h, + int x, int y, + int version_major, int version_minor, + bool clickthrough, bool offscreen); + bool (*should_close) (void* ptr); + bool (*should_render) (void* ptr); + bool (*bg_changed) (void* ptr); + void (*swap_buffers) (void* ptr); + void (*raise) (void* ptr); + void (*destroy) (void* ptr); + void (*terminate) (void); + void (*get_pos) (void* ptr, int* x, int* y); + void (*get_fbsize) (void* ptr, int* w, int* h); + void (*set_geometry) (void* ptr, int x, int y, int w, int h); + void (*set_swap) (int interval); + void (*set_floating) (bool floating); + void (*set_decorated) (bool decorated); + void (*set_focused) (bool focused); + void (*set_maximized) (bool maximized); + void (*set_transparent)(bool transparent); + double (*get_time) (void* ptr); + void (*set_time) (void* ptr, double time); + void (*set_visible) (void* ptr, bool visible); + const char* (*get_environment) (void); + #ifdef GLAVA_RDX11 + Display* (*get_x11_display)(void); + Window (*get_x11_window) (void* ptr); + #else /* define placeholders to ensure equal struct size */ + void* _X11_DISPLAY_PLACEHOLDER; + void* _X11_WINDOW_PLACEHOLDER; + #endif +}; + +#define WCB_FUNC(F) \ + .F = (typeof(((struct gl_wcb*) NULL)->F)) &F + +#define WCB_ATTACH(B, N) \ + struct gl_wcb N = { \ + .name = B, \ + WCB_FUNC(offscreen), \ + WCB_FUNC(init), \ + WCB_FUNC(create_and_bind), \ + WCB_FUNC(should_close), \ + WCB_FUNC(should_render), \ + WCB_FUNC(bg_changed), \ + WCB_FUNC(swap_buffers), \ + WCB_FUNC(raise), \ + WCB_FUNC(destroy), \ + WCB_FUNC(terminate), \ + WCB_FUNC(set_swap), \ + WCB_FUNC(get_pos), \ + WCB_FUNC(get_fbsize), \ + WCB_FUNC(set_geometry), \ + WCB_FUNC(set_floating), \ + WCB_FUNC(set_decorated), \ + WCB_FUNC(set_focused), \ + WCB_FUNC(set_maximized), \ + WCB_FUNC(set_transparent), \ + WCB_FUNC(set_time), \ + WCB_FUNC(get_time), \ + WCB_FUNC(set_visible), \ + WCB_FUNC(get_environment), \ + WCB_FUNC(get_x11_display), \ + WCB_FUNC(get_x11_window) \ + } + +#endif /* RENDER_H */ diff --git a/share/dotfiles/.config/glava/glava_repo/glava/xwin.c b/share/dotfiles/.config/glava/glava_repo/glava/xwin.c new file mode 100644 index 00000000..b83be06b --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/xwin.c @@ -0,0 +1,472 @@ +/* X11 specific code and features */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <limits.h> +#include <errno.h> +#include <time.h> +#include <fcntl.h> +#include <unistd.h> + +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xatom.h> +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/XShm.h> + +#include "glad.h" + +#define GLAVA_RDX11 +#include "render.h" +#include "xwin.h" + +/* BMP Image header */ +struct __attribute__((packed)) bmp_header { + uint16_t header; + uint32_t size; + uint16_t reserved0, reserved1; + uint32_t offset; + /* BITMAPINFOHEADER */ + uint32_t header_size, width, height; + uint16_t planes, bits_per_pixel; + uint32_t compression, image_size, hres, vres, colors, colors_used; +}; + +#define BMP_HEADER_MAGIC 0x4D42 +#define BMP_BITFIELDS 3 + +void xwin_assign_icon_bmp(struct gl_wcb* wcb, void* impl, const char* path) { + int fd = open(path, O_RDONLY); + if (fd == -1) { + fprintf(stderr, "failed to load icon '%s': %s\n", path, strerror(errno)); + return; + } + Display* d = wcb->get_x11_display(); + Window w = wcb->get_x11_window(impl); + struct stat st; + fstat(fd, &st); + const struct bmp_header* header = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (header->header != BMP_HEADER_MAGIC) { + fprintf(stderr, "failed to load icon '%s': invalid BMP header.\n", path); + close(fd); + return; + } + if (header->bits_per_pixel != 32) { + fprintf(stderr, "failed to load icon '%s': wrong bit depth (%d).\n", + path, (int) header->bits_per_pixel); + close(fd); + return; + } + if (header->planes != 1 || header->compression != BMP_BITFIELDS) { + fprintf(stderr, "failed to load icon '%s': invalid BMP format, requires RGBA bitfields.\n", path); + close(fd); + return; + } + + /* Obtain image data pointer from offset */ + const char* data = (const char*) (((const uint8_t*) header) + header->offset); + + /* Assign icon using the older WMHints. Most window managers don't actually use this. */ + XWMHints hints = {}; + hints.flags = IconPixmapHint; + hints.icon_pixmap = XCreateBitmapFromData(d, w, data, header->width, header->height); + XSetWMHints(d, w, &hints); + + /* To assign the icon property we need to convert the image data to `unsigned long`, which + can be 64-bits and padded depending on the architecture. Additionally we need to flip the + Y-axis due to how BMP data is stored. */ + size_t sz = header->width * header->height; + size_t asz = sz + 2; + unsigned long* off = malloc(asz * sizeof(unsigned long)); + for (size_t x = 0; x < header->width; ++x) { + for (size_t y = 0; y < header->height; ++y) { + off[x + (((header->height - 1) - y) * header->height) + 2] + = ((const uint32_t*) data)[x + (y * header->height)]; + } + } + /* The first two elements represent the icon dimensions */ + off[0] = header->width; + off[1] = header->height; + XChangeProperty(d, w, XInternAtom(d, "_NET_WM_ICON", true), + XA_CARDINAL, 32, PropModeReplace, (const unsigned char*) off, asz); + free(off); + close(fd); +}; + +/* Note: currently unused */ +Window* __attribute__ ((unused)) xwin_get_desktop_layer(struct gl_wcb* wcb) { + static Window desktop; + static bool searched = false; + if (!searched) { + Display* d = wcb->get_x11_display(); + Atom class = XInternAtom(d, "WM_CLASS", false); + desktop = DefaultRootWindow(d); + Window _ignored, * children; + unsigned int nret; + XQueryTree(d, desktop, &_ignored, &_ignored, &children, &nret); + if (children) { + for (unsigned int t = 0; t < nret; ++t) { + char* name; + XFetchName(d, children[t], &name); + if (name) { + /* Mutter-based window managers */ + if (!strcmp(name, "mutter guard window")) { + printf("Reparenting to mutter guard window instead of root window\n"); + desktop = children[t]; + t = nret; /* break after */ + } + XFree(name); + } + unsigned long bytes; + XTextProperty text = {}; + char** list; + int list_sz; + /* Get WM_CLASS property */ + if (Success == XGetWindowProperty(d, children[t], class, 0, 512, false, AnyPropertyType, + &text.encoding, &text.format, &text.nitems, &bytes, + &text.value)) { + /* decode string array */ + if (Success == XmbTextPropertyToTextList(d, &text, &list, &list_sz)) { + if (list_sz >= 1 && !strcmp(list[0], "plasmashell")) { + desktop = children[t]; + t = nret; + } + XFreeStringList(list); + } + XFree(text.value); + } + } + XFree(children); + } + searched = true; + } + return &desktop; +} + +void xwin_wait_for_wm(void) { + Display* d = XOpenDisplay(0); + + Atom check = None; + bool exists = false; + struct timespec tv = { .tv_sec = 0, .tv_nsec = 50 * 1000000 }; + + do { + if (check == None) { + check = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", true); + } + if (check) { + int num_prop, idx; + Atom* props = XListProperties(d, DefaultRootWindow(d), &num_prop); + for (idx = 0; idx < num_prop; ++idx) { + if (props[idx] == check) { + exists = true; + break; + } + } + XFree(props); + } + if (!exists) nanosleep(&tv, NULL); + } while (!exists); + + XCloseDisplay(d); +} + +const char* xwin_detect_wm(struct gl_wcb* wcb) { + Display* d = wcb->get_x11_display(); + Atom check = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", false); + Atom name = XInternAtom(d, "_NET_WM_NAME", false); + Atom type = XInternAtom(d, "UTF8_STRING", false); + union { + Atom a; + int i; + long unsigned int lui; + } ignored; + + unsigned long nitems = 0; + unsigned char* wm_name = NULL; + Window* wm_check; + if (Success != XGetWindowProperty(d, DefaultRootWindow(d), check, 0, 1024, false, XA_WINDOW, + &ignored.a, &ignored.i, &nitems, &ignored.lui, (unsigned char**) &wm_check)) { + return NULL; + } + + if (nitems > 0 && Success == XGetWindowProperty(d, *wm_check, name, 0, 1024, false, type, + &ignored.a, &ignored.i, &nitems, &ignored.lui, &wm_name)) { + if (nitems > 0) { + static const char* wm_name_store = NULL; + if (wm_name_store) XFree((unsigned char*) wm_name_store); + wm_name_store = (const char*) wm_name; + } else { + XFree(wm_name); + wm_name = NULL; + } + } + + XFree(wm_check); + + return (const char*) wm_name; + +} + +static int stub_handler(Display* d, XErrorEvent* e) { return 0; } + +bool xwin_should_render(struct gl_wcb* wcb, void* impl) { + bool ret = true, should_close = false; + Display* d = wcb->get_x11_display(); + if (!d) { + d = XOpenDisplay(0); + should_close = true; + } + + Atom prop = XInternAtom(d, "_NET_ACTIVE_WINDOW", true); + Atom fullscreen = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", true); + + Atom actual_type; + int actual_format, t; + unsigned long nitems, bytes_after; + unsigned char* data = NULL; + + XSetErrorHandler(stub_handler); /* dummy error handler */ + + if (Success != XGetWindowProperty(d, DefaultRootWindow(d), prop, 0, 1, false, AnyPropertyType, + &actual_type, &actual_format, &nitems, &bytes_after, &data)) { + goto close; /* if an error occurs here, the WM probably isn't EWMH compliant */ + } + + if (!nitems) + goto close; + + Window active = ((Window*) data)[0]; + + prop = XInternAtom(d, "_NET_WM_STATE", true); + + if (data) { + XFree(data); + data = NULL; + } + + if (Success != XGetWindowProperty(d, active, prop, 0, LONG_MAX, false, AnyPropertyType, + &actual_type, &actual_format, &nitems, &bytes_after, &data)) { + goto close; /* some WMs are a little slow on creating _NET_WM_STATE, so errors may occur here */ + } + for (t = 0; t < nitems; ++t) { + if (fullscreen == ((Atom*) data)[t]) { + ret = false; + } + } +close: + if (data) + XFree(data); + if (should_close) + XCloseDisplay(d); + return ret; +} + +/* Create string copy on stack with upcase chars */ +#define S_UPPER(in, out) char out[strlen(in) + 1]; \ + do { \ + for (size_t t = 0; t < sizeof(out) / sizeof(char); ++t) { \ + char c = in[t]; \ + switch (c) { \ + case 'a' ... 'z': c -= 'a' - 'A'; \ + default: out[t] = c; \ + } \ + } \ + } while (0) + +static void xwin_changeatom(struct gl_wcb* wcb, void* impl, const char* type, + const char* atom, const char* fmt, int mode) { + Window w = wcb->get_x11_window(impl); + Display* d = wcb->get_x11_display(); + Atom wtype = XInternAtom(d, atom, false); + char buf[256]; + snprintf(buf, sizeof(buf), fmt, type); + Atom desk = XInternAtom(d, buf, false); + XChangeProperty(d, w, wtype, XA_ATOM, 32, mode, (unsigned char*) &desk, 1); +} + +/* Set window types defined by the EWMH standard, possible values: + -> "desktop", "dock", "toolbar", "menu", "utility", "splash", "dialog", "normal" */ +bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* rtype) { + S_UPPER(rtype, type); + if (type[0] != '!') { + xwin_changeatom(wcb, impl, type, "_NET_WM_WINDOW_TYPE", + "_NET_WM_WINDOW_TYPE_%s", PropModeReplace); + } + return !strcmp(type, "DESKTOP"); +} + +void xwin_addstate(struct gl_wcb* wcb, void* impl, const char* rstate) { + S_UPPER(rstate, state); + if (strcmp(state, "PINNED")) + xwin_changeatom(wcb, impl, state, "_NET_WM_STATE", "_NET_WM_STATE_%s", PropModeAppend); + else + xwin_setdesktop(wcb, impl, XWIN_ALL_DESKTOPS); +} + +void xwin_setdesktop(struct gl_wcb* wcb, void* impl, unsigned long desktop) { + Window w = wcb->get_x11_window(impl); + Display* d = wcb->get_x11_display(); + Atom wtype = XInternAtom(d, "_NET_WM_DESKTOP", false); + XChangeProperty(d, w, wtype, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &desktop, 1); +} + +static Drawable get_drawable(Display* d, Window w) { + Drawable p; + Atom act_type; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data = NULL; + Atom id; + + id = XInternAtom(d, "_XROOTPMAP_ID", False); + + if (XGetWindowProperty(d, w, id, 0, 1, False, XA_PIXMAP, + &act_type, &act_format, &nitems, &bytes_after, + &data) == Success && data) { + p = *((Pixmap *) data); + XFree(data); + } else { + p = w; + } + + return p; +} + +unsigned int xwin_copyglbg(struct glava_renderer* rd, unsigned int tex) { + GLuint texture = (GLuint) tex; + if (!texture) + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + int x, y, w, h; + rd_get_wcb(rd)->get_fbsize(rd_get_impl_window(rd), &w, &h); + rd_get_wcb(rd)->get_pos(rd_get_impl_window(rd), &x, &y); + XColor c; + Display* d = rd_get_wcb(rd)->get_x11_display(); + Drawable src = get_drawable(d, DefaultRootWindow(d)); + bool use_shm = XShmQueryExtension(d); + + /* Obtain section of root pixmap */ + + XShmSegmentInfo shminfo; + Visual* visual = DefaultVisual(d, DefaultScreen(d)); + XVisualInfo match = { .visualid = XVisualIDFromVisual(visual) }; + int nret; + XVisualInfo* info = XGetVisualInfo(d, VisualIDMask, &match, &nret); + XImage* image; + if (use_shm) { + image = XShmCreateImage(d, visual, info->depth, ZPixmap, NULL, + &shminfo, (unsigned int) w, (unsigned int) h); + if ((shminfo.shmid = shmget(IPC_PRIVATE, image->bytes_per_line * image->height, + IPC_CREAT | 0777)) == -1) { + fprintf(stderr, "shmget() failed: %s\n", strerror(errno)); + glava_abort(); + } + shminfo.shmaddr = image->data = shmat(shminfo.shmid, 0, 0); + shminfo.readOnly = false; + XShmAttach(d, &shminfo); + XShmGetImage(d, src, image, x, y, AllPlanes); + } else { + image = XGetImage(d, src, x, y, (unsigned int) w, (unsigned int) h, + AllPlanes, ZPixmap); + } + + /* Try to convert pixel bit depth to OpenGL storage format. The following formats\ + will need intermediate conversion before OpenGL can accept the data: + + - 8-bit pixel formats (retro displays, low-bandwidth virtual displays) + - 36-bit pixel formats (rare deep color displays) */ + + if (image) { + bool invalid = false, aligned = false; + GLenum type = 0; + switch (image->bits_per_pixel) { + case 16: + switch (image->depth) { + case 12: type = GL_UNSIGNED_SHORT_4_4_4_4; break; /* 12-bit (rare) */ + case 15: type = GL_UNSIGNED_SHORT_5_5_5_1; break; /* 15-bit, hi-color */ + case 16: /* 16-bit, hi-color */ + type = GL_UNSIGNED_SHORT_5_6_5; + aligned = true; + break; + } + break; + case 32: + switch (image->depth) { + case 24: type = GL_UNSIGNED_BYTE; break; /* 24-bit, true color */ + case 30: type = GL_UNSIGNED_INT_10_10_10_2; break; /* 30-bit, deep color */ + } + break; + case 64: + if (image->depth == 48) /* 48-bit deep color */ + type = GL_UNSIGNED_SHORT; + else goto invalid; + break; + /* >64-bit formats */ + case 128: + if (image->depth == 96) + type = GL_UNSIGNED_INT; + else goto invalid; + break; + default: + invalid: invalid = true; + } + + uint8_t* buf; + if (invalid) { + abort(); + /* Manual reformat (slow) */ + buf = malloc(4 * w * h); + int xi, yi; + Colormap map = DefaultColormap(d, DefaultScreen(d)); + for (yi = 0; yi < h; ++yi) { + for (xi = 0; xi < w; ++xi) { + c.pixel = XGetPixel(image, xi, yi); + XQueryColor(d, map, &c); + size_t base = (xi + (yi * w)) * 4; + buf[base + 0] = c.red / 256; + buf[base + 1] = c.green / 256; + buf[base + 2] = c.blue / 256; + buf[base + 3] = 255; + } + } + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); + free(buf); + } else { + /* Use image data directly. The alpha value is garbage/unassigned data, but + we need to read it because X11 keeps pixel data aligned */ + buf = (uint8_t*) image->data; + /* Data could be 2, 4, or 8 byte aligned, the RGBA format and type (depth) + already ensures reads will be properly aligned across scanlines */ + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLenum format = image->bitmap_bit_order == LSBFirst ? + (!aligned ? GL_BGRA : GL_BGR) : + (!aligned ? GL_RGBA : GL_RGB); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, format, type, buf); + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); /* restore default */ + } + } + if (use_shm) { + XShmDetach(d, &shminfo); + shmdt(shminfo.shmaddr); + shmctl(shminfo.shmid, IPC_RMID, NULL); + } + + if (image) XDestroyImage(image); + XFree(info); + + return texture; +} diff --git a/share/dotfiles/.config/glava/glava_repo/glava/xwin.h b/share/dotfiles/.config/glava/glava_repo/glava/xwin.h new file mode 100644 index 00000000..37cf48ed --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glava/xwin.h @@ -0,0 +1,22 @@ + +#define XWIN_ALL_DESKTOPS 0xFFFFFFFF + +#ifndef XWIN_H +#define XWIN_H + +#include <stdbool.h> +#include "render.h" + +typedef unsigned long int Window; + +void xwin_assign_icon_bmp(struct gl_wcb* wcb, void* impl, const char* path); +bool xwin_should_render(struct gl_wcb* wcb, void* impl); +void xwin_wait_for_wm(void); +bool xwin_settype(struct gl_wcb* wcb, void* impl, const char* type); +void xwin_setdesktop(struct gl_wcb* wcb, void* impl, unsigned long desktop); +void xwin_addstate(struct gl_wcb* wcb, void* impl, const char* state); +unsigned int xwin_copyglbg(struct glava_renderer* rd, unsigned int texture); +Window* xwin_get_desktop_layer(struct gl_wcb* wcb); +const char* xwin_detect_wm(struct gl_wcb* wcb); + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/LICENSE_ORIGINAL b/share/dotfiles/.config/glava/glava_repo/glfft/LICENSE_ORIGINAL new file mode 100644 index 00000000..1d7f7650 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/LICENSE_ORIGINAL @@ -0,0 +1,19 @@ +Copyright (c) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft.cpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft.cpp new file mode 100644 index 00000000..a4b53b55 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft.cpp @@ -0,0 +1,1125 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "glfft.hpp" +#include <algorithm> +#include <stdexcept> +#include <fstream> +#include <sstream> +#include <numeric> +#include <assert.h> +#include <cmath> + +#ifdef GLFFT_CLI_ASYNC +#include "glfft_cli.hpp" +#endif + +/* GLava addition: should be defined by meson */ +#if defined(GLAVA_STANDALONE) || !defined(SHADER_INSTALL_PATH) +#undef SHADER_INSTALL_PATH +#define SHADER_INSTALL_PATH "../shaders/glava" +#endif + +using namespace std; +using namespace GLFFT; + +enum Bindings +{ + BindingSSBOIn = 0, + BindingSSBOOut = 1, + BindingSSBOAux = 2, + BindingUBO = 3, + BindingTexture0 = 4, + BindingTexture1 = 5, + BindingImage = 6 +}; + +struct WorkGroupSize +{ + unsigned x, y, z; +}; + +struct Radix +{ + WorkGroupSize size; + unsigned num_workgroups_x; + unsigned num_workgroups_y; + unsigned radix; + unsigned vector_size; + bool shared_banked; +}; + +static unsigned next_pow2(unsigned v) +{ + v--; + v |= v >> 16; + v |= v >> 8; + v |= v >> 4; + v |= v >> 2; + v |= v >> 1; + return v + 1; +} + +static void reduce(unsigned &wg_size, unsigned &divisor) +{ + if (divisor > 1 && wg_size >= divisor) + { + wg_size /= divisor; + divisor = 1; + } + else if (divisor > 1 && wg_size < divisor) + { + divisor /= wg_size; + wg_size = 1; + } +} + +static unsigned radix_to_wg_z(unsigned radix) +{ + switch (radix) + { + case 16: + return 4; + + case 64: + return 8; + + default: + return 1; + } +} + +static Radix build_radix(unsigned Nx, unsigned Ny, + Mode mode, unsigned vector_size, bool shared_banked, unsigned radix, + WorkGroupSize size, + bool pow2_stride) +{ + unsigned wg_x = 0, wg_y = 0; + + if (Ny == 1 && size.y > 1) + { + throw logic_error("WorkGroupSize.y must be 1, when Ny == 1.\n"); + } + + // To avoid too many threads per workgroup due to workgroup_size_z, + // try to divide workgroup_size_y, then workgroup_size_x. + // TODO: Make a better constraint solver which takes into account cache line sizes, + // and image swizzling patterns, etc ... Not that critical though, since wisdom interface + // will find the optimal options despite this. + unsigned divisor = size.z; + reduce(size.y, divisor); + reduce(size.x, divisor); + + switch (mode) + { + case Vertical: + // If we have pow2_stride, we need to transform 2^n + 1 elements horizontally, + // so just add a single workgroup in X. + // We pad by going up to pow2 stride anyways. + // We will transform some garbage, + // but it's better than transforming close to double the amount. + wg_x = (2 * Nx) / (vector_size * size.x) + pow2_stride; + wg_y = Ny / (size.y * radix); + break; + + case VerticalDual: + vector_size = max(vector_size, 4u); + wg_x = (4 * Nx) / (vector_size * size.x); + wg_y = Ny / (size.y * radix); + break; + + case Horizontal: + wg_x = (2 * Nx) / (vector_size * radix * size.x); + wg_y = Ny / size.y; + break; + + case HorizontalDual: + vector_size = max(vector_size, 4u); + wg_x = (4 * Nx) / (vector_size * radix * size.x); + wg_y = Ny / size.y; + break; + + default: + assert(0); + } + + return { size, wg_x, wg_y, radix, vector_size, shared_banked }; +} + +// Resolve radices are simpler, and don't yet support different vector sizes, etc. +static Radix build_resolve_radix(unsigned Nx, unsigned Ny, WorkGroupSize size) +{ + return { size, Nx / size.x, Ny / size.y, 2, 2, false }; +} + +// Smaller FFT with larger workgroups are not always possible to create. +static bool is_radix_valid(unsigned Nx, unsigned Ny, + Mode mode, unsigned vector_size, unsigned radix, + WorkGroupSize size, + bool pow2_stride) +{ + auto res = build_radix(Nx, Ny, + mode, vector_size, false, radix, + size, + pow2_stride); + + return res.num_workgroups_x > 0 && res.num_workgroups_y > 0; +} + +static double find_cost(unsigned Nx, unsigned Ny, Mode mode, unsigned radix, + const FFTOptions &options, const FFTWisdom &wisdom) +{ + auto opt = wisdom.find_optimal_options(Nx, Ny, radix, mode, SSBO, SSBO, options.type); + + // Return a very rough estimate if we cannot find cost. + // The cost functions generated here are expected to be huge, + // always much larger than true cost functions. + // The purpose of this is to give a strong bias towards radices we have wisdom for. + // We also give a bias towards larger radices, since they are generally more BW efficient. + return opt ? opt->first.cost : Nx * Ny * (log2(float(radix)) + 2.0f); +} + +struct CostPropagate +{ + CostPropagate() = default; + CostPropagate(double cost, vector<unsigned> radices) + : cost(cost), radices(move(radices)) {} + + void merge_if_better(const CostPropagate &a, const CostPropagate &b) + { + double new_cost = a.cost + b.cost; + + if ((cost == 0.0 || new_cost < cost) && a.cost != 0.0 && b.cost != 0.0) + { + cost = new_cost; + radices = a.radices; + radices.insert(end(radices), begin(b.radices), end(b.radices)); + } + } + + double cost = 0.0; + vector<unsigned> radices; +}; + +static vector<Radix> split_radices(unsigned Nx, unsigned Ny, Mode mode, Target input_target, Target output_target, + const FFTOptions &options, + bool pow2_stride, const FFTWisdom &wisdom, double &accumulate_cost) +{ + unsigned N; + switch (mode) + { + case Vertical: + case VerticalDual: + N = Ny; + break; + + case Horizontal: + case HorizontalDual: + N = Nx; + break; + + default: + return {}; + } + + // N == 1 is for things like Nx1 transforms where we don't do any vertical transforms. + if (N == 1) + { + return {}; + } + + // Treat cost 0.0 as invalid. + double cost_table[8] = {0.0}; + CostPropagate cost_propagate[32]; + + // Fill table with fastest known ways to do radix 4, radix 8, radix 16, and 64. + // We'll then find the optimal subdivision which has the lowest additive cost. + cost_table[2] = find_cost(Nx, Ny, mode, 4, options, wisdom); + cost_table[3] = find_cost(Nx, Ny, mode, 8, options, wisdom); + cost_table[4] = find_cost(Nx, Ny, mode, 16, options, wisdom); + cost_table[6] = find_cost(Nx, Ny, mode, 64, options, wisdom); + + auto is_valid = [&](unsigned radix) -> bool { + unsigned workgroup_size_z = radix_to_wg_z(radix); + auto &opt = wisdom.find_optimal_options_or_default(Nx, Ny, radix, mode, SSBO, SSBO, options); + + // We don't want pow2_stride to round up a very inefficient work group and make the is_valid test pass. + return is_radix_valid(Nx, Ny, + mode, opt.vector_size, radix, + { opt.workgroup_size_x, opt.workgroup_size_y, workgroup_size_z }, + false); + }; + + // If our work-space is too small to allow certain radices, we disable them from consideration here. + for (unsigned i = 2; i <= 6; i++) + { + // Don't check the composite radix. + if (i == 5) + { + continue; + } + + if (is_valid(1 << i)) + { + cost_propagate[i] = CostPropagate(cost_table[i], { 1u << i }); + } + } + + // Now start bubble this up all the way to N, starting from radix 16. + for (unsigned i = 4; (1u << i) <= N; i++) + { + auto &target = cost_propagate[i]; + + for (unsigned r = 2; i - r >= r; r++) + { + target.merge_if_better(cost_propagate[r], cost_propagate[i - r]); + } + + if ((1u << i) == N && target.cost == 0.0) + { + throw logic_error("There is no possible subdivision ...\n"); + } + } + + // Ensure that the radix splits are sensible. + // A radix-N non p-1 transform mandates that p factor is at least N. + // Sort the splits so that larger radices come first. + // For composite radices like 16 and 64, they are built with 4x4 and 8x8, so we only + // need p factors for 4 and 8 for those cases. + // The cost function doesn't depend in which order we split the radices. + auto &cost = cost_propagate[unsigned(log2(float(N)))]; + auto radices = move(cost.radices); + + sort(begin(radices), end(radices), greater<unsigned>()); + + if (accumulate(begin(radices), end(radices), 1u, multiplies<unsigned>()) != N) + { + throw logic_error("Radix splits are invalid."); + } + + vector<Radix> radices_out; + radices_out.reserve(radices.size()); + + // Fill in the structs with all information. + for (auto radix : radices) + { + bool first = radices_out.empty(); + bool last = radices_out.size() + 1 == radices.size(); + + // Use known performance options as a fallback. + // We used SSBO -> SSBO cost functions to find the optimal radix splits, + // but replace first and last options with Image -> SSBO / SSBO -> Image cost functions if appropriate. + auto &orig_opt = wisdom.find_optimal_options_or_default(Nx, Ny, radix, mode, SSBO, SSBO, options); + auto &opts = wisdom.find_optimal_options_or_default(Nx, Ny, radix, mode, + first ? input_target : SSBO, + last ? output_target : SSBO, + { orig_opt, options.type }); + + radices_out.push_back(build_radix(Nx, Ny, + mode, opts.vector_size, opts.shared_banked, radix, + { opts.workgroup_size_x, opts.workgroup_size_y, radix_to_wg_z(radix) }, + pow2_stride)); + } + + accumulate_cost += cost.cost; + return radices_out; +} + +Program* ProgramCache::find_program(const Parameters ¶meters) const +{ + auto itr = programs.find(parameters); + if (itr != end(programs)) + { + return itr->second.get(); + } + else + { + return nullptr; + } +} + +void ProgramCache::insert_program(const Parameters ¶meters, std::unique_ptr<Program> program) +{ + programs[parameters] = move(program); +} + +Program* FFT::get_program(const Parameters ¶ms) +{ + Program *prog = cache->find_program(params); + if (!prog) + { + auto newprog = build_program(params); + if (!newprog) + { + throw runtime_error("Failed to compile shader.\n"); + } + prog = newprog.get(); + cache->insert_program(params, move(newprog)); + } + return prog; +} + +static inline unsigned mode_to_input_components(Mode mode) +{ + switch (mode) + { + case HorizontalDual: + case VerticalDual: + return 4; + + case Horizontal: + case Vertical: + case ResolveComplexToReal: + return 2; + + case ResolveRealToComplex: + return 1; + + default: + return 0; + } +} + +FFT::FFT(Context *context, unsigned Nx, unsigned Ny, + unsigned radix, unsigned p, + Mode mode, Target input_target, Target output_target, + std::shared_ptr<ProgramCache> program_cache, const FFTOptions &options) + : context(context), cache(move(program_cache)), size_x(Nx), size_y(Ny) +{ + set_texture_offset_scale(0.5f / Nx, 0.5f / Ny, 1.0f / Nx, 1.0f / Ny); + + if (!Nx || !Ny || (Nx & (Nx - 1)) || (Ny & (Ny - 1))) + { + throw logic_error("FFT size is not POT."); + } + + if (p != 1 && input_target != SSBO) + { + throw logic_error("P != 1 only supported with SSBO as input."); + } + + if (p < radix && output_target != SSBO) + { + throw logic_error("P < radix only supported with SSBO as output."); + } + + // We don't really care about transform direction since it's just a matter of sign-flipping twiddles, + // but we have to obey some fundamental assumptions of resolve passes. + Direction direction = mode == ResolveComplexToReal ? Inverse : Forward; + + Radix res; + if (mode == ResolveRealToComplex || mode == ResolveComplexToReal) + { + res = build_resolve_radix(Nx, Ny, { options.performance.workgroup_size_x, options.performance.workgroup_size_y, 1 }); + } + else + { + res = build_radix(Nx, Ny, + mode, options.performance.vector_size, options.performance.shared_banked, radix, + { options.performance.workgroup_size_x, options.performance.workgroup_size_y, radix_to_wg_z(radix) }, + false); + } + + const Parameters params = { + res.size.x, + res.size.y, + res.size.z, + res.radix, + res.vector_size, + direction, + mode, + input_target, + output_target, + p == 1, + res.shared_banked, + options.type.fp16, options.type.input_fp16, options.type.output_fp16, + options.type.normalize, + }; + + if (res.num_workgroups_x == 0 || res.num_workgroups_y == 0) + { + throw logic_error("Invalid workgroup sizes for this radix."); + } + + unsigned uv_scale_x = res.vector_size / mode_to_input_components(mode); + const Pass pass = { + params, + res.num_workgroups_x, res.num_workgroups_y, + uv_scale_x, + next_pow2(res.num_workgroups_x * params.workgroup_size_x), + get_program(params), + }; + + passes.push_back(pass); +} + +static inline void print_radix_splits(Context *context, const vector<Radix> radices[2]) +{ + context->log("Transform #1\n"); + for (auto &radix : radices[0]) + { + context->log(" Size: (%u, %u, %u)\n", + radix.size.x, radix.size.y, radix.size.z); + context->log(" Dispatch: (%u, %u)\n", + radix.num_workgroups_x, radix.num_workgroups_y); + context->log(" Radix: %u\n", + radix.radix); + context->log(" VectorSize: %u\n\n", + radix.vector_size); + } + + context->log("Transform #2\n"); + for (auto &radix : radices[1]) + { + context->log(" Size: (%u, %u, %u)\n", + radix.size.x, radix.size.y, radix.size.z); + context->log(" Dispatch: (%u, %u)\n", + radix.num_workgroups_x, radix.num_workgroups_y); + context->log(" Radix: %u\n", + radix.radix); + context->log(" VectorSize: %u\n\n", + radix.vector_size); + } +} + +static inline unsigned type_to_input_components(Type type) +{ + switch (type) + { + case ComplexToComplex: + case ComplexToReal: + return 2; + + case RealToComplex: + return 1; + + case ComplexToComplexDual: + return 4; + + default: + return 0; + } +} + +FFT::FFT(Context *context, unsigned Nx, unsigned Ny, + Type type, Direction direction, Target input_target, Target output_target, + std::shared_ptr<ProgramCache> program_cache, const FFTOptions &options, const FFTWisdom &wisdom) + : context(context), cache(move(program_cache)), size_x(Nx), size_y(Ny) +{ + set_texture_offset_scale(0.5f / Nx, 0.5f / Ny, 1.0f / Nx, 1.0f / Ny); + + size_t temp_buffer_size = Nx * Ny * sizeof(float) * (type == ComplexToComplexDual ? 4 : 2); + temp_buffer_size >>= options.type.output_fp16; + + temp_buffer = context->create_buffer(nullptr, temp_buffer_size, AccessStreamCopy); + if (output_target != SSBO) + { + temp_buffer_image = context->create_buffer(nullptr, temp_buffer_size, AccessStreamCopy); + } + + bool expand = false; + if (type == ComplexToReal || type == RealToComplex) + { + // If we're doing C2R or R2C, we'll need double the scratch memory, + // so make sure we're dividing Nx *after* allocating. + Nx /= 2; + expand = true; + } + + // Sanity checks. + if (!Nx || !Ny || (Nx & (Nx - 1)) || (Ny & (Ny - 1))) + { + throw logic_error("FFT size is not POT."); + } + + if (type == ComplexToReal && direction == Forward) + { + throw logic_error("ComplexToReal transforms requires inverse transform."); + } + + if (type == RealToComplex && direction != Forward) + { + throw logic_error("RealToComplex transforms requires forward transform."); + } + + if (type == RealToComplex && input_target == Image) + { + throw logic_error("Input real-to-complex must use ImageReal target."); + } + + if (type == ComplexToReal && output_target == Image) + { + throw logic_error("Output complex-to-real must use ImageReal target."); + } + + vector<Radix> radices[2]; + Mode modes[2]; + Target targets[4]; + + switch (direction) + { + case Forward: + modes[0] = type == ComplexToComplexDual ? HorizontalDual : Horizontal; + modes[1] = type == ComplexToComplexDual ? VerticalDual : Vertical; + + targets[0] = input_target; + targets[1] = Ny > 1 ? SSBO : output_target; + targets[2] = targets[1]; + targets[3] = output_target; + + radices[0] = split_radices(Nx, Ny, modes[0], targets[0], targets[1], options, false, wisdom, cost); + radices[1] = split_radices(Nx, Ny, modes[1], targets[2], targets[3], options, expand, wisdom, cost); + break; + + case Inverse: + case InverseConvolve: + modes[0] = type == ComplexToComplexDual ? VerticalDual : Vertical; + modes[1] = type == ComplexToComplexDual ? HorizontalDual : Horizontal; + + targets[0] = input_target; + targets[1] = Ny > 1 ? SSBO : input_target; + targets[2] = targets[1]; + targets[3] = output_target; + + radices[0] = split_radices(Nx, Ny, modes[0], targets[0], targets[1], options, expand, wisdom, cost); + radices[1] = split_radices(Nx, Ny, modes[1], targets[2], targets[3], options, false, wisdom, cost); + break; + } + +#if 0 + print_radix_splits(context, radices); +#endif + + passes.reserve(radices[0].size() + radices[1].size() + expand); + + unsigned index = 0; + unsigned last_index = (radices[1].empty() && !expand) ? 0 : 1; + + for (auto &radix_direction : radices) + { + unsigned p = 1; + unsigned i = 0; + + for (auto &radix : radix_direction) + { + // If this is the last pass and we're writing to an image, use a special shader variant. + bool last_pass = index == last_index && i == radix_direction.size() - 1; + + bool input_fp16 = passes.empty() ? options.type.input_fp16 : options.type.output_fp16; + Target out_target = last_pass ? output_target : SSBO; + Target in_target = passes.empty() ? input_target : SSBO; + Direction dir = direction == InverseConvolve && !passes.empty() ? Inverse : direction; + unsigned uv_scale_x = radix.vector_size / type_to_input_components(type); + + const Parameters params = { + radix.size.x, + radix.size.y, + radix.size.z, + radix.radix, + radix.vector_size, + dir, + modes[index], + in_target, + out_target, + p == 1, + radix.shared_banked, + options.type.fp16, input_fp16, options.type.output_fp16, + options.type.normalize, + }; + + const Pass pass = { + params, + radix.num_workgroups_x, radix.num_workgroups_y, + uv_scale_x, + next_pow2(radix.num_workgroups_x * params.workgroup_size_x), + get_program(params), + }; + + passes.push_back(pass); + + p *= radix.radix; + i++; + } + + // After the first transform direction, inject either a real-to-complex resolve or complex-to-real resolve. + // This way, we avoid having special purpose transforms for all FFT variants. + if (index == 0 && (type == ComplexToReal || type == RealToComplex)) + { + bool input_fp16 = passes.empty() ? options.type.input_fp16 : options.type.output_fp16; + bool last_pass = radices[1].empty(); + Direction dir = direction == InverseConvolve && !passes.empty() ? Inverse : direction; + Target in_target = passes.empty() ? input_target : SSBO; + Target out_target = last_pass ? output_target : SSBO; + Mode mode = type == ComplexToReal ? ResolveComplexToReal : ResolveRealToComplex; + unsigned uv_scale_x = 1; + + auto base_opts = options; + base_opts.type.input_fp16 = input_fp16; + + auto &opts = wisdom.find_optimal_options_or_default(Nx, Ny, 2, mode, in_target, out_target, base_opts); + auto res = build_resolve_radix(Nx, Ny, { opts.workgroup_size_x, opts.workgroup_size_y, 1 }); + + const Parameters params = { + res.size.x, + res.size.y, + res.size.z, + res.radix, + res.vector_size, + dir, + mode, + in_target, + out_target, + true, + false, + base_opts.type.fp16, base_opts.type.input_fp16, base_opts.type.output_fp16, + base_opts.type.normalize, + }; + + const Pass pass = { + params, + Nx / res.size.x, + Ny / res.size.y, + uv_scale_x, + next_pow2(Nx), + get_program(params), + }; + + passes.push_back(pass); + } + + index++; + } +} + +string FFT::load_shader_string(const char *path) +{ + ifstream file(path); + if (!file.good()) + { + throw runtime_error("Failed to load shader file from disk.\n"); + } + stringstream buf; + buf << file.rdbuf(); + return buf.str(); +} + +void FFT::store_shader_string(const char *path, const string &source) +{ + ofstream file(path); + file.write(source.data(), source.size()); +} + +unique_ptr<Program> FFT::build_program(const Parameters ¶ms) +{ + string str; + str.reserve(16 * 1024); + +#if 0 + context->log("Building program:\n"); + context->log( + " WG_X: %u\n" + " WG_Y: %u\n" + " WG_Z: %u\n" + " P1: %u\n" + " Radix: %u\n" + " Dir: %d\n" + " Mode: %u\n" + " InTarget: %u\n" + " OutTarget: %u\n" + " FP16: %u\n" + " InFP16: %u\n" + " OutFP16: %u\n" + " Norm: %u\n", + params.workgroup_size_x, + params.workgroup_size_y, + params.workgroup_size_z, + params.p1, + params.radix, + params.direction, + params.mode, + params.input_target, + params.output_target, + params.fft_fp16, + params.input_fp16, + params.output_fp16, + params.fft_normalize); +#endif + + if (params.p1) + { + str += "#define FFT_P1\n"; + } + + if (params.fft_fp16) + { + str += "#define FFT_FP16\n"; + } + + if (params.input_fp16) + { + str += "#define FFT_INPUT_FP16\n"; + } + + if (params.output_fp16) + { + str += "#define FFT_OUTPUT_FP16\n"; + } + + if (params.fft_normalize) + { + str += "#define FFT_NORMALIZE\n"; + } + + if (params.direction == InverseConvolve) + { + str += "#define FFT_CONVOLVE\n"; + } + + str += params.shared_banked ? "#define FFT_SHARED_BANKED 1\n" : "#define FFT_SHARED_BANKED 0\n"; + + str += params.direction == Forward ? "#define FFT_FORWARD\n" : "#define FFT_INVERSE\n"; + str += string("#define FFT_RADIX ") + to_string(params.radix) + "\n"; + + unsigned vector_size = params.vector_size; + switch (params.mode) + { + case VerticalDual: + str += "#define FFT_DUAL\n"; + str += "#define FFT_VERT\n"; + break; + + case Vertical: + str += "#define FFT_VERT\n"; + break; + + case HorizontalDual: + str += "#define FFT_DUAL\n"; + str += "#define FFT_HORIZ\n"; + break; + + case Horizontal: + str += "#define FFT_HORIZ\n"; + break; + + case ResolveRealToComplex: + str += "#define FFT_RESOLVE_REAL_TO_COMPLEX\n"; + str += "#define FFT_HORIZ\n"; + vector_size = 2; + break; + + case ResolveComplexToReal: + str += "#define FFT_RESOLVE_COMPLEX_TO_REAL\n"; + str += "#define FFT_HORIZ\n"; + vector_size = 2; + break; + } + + switch (params.input_target) + { + case ImageReal: + str += "#define FFT_INPUT_REAL\n"; + // Fallthrough + case Image: + str += "#define FFT_INPUT_TEXTURE\n"; + break; + + default: + break; + } + + switch (params.output_target) + { + case ImageReal: + str += "#define FFT_OUTPUT_REAL\n"; + // Fallthrough + case Image: + str += "#define FFT_OUTPUT_IMAGE\n"; + break; + + default: + break; + } + + switch (vector_size) + { + case 2: + str += "#define FFT_VEC2\n"; + break; + + case 4: + str += "#define FFT_VEC4\n"; + break; + + case 8: + str += "#define FFT_VEC8\n"; + break; + } + + str += string("layout(local_size_x = ") + + to_string(params.workgroup_size_x) + + ", local_size_y = " + + to_string(params.workgroup_size_y) + + ", local_size_z = " + + to_string(params.workgroup_size_z) + + ") in;\n"; + + str += load_shader_string("glfft/glsl/fft_common.comp"); + switch (params.radix) + { + case 4: + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix4.comp"); + break; + + case 8: + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix8.comp"); + break; + + case 16: + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix4.comp"); + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_shared.comp"); + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix16.comp"); + break; + + case 64: + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix8.comp"); + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_shared.comp"); + str += load_shader_string(SHADER_INSTALL_PATH "/util/fft_radix64.comp"); + break; + } + str += load_shader_string("glfft/glsl/fft_main.comp"); + + auto prog = context->compile_compute_shader(str.c_str()); + if (!prog) + { + puts(str.c_str()); + } + +#if 0 + char shader_path[1024]; + snprintf(shader_path, sizeof(shader_path), "glfft_shader_radix%u_first%u_mode%u_in_target%u_out_target%u.comp.src", + params.radix, params.p1, params.mode, unsigned(params.input_target), unsigned(params.output_target)); + store_shader_string(shader_path, str); +#endif + + return prog; +} + +double FFT::bench(Context *context, Resource *output, Resource *input, + unsigned warmup_iterations, unsigned iterations, unsigned dispatches_per_iteration, double max_time) +{ + context->wait_idle(); + auto *cmd = context->request_command_buffer(); + for (unsigned i = 0; i < warmup_iterations; i++) + { + process(cmd, output, input); + } + context->submit_command_buffer(cmd); + context->wait_idle(); + + unsigned runs = 0; + double start_time = context->get_time(); + double total_time = 0.0; + + for (unsigned i = 0; i < iterations && (((context->get_time() - start_time) < max_time) || i == 0); i++) + { +#ifdef GLFFT_CLI_ASYNC + check_async_cancel(); +#endif + + auto *cmd = context->request_command_buffer(); + + double iteration_start = context->get_time(); + for (unsigned d = 0; d < dispatches_per_iteration; d++) + { + process(cmd, output, input); + cmd->barrier(); + runs++; + } + + context->submit_command_buffer(cmd); + context->wait_idle(); + + double iteration_end = context->get_time(); + total_time += iteration_end - iteration_start; + } + + return total_time / runs; +} + +void FFT::process(CommandBuffer *cmd, Resource *output, Resource *input, Resource *input_aux) +{ + if (passes.empty()) + { + return; + } + + Resource *buffers[2] = { + input, + passes.size() & 1 ? + (passes.back().parameters.output_target != SSBO ? temp_buffer_image.get() : output) : + temp_buffer.get(), + }; + + if (input_aux != 0) + { + if (passes.front().parameters.input_target != SSBO) + { + cmd->bind_texture(BindingTexture1, static_cast<Texture*>(input_aux)); + cmd->bind_sampler(BindingTexture1, texture.samplers[1]); + } + else + { + if (ssbo.input_aux.size != 0) + { + cmd->bind_storage_buffer_range(BindingSSBOAux, + ssbo.input_aux.offset, ssbo.input_aux.size, static_cast<Buffer*>(input_aux)); + } + else + { + cmd->bind_storage_buffer(BindingSSBOAux, static_cast<Buffer*>(input_aux)); + } + } + } + + Program *current_program = nullptr; + unsigned p = 1; + unsigned pass_index = 0; + + struct FFTConstantData + { + uint32_t p; + uint32_t stride; + uint32_t padding[2]; + float offset_x, offset_y; + float scale_x, scale_y; + }; + + for (auto &pass : passes) + { + if (pass.program != current_program) + { + cmd->bind_program(pass.program); + current_program = pass.program; + } + + if (pass.parameters.p1) + { + p = 1; + } + + FFTConstantData constant_data; + constant_data.p = p; + constant_data.stride = pass.stride; + p *= pass.parameters.radix; + + if (pass.parameters.input_target != SSBO) + { + cmd->bind_texture(BindingTexture0, static_cast<Texture*>(buffers[0])); + cmd->bind_sampler(BindingTexture0, texture.samplers[0]); + + // If one compute thread reads multiple texels in X dimension, scale this accordingly. + float scale_x = texture.scale_x * pass.uv_scale_x; + + constant_data.offset_x = texture.offset_x; + constant_data.offset_y = texture.offset_y; + constant_data.scale_x = scale_x; + constant_data.scale_y = texture.scale_y; + } + else + { + if (buffers[0] == input && ssbo.input.size != 0) + { + cmd->bind_storage_buffer_range(BindingSSBOIn, + ssbo.input.offset, ssbo.input.size, static_cast<Buffer*>(buffers[0])); + } + else if (buffers[0] == output && ssbo.output.size != 0) + { + cmd->bind_storage_buffer_range(BindingSSBOIn, + ssbo.output.offset, ssbo.output.size, static_cast<Buffer*>(buffers[0])); + } + else + { + cmd->bind_storage_buffer(BindingSSBOIn, static_cast<Buffer*>(buffers[0])); + } + } + + if (pass.parameters.output_target != SSBO) + { + Format format = FormatUnknown; + + // TODO: Make this more flexible, would require shader variants per-format though. + if (pass.parameters.output_target == ImageReal) + { + format = FormatR32Float; + } + else + { + switch (pass.parameters.mode) + { + case VerticalDual: + case HorizontalDual: + format = FormatR16G16B16A16Float; + break; + + case Vertical: + case Horizontal: + case ResolveRealToComplex: + format = FormatR32Uint; + break; + + default: + break; + } + } + cmd->bind_storage_texture(BindingImage, static_cast<Texture*>(output), format); + } + else + { + if (buffers[1] == output && ssbo.output.size != 0) + { + cmd->bind_storage_buffer_range(BindingSSBOOut, + ssbo.output.offset, ssbo.output.size, static_cast<Buffer*>(buffers[1])); + } + else + { + cmd->bind_storage_buffer(BindingSSBOOut, static_cast<Buffer*>(buffers[1])); + } + } + + cmd->push_constant_data(BindingUBO, &constant_data, sizeof(constant_data)); + cmd->dispatch(pass.workgroups_x, pass.workgroups_y, 1); + + // For last pass, we don't know how our resource will be used afterwards, + // so let barrier decisions be up to the API user. + if (pass_index + 1 < passes.size()) + { + cmd->barrier(static_cast<Buffer*>(buffers[1])); + } + + if (pass_index == 0) + { + buffers[0] = passes.size() & 1 ? + temp_buffer.get() : + (passes.back().parameters.output_target != SSBO ? temp_buffer_image.get() : output); + } + + swap(buffers[0], buffers[1]); + pass_index++; + } +} + diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft.hpp new file mode 100644 index 00000000..c3b1a693 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft.hpp @@ -0,0 +1,225 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLFFT_HPP__ +#define GLFFT_HPP__ + +#include "glfft_interface.hpp" +#include "glfft_common.hpp" +#include "glfft_wisdom.hpp" +#include <vector> +#include <unordered_map> +#include <limits> + +/// GLFFT doesn't try to preserve GL state in any way. +/// E.g. SHADER_STORAGE_BUFFER bindings, programs bound, texture bindings, etc. +/// Applications calling this library must expect that some GL state will be modified. +/// No rendering state associated with graphics will be modified. + +namespace GLFFT +{ + +class FFT +{ + public: + /// @brief Creates a full FFT. + /// + /// All buffer allocation done by GLFFT will be done in constructor. + /// Will throw if invalid parameters are passed. + /// + /// @param context The graphics context. + /// @param Nx Number of samples in horizontal dimension. + /// @param Ny Number of samples in vertical dimension. + /// @param type The transform type. + /// @param direction Forward, inverse or inverse with convolution. + /// For real-to-complex and complex-to-real transforms, the + /// transform type must match. + /// @param input_target GL object type of input target. For real-to-complex with texture as input, ImageReal is used. + /// @param output_target GL object type of output target. For complex-to-real with texture as output, ImageReal is used. + /// @param cache A program cache for caching the GLFFT programs created. + /// @param options FFT options such as performance related parameters and types. + /// @param wisdom GLFFT wisdom which can override performance related options + /// (options.performance is used as a fallback). + FFT(Context *context, unsigned Nx, unsigned Ny, + Type type, Direction direction, Target input_target, Target output_target, + std::shared_ptr<ProgramCache> cache, const FFTOptions &options, + const FFTWisdom &wisdom = FFTWisdom()); + + /// @brief Creates a single stage FFT. Used mostly internally for benchmarking partial FFTs. + /// + /// All buffer allocation done by GLFFT will be done in constructor. + /// Will throw if invalid parameters are passed. + /// + /// @param context The graphics context. + /// @param Nx Number of samples in horizontal dimension. + /// @param Ny Number of samples in vertical dimension. + /// @param radix FFT radix to test. + /// @param p Accumulated p factor. If 1, "first pass" mode is tested, otherwise, generic FFT stages. + /// @param mode The transform mode. + /// @param input_target GL object type of input target. For real-to-complex with texture as input, ImageReal is used. + /// @param output_target GL object type of output target. For complex-to-real with texture as output, ImageReal is used. + /// @param cache A program cache for caching the GLFFT programs created. + /// @param options FFT options such as performance related parameters and types. + FFT(Context *context, unsigned Nx, unsigned Ny, unsigned radix, unsigned p, + Mode mode, Target input_target, Target output_target, + std::shared_ptr<ProgramCache> cache, const FFTOptions &options); + + /// @brief Process the FFT. + /// + /// The type of object passed here must match what FFT was initialized with. + /// + /// @param cmd Command buffer for issuing dispatch commands. + /// @param output Output buffer or image. + /// NOTE: For images, the texture must be using immutable storage, i.e. glTexStorage2D! + /// @param input Input buffer or texture. + /// @param input_aux If using convolution transform type, + /// the content of input and input_aux will be multiplied together. + void process(CommandBuffer *cmd, Resource *output, Resource *input, Resource *input_aux = nullptr); + + /// @brief Run process() multiple times, timing the results. + /// + /// Mostly used internally by GLFFT wisdom, glfft_cli's bench, and so on. + /// + /// @param context The graphics context. + /// @param output Output buffer or image. + /// NOTE: For images, the texture must be using immutable storage, i.e. glTexStorage2D! + /// @param input Input buffer or texture. + /// @param warmup_iterations Number of iterations to run to "warm" up GL, ensures we don't hit + /// recompilations or similar when benching. + /// @param iterations Number of iterations to run the benchmark. + /// Each iteration will ensure timing with a glFinish() followed by timing. + /// @param dispatches_per_iteration Number of calls to process() we should do per iteration. + /// @param max_time The max time the benchmark should run. Will be checked after each iteration is complete. + /// + /// @returns Average GPU time per process() call. + double bench(Context *context, Resource *output, Resource *input, + unsigned warmup_iterations, unsigned iterations, unsigned dispatches_per_iteration, + double max_time = std::numeric_limits<double>::max()); + + /// @brief Returns cost for a process() call. Only used for debugging. + double get_cost() const { return cost; } + + /// @brief Returns number of passes (glDispatchCompute) in a process() call. + unsigned get_num_passes() const { return passes.size(); } + + /// @brief Returns Nx. + unsigned get_dimension_x() const { return size_x; } + /// @brief Returns Ny. + unsigned get_dimension_y() const { return size_y; } + + /// @brief Sets offset and scale parameters for normalized texel coordinates when sampling textures. + /// + /// By default, these values are 0.5 / size (samples in the center of texel (0, 0)). + /// Scale is 1.0 / size, so it steps one texel for each coordinate in the FFT transform. + /// Setting this to something custom is useful to get downsampling with GL_LINEAR -> FFT transform + /// without having to downsample the texture first, then FFT. + void set_texture_offset_scale(float offset_x, float offset_y, float scale_x, float scale_y) + { + texture.offset_x = offset_x; + texture.offset_y = offset_y; + texture.scale_x = scale_x; + texture.scale_y = scale_y; + } + + /// @brief Set binding range for input. + /// + /// If input is an SSBO, set a custom binding range to be passed to glBindBufferRange. + /// By default, the entire buffer is bound. + void set_input_buffer_range(size_t offset, size_t size) + { + ssbo.input.offset = offset; + ssbo.input.size = size; + } + + /// @brief Set binding range for input_aux. + /// + /// If input_aux is an SSBO, set a custom binding range to be passed to glBindBufferRange. + /// By default, the entire buffer is bound. + void set_input_aux_buffer_range(size_t offset, size_t size) + { + ssbo.input_aux.offset = offset; + ssbo.input_aux.size = size; + } + + /// @brief Set binding range for output. + /// + /// If output buffer is an SSBO, set a custom binding range to be passed to glBindBufferRange. + /// By default, the entire buffer is bound. + void set_output_buffer_range(size_t offset, size_t size) + { + ssbo.output.offset = offset; + ssbo.output.size = size; + } + + /// @brief Set samplers for input textures. + /// + /// Set sampler objects to be used for input and input_aux if textures are used as input. + /// By default, sampler object 0 will be used (inheriting sampler parameters from the texture object itself). + void set_samplers(Sampler *sampler0, Sampler *sampler1 = nullptr) + { + texture.samplers[0] = sampler0; + texture.samplers[1] = sampler1; + } + + private: + Context *context; + + struct Pass + { + Parameters parameters; + + unsigned workgroups_x; + unsigned workgroups_y; + unsigned uv_scale_x; + unsigned stride; + Program *program; + }; + + double cost = 0.0; + + std::unique_ptr<Buffer> temp_buffer; + std::unique_ptr<Buffer> temp_buffer_image; + std::vector<Pass> passes; + std::shared_ptr<ProgramCache> cache; + + std::unique_ptr<Program> build_program(const Parameters ¶ms); + static std::string load_shader_string(const char *path); + static void store_shader_string(const char *path, const std::string &source); + + Program* get_program(const Parameters ¶ms); + + struct + { + float offset_x = 0.0f, offset_y = 0.0f, scale_x = 1.0f, scale_y = 1.0f; + Sampler *samplers[2] = { nullptr, nullptr }; + } texture; + + struct + { + struct + { + size_t offset = 0; + size_t size = 0; + } input, input_aux, output; + } ssbo; + unsigned size_x, size_y; +}; + +} + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_common.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_common.hpp new file mode 100644 index 00000000..4065f682 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_common.hpp @@ -0,0 +1,178 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// For the most part used by the implementation. + +#ifndef GLFFT_COMMON_HPP__ +#define GLFFT_COMMON_HPP__ + +#include "glfft_interface.hpp" +#include <functional> +#include <cstddef> +#include <cstdlib> +#include <string> +#include <cstring> +#include <memory> +#include <unordered_map> + +namespace GLFFT +{ + +enum Direction +{ + /// Forward FFT transform. + Forward = -1, + /// Inverse FFT transform, but with two inputs (in frequency domain) which are multiplied together + /// for convolution. + InverseConvolve = 0, + /// Inverse FFT transform. + Inverse = 1 +}; + +enum Mode +{ + Horizontal, + HorizontalDual, + Vertical, + VerticalDual, + + ResolveRealToComplex, + ResolveComplexToReal, +}; + +enum Type +{ + /// Regular complex-to-complex transform. + ComplexToComplex, + /// Complex-to-complex dual transform where the complex value is four-dimensional, + /// i.e. a vector of two complex values. Typically used to transform RGBA data. + ComplexToComplexDual, + /// Complex-to-real transform. N / 2 + 1 complex values are used per row with a stride of N complex samples. + ComplexToReal, + /// Real-to-complex transform. N / 2 + 1 complex output samples are created per row with a stride of N complex samples. + RealToComplex +}; + +enum Target +{ + /// GL_SHADER_STORAGE_BUFFER + SSBO, + /// Textures, when used as output, type is determined by transform type. + /// ComplexToComplex / RealToComplex -> GL_RG16F + /// ComplexToComplexDual -> GL_RGBA16F + Image, + /// Real-valued (single component) textures, when used as output, type is determined by transform type. + /// ComplexToReal -> GL_R32F (because GLES 3.1 doesn't have GL_R16F image type). + ImageReal +}; + +struct Parameters +{ + unsigned workgroup_size_x; + unsigned workgroup_size_y; + unsigned workgroup_size_z; + unsigned radix; + unsigned vector_size; + Direction direction; + Mode mode; + Target input_target; + Target output_target; + bool p1; + bool shared_banked; + bool fft_fp16, input_fp16, output_fp16; + bool fft_normalize; + + bool operator==(const Parameters &other) const + { + return std::memcmp(this, &other, sizeof(Parameters)) == 0; + } +}; + +/// @brief Options for FFT implementation. +/// Defaults for performance as conservative. +struct FFTOptions +{ + struct Performance + { + /// Workgroup size used in layout(local_size_x). + /// Only affects performance, however, large values may make implementations of smaller sized FFTs impossible. + /// FFT constructor will throw in this case. + unsigned workgroup_size_x = 4; + /// Workgroup size used in layout(local_size_x). + /// Only affects performance, however, large values may make implementations of smaller sized FFTs impossible. + /// FFT constructor will throw in this case. + unsigned workgroup_size_y = 1; + /// Vector size. Very GPU dependent. "Scalar" GPUs prefer 2 here, vector GPUs prefer 4 (and maybe 8). + unsigned vector_size = 2; + /// Whether to use banked shared memory or not. + /// Desktop GPUs prefer true here, false for mobile in general. + bool shared_banked = false; + } performance; + + struct Type + { + /// Whether internal shader should be mediump float. + bool fp16 = false; + /// Whether input SSBO is a packed 2xfp16 format. Otherwise, regular FP32. + bool input_fp16 = false; + /// Whether output SSBO is a packed 2xfp16 format. Otherwise, regular FP32. + bool output_fp16 = false; + /// Whether to apply 1 / N normalization factor. + bool normalize = false; + } type; +}; + +} + +namespace std +{ + template<> + struct hash<GLFFT::Parameters> + { + std::size_t operator()(const GLFFT::Parameters ¶ms) const + { + std::size_t h = 0; + hash<uint8_t> hasher; + for (std::size_t i = 0; i < sizeof(GLFFT::Parameters); i++) + { + h ^= hasher(reinterpret_cast<const uint8_t*>(¶ms)[i]); + } + + return h; + } + }; +} + +namespace GLFFT +{ + +class ProgramCache +{ + public: + Program* find_program(const Parameters ¶meters) const; + void insert_program(const Parameters ¶meters, std::unique_ptr<Program> program); + size_t cache_size() const { return programs.size(); } + + private: + std::unordered_map<Parameters, std::unique_ptr<Program>> programs; +}; + +} + +#endif + diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_api_headers.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_api_headers.hpp new file mode 100644 index 00000000..d4714e0a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_api_headers.hpp @@ -0,0 +1,6 @@ + +/* Let GLFFT use GLava's headers */ +#define GLFFT_GLSL_LANG_STRING "#version 430 core\n" +extern "C" { + #include "../glava/glad.h" +} diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.cpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.cpp new file mode 100644 index 00000000..47e7ef43 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.cpp @@ -0,0 +1,310 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "glfft_gl_interface.hpp" +#ifdef GLFFT_GL_DEBUG +#include "glfft_validate.hpp" +#endif +#include <cstdarg> +#include <cstring> +#include <vector> + +using namespace GLFFT; +using namespace std; + +GLCommandBuffer GLContext::static_command_buffer; + +void GLCommandBuffer::bind_program(Program *program) +{ + glUseProgram(program ? static_cast<GLProgram*>(program)->name : 0); +} + +void GLCommandBuffer::bind_storage_texture(unsigned binding, Texture *texture, Format format) +{ + glBindImageTexture(binding, static_cast<GLTexture*>(texture)->name, + 0, GL_FALSE, 0, GL_WRITE_ONLY, convert(format)); +} + +void GLCommandBuffer::bind_texture(unsigned binding, Texture *texture) +{ + glActiveTexture(GL_TEXTURE0 + binding); + glBindTexture(GL_TEXTURE_2D, static_cast<GLTexture*>(texture)->name); +} + +void GLCommandBuffer::bind_sampler(unsigned binding, Sampler *sampler) +{ + glBindSampler(binding, sampler ? static_cast<GLSampler*>(sampler)->name : 0); +} + +void GLCommandBuffer::bind_storage_buffer(unsigned binding, Buffer *buffer) +{ + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, static_cast<GLBuffer*>(buffer)->name); +} + +void GLCommandBuffer::bind_storage_buffer_range(unsigned binding, size_t offset, size_t size, Buffer *buffer) +{ + glBindBufferRange(GL_SHADER_STORAGE_BUFFER, binding, static_cast<GLBuffer*>(buffer)->name, offset, size); +} + +void GLCommandBuffer::dispatch(unsigned x, unsigned y, unsigned z) +{ + glDispatchCompute(x, y, z); +} + +void GLCommandBuffer::barrier(Buffer*) +{ + glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT); +} + +void GLCommandBuffer::barrier(Texture*) +{ + glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT); +} + +void GLCommandBuffer::barrier() +{ + glMemoryBarrier(GL_ALL_BARRIER_BITS); +} + +void GLCommandBuffer::push_constant_data(unsigned binding, const void *data, size_t size) +{ + glBindBufferBase(GL_UNIFORM_BUFFER, binding, ubos[ubo_index]); + void *ptr = glMapBufferRange(GL_UNIFORM_BUFFER, + 0, CommandBuffer::MaxConstantDataSize, + GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); + + if (ptr) + { + std::memcpy(ptr, data, size); + glUnmapBuffer(GL_UNIFORM_BUFFER); + } + + if (++ubo_index >= ubo_count) + ubo_index = 0; +} + +CommandBuffer* GLContext::request_command_buffer() +{ + if (!initialized_ubos) + { + glGenBuffers(MaxBuffersRing, ubos); + for (auto &ubo : ubos) + { + glBindBuffer(GL_UNIFORM_BUFFER, ubo); + glBufferData(GL_UNIFORM_BUFFER, CommandBuffer::MaxConstantDataSize, nullptr, GL_STREAM_DRAW); + } + static_command_buffer.set_constant_data_buffers(ubos, MaxBuffersRing); + initialized_ubos = true; + } + return &static_command_buffer; +} + +void GLContext::submit_command_buffer(CommandBuffer*) +{} + +void GLContext::wait_idle() +{ + glFinish(); +} + +unique_ptr<Texture> GLContext::create_texture(const void *initial_data, + unsigned width, unsigned height, + Format format) +{ + return unique_ptr<Texture>(new GLTexture(initial_data, width, height, format)); +} + +unique_ptr<Buffer> GLContext::create_buffer(const void *initial_data, size_t size, AccessMode access) +{ + return unique_ptr<Buffer>(new GLBuffer(initial_data, size, access)); +} + +unique_ptr<Program> GLContext::compile_compute_shader(const char *source) +{ +#ifdef GLFFT_GL_DEBUG + if (!validate_glsl_source(source)) + return nullptr; +#endif + + GLuint program = glCreateProgram(); + if (!program) + { + return nullptr; + } + + GLuint shader = glCreateShader(GL_COMPUTE_SHADER); + + const char *sources[] = { GLFFT_GLSL_LANG_STRING, source }; + glShaderSource(shader, 2, sources, NULL); + glCompileShader(shader); + + GLint status; + glGetShaderiv(shader, GL_COMPILE_STATUS, &status); + if (status == GL_FALSE) + { + GLint len; + GLsizei out_len; + + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); + vector<char> buf(len); + glGetShaderInfoLog(shader, len, &out_len, buf.data()); + log("GLFFT: Shader log:\n%s\n\n", buf.data()); + + glDeleteShader(shader); + glDeleteProgram(program); + return 0; + } + + glAttachShader(program, shader); + glLinkProgram(program); + glDeleteShader(shader); + + glGetProgramiv(program, GL_LINK_STATUS, &status); + if (status == GL_FALSE) + { + GLint len; + GLsizei out_len; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len); + vector<char> buf(len); + glGetProgramInfoLog(program, len, &out_len, buf.data()); + log("Program log:\n%s\n\n", buf.data()); + + glDeleteProgram(program); + glDeleteShader(shader); + return nullptr; + } + + return unique_ptr<Program>(new GLProgram(program)); +} + +void GLContext::log(const char *fmt, ...) +{ + char buffer[4 * 1024]; + + va_list va; + va_start(va, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, va); + va_end(va); + glfft_log("%s", buffer); +} + +double GLContext::get_time() +{ + return glfft_time(); +} + +unsigned GLContext::get_max_work_group_threads() +{ + GLint value; + glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &value); + return value; +} + +const char* GLContext::get_renderer_string() +{ + return reinterpret_cast<const char*>(glGetString(GL_RENDERER)); +} + +const void* GLContext::map(Buffer *buffer, size_t offset, size_t size) +{ + glBindBuffer(GL_SHADER_STORAGE_BUFFER, static_cast<GLBuffer*>(buffer)->name); + const void *ptr = glMapBufferRange(GL_SHADER_STORAGE_BUFFER, offset, size, GL_MAP_READ_BIT); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); + return ptr; +} + +void GLContext::unmap(Buffer *buffer) +{ + glBindBuffer(GL_SHADER_STORAGE_BUFFER, static_cast<GLBuffer*>(buffer)->name); + glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); +} + +void GLContext::teardown() +{ + if (initialized_ubos) + glDeleteBuffers(MaxBuffersRing, ubos); + initialized_ubos = false; +} + +GLContext::~GLContext() +{ + teardown(); +} + +GLTexture::GLTexture(const void *initial_data, + unsigned width, unsigned height, + Format format) +{ + glGenTextures(1, &name); + glBindTexture(GL_TEXTURE_2D, name); + glTexStorage2D(GL_TEXTURE_2D, 1, convert(format), width, height); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + if (initial_data) + { + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, + convert_format(format), convert_type(format), initial_data); + } + + glBindTexture(GL_TEXTURE_2D, 0); +} + +GLTexture::~GLTexture() +{ + if (owned) + glDeleteTextures(1, &name); +} + +GLBuffer::GLBuffer(const void *initial_data, size_t size, AccessMode access) +{ + glGenBuffers(1, &name); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, name); + glBufferData(GL_SHADER_STORAGE_BUFFER, size, initial_data, convert(access)); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); +} + +GLBuffer::~GLBuffer() +{ + if (owned) + glDeleteBuffers(1, &name); +} + +GLProgram::GLProgram(GLuint name) + : name(name) +{} + +GLProgram::~GLProgram() +{ + if (name != 0) + { + glDeleteProgram(name); + } +} + +GLSampler::~GLSampler() +{ + if (name != 0) + { + glDeleteSamplers(1, &name); + } +} + diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.hpp new file mode 100644 index 00000000..43929c7b --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_gl_interface.hpp @@ -0,0 +1,258 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLFFT_GL_INTERFACE_HPP__ +#define GLFFT_GL_INTERFACE_HPP__ + +#include "glfft_interface.hpp" + +#include "glfft_gl_api_headers.hpp" + +/* GLava additions (POSIX) */ +extern "C" { + #include <time.h> + #include <stdarg.h> + #include <stdlib.h> + #include <string.h> + #include <error.h> +} + +#ifndef GLFFT_GLSL_LANG_STRING +#error GLFFT_GLSL_LANG_STRING must be defined to e.g. "#version 310 es\n" or "#version 430 core\n". +#endif + +#ifndef GLFFT_LOG_OVERRIDE +void glfft_log(const char *fmt, ...) { + va_list l; + va_start(l, fmt); + vfprintf(stdout, fmt, l); + va_end(l); +} +#else +#define glfft_log GLFFT_LOG_OVERRIDE +#endif + +#ifndef GLFFT_TIME_OVERRIDE +double glfft_time() { + struct timespec tv; + if (clock_gettime(CLOCK_REALTIME, &tv)) { + fprintf(stderr, "clock_gettime(CLOCK_REALTIME, ...): %s\n", strerror(errno)); + } + return (double) tv.tv_sec + ((double) tv.tv_nsec / 1000000000.0); +} +#else +#define glfft_time GLFFT_TIME_OVERRIDE +#endif + +namespace GLFFT +{ + class GLContext; + + class GLTexture : public Texture + { + public: + friend class GLContext; + friend class GLCommandBuffer; + ~GLTexture(); + + GLTexture(GLuint obj) : name(obj), owned(false) {} + GLuint get() const { return name; } + + private: + GLTexture(const void *initial_data, + unsigned width, unsigned height, + Format format); + GLuint name; + bool owned = true; + }; + + // Not really used by test and bench code, but can be useful for API users. + class GLSampler : public Sampler + { + public: + friend class GLContext; + friend class GLCommandBuffer; + ~GLSampler(); + + GLSampler(GLuint obj) : name(obj) {} + GLuint get() const { return name; } + + private: + GLuint name; + }; + + class GLBuffer : public Buffer + { + public: + friend class GLContext; + friend class GLCommandBuffer; + ~GLBuffer(); + + GLBuffer(GLuint obj) : name(obj), owned(false) {} + GLuint get() const { return name; } + + private: + GLuint name; + GLBuffer(const void *initial_data, size_t size, AccessMode access); + bool owned = true; + }; + + class GLProgram : public Program + { + public: + friend class GLContext; + friend class GLCommandBuffer; + ~GLProgram(); + + GLuint get() const { return name; } + + private: + GLProgram(GLuint name); + GLuint name; + }; + + class GLCommandBuffer : public CommandBuffer + { + public: + ~GLCommandBuffer() = default; + + void set_constant_data_buffers(const GLuint *ubos, unsigned count) + { + this->ubos = ubos; + ubo_index = 0; + ubo_count = count; + } + + void bind_program(Program *program) override; + void bind_storage_texture(unsigned binding, Texture *texture, Format format) override; + void bind_texture(unsigned binding, Texture *texture) override; + void bind_sampler(unsigned binding, Sampler *sampler) override; + void bind_storage_buffer(unsigned binding, Buffer *texture) override; + void bind_storage_buffer_range(unsigned binding, size_t offset, size_t length, Buffer *texture) override; + void dispatch(unsigned x, unsigned y, unsigned z) override; + + void barrier(Buffer *buffer) override; + void barrier(Texture *buffer) override; + void barrier() override; + + void push_constant_data(unsigned binding, const void *data, size_t size) override; + + private: + const GLuint *ubos = nullptr; + unsigned ubo_count = 0; + unsigned ubo_index = 0; + }; + + class GLContext : public Context + { + public: + ~GLContext(); + + std::unique_ptr<Texture> create_texture(const void *initial_data, + unsigned width, unsigned height, + Format format) override; + + std::unique_ptr<Buffer> create_buffer(const void *initial_data, size_t size, AccessMode access) override; + std::unique_ptr<Program> compile_compute_shader(const char *source) override; + + CommandBuffer* request_command_buffer() override; + void submit_command_buffer(CommandBuffer *cmd) override; + void wait_idle() override; + + const char* get_renderer_string() override; + void log(const char *fmt, ...) override; + double get_time() override; + + unsigned get_max_work_group_threads() override; + + const void* map(Buffer *buffer, size_t offset, size_t size) override; + void unmap(Buffer *buffer) override; + + // Not supported in GLES, so override when creating platform-specific context. + bool supports_texture_readback() override { return false; } + void read_texture(void*, Texture*, Format) override {} + + protected: + void teardown(); + + private: + static GLCommandBuffer static_command_buffer; + + enum { MaxBuffersRing = 256 }; + GLuint ubos[MaxBuffersRing]; + bool initialized_ubos = false; + }; + + static inline GLenum convert(AccessMode mode) + { + switch (mode) + { + case AccessStreamCopy: return GL_STREAM_COPY; + case AccessStaticCopy: return GL_STATIC_COPY; + case AccessStreamRead: return GL_STREAM_READ; + } + return 0; + } + + static inline GLenum convert(Format format) + { + switch (format) + { + case FormatR16G16B16A16Float: return GL_RGBA16F; + case FormatR32G32B32A32Float: return GL_RGBA32F; + case FormatR32Float: return GL_R32F; + case FormatR16G16Float: return GL_RG16F; + case FormatR32G32Float: return GL_RG32F; + case FormatR32Uint: return GL_R32UI; + case FormatUnknown: return 0; + } + return 0; + } + + static inline GLenum convert_format(Format format) + { + switch (format) + { + case FormatR16G16Float: return GL_RG; + case FormatR32G32Float: return GL_RG; + case FormatR16G16B16A16Float: return GL_RGBA; + case FormatR32G32B32A32Float: return GL_RGBA; + case FormatR32Float: return GL_RED; + case FormatR32Uint: return GL_RED_INTEGER; + case FormatUnknown: return 0; + } + return 0; + } + + static inline GLenum convert_type(Format format) + { + switch (format) + { + case FormatR16G16Float: return GL_HALF_FLOAT; + case FormatR16G16B16A16Float: return GL_HALF_FLOAT; + case FormatR32Float: return GL_FLOAT; + case FormatR32G32Float: return GL_FLOAT; + case FormatR32G32B32A32Float: return GL_FLOAT; + case FormatR32Uint: return GL_UNSIGNED_INT; + case FormatUnknown: return 0; + } + return 0; + } +} + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_interface.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_interface.hpp new file mode 100644 index 00000000..c2cc9097 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_interface.hpp @@ -0,0 +1,131 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLFFT_INTERFACE_HPP__ +#define GLFFT_INTERFACE_HPP__ + +#include <memory> + +namespace GLFFT +{ + class Context; + + class Resource + { + public: + virtual ~Resource() = default; + + // Non-movable, non-copyable to make things simpler. + Resource(Resource&&) = delete; + void operator=(const Resource&) = delete; + + protected: + Resource() = default; + }; + + class Texture : public Resource {}; + class Sampler : public Resource {}; + class Buffer : public Resource {}; + + class Program + { + public: + virtual ~Program() = default; + protected: + friend class Context; + Program() = default; + }; + + enum AccessMode + { + AccessStreamCopy, + AccessStaticCopy, + AccessStreamRead + }; + + enum Format + { + FormatUnknown, + FormatR16G16B16A16Float, + FormatR32G32B32A32Float, + FormatR32G32Float, + FormatR32Float, + FormatR16G16Float, + FormatR32Uint + }; + + class CommandBuffer; + + class Context + { + public: + virtual ~Context() = default; + + virtual std::unique_ptr<Texture> create_texture(const void *initial_data, + unsigned width, unsigned height, + Format format) = 0; + + virtual std::unique_ptr<Buffer> create_buffer(const void *initial_data, size_t size, AccessMode access) = 0; + virtual std::unique_ptr<Program> compile_compute_shader(const char *source) = 0; + + virtual CommandBuffer* request_command_buffer() = 0; + virtual void submit_command_buffer(CommandBuffer *cmd) = 0; + virtual void wait_idle() = 0; + + virtual const char* get_renderer_string() = 0; + virtual void log(const char *fmt, ...) = 0; + virtual double get_time() = 0; + + virtual unsigned get_max_work_group_threads() = 0; + + virtual const void* map(Buffer *buffer, size_t offset, size_t size) = 0; + virtual void unmap(Buffer *buffer) = 0; + + virtual bool supports_texture_readback() = 0; + virtual void read_texture(void *buffer, Texture *texture, Format format) = 0; + + protected: + Context() = default; + }; + + class CommandBuffer + { + public: + virtual ~CommandBuffer() = default; + + virtual void bind_program(Program *program) = 0; + virtual void bind_storage_texture(unsigned binding, Texture *texture, Format format) = 0; + virtual void bind_texture(unsigned binding, Texture *texture) = 0; + virtual void bind_sampler(unsigned binding, Sampler *sampler) = 0; + virtual void bind_storage_buffer(unsigned binding, Buffer *texture) = 0; + virtual void bind_storage_buffer_range(unsigned binding, size_t offset, size_t length, Buffer *texture) = 0; + virtual void dispatch(unsigned x, unsigned y, unsigned z) = 0; + + virtual void barrier(Buffer *buffer) = 0; + virtual void barrier(Texture *buffer) = 0; + virtual void barrier() = 0; + + enum { MaxConstantDataSize = 64 }; + virtual void push_constant_data(unsigned binding, const void *data, size_t size) = 0; + + protected: + CommandBuffer() = default; + }; +} + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.cpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.cpp new file mode 100644 index 00000000..ad18317c --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.cpp @@ -0,0 +1,600 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "glfft_wisdom.hpp" +#include "glfft_interface.hpp" +#include "glfft.hpp" +#include <utility> + +/* GLAVA NOTICE: automatic wisdom serialization support may be added at a late date */ +#ifdef GLFFT_SERIALIZATION +#include "rapidjson/reader.h" +#include "rapidjson/prettywriter.h" +#include "rapidjson/stringbuffer.h" +#include "rapidjson/document.h" +using namespace rapidjson; +#endif + +#ifdef GLFFT_CLI_ASYNC +#include "glfft_cli.hpp" +#endif + +using namespace std; +using namespace GLFFT; + +FFTStaticWisdom FFTWisdom::get_static_wisdom_from_renderer(Context *context) +{ + FFTStaticWisdom res; + + const char *renderer = context->get_renderer_string(); + unsigned threads = context->get_max_work_group_threads(); + + if (strstr(renderer, "GeForce") || strstr(renderer, "Quadro")) + { + context->log("Detected GeForce/Quadro GPU.\n"); + res.min_workgroup_size = 32; // Warp threads. + res.min_workgroup_size_shared = 32; + res.max_workgroup_size = min(threads, 256u); // Very unlikely that more than 256 threads will do anything good. + res.min_vector_size = 2; + res.max_vector_size = 2; + res.shared_banked = FFTStaticWisdom::True; + } + else if (strstr(renderer, "Radeon")) + { + context->log("Detected Radeon GPU.\n"); + res.min_workgroup_size = 64; // Wavefront threads (GCN). + res.min_workgroup_size_shared = 128; + res.max_workgroup_size = min(threads, 256u); // Very unlikely that more than 256 threads will do anything good. + // TODO: Find if we can restrict this to 2 or 4 always. + res.min_vector_size = 2; + res.max_vector_size = 4; + res.shared_banked = FFTStaticWisdom::True; + } + else if (strstr(renderer, "Mali")) + { + context->log("Detected Mali GPU.\n"); + + res.min_workgroup_size = 4; + res.min_workgroup_size_shared = 4; + res.max_workgroup_size = 64; // Going beyond 64 threads per WG is not a good idea. + res.min_vector_size = 4; + res.max_vector_size = 4; + res.shared_banked = FFTStaticWisdom::False; + } + // TODO: Add more GPUs. + + return res; +} + +pair<double, FFTOptions::Performance> FFTWisdom::learn_optimal_options( + Context *context, unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, + const FFTOptions::Type &type) +{ + WisdomPass pass = { + { + Nx, Ny, radix, mode, input_target, output_target, + type, + }, + 0.0, + }; + + auto itr = library.find(pass); + if (itr != end(library)) + { + return make_pair(itr->first.cost, itr->second); + } + else + { + auto result = study(context, pass, type); + pass.cost = result.first; + library[pass] = result.second; + + return result; + } +} + +void FFTWisdom::learn_optimal_options_exhaustive(Context *context, + unsigned Nx, unsigned Ny, + Type type, Target input_target, Target output_target, const FFTOptions::Type &fft_type) +{ + bool learn_resolve = type == ComplexToReal || type == RealToComplex; + Mode vertical_mode = type == ComplexToComplexDual ? VerticalDual : Vertical; + Mode horizontal_mode = type == ComplexToComplexDual ? HorizontalDual : Horizontal; + + // Create wisdom for horizontal transforms and vertical transform. + static const unsigned radices[] = { 4, 8, 16, 64 }; + for (auto radix : radices) + { + try + { + // If we're doing SSBO -> Image or Image -> SSBO. Create wisdom for the two variants. + + // Learn plain transforms. + if (Ny > 1) + { + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, vertical_mode, SSBO, SSBO, fft_type); + } + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, horizontal_mode, SSBO, SSBO, fft_type); + + // Learn the first/last pass transforms. Can be fairly significant since accessing textures makes more sense with + // block interleave and larger WG_Y sizes. + if (input_target != SSBO) + { + if (Ny > 1) + { + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, vertical_mode, input_target, SSBO, fft_type); + } + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, horizontal_mode, input_target, SSBO, fft_type); + } + + if (output_target != SSBO) + { + if (Ny > 1) + { + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, vertical_mode, SSBO, output_target, fft_type); + } + learn_optimal_options(context, Nx >> learn_resolve, Ny, radix, horizontal_mode, SSBO, output_target, fft_type); + } + } +#ifdef GLFFT_CLI_ASYNC + catch (const AsyncCancellation &) + { + throw; + } +#endif + catch (...) + { + // If our default options cannot successfully create the radix pass (i.e. throws), + // just ignore it for purpose of creating wisdom. + } + } + + auto resolve_type = fft_type; + resolve_type.input_fp16 = resolve_type.output_fp16; + Mode resolve_mode = type == ComplexToReal ? ResolveComplexToReal : ResolveRealToComplex; + Target resolve_input_target = SSBO; + + // If we have C2R Nx1 transform, the first pass is resolve, so use those types. + if (type == ComplexToReal && Ny == 1) + { + resolve_type = fft_type; + resolve_input_target = input_target; + } + + // If we need to do a resolve pass, train this case as well. + if (learn_resolve) + { + try + { + // If Ny == 1 and we're doing RealToComplex, this will be the last pass, so use output_target as target. + if (Ny == 1 && resolve_mode == ResolveRealToComplex) + { + learn_optimal_options(context, Nx >> learn_resolve, Ny, 2, resolve_mode, resolve_input_target, output_target, resolve_type); + } + else + { + learn_optimal_options(context, Nx >> learn_resolve, Ny, 2, resolve_mode, resolve_input_target, SSBO, resolve_type); + } + } +#ifdef GLFFT_CLI_ASYNC + catch (const AsyncCancellation &) + { + throw; + } +#endif + catch (...) + { + // If our default options cannot successfully create the radix pass (i.e. throws), + // just ignore it for purpose of creating wisdom. + } + } +} + +double FFTWisdom::bench(Context *context, Resource *output, Resource *input, + const WisdomPass &pass, const FFTOptions &options, const shared_ptr<ProgramCache> &cache) const +{ + FFT fft(context, pass.pass.Nx, pass.pass.Ny, pass.pass.radix, pass.pass.input_target != SSBO ? 1 : pass.pass.radix, + pass.pass.mode, pass.pass.input_target, pass.pass.output_target, + cache, options); + + return fft.bench(context, + output, input, params.warmup, params.iterations, params.dispatches, params.timeout); +} + +static inline unsigned mode_to_size(Mode mode) +{ + switch (mode) + { + case VerticalDual: + case HorizontalDual: + case ResolveRealToComplex: + case ResolveComplexToReal: + return 4; + + default: + return 2; + } +} + +std::pair<double, FFTOptions::Performance> FFTWisdom::study(Context *context, const WisdomPass &pass, FFTOptions::Type type) const +{ + auto cache = make_shared<ProgramCache>(); + + unique_ptr<Resource> output; + unique_ptr<Resource> input; + + unsigned mode_size = mode_to_size(pass.pass.mode); + vector<float> tmp(mode_size * pass.pass.Nx * pass.pass.Ny); + + if (pass.pass.input_target == SSBO) + { + input = context->create_buffer(tmp.data(), tmp.size() * sizeof(float) >> type.input_fp16, AccessStaticCopy); + } + else + { + Format format = FormatUnknown; + unsigned Nx = pass.pass.Nx; + unsigned Ny = pass.pass.Ny; + + switch (pass.pass.mode) + { + case VerticalDual: + case HorizontalDual: + format = FormatR32G32B32A32Float; + break; + + case Vertical: + case Horizontal: + format = FormatR32G32Float; + break; + + case ResolveComplexToReal: + format = FormatR32G32Float; + Nx *= 2; + break; + + default: + throw logic_error("Invalid input mode.\n"); + } + + input = context->create_texture(tmp.data(), Nx, Ny, format); + } + + if (pass.pass.output_target == SSBO) + { + output = context->create_buffer(nullptr, tmp.size() * sizeof(float) >> type.output_fp16, AccessStreamCopy); + } + else + { + Format format = FormatUnknown; + unsigned Nx = pass.pass.Nx; + unsigned Ny = pass.pass.Ny; + + switch (pass.pass.mode) + { + case VerticalDual: + case HorizontalDual: + format = FormatR32G32B32A32Float; + break; + + case Vertical: + case Horizontal: + format = FormatR32G32Float; + break; + + case ResolveRealToComplex: + format = FormatR32G32Float; + Nx *= 2; + break; + + default: + throw logic_error("Invalid output mode.\n"); + } + + output = context->create_texture(nullptr, Nx, Ny, format); + } + + // Exhaustive search, look for every sensible combination, and find fastest parameters. + // Get initial best cost with defaults. + FFTOptions::Performance best_perf; + double minimum_cost = bench(context, output.get(), input.get(), pass, { best_perf, type }, cache); + + static const FFTStaticWisdom::Tristate shared_banked_values[] = { FFTStaticWisdom::False, FFTStaticWisdom::True }; + static const unsigned vector_size_values[] = { 2, 4, 8 }; + static const unsigned workgroup_size_x_values[] = { 4, 8, 16, 32, 64, 128, 256 }; + static const unsigned workgroup_size_y_values[] = { 1, 2, 4, 8, }; + + bool test_resolve = pass.pass.mode == ResolveComplexToReal || pass.pass.mode == ResolveRealToComplex; + bool test_dual = pass.pass.mode == VerticalDual || pass.pass.mode == HorizontalDual; + unsigned bench_count = 0; + + for (auto shared_banked : shared_banked_values) + { + // Useless test, since shared banked is only relevant for radix 16/64. + if (pass.pass.radix < 16 && shared_banked) + { + continue; + } + + bool fair_shared_banked = (pass.pass.radix < 16) || + (static_wisdom.shared_banked == FFTStaticWisdom::DontCare) || + (shared_banked == static_wisdom.shared_banked); + + if (!fair_shared_banked) + { + continue; + } + + for (auto vector_size : vector_size_values) + { + // Resolve passes currently only support vector size 2. Shared banked makes no sense either. + if (test_resolve && (vector_size != 2 || shared_banked)) + { + continue; + } + + // We can only use vector_size 8 with FP16. + if (vector_size == 8 && (!type.fp16 || !type.input_fp16 || !type.output_fp16)) + { + continue; + } + + // Makes little sense to test since since vector_size will be bumped to 4 anyways. + if (test_dual && vector_size < 4) + { + continue; + } + + for (auto workgroup_size_x : workgroup_size_x_values) + { + for (auto workgroup_size_y : workgroup_size_y_values) + { + unsigned workgroup_size = workgroup_size_x * workgroup_size_y; + + unsigned min_workgroup_size = pass.pass.radix >= 16 ? static_wisdom.min_workgroup_size_shared : + static_wisdom.min_workgroup_size; + + unsigned min_vector_size = test_dual ? max(4u, static_wisdom.min_vector_size) : static_wisdom.min_vector_size; + unsigned max_vector_size = test_dual ? max(4u, static_wisdom.max_vector_size) : static_wisdom.max_vector_size; + + bool fair_workgroup_size = workgroup_size <= static_wisdom.max_workgroup_size && + workgroup_size >= min_workgroup_size; + if (pass.pass.Ny == 1 && workgroup_size_y > 1) + { + fair_workgroup_size = false; + } + + if (!fair_workgroup_size) + { + continue; + } + + // If we have dual mode, accept vector sizes larger than max. + bool fair_vector_size = test_resolve || (vector_size <= max_vector_size && + vector_size >= min_vector_size); + + if (!fair_vector_size) + { + continue; + } + + FFTOptions::Performance perf; + perf.shared_banked = shared_banked; + perf.vector_size = vector_size; + perf.workgroup_size_x = workgroup_size_x; + perf.workgroup_size_y = workgroup_size_y; + + try + { + // If workgroup sizes are too big for our test, this will throw. + double cost = bench(context, output.get(), input.get(), pass, { perf, type }, cache); + bench_count++; + +#if 1 + context->log("\nWisdom run (mode = %u, radix = %u):\n", pass.pass.mode, pass.pass.radix); + context->log(" Width: %4u\n", pass.pass.Nx); + context->log(" Height: %4u\n", pass.pass.Ny); + context->log(" Shared banked: %3s\n", shared_banked ? "yes" : "no"); + context->log(" Vector size: %u\n", vector_size); + context->log(" Workgroup size: (%u, %u)\n", workgroup_size_x, workgroup_size_y); + context->log(" Cost: %8.3g\n", cost); +#endif + + if (cost < minimum_cost) + { +#if 1 + context->log(" New optimal solution! (%g -> %g)\n", minimum_cost, cost); +#endif + best_perf = perf; + minimum_cost = cost; + } + } +#ifdef GLFFT_CLI_ASYNC + catch (const AsyncCancellation &) + { + throw; + } +#endif + catch (...) + { + // If we pass in bogus parameters, + // FFT will throw and we just ignore this. + } + } + } + } + } + + context->log("Tested %u variants!\n", bench_count); + return make_pair(minimum_cost, best_perf); +} + +const pair<const WisdomPass, FFTOptions::Performance>* FFTWisdom::find_optimal_options(unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, const FFTOptions::Type &type) const +{ + WisdomPass pass = { + { + Nx, Ny, radix, mode, input_target, output_target, + type, + }, + 0.0, + }; + + auto itr = library.find(pass); + return itr != end(library) ? (&(*itr)) : nullptr; +} + +const FFTOptions::Performance& FFTWisdom::find_optimal_options_or_default(unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, const FFTOptions &base_options) const +{ + WisdomPass pass = { + { + Nx, Ny, radix, mode, input_target, output_target, + base_options.type, + }, + 0.0, + }; + + auto itr = library.find(pass); + +#if 0 + if (itr == end(library)) + { + context->log("Didn't find options for (%u x %u, radix %u, mode %u, input_target %u, output_target %u)\n", + Nx, Ny, radix, unsigned(mode), unsigned(input_target), unsigned(output_target)); + } +#endif + + return itr != end(library) ? itr->second : base_options.performance; +} + +#ifdef GLFFT_SERIALIZATION +std::string FFTWisdom::archive() const +{ + StringBuffer s; + PrettyWriter<StringBuffer> writer{s}; + + writer.StartObject(); + writer.String("library"); + + // Serialize all wisdom accumulated to a string. + writer.StartArray(); + for (auto &entry : library) + { + writer.StartObject(); + + writer.String("scenario"); + writer.StartObject(); + writer.String("nx"); + writer.Uint(entry.first.pass.Nx); + writer.String("ny"); + writer.Uint(entry.first.pass.Ny); + writer.String("radix"); + writer.Uint(entry.first.pass.radix); + writer.String("mode"); + writer.Uint(entry.first.pass.mode); + writer.String("input_target"); + writer.Uint(entry.first.pass.input_target); + writer.String("output_target"); + writer.Uint(entry.first.pass.output_target); + writer.EndObject(); + + writer.String("type"); + writer.StartObject(); + writer.String("fp16"); + writer.Bool(entry.first.pass.type.fp16); + writer.String("input_fp16"); + writer.Bool(entry.first.pass.type.input_fp16); + writer.String("output_fp16"); + writer.Bool(entry.first.pass.type.output_fp16); + writer.String("normalize"); + writer.Bool(entry.first.pass.type.normalize); + writer.EndObject(); + + writer.String("performance"); + writer.StartObject(); + writer.String("shared_banked"); + writer.Bool(entry.second.shared_banked); + writer.String("vector_size"); + writer.Uint(entry.second.vector_size); + writer.String("workgroup_size_x"); + writer.Uint(entry.second.workgroup_size_x); + writer.String("workgroup_size_y"); + writer.Uint(entry.second.workgroup_size_y); + writer.EndObject(); + + writer.String("cost"); + writer.Double(entry.first.cost); + + writer.EndObject(); + } + writer.EndArray(); + writer.EndObject(); + return s.GetString(); +} + +void FFTWisdom::extract(const char *json) +{ + Document document; + document.Parse(json); + + // Exception safe, we don't want to risk throwing in the middle of the + // loop, leaving the library is broken state. + unordered_map<WisdomPass, FFTOptions::Performance> new_library; + + auto &lib = document["library"]; + + // y u no begin(), end() :( + for (Value::ConstValueIterator itr = lib.Begin(); itr != lib.End(); ++itr) + { + auto &v = *itr; + + WisdomPass pass; + FFTOptions::Performance perf; + + pass.cost = v["cost"].GetDouble(); + + auto &scenario = v["scenario"]; + pass.pass.Nx = scenario["nx"].GetUint(); + pass.pass.Ny = scenario["ny"].GetUint(); + pass.pass.radix = scenario["radix"].GetUint(); + pass.pass.mode = static_cast<Mode>(scenario["mode"].GetUint()); + pass.pass.input_target = static_cast<Target>(scenario["input_target"].GetUint()); + pass.pass.output_target = static_cast<Target>(scenario["output_target"].GetUint()); + + auto &type = v["type"]; + pass.pass.type.fp16 = type["fp16"].GetBool(); + pass.pass.type.input_fp16 = type["input_fp16"].GetBool(); + pass.pass.type.output_fp16 = type["output_fp16"].GetBool(); + pass.pass.type.normalize = type["normalize"].GetBool(); + + auto &performance = v["performance"]; + perf.shared_banked = performance["shared_banked"].GetBool(); + perf.vector_size = performance["vector_size"].GetUint(); + perf.workgroup_size_x = performance["workgroup_size_x"].GetUint(); + perf.workgroup_size_y = performance["workgroup_size_y"].GetUint(); + + new_library[pass] = perf; + } + + // Exception safe. + swap(library, new_library); +} +#endif + diff --git a/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.hpp b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.hpp new file mode 100644 index 00000000..d2a11ee8 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/glfft/glfft_wisdom.hpp @@ -0,0 +1,149 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLFFT_WISDOM_HPP__ +#define GLFFT_WISDOM_HPP__ + +#include <unordered_map> +#include <utility> +#include <string> +#include "glfft_common.hpp" +#include "glfft_interface.hpp" + +namespace GLFFT +{ + +struct WisdomPass +{ + struct + { + unsigned Nx; + unsigned Ny; + unsigned radix; + Mode mode; + Target input_target; + Target output_target; + FFTOptions::Type type; + } pass; + + double cost; + + bool operator==(const WisdomPass &other) const + { + return std::memcmp(&pass, &other.pass, sizeof(pass)) == 0; + } +}; + +} + +namespace std +{ + template<> + struct hash<GLFFT::WisdomPass> + { + std::size_t operator()(const GLFFT::WisdomPass ¶ms) const + { + std::size_t h = 0; + hash<uint8_t> hasher; + for (std::size_t i = 0; i < sizeof(params.pass); i++) + { + h ^= hasher(reinterpret_cast<const uint8_t*>(¶ms.pass)[i]); + } + + return h; + } + }; +} + +namespace GLFFT +{ + +// Adds information which depends on the GPU vendor. +// This can speed up learning process, since there will be fewer "obviously wrong" settings to test. +struct FFTStaticWisdom +{ + enum Tristate { True = 1, False = 0, DontCare = -1 }; + + unsigned min_workgroup_size = 1; + unsigned min_workgroup_size_shared = 1; + unsigned max_workgroup_size = 128; // GLES 3.1 mandates support for this. + unsigned min_vector_size = 2; + unsigned max_vector_size = 4; + Tristate shared_banked = DontCare; +}; + +class FFTWisdom +{ + public: + std::pair<double, FFTOptions::Performance> learn_optimal_options(Context *ctx, + unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, const FFTOptions::Type &type); + + void learn_optimal_options_exhaustive(Context *ctx, + unsigned Nx, unsigned Ny, + Type type, Target input_target, Target output_target, const FFTOptions::Type &fft_type); + + const std::pair<const WisdomPass, FFTOptions::Performance>* find_optimal_options(unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, const FFTOptions::Type &base_options) const; + + const FFTOptions::Performance& find_optimal_options_or_default(unsigned Nx, unsigned Ny, unsigned radix, + Mode mode, Target input_target, Target output_target, const FFTOptions &base_options) const; + + void set_static_wisdom(FFTStaticWisdom static_wisdom) { this->static_wisdom = static_wisdom; } + static FFTStaticWisdom get_static_wisdom_from_renderer(Context *context); + + void set_bench_params(unsigned warmup, + unsigned iterations, unsigned dispatches, double timeout) + { + params.warmup = warmup; + params.iterations = iterations; + params.dispatches = dispatches; + params.timeout = timeout; + } + +#ifdef GLFFT_SERIALIZATION + // Serialization interface. + std::string archive() const; + void extract(const char *json); +#endif + + private: + std::unordered_map<WisdomPass, FFTOptions::Performance> library; + + std::pair<double, FFTOptions::Performance> study(Context *context, + const WisdomPass &pass, FFTOptions::Type options) const; + + double bench(Context *cmd, Resource *output, Resource *input, + const WisdomPass &pass, const FFTOptions &options, + const std::shared_ptr<ProgramCache> &cache) const; + + FFTStaticWisdom static_wisdom; + + struct + { + unsigned warmup = 2; + unsigned iterations = 20; + unsigned dispatches = 50; + double timeout = 1.0; + } params; +}; + +} + +#endif + diff --git a/share/dotfiles/.config/glava/glava_repo/meson.build b/share/dotfiles/.config/glava/glava_repo/meson.build new file mode 100644 index 00000000..c3ba8cdb --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/meson.build @@ -0,0 +1,202 @@ +project( + 'glava', + ['c', 'cpp'], + version: run_command('git', 'describe', '--tags').stdout().strip(), + default_options:['buildtype=release', 'strip=true', 'optimization=2']) + +cc = meson.get_compiler('c') + +if get_option('glad') + if get_option('buildtype').startswith('debug') + run_command('./glad_generate.sh', 'c-debug') + else + run_command('./glad_generate.sh') + endif +endif + +if get_option('buildtype').startswith('debug') + add_project_arguments('-DGLAVA_DEBUG', language: 'c') +endif + +glava_dependencies = [ + dependency('threads'), + cc.find_library('pulse'), + cc.find_library('pulse-simple'), + cc.find_library('dl'), + cc.find_library('m'), + cc.find_library('X11'), + cc.find_library('Xext') +] + +if cc.get_id() == 'clang' + add_project_arguments('-fblocks', language: 'c') + glava_dependencies += cc.find_library('BlocksRuntime') +endif + +shader_dir = get_option('shader_install_dir') +glava_version = meson.project_version() +if glava_version == '' + glava_version = 'unknown' +endif + +if host_machine.system() == 'linux' or host_machine.system() == 'bsd' + add_project_arguments('-DGLAVA_UNIX', language: ['cpp', 'c']) +endif + +# Note: the OSX install directives only exist for future platform support +if host_machine.system() == 'darwin' + add_project_arguments('-DGLAVA_OSX', language: ['cpp', 'c']) + error('OSX targets are not supported, see issue #86.') + # shader_dir = '/Library/glava/' +endif + +if get_option('enable_glfw') + add_project_arguments('-DGLAVA_GLFW', language: ['cpp', 'c']) + glava_dependencies += cc.find_library('glfw') +endif + +if not get_option('disable_glx') + add_project_arguments('-DGLAVA_GLX', language: ['cpp', 'c']) + glava_dependencies += cc.find_library('Xrender') +endif + +if get_option('standalone') + add_project_arguments('-DGLAVA_STANDALONE', language: ['cpp', 'c']) +endif + +resource_dir = get_option('resource_install_dir') +if get_option('standalone') + resource_dir = '..' +endif + +add_project_arguments( + '-DGLAVA_VERSION="' + glava_version + '"', + '-DSHADER_INSTALL_PATH="' + shader_dir + '/glava"', + '-DGLAVA_RESOURCE_PATH="' + resource_dir + '/resources"', + # todo: add back + # '-fvisibility=hidden', + language: ['cpp', 'c']) + +glfft = static_library( + 'glfft', + sources: run_command('find', 'glfft', '-type', 'f', '-name', '*.cpp', '-print') + .stdout().strip().split('\n'), + c_args: ['-std=c++11'], + dependencies: [ cc.find_library('dl') ]) + +libglava = shared_library( + 'glava', + sources: run_command('find', 'glava', '-type', 'f', '-name', '*.c', '-print') + .stdout().strip().split('\n'), + dependencies: glava_dependencies, + install: true) + +executable( + 'glava', + sources: 'glava-cli/cli.c', + link_with: libglava, + c_args: ['-I' + meson.source_root() + '/glava', '-std=c++11'], + install: true) + +if not get_option('disable_config') + + # Generator and target for lua objects used by `glava-config`. + # This has been written such that ninja can detect when sources + # need to be rebuilt. + + luac_input_ext = 'lua' + luac_output_ext = 'lua' + + glava_config_lua_sources = run_command( + 'find', 'glava-config', '-type', 'f', '-name', '*.' + luac_input_ext, '-print' + ).stdout().strip().split('\n') + glava_config_lua_targets = [] + foreach s: run_command( + 'basename', '-s.' + luac_input_ext, glava_config_lua_sources + ).stdout().strip().split('\n') + glava_config_lua_targets += s + '.' + luac_output_ext + endforeach + + luac_name = 'luac' + get_option('lua_version') + luac_args = ['-o', '@OUTPUT@', '@INPUT@'] + lua_dir = get_option('lua_implementation') + lua_ver = get_option('lua_version') + lua_impl = get_option('lua_implementation') + lua_inc = get_option('lua_implementation') + get_option('lua_version') + if get_option('lua_implementation') == 'luajit' + # LuaJIT compiler produces better bytecode; use that + luac_name = 'luajit' + lua_impl += '-' + luac_args = ['-b', '@INPUT@', '@OUTPUT@'] + if get_option('buildtype').startswith('debug') + luac_args += '-g' + endif + # LuaJIT uses /usr/share/lua/5.1; ignore version + lua_dir = 'lua' + lua_ver = '5.1' + lua_inc = 'luajit-2.0' + elif not get_option('buildtype').startswith('debug') + luac_args = ['-s'] + luac_args + endif + + luac_target = custom_target( + 'glava-config-luac', + input: generator( + find_program(luac_name), + output: '@BASENAME@.' + luac_output_ext, + arguments: luac_args).process(glava_config_lua_sources), + output: glava_config_lua_targets, + command: [find_program('cp'), '-t', '@OUTDIR@', '@INPUT@'], + build_by_default: true, + install: true, + install_dir: get_option('lua_install_dir') + '/' + lua_dir + '/' + + lua_ver + '/' + 'glava-config') + + executable( + 'glava-config', + install: true, + sources: 'glava-config/entry.c', + c_args: '-I/usr/include/' + lua_inc, + dependencies: [ + cc.find_library('X11'), + cc.find_library(lua_impl + lua_ver) + ]) + + # Local glava-config environment symlink for standalone execution + if get_option('standalone') + env_target = custom_target( + 'glava-config-env', input: [], output: 'glava-env', + depends: luac_target, + command: [find_program('mkdir'), '-p', 'glava-env'], + build_by_default: true) + + custom_target( + 'glava-config-ln', input: [], output: '.PHONY', + depends: env_target, + command: [find_program('ln'), '-sfT', + '../glava-config-luac@cus', + 'glava-env/glava-config'], + build_by_default: true) + endif +endif + +if not get_option('disable_obs') + shared_library( + 'glava-obs', + install: true, + install_dir: get_option('obs_plugin_install_dir'), + sources: 'glava-obs/entry.c', + link_with: libglava, + c_args: '-I/usr/include/obs', + dependencies: [ + dependency('threads'), + cc.find_library('GL'), + cc.find_library('X11'), + cc.find_library('obs'), + cc.find_library('dl') + ]) +endif + +install_subdir('shaders/glava', install_dir: shader_dir) +install_subdir('resources', install_dir: resource_dir) +install_headers('glava/glava.h') diff --git a/share/dotfiles/.config/glava/glava_repo/meson_options.txt b/share/dotfiles/.config/glava/glava_repo/meson_options.txt new file mode 100644 index 00000000..2c1d456a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/meson_options.txt @@ -0,0 +1,24 @@ +option('enable_glfw', type: 'boolean', value: false, + description: 'Enable legacy GLFW backend') +option('disable_glx', type: 'boolean', value: false, + description: 'Disable GLX backend') +option('standalone', type: 'boolean', value: false, + description: 'Configure build to run without installation') +option('glad', type: 'boolean', value: false, + description: 'Download and build GLAD headers (non-reproducable)') +option('disable_obs', type: 'boolean', value: false, + description: 'Disable OBS Studio plugin support') +option('disable_config', type: 'boolean', value: true, + description: 'Skip building GLava GTK+ configuration tool') +option('shader_install_dir', type: 'string', value: '/etc/xdg', + description: 'GLSL config/module system install directory') +option('lua_install_dir', type: 'string', value: '/usr/share', + description: 'Location to install Lua modules for glava-config') +option('lua_version', type: 'string', value: '5.3', + description: 'Lua version to use for glava-config') +option('lua_implementation', type: 'string', value: 'lua', + description: 'Lua implementation to use (\'lua\' or \'luajit\')') +option('resource_install_dir', type: 'string', value: '/usr/share/glava', + description: 'Location to install generic GLava resources') +option('obs_plugin_install_dir', type: 'string', value: '/usr/lib/obs-plugins', + description: 'Location to install OBS plugin if enabled') diff --git a/share/dotfiles/.config/glava/glava_repo/resources/glava.bmp b/share/dotfiles/.config/glava/glava_repo/resources/glava.bmp new file mode 100644 index 00000000..873286a4 Binary files /dev/null and b/share/dotfiles/.config/glava/glava_repo/resources/glava.bmp differ diff --git a/share/dotfiles/.config/glava/glava_repo/resources/transparent.png b/share/dotfiles/.config/glava/glava_repo/resources/transparent.png new file mode 100644 index 00000000..29c4977b Binary files /dev/null and b/share/dotfiles/.config/glava/glava_repo/resources/transparent.png differ diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars.glsl new file mode 100644 index 00000000..6ff84c2f --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars.glsl @@ -0,0 +1,34 @@ +/* Note: to only render a single channel, see `setmirror` in `rc.glsl`. */ + +/* Center line thickness (pixels) */ +#define C_LINE 1 +/* Width (in pixels) of each bar */ +#define BAR_WIDTH 5 +/* Width (in pixels) of each bar gap */ +#define BAR_GAP 1 +/* Outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 1 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* Whether the current settings use the alpha channel; + enabling this is required for alpha to function + correctly on X11 with `"native"` transparency */ +#define USE_ALPHA 0 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 80 +/* Bar color. By default this provides a blue-white gradient. */ +#define COLOR @fg:mix(#3366b2, #a0a0b2, clamp(d / GRADIENT, 0, 1)) +/* Outline color. By default this provides a 'glint' outline based on the bar color */ +#define BAR_OUTLINE @bg:vec4(COLOR.rgb * 1.5, COLOR.a) +/* Direction that the bars are facing, 0 for inward, 1 for outward */ +#define DIRECTION 0 +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to flip the output vertically */ +#define FLIP 0 +/* Whether to mirror output along `Y = X`, causing output to render on the left side of the window */ +/* Use with `FLIP 1` to render on the right side */ +#define MIRROR_YX 0 +/* Whether to disable mono rendering when `#request setmirror true` is set in `rc.glsl`. */ +#define DISABLE_MONO 0 + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/1.frag new file mode 100644 index 00000000..dcebf3eb --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/1.frag @@ -0,0 +1,135 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include "@bars.glsl" +#include ":bars.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; +#include ":util/smooth.glsl" + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +#if DISABLE_MONO == 1 +#define _CHANNELS 2 +#endif + +void main() { + + #if MIRROR_YX == 0 + #define AREA_WIDTH screen.x + #define AREA_HEIGHT screen.y + #define AREA_X gl_FragCoord.x + #define AREA_Y gl_FragCoord.y + #else + #define AREA_WIDTH screen.y + #define AREA_HEIGHT screen.x + #define AREA_X gl_FragCoord.y + #define AREA_Y gl_FragCoord.x + #endif + + #if _CHANNELS == 2 + float dx = (AREA_X - (AREA_WIDTH / 2)); + #else + #if INVERT == 1 + float dx = AREA_WIDTH - AREA_X; + #else + float dx = AREA_X; + #endif + #endif + #if FLIP == 0 + float d = AREA_Y; + #else + float d = AREA_HEIGHT - AREA_Y; + #endif + float section = BAR_WIDTH + BAR_GAP; /* size of section for each bar (including gap) */ + float center = section / 2.0F; /* half section, distance to center */ + float m = abs(mod(dx, section)); /* position in section */ + float md = m - center; /* position in section from center line */ + float nbars = floor((AREA_WIDTH * 0.5F) / section) * 2; + float p, s; + if (md < ceil(float(BAR_WIDTH) / 2) && md >= -floor(float(BAR_WIDTH) / 2)) { /* if not in gap */ + s = dx / section; + p = (sign(s) == 1.0 ? ceil(s) : floor(s)); + #if _CHANNELS == 2 + p /= float(nbars / 2); + #else + p /= float(nbars); + #endif + p += sign(p) * ((0.5F + center) / AREA_WIDTH); /* index center of bar position */ + /* Apply smooth function and index texture */ + #define smooth_f(tex, p) smooth_audio(tex, audio_sz, p) + float v; + /* ignore out of bounds values */ + if (p > 1.0F || p < -1.0F) { + fragment = vec4(0, 0, 0, 0); + return; + } + /* handle user options and store result of indexing in 'v' */ + if (p > 0.0F) { + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_l, p); + #else + v = smooth_f(audio_r, p); + #endif + } else { + p = abs(p); + #if DIRECTION == 1 + p = 1.0F - p; + #endif + #if _CHANNELS == 1 + v = smooth_f(audio_l, p); + #elif INVERT > 0 + v = smooth_f(audio_r, p); + #else + v = smooth_f(audio_l, p); + #endif + } + #undef smooth_f + + v *= AMPLIFY; /* amplify result */ + if (d < v - BAR_OUTLINE_WIDTH) { /* if within range of the reported frequency, draw */ + #if BAR_OUTLINE_WIDTH > 0 + if (md < ceil(float(BAR_WIDTH) / 2) - BAR_OUTLINE_WIDTH && md >= -floor(float(BAR_WIDTH) / 2) + BAR_OUTLINE_WIDTH) + fragment = COLOR; + else + fragment = BAR_OUTLINE; + #else + fragment = COLOR; + #endif + return; + } + + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + fragment = BAR_OUTLINE; + return; + } + #endif + } + fragment = vec4(0, 0, 0, 0); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/2.frag new file mode 100644 index 00000000..0ed8188c --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/bars/2.frag @@ -0,0 +1,5 @@ +#if USE_ALPHA == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle.glsl new file mode 100644 index 00000000..30906d9b --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle.glsl @@ -0,0 +1,18 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 1.5 +/* outline color */ +#define OUTLINE @fg:#333333 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 150 +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to fill in the space between the line and inner circle */ +#define C_FILL 0 +/* Whether to apply a post-processing image smoothing effect + 1 to enable, 0 to disable. Only works with `xroot` transparency, + and improves performance if disabled. */ +#define C_SMOOTH 1 diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/1.frag new file mode 100644 index 00000000..6caccd1d --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/1.frag @@ -0,0 +1,84 @@ +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@circle.glsl" +#include ":circle.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +/* This shader is based on radial.glsl, refer to it for more commentary */ + +float apply_smooth(float theta) { + float idx = theta + ROTATE; + float dir = mod(abs(idx), TWOPI); + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); + if (INVERT > 0) + idx = -idx; + + float pos = abs(idx) / (PI + 0.001F); + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) + float v; + if (idx > 0) v = smooth_f(audio_l); + else v = smooth_f(audio_r); + v *= AMPLIFY; + #undef smooth_f + return v; +} + +void main() { + fragment = vec4(0, 0, 0, 0); + float + dx = gl_FragCoord.x - (screen.x / 2), + dy = gl_FragCoord.y - (screen.y / 2); + float theta = atan(dy, dx); + float d = sqrt((dx * dx) + (dy * dy)); + float adv = (1.0F / d) * (C_LINE * 0.5); + float + adj0 = theta + adv, + adj1 = theta - adv; + d -= C_RADIUS; + if (d >= -(float(C_LINE) / 2.0F)) { + float v = apply_smooth(theta); + + adj0 = apply_smooth(adj0) - v; + adj1 = apply_smooth(adj1) - v; + + float + dmax = max(adj0, adj1), + dmin = min(adj0, adj1); + + d -= v; + #if C_FILL > 0 + #define BOUNDS (d < (float(C_LINE) / 2.0F)) + #else + #define BOUNDS (d > -(float(C_LINE) / 2.0F) && d < (float(C_LINE) / 2.0F)) || (d <= dmax && d >= dmin) + #endif + if (BOUNDS) { + fragment = OUTLINE; + } + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/2.frag new file mode 100644 index 00000000..e6cd45a5 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/2.frag @@ -0,0 +1,33 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@circle.glsl" +#include ":circle.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + #if C_SMOOTH > 0 + #if _USE_ALPHA + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (fragment.a == 0) { + fragment = avg; + } + #endif + #endif +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/3.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/3.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/circle/3.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_KWin.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_KWin.glsl new file mode 100644 index 00000000..aa168ba4 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_KWin.glsl @@ -0,0 +1,8 @@ +#request setdecorated false +#request setxwintype "normal" +#request addxwinstate "below" +#request addxwinstate "skip_taskbar" +#request addxwinstate "skip_pager" +#request addxwinstate "pinned" +#request setclickthrough true + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Openbox.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Openbox.glsl new file mode 100644 index 00000000..c95c6162 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Openbox.glsl @@ -0,0 +1,2 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Xfwm4.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Xfwm4.glsl new file mode 100644 index 00000000..1c20359a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_Xfwm4.glsl @@ -0,0 +1,3 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" +#request addxwinstate "below" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_awesome.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_awesome.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_awesome.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_default.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_default.glsl new file mode 100644 index 00000000..90336cc6 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_default.glsl @@ -0,0 +1 @@ +#request setxwintype "desktop" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_i3.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_i3.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_i3.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_spectrwm.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_spectrwm.glsl new file mode 100644 index 00000000..7f2bba34 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/env_spectrwm.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph.glsl new file mode 100644 index 00000000..cbcce46a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph.glsl @@ -0,0 +1,25 @@ + +/* Vertical scale, larger values will amplify output */ +#define VSCALE 300 +/* Rendering direction, either -1 (outwards) or 1 (inwards). */ +#define DIRECTION 1 + +/* Color gradient scale, (optionally) used in `COLOR` macro */ +#define GRADIENT 75 +/* Color definition. By default this is a gradient formed by mixing two colors. + `pos` represents the pixel position relative to the visualizer baseline. */ +#define COLOR @fg:mix(#802A2A, #4F4F92, clamp(pos / GRADIENT, 0, 1)) +/* 1 to draw outline, 0 to disable */ +#define DRAW_OUTLINE 0 +/* 1 to draw edge highlight, 0 to disable */ +#define DRAW_HIGHLIGHT 1 +/* Whether to anti-alias the border of the graph, creating a smoother curve. + This may have a small impact on performance. + Note: requires `xroot` or `none` opacity to be set */ +#define ANTI_ALIAS 0 +/* outline color */ +#define OUTLINE @bg:#262626 +/* 1 to join the two channels together in the middle, 0 to clamp both down to zero */ +#define JOIN_CHANNELS 0 +/* 1 to invert (vertically), 0 otherwise */ +#define INVERT 0 diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/1.frag new file mode 100644 index 00000000..bfbf04a4 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/1.frag @@ -0,0 +1,133 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +/* When we transform our audio, we need to go through the following steps: + + transform -> "window" + First, apply a window function to taper off the ends of the spectrum, helping + avoid artifacts in the FFT output. + + transform -> "fft" + Apply the Fast Fourier Transform algorithm to separate raw audio data (waves) + into their respective spectrums. + + transform -> "fft" + As part of the FFT process, we return spectrum magnitude on a log(n) scale, + as this is how the (decibel) dB scale functions. + + transform -> "gravity" + To help make our data more pleasing to look at, we apply our data received over + time to a buffer, taking the max of either the existing value in the buffer or + the data from the input. We then reduce the data by the 'gravity step', and + return the storage buffer. + + This makes frequent and abrupt changes in frequency less distracting, and keeps + short frequency responses on the screen longer. + + transform -> "avg" + As a final step, we take the average of several data frames (specified by + 'setavgframes') and return the result to further help smooth the resulting + animation. In order to mitigate abrupt changes to the average, the values + at each end of the average buffer can be weighted less with a window function + (the same window function used at the start of this step!). It can be disabled + with 'setavgwindow'. +*/ + +#include ":util/smooth.glsl" +#include "@graph.glsl" +#include ":graph.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +/* distance from center */ +#define CDIST (abs((screen.x / 2) - gl_FragCoord.x) / screen.x) +/* distance from sides (far) */ +#define FDIST (min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) + +#if DIRECTION < 0 +#define LEFT_IDX (gl_FragCoord.x) +#define RIGHT_IDX (-gl_FragCoord.x + screen.x) +/* distance from base frequencies */ +#define BDIST FDIST +/* distance from high frequencies */ +#define HDIST CDIST +#else +#define LEFT_IDX (half_w - gl_FragCoord.x) +#define RIGHT_IDX (gl_FragCoord.x - half_w) +#define BDIST CDIST +#define HDIST FDIST +#endif + +#define TWOPI 6.28318530718 + +float half_w; +float middle; +highp float pixel = 1.0F / float(screen.x); + +float get_line_height(in sampler1D tex, float idx) { + float s = smooth_audio_adj(tex, audio_sz, idx / half_w, pixel); + /* scale the data upwards so we can see it */ + s *= VSCALE; + /* clamp far ends of the screen down to make the ends of the graph smoother */ + + float fact = clamp((abs((screen.x / 2) - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + #if JOIN_CHANNELS > 0 + fact = -2 * pow(fact, 3) + 3 * pow(fact, 2); /* To avoid spikes */ + s = fact * s + (1 - fact) * middle; + #else + s *= fact; + #endif + + s *= clamp((min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + + return s; +} + +void render_side(in sampler1D tex, float idx) { + float s = get_line_height(tex, idx); + + /* and finally set fragment color if we are in range */ + #if INVERT > 0 + float d = float(screen.y) - gl_FragCoord.y; + #else + float d = gl_FragCoord.y; + #endif + #define pos d + if (pos + 1.5 <= s) { + fragment = COLOR; + } else { + fragment = vec4(0, 0, 0, 0); + } +} + +void main() { + half_w = (screen.x / 2); + + middle = VSCALE * (smooth_audio_adj(audio_l, audio_sz, 1, pixel) + smooth_audio_adj(audio_r, audio_sz, 0, pixel)) / 2; + + if (gl_FragCoord.x < half_w) { + render_side(audio_l, LEFT_IDX); + } else { + render_side(audio_r, RIGHT_IDX); + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/2.frag new file mode 100644 index 00000000..ff184452 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/2.frag @@ -0,0 +1,44 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if DRAW_OUTLINE == 0 && DRAW_HIGHLIGHT == 0 +#error __disablestage +#endif + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0) { + /* outline */ + #if DRAW_OUTLINE > 0 + fragment = OUTLINE; + #endif + } else if (avg.a < 1) { + /* creates a highlight along the edge of the spectrum */ + #if DRAW_HIGHLIGHT > 0 + fragment.rgb *= avg.a * 2; + #endif + } + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/3.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/3.frag new file mode 100644 index 00000000..22631399 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/3.frag @@ -0,0 +1,104 @@ + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +/* Moves toward the border of the graph, gives the + y coordinate of the last colored pixel */ +float get_col_height_up(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y >= 0) { + #else + while (y < screen.y) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a <= 0) { + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + break; + } + #if INVERT > 0 + y -= 1; + #else + y += 1; + #endif + } + + return y; +} + +/* Moves toward the base of the graph, gives the + y coordinate of the first colored pixel */ +float get_col_height_down(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y < screen.y) { + #else + while (y >= 0) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a > 0) { + break; + } + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + } + + return y; +} + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + #if ANTI_ALIAS > 0 + + if (fragment.a <= 0) { + bool left_done = false; + float h2; + float a_fact = 0; + + if (texelFetch(tex, ivec2(gl_FragCoord.x - 1, gl_FragCoord.y), 0).a > 0) { + float h1 = get_col_height_up(gl_FragCoord.x - 1, gl_FragCoord.y); + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + + a_fact = clamp(abs((h1 - gl_FragCoord.y) / (h2 - h1)), 0.0, 1.0); + + left_done = true; + } + if (texelFetch(tex, ivec2(gl_FragCoord.x + 1, gl_FragCoord.y), 0).a > 0) { + if (!left_done) { + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + } + float h3 = get_col_height_up(gl_FragCoord.x + 1, gl_FragCoord.y); + + a_fact = max(a_fact, clamp(abs((h3 - gl_FragCoord.y) / (h2 - h3)), 0.0, 1.0)); + } + + fragment.a *= a_fact; + + } + + #endif +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/4.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/4.frag new file mode 100644 index 00000000..f4b70595 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/graph/4.frag @@ -0,0 +1,5 @@ +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial.glsl new file mode 100644 index 00000000..ee5ea92c --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial.glsl @@ -0,0 +1,36 @@ + +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 2 +/* outline color */ +#define OUTLINE @bg:#333333 +/* number of bars (use even values for best results) */ +#define NBARS 160 +/* width (in pixels) of each bar*/ +#define BAR_WIDTH 4.5 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 95 +/* Bar color. This is a gradient by default. */ +#define COLOR @fg:mix(#cc3333, #cca0a0, clamp(d / GRADIENT, 0, 1)) +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to swap left/right audio buffers, set to 1 to enable */ +#define INVERT 0 +/* Aliasing factors. Higher values mean more defined and jagged lines. + Note: aliasing does not have a notable impact on performance, but requires + `xroot` transparency to be enabled since it relies on alpha blending with + the background. */ +#define BAR_ALIAS_FACTOR 1.2 +#define C_ALIAS_FACTOR 1.8 +/* Offset (Y) of the visualization */ +#define CENTER_OFFSET_Y 0 +/* Offset (X) of the visualization */ +#define CENTER_OFFSET_X 0 + +/* (DEPRECATED) outline color */ +#define BAR_OUTLINE OUTLINE +/* (DEPRECATED) outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 0 diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/1.frag new file mode 100644 index 00000000..f1942e00 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/1.frag @@ -0,0 +1,116 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@radial.glsl" +#include ":radial.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +void main() { + + #if _USE_ALPHA > 0 + #define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a)) + fragment = #00000000; + #else + #define APPLY_FRAG(f, c) f = c + #endif + + /* To handle jagged edges, we alias in the shader by using alpha layer blending. + Alpha layer blending is only applied when `xroot` transparency is enabled. */ + + float /* translate (x, y) to use (0, 0) as the center of the screen */ + dx = gl_FragCoord.x - (screen.x / 2) + CENTER_OFFSET_X, + dy = gl_FragCoord.y - (screen.y / 2) + CENTER_OFFSET_Y; + float theta = atan(dy, dx); /* fragment angle with the center of the screen as the origin */ + float d = sqrt((dx * dx) + (dy * dy)); /* distance */ + if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) { + APPLY_FRAG(fragment, OUTLINE); + #if _USE_ALPHA > 0 + fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1); + #else + return; /* return immediately if there is no alpha blending available */ + #endif + } + if (d > C_RADIUS) { + const float section = (TWOPI / NBARS); /* range (radians) for each bar */ + const float center = ((TWOPI / NBARS) / 2.0F); /* center line angle */ + float m = mod(theta, section); /* position in section (radians) */ + float ym = d * sin(center - m); /* distance from center line (cartesian coords) */ + if (abs(ym) < BAR_WIDTH / 2) { /* if within width, draw audio */ + float idx = theta + ROTATE; /* position (radians) in texture */ + float dir = mod(abs(idx), TWOPI); /* absolute position, [0, 2pi) */ + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); /* Re-correct position values to [-pi, pi) */ + #if INVERT == 0 + idx = -idx; /* Invert if needed */ + #endif + float pos = int(abs(idx) / section) / float(NBARS / 2); /* bar position, [0, 1) */ + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) /* smooth function format */ + float v; + if (idx > 0) v = smooth_f(audio_l); /* left buffer */ + else v = smooth_f(audio_r); /* right buffer */ + v *= AMPLIFY; /* amplify */ + #undef smooth_f + /* offset to fragment distance from inner circle */ + #if _USE_ALPHA > 0 + #define ALIAS_FACTOR (((BAR_WIDTH / 2) - abs(ym)) * BAR_ALIAS_FACTOR) + d -= C_RADIUS; /* start bar overlapping the inner circle for blending */ + #else + #define ALIAS_FACTOR 1 + d -= C_RADIUS + (float(C_LINE) / 2.0F); /* start bar after circle */ + #endif + if (d <= v - BAR_OUTLINE_WIDTH) { + vec4 r; + #if BAR_OUTLINE_WIDTH > 0 + if (abs(ym) < (BAR_WIDTH / 2) - BAR_OUTLINE_WIDTH) + r = COLOR; + else + r = BAR_OUTLINE; + #else + r = COLOR; + #endif + #if _USE_ALPHA > 0 + r.a *= ALIAS_FACTOR; + #endif + APPLY_FRAG(fragment, r); + return; + } + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + #if _USE_ALPHA > 0 + vec4 r = BAR_OUTLINE; + r.a *= ALIAS_FACTOR; + APPLY_FRAG(fragment, r); + #else + APPLY_FRAG(fragment, BAR_OUTLINE); + #endif + return; + } + #endif + } + } + fragment = APPLY_FRAG(fragment, vec4(0, 0, 0, 0)); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/2.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/radial/2.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/rc.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/rc.glsl new file mode 100644 index 00000000..a0d43ca2 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/rc.glsl @@ -0,0 +1,236 @@ + +/* The module to use. A module is a set of shaders used to produce + the visualizer. The structure for a module is the following: + + module_name [directory] + 1.frag [file: fragment shader], + 2.frag [file: fragment shader], + ... + + Shaders are loaded in numerical order, starting at '1.frag', + continuing indefinitely. The results of each shader (except + for the final pass) is given to the next shader in the list + as a 2D sampler. + + See documentation for more details. */ +#request mod bars + +/* Window hints */ +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false + +/* Set window background opacity mode. Possible values are: + + "native" - True transparency provided by the compositor. Can + reduce performance on some systems, depending on + the compositor used. + + "xroot" - Maintain a copy of the root window's pixmap + (usually the desktop background) to provide a + pseudo-transparent effect. Useful when no compositor + is available or native transparency isn't nessecary. + Has very little performance impact. + + "none" - Disable window opacity completely. */ +#request setopacity "native" + +/* Whether to average and mirror left and right audio input channels. + This may cause some modules to only render a single channel. */ +#request setmirror false + +/* OpenGL context and GLSL shader versions, do not change unless + you *absolutely* know what you are doing. */ +#request setversion 3 3 +#request setshaderversion 330 + +/* Window title */ +#request settitle "GLava" + +/* Window geometry (x, y, width, height) */ +#request setgeometry 0 0 800 600 + +/* Window background color (RGBA format). + Does not work with `setopacity "xroot"` */ +#request setbg 00000000 + +/* (X11 only) EWMH Window type. Possible values are: + + "desktop", "dock", "toolbar", "menu", + "utility", "splash", "dialog", "normal" + + This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE), + where (TYPE) is the one of the window types listed (after being + converted to uppercase). + + Alternatively, you can set this value to "!", which will cause + the window to be unmanaged. If this is set, then `addxwinstate` + will do nothing, but you can use "!+" and "!-" to stack on top + or below other windows. +*/ +#request setxwintype "normal" + +/* (X11 only) EWMH Window state atoms (multiple can be specified). + Possible values are: + + "modal", "sticky", "maximized_vert", "maximized_horz", + "shaded", "skip_taskbar", "skip_pager", "hidden", "fullscreen", + "above", "below", "demands_attention", "focused", "pinned" + + This will add _NET_WM_STATE_(TYPE) atoms to _NET_WM_STATE, + where (TYPE) is one of the window states listed (after being + converted to uppercase). + + The lines below (commented out by default) are of relevance + if you are trying to get GLava to behave as a desktop widget + and your WM is not correctly responding to the "desktop" value + for `setxwintype`. +*/ +// #request addxwinstate "sticky" +// #request addxwinstate "skip_taskbar" +// #request addxwinstate "skip_pager" +// #request addxwinstate "above" +// #request addxwinstate "pinned" + +/* (X11 only) Use the XShape extension to support clicking through + the GLava window. Useful when you want to interact with other + desktop windows (icons, menus, desktop shells). Enabled by + default when GLava itself is a desktop window. */ +#request setclickthrough false + +/* Audio source + + When the "pulseaudio" backend is set, this can be a number or + a name of an audio sink or device to record from. Set to "auto" + to use the default output device. + + When the "fifo" backend is set, "auto" is interpreted as + "/tmp/mpd.fifo". Otherwise, a valid path should be provided. */ +#request setsource "auto" + +/* Buffer swap interval (vsync), set to '0' to prevent + waiting for refresh, '1' (or more) to wait for the specified + amount of frames. */ +#request setswap 1 + +/* Linear interpolation for audio data frames. Drastically + improves smoothness with configurations that yield low UPS + (`setsamplerate` and `setsamplesize`), or monitors that have + high refresh rates. + + This feature itself, however, will effect performance as it + will have to interpolate data every frame on the CPU. It will + automatically (and temporarily) disable itself if the update + rate is close to, or higher than the framerate: + + if (update_rate / frame_rate > 0.9) disable_interpolation; + + This will delay data output by one update frame, so it can + desync audio with visual effects on low UPS configs. */ +#request setinterpolate false + +/* Frame limiter, set to the frames per second (FPS) desired or + simply set to zero (or lower) to disable the frame limiter. */ +#request setframerate 0 + +/* Suspends rendering if a fullscreen window is focused while + GLava is still visible (ie. on another monitor). This prevents + rendering from interfering with other graphically intensive + tasks. + + If GLava is minimized or completely obscured, it will not + render regardless of this option. */ +#request setfullscreencheck false + +/* Enable/disable printing framerate every second. 'FPS' stands + for 'Frames Per Second', and 'UPS' stands for 'Updates Per + Second'. Updates are performed when new data is submitted + by pulseaudio, and require transformations to be re-applied + (thus being a good measure of how much work your CPU has to + perform over time) */ +#request setprintframes true + +/* PulseAudio sample buffer size. Lower values result in more + frequent audio updates (also depends on sampling rate), but + will also require all transformations to be applied much + more frequently (CPU intensive). + + High (>2048, with 22050 Hz) values will decrease accuracy + (as some signals can be missed by transformations like FFT) + + The following settings (@22050 Hz) produce the listed rates: + + Sample UPS Description + - 2048 -> 43.0 (low accuracy, cheap), use with < 60 FPS + - 1024 -> 86.1 (high accuracy, expensive), use with >= 60 FPS + - 512 -> 172.3 (extreme accuracy, very expensive), use only + for graphing accurate spectrum data with + custom modules. + + If the framerate drops below the update rate, the update rate + will be locked to the framerate (to prevent wasting CPU time). + This behaviour means you can use a 1024 sample size on a 60Hz + monitor with vsync enabled to get 60FPS and 60UPS. + + For high refresh rate monitors (120+ Hz), it's recommended to + also stick with the 1024 sample size and use interpolation to + smooth the data, as accuracy beyond this setting is mostly + meaningless for visual purposes. +*/ +#request setsamplesize 1024 + +/* Audio buffer size to be used for processing and shaders. + Increasing this value can have the effect of adding 'gravity' + to FFT output, as the audio signal will remain in the buffer + longer. + + This value has a _massive_ effect on FFT performance and + quality for some modules. */ +#request setbufsize 4096 + +/* PulseAudio sample rate. Lower values can add 'gravity' to + FFT output, but can also reduce accuracy. Most hardware + samples at 44100Hz. + + Lower sample rates also can make output more choppy, when + not using interpolation. It's generally OK to leave this + value unless you have a strange PulseAudio configuration. + + This option does nothing when using the "fifo" audio + backend. Instead, an ideal rate should be be configured + in the application generating the output. */ +#request setsamplerate 22050 + +/* Enable GPU acceleration of the audio buffer's fourier transform. + This drastically reduces CPU usage, but should be avoided on + old integrated graphics hardware. + + Enabling this also enables acceleration for post-FFT processing + effects, such as gravity, averaging, windowing, and interpolation. */ +#request setaccelfft true + +/* ** DEPRECATED ** + Force window geometry (locking the window in place), useful + for some pesky WMs that try to reposition the window when + embedding in the desktop. + + This routinely sends X11 events and should be avoided. */ +#request setforcegeometry false + +/* ** DEPRECATED ** + Force window to be raised (focused in some WMs), useful for + WMs that have their own stacking order for desktop windows. + + This routinely sends X11 events and should be avoided. */ +#request setforceraised false + +/* ** DEPRECATED ** + Scale down the audio buffer before any operations are + performed on the data. Higher values are faster. + + This value can affect the output of various transformations, + since it applies (crude) averaging to the data when shrinking + the buffer. It is reccommended to use `setsamplerate` and + `setsamplesize` to improve performance or accuracy instead. */ +#request setbufscale 1 diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/smooth_parameters.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/smooth_parameters.glsl new file mode 100644 index 00000000..09e829fa --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/smooth_parameters.glsl @@ -0,0 +1,78 @@ + +/* Settings for smoothing functions and transformations commonly + used to display FFT output. + + IMPORTANT: THESE VALUES CAN BE OVERRIDDEN IN MODULE CONFIG + FILES, IF CHANGING VALUES HERE DOES NOT WORK, CHECK + TO MAKE SURE THEY ARE NOT BEING SET ELSEWHERE. +*/ + +/* The type of formula to use for weighting values when smoothing. + Possible values: + + - circular heavily rounded points + - sinusoidal rounded at both low and high weighted values + like a sine wave + - linear not rounded at all; linear distance + */ +#define ROUND_FORMULA sinusoidal + +/* The sampling mode for processing raw FFT input: + + - average averages all the inputs in the sample range for + a given point. Produces smooth output, but peaks + are not well represented + - maximum obtains the best value from the closest peak in + the sample range. Very accurate peaks, but + output is jagged and sporadic. + - hybrid uses the results from both `average` and `maximum` + with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ +#define SAMPLE_MODE average +/* Weight should be provided in the range (0, 1). Higher values favour + averaged results. `hybrid` mode only. */ +#define SAMPLE_HYBRID_WEIGHT 0.65 + +/* Factor used to scale frequencies. Lower values allows lower + frequencies to occupy more space. */ +#define SAMPLE_SCALE 8 + +/* The frequency range to sample. 1.0 would be the entire FFT output, + and lower values reduce the displayed frequencies in a log-like + scale. */ +#define SAMPLE_RANGE 0.9 + +/* Factor for how to scale higher frequencies. Used in a linear equation + which is multiplied by the result of the fft transformation. */ +#request setfftscale 10.2 + +/* Cutoff for the bass end of the audio data when scaling frequencies. + Higher values cause more of the bass frequencies to be skipped when + scaling. */ +#request setfftcutoff 0.3 + +/* How many frames to queue and run through the average function. + Increasing this value will create latency between the audio and the + animation, but will make for much smoother results. */ +#request setavgframes 5 + +/* Whether to window frames ran through the average function (new & old + frames are weighted less). This massively helps smoothing out + spontaneous values in the animation. */ +#request setavgwindow true + +/* Gravity step, higher values means faster drops. The step is applied + in a rate independant method like so: + + val -= (gravitystep) * (seconds per update) */ +#request setgravitystep 4.2 + +/* Smoothing factor. Larger values mean more smoothing in the output, + however high values can be expensive to compute. Values are in + normalized width: [0.0, 1.0) */ +#request setsmoothfactor 0.025 + +/* Whether to use a separate pass for audio data while smoothing. On + most hardware, this will improve performance, but involves doing a + separate render step for each audio texture and will add some driver + (CPU) overhead. */ +#request setsmoothpass true diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/1.frag new file mode 100644 index 00000000..5a7bd634 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/1.frag @@ -0,0 +1,33 @@ +/* Request transforms and basic uniforms to assert nothing here breaks */ + +#include ":util/smooth.glsl" + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +void main() { + float dummy_result0 = smooth_audio(audio_l, audio_sz, gl_FragCoord.x / float(screen.x)); + float dummy_result1 = smooth_audio(audio_r, audio_sz, gl_FragCoord.x / float(screen.x)); + fragment = vec4(1.0, 0, 0, float(1) / float(3)); +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/2.frag new file mode 100644 index 00000000..85498f85 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/2.frag @@ -0,0 +1,12 @@ +/* Pass the initial results to a dummy shader to assert that linking works correctly */ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/3.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/3.frag new file mode 100644 index 00000000..d5db2d25 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test/3.frag @@ -0,0 +1,2 @@ +/* Assert that the premultiply step works */ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/test_rc.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test_rc.glsl new file mode 100644 index 00000000..60ebf431 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/test_rc.glsl @@ -0,0 +1,27 @@ +#request mod test +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false +#request setopacity "native" +#request setmirror false +#request setversion 3 3 +#request setshaderversion 330 +#request settitle "GLava" +#request setgeometry 0 0 640 640 +#request setbg 00000000 +#request setxwintype "desktop" +#request setclickthrough false +#request setsource "auto" +#request setswap 0 +#request setinterpolate true +#request setframerate 0 +#request setfullscreencheck false +#request setprintframes true +#request setsamplesize 1024 +#request setbufsize 4096 +#request setsamplerate 22050 +#request setforcegeometry false +#request setforceraised false +#request setbufscale 1 +#request settesteval 55000055 diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/average_pass.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/average_pass.frag new file mode 100644 index 00000000..43de1bc2 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/average_pass.frag @@ -0,0 +1,46 @@ +out vec4 fragment; +in vec4 gl_FragCoord; + +#include ":util/common.glsl" + +/* + This averaging shader uses compile-time loop generation to ensure two things: + + - We can avoid requiring GL 4.3 features to dynamically index texture arrays + - We ensure no branching occurs in this shader for optimial performance. + + The alternative is requiring the GLSL compiler to determine that a loop for + texture array indexes (which must be determined at compile-time in 3.3) can be + expanded if the bounds are constant. This is somewhat vendor-specific so GLava + provides a special `#expand` macro to solve this problem in the preprocessing + stage. +*/ + +#define SAMPLER(I) uniform sampler1D t##I; +#expand SAMPLER _AVG_FRAMES + +#define WIN_FUNC window_frame + +void main() { + float r = 0; + + /* Disable windowing for two frames (distorts results) */ + #if _AVG_FRAMES == 2 + #define _AVG_WINDOW 0 + #endif + + /* Use 'shallow' windowing for 3 frames to ensure the first & last + frames have a reasonable amount of weight */ + #if _AVG_FRAMES == 3 + #define WIN_FUNC window_shallow + #endif + + #if _AVG_WINDOW == 0 + #define F(I) r += texelFetch(t##I, int(gl_FragCoord.x), 0).r + #else + #define F(I) r += window(I, _AVG_FRAMES - 1) * texelFetch(t##I, int(gl_FragCoord.x), 0).r + #endif + #expand F _AVG_FRAMES + + fragment.r = r / _AVG_FRAMES; +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/common.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/common.glsl new file mode 100644 index 00000000..91e0777a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/common.glsl @@ -0,0 +1,23 @@ +#ifndef _COMMON_GLSL +#define _COMMON_GLSL + +#ifndef TWOPI +#define TWOPI 6.28318530718 +#endif + +#ifndef PI +#define PI 3.14159265359 +#endif + +/* Window value t that resides in range [0, sz] */ +#define window(t, sz) (0.53836 - (0.46164 * cos(TWOPI * t / sz))) +#define window_frame(t, sz) (0.6 - (0.4 * cos(TWOPI * t / sz))) +#define window_shallow(t, sz) (0.7 - (0.3 * cos(TWOPI * t / sz))) +/* Do nothing (used as an option for configuration) */ +#define linear(x) (x) +/* Take value x that scales linearly between [0, 1) and return its sinusoidal curve */ +#define sinusoidal(x) ((0.5 * sin((PI * (x)) - (PI / 2))) + 0.5) +/* Take value x that scales linearly between [0, 1) and return its circlar curve */ +#define circular(x) sqrt(1 - (((x) - 1) * ((x) - 1))) + +#endif diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_common.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_common.glsl new file mode 100644 index 00000000..c8f0e3cb --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_common.glsl @@ -0,0 +1,842 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#if defined(FFT_FP16) && defined(GL_ES) +precision mediump float; +#endif + +#define BINDING_SSBO_IN 0 +#define BINDING_SSBO_OUT 1 +#define BINDING_SSBO_AUX 2 +#define BINDING_UBO 3 +#define BINDING_TEXTURE0 4 +#define BINDING_TEXTURE1 5 +#define BINDING_IMAGE 6 + +layout(std140, binding = BINDING_UBO) uniform UBO +{ + uvec4 p_stride_padding; + vec4 texture_offset_scale; +} constant_data; +#define uStride constant_data.p_stride_padding.y + +// cfloat is the "generic" type used to hold complex data. +// GLFFT supports vec2, vec4 and "vec8" for its complex data +// to be able to work on 1, 2 and 4 complex values in a single vector. +// FFT_VEC2, FFT_VEC4, FFT_VEC8 defines which type we're using. +// The shaders are compiled on-demand. + +// FP16 values are packed as 2xfp16 in a uint. +// packHalf2x16 and unpackHalf2x16 are used to bitcast between these formats. + +// The complex number format is (real, imag, real, imag, ...) in an interleaved fashion. +// For complex-to-real or real-to-complex transforms, we consider two adjacent real samples to be a complex number as-is. +// Separate "resolve" passes are added to make the transform correct. + +#if defined(FFT_VEC2) +#define cfloat vec2 +#define cfloat_buffer_fp16 uint +#elif defined(FFT_VEC4) +#define cfloat vec4 +#define cfloat_buffer_fp16 uvec2 +#elif defined(FFT_VEC8) +#if !defined(FFT_INPUT_FP16) || !defined(FFT_OUTPUT_FP16) || !defined(FFT_FP16) +#error FFT_VEC8 must use FP16 everywhere. +#endif +#define cfloat uvec4 +#define cfloat_buffer_fp16 uvec4 +#else +#error FFT_VEC2, FFT_VEC4 or FFT_VEC8 must be defined. +#endif + +#ifdef FFT_INPUT_FP16 +#define cfloat_buffer_in cfloat_buffer_fp16 +#else +#define cfloat_buffer_in cfloat +#endif + +#ifdef FFT_OUTPUT_FP16 +#define cfloat_buffer_out cfloat_buffer_fp16 +#else +#define cfloat_buffer_out cfloat +#endif + +// Normally this would be sqrt(1 / radix), but we'd have to apply normalization +// for every pass instead of just half of them. Also, 1 / 2^n is "lossless" in FP math. +#ifdef FFT_NORMALIZE +#define FFT_NORM_FACTOR (1.0 / float(FFT_RADIX)) +#endif + +// FFT_CVECTOR_SIZE defines an interleaving stride for the first pass. +// The first FFT pass with stockham autosort needs to do some shuffling around if we're processing +// more than one complex value per vector. +// This is only needed for horizontal transforms since we vectorize horizontally and different elements +// in the vector are from different transforms when we do vertical transforms. + +#if defined(FFT_P1) && !defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8) +#define FFT_CVECTOR_SIZE 4 +#elif defined(FFT_P1) && ((!defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC4)) || (defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8))) +#define FFT_CVECTOR_SIZE 2 +#else +#define FFT_CVECTOR_SIZE 1 +#endif + +#ifdef GL_ES +#define FFT_HIGHP highp +#else +#define FFT_HIGHP +#endif + +#ifdef FFT_VEC8 + +// Currently unlikely to be useful. +uvec4 PADD(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) + unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) + unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) + unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) + unpackHalf2x16(b.w))); +} + +uvec4 PSUB(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) - unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) - unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) - unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) - unpackHalf2x16(b.w))); +} + +uvec4 PMUL(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) * unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) * unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) * unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) * unpackHalf2x16(b.w))); +} + +uvec4 CONJ_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).yx), + packHalf2x16(unpackHalf2x16(v.y).yx), + packHalf2x16(unpackHalf2x16(v.z).yx), + packHalf2x16(unpackHalf2x16(v.w).yx)); +} + +uvec4 LDUP_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).xx), + packHalf2x16(unpackHalf2x16(v.y).xx), + packHalf2x16(unpackHalf2x16(v.z).xx), + packHalf2x16(unpackHalf2x16(v.w).xx)); +} + +uvec4 HDUP_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).yy), + packHalf2x16(unpackHalf2x16(v.y).yy), + packHalf2x16(unpackHalf2x16(v.z).yy), + packHalf2x16(unpackHalf2x16(v.w).yy)); +} + +// Sign-flip. Works for the cases we're interested in. +uvec4 cmul_minus_j(uvec4 v) +{ + return uvec4(0x80000000u) ^ CONJ_SWIZZLE(v); +} + +uvec4 cmul_plus_j(uvec4 v) +{ + return uvec4(0x00008000u) ^ CONJ_SWIZZLE(v); +} + +uvec4 cmul(uvec4 a, uvec4 b) +{ + uvec4 r3 = CONJ_SWIZZLE(a); + uvec4 r1 = LDUP_SWIZZLE(b); + uvec4 R0 = PMUL(a, r1); + uvec4 r2 = HDUP_SWIZZLE(b); + uvec4 R1 = PMUL(r2, r3); + return PADD(R0, uvec4(0x8000u) ^ R1); +} + +void butterfly(inout uvec4 a, inout uvec4 b, uvec4 w) +{ + uvec4 t = cmul(b, w); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly(inout uvec4 a, inout uvec4 b, vec4 w) +{ + uvec4 t = cmul(b, uvec2(packHalf2x16(w.xy), packHalf2x16(w.zw)).xxyy); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly(inout uvec4 a, inout uvec4 b, vec2 w) +{ + uvec4 t = cmul(b, uvec4(packHalf2x16(w))); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly_p1(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly_p1_minus_j(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = uvec4(0x80000000u) ^ (PSUB(CONJ_SWIZZLE(a), CONJ_SWIZZLE(t))); + a = PADD(a, t); +} + +void butterfly_p1_plus_j(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = uvec4(0x00008000u) ^ (PSUB(CONJ_SWIZZLE(a), CONJ_SWIZZLE(t))); + a = PADD(a, t); +} +#endif + +// Complex multiply. +vec4 cmul(vec4 a, vec4 b) +{ + vec4 r3 = a.yxwz; + vec4 r1 = b.xxzz; + vec4 R0 = a * r1; + vec4 r2 = b.yyww; + vec4 R1 = r2 * r3; + return R0 + vec4(-R1.x, R1.y, -R1.z, R1.w); +} + +vec2 cmul(vec2 a, vec2 b) +{ + vec2 r3 = a.yx; + vec2 r1 = b.xx; + vec2 R0 = a * r1; + vec2 r2 = b.yy; + vec2 R1 = r2 * r3; + return R0 + vec2(-R1.x, R1.y); +} + +#ifdef FFT_INPUT_TEXTURE + +#ifndef FFT_P1 +#error Input texture can only be used when P == 1. +#endif + +#ifdef GL_ES +#if defined(FFT_INPUT_FP16) || defined(FFT_FP16) +precision mediump sampler2D; +#else +precision highp sampler2D; +#endif +#endif + +#define uTexelOffset constant_data.texture_offset_scale.xy +#define uTexelScale constant_data.texture_offset_scale.zw + +layout(binding = BINDING_TEXTURE0) uniform sampler2D uTexture; +#ifdef FFT_CONVOLVE +layout(binding = BINDING_TEXTURE1) uniform sampler2D uTexture2; +#endif + +cfloat load_texture(sampler2D sampler, uvec2 coord) +{ + FFT_HIGHP vec2 uv = vec2(coord) * uTexelScale + uTexelOffset; + + // Quite messy, this :) +#if defined(FFT_VEC8) + #if defined(FFT_INPUT_REAL) + return uvec4( + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(4, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(5, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(6, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(7, 0)).x))); + #elif defined(FFT_DUAL) + vec4 c0 = textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)); + vec4 c1 = textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)); + return uvec4(packHalf2x16(c0.xy), packHalf2x16(c0.zw), packHalf2x16(c1.xy), packHalf2x16(c1.zw)); + #else + return uvec4( + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).xy)); + #endif +#elif defined(FFT_VEC4) + #if defined(FFT_INPUT_REAL) + return vec4( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).x); + #elif defined(FFT_DUAL) + return textureLod(sampler, uv, 0.0); + #else + return vec4( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).xy, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).xy); + #endif +#elif defined(FFT_VEC2) + #if defined(FFT_INPUT_REAL) + return vec2( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x); + #else + return textureLod(sampler, uv, 0.0).xy; + #endif +#endif +} + +cfloat load_texture(uvec2 coord) +{ +#ifdef FFT_CONVOLVE + // Convolution in frequency domain is multiplication. + cfloat c0 = load_texture(uTexture, coord); + cfloat c1 = load_texture(uTexture2, coord); + return cmul(c0, c1); +#else + return load_texture(uTexture, coord); +#endif +} + +// Implement a dummy load_global, or we have to #ifdef out lots of dead code elsewhere. +#ifdef FFT_VEC8 +cfloat load_global(uint offset) +{ + return cfloat(0u); +} +#else +cfloat load_global(uint offset) +{ + return cfloat(0.0); +} +#endif + +#else + +layout(std430, binding = BINDING_SSBO_IN) readonly buffer Block +{ + cfloat_buffer_in data[]; +} fft_in; + +#ifdef FFT_CONVOLVE +layout(std430, binding = BINDING_SSBO_AUX) readonly buffer Block2 +{ + cfloat_buffer_in data[]; +} fft_in2; + +cfloat load_global(uint offset) +{ + // Convolution in frequency domain is multiplication. +#if defined(FFT_INPUT_FP16) && defined(FFT_VEC2) + return cmul(unpackHalf2x16(fft_in.data[offset]), unpackHalf2x16(fft_in2.data[offset])); +#elif defined(FFT_INPUT_FP16) && defined(FFT_VEC4) + uvec2 data = fft_in.data[offset]; + uvec2 data2 = fft_in2.data[offset]; + return cmul(vec4(unpackHalf2x16(data.x), unpackHalf2x16(data.y)), vec4(unpackHalf2x16(data2.x), unpackHalf2x16(data2.y))); +#else + return cmul(fft_in.data[offset], fft_in2.data[offset]); +#endif +} +#else +cfloat load_global(uint offset) +{ +#if defined(FFT_INPUT_FP16) && defined(FFT_VEC2) + return unpackHalf2x16(fft_in.data[offset]); +#elif defined(FFT_INPUT_FP16) && defined(FFT_VEC4) + uvec2 data = fft_in.data[offset]; + return vec4(unpackHalf2x16(data.x), unpackHalf2x16(data.y)); +#else + return fft_in.data[offset]; +#endif +} +#endif +#endif + +#ifndef FFT_OUTPUT_IMAGE +layout(std430, binding = BINDING_SSBO_OUT) writeonly buffer BlockOut +{ + cfloat_buffer_out data[]; +} fft_out; + +void store_global(uint offset, cfloat v) +{ +#ifdef FFT_NORM_FACTOR +#ifdef FFT_VEC8 + v = PMUL(uvec4(packHalf2x16(vec2(FFT_NORM_FACTOR))), v); +#else + v *= FFT_NORM_FACTOR; +#endif +#endif + +#if defined(FFT_OUTPUT_FP16) && defined(FFT_VEC2) + fft_out.data[offset] = packHalf2x16(v); +#elif defined(FFT_OUTPUT_FP16) && defined(FFT_VEC4) + fft_out.data[offset] = uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); +#else + fft_out.data[offset] = v; +#endif +} +#endif + +#ifdef FFT_OUTPUT_IMAGE + +#ifdef GL_ES +#ifdef FFT_OUTPUT_REAL +precision highp image2D; +#else +precision mediump image2D; +#endif +precision highp uimage2D; +#endif + +//#ifdef FFT_P1 +//#error FFT_OUTPUT_IMAGE is not supported in first pass. +//#endif + +// Currently, GLFFT only supports outputing to "fixed" formats like these. +// Should be possible to add options for this to at least choose between FP16/FP32 output, +// and maybe rgba8_unorm for FFT_DUAL case. +#if defined(FFT_DUAL) +layout(rgba16f, binding = BINDING_IMAGE) uniform writeonly image2D uImage; +#elif defined(FFT_OUTPUT_REAL) +layout(r32f, binding = BINDING_IMAGE) uniform writeonly image2D uImage; +#else +// GLES 3.1 doesn't support rg16f layout for some reason, so work around it ... +layout(r32ui, binding = BINDING_IMAGE) uniform writeonly uimage2D uImage; +#endif + +void store(ivec2 coord, vec4 value) +{ +#ifdef FFT_NORM_FACTOR + value *= FFT_NORM_FACTOR; +#endif + +#if defined(FFT_DUAL) + imageStore(uImage, coord, value); +#elif defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(3, 0), value.wwww); +#else + imageStore(uImage, coord + ivec2(0, 0), uvec4(packHalf2x16(value.xy))); + imageStore(uImage, coord + ivec2(1, 0), uvec4(packHalf2x16(value.zw))); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(4, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(3, 0), value.wwww); +#else + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), uvec4(packHalf2x16(value.xy))); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), uvec4(packHalf2x16(value.zw))); +#endif +#else +#error Inconsistent defines. +#endif +} + +#ifndef FFT_DUAL +void store(ivec2 coord, vec2 value) +{ +#ifdef FFT_NORM_FACTOR + value *= FFT_NORM_FACTOR; +#endif + +#if defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); +#else + imageStore(uImage, coord, uvec4(packHalf2x16(value.xy))); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); +#else + imageStore(uImage, coord, uvec4(packHalf2x16(value.xy))); +#endif +#else +#error Inconsistent defines. +#endif +} +#endif + +#ifdef FFT_VEC8 +void store(ivec2 coord, uvec4 value) +{ +#ifdef FFT_NORM_FACTOR + value = PMUL(value, uvec4(packHalf2x16(vec2(FFT_NORM_FACTOR)))); +#endif + +#if defined(FFT_DUAL) +#if defined(FFT_HORIZ) + imageStore(uImage, coord + ivec2(0, 0), vec4(unpackHalf2x16(value.x), unpackHalf2x16(value.y))); + imageStore(uImage, coord + ivec2(1, 0), vec4(unpackHalf2x16(value.z), unpackHalf2x16(value.w))); +#else + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), vec4(unpackHalf2x16(value.x), unpackHalf2x16(value.y))); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), vec4(unpackHalf2x16(value.z), unpackHalf2x16(value.w))); +#endif +#elif defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + vec2 value0 = unpackHalf2x16(value.x); + vec2 value1 = unpackHalf2x16(value.y); + vec2 value2 = unpackHalf2x16(value.z); + vec2 value3 = unpackHalf2x16(value.w); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value0.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value0.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(2, 0), value1.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(3, 0), value1.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(4, 0), value2.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(5, 0), value2.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(6, 0), value3.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(7, 0), value3.yyyy); +#else + imageStore(uImage, coord + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord + ivec2(3, 0), value.wwww); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + vec2 value0 = unpackHalf2x16(value.x); + vec2 value1 = unpackHalf2x16(value.y); + vec2 value2 = unpackHalf2x16(value.z); + vec2 value3 = unpackHalf2x16(value.w); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(0, 0), value0.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(1, 0), value0.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(2, 0), value1.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(3, 0), value1.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(4, 0), value2.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(5, 0), value2.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(6, 0), value3.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(7, 0), value3.yyyy); +#else + imageStore(uImage, coord * ivec2(4, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(3, 0), value.wwww); +#endif +#else +#error Inconsistent defines. +#endif +} +#endif + +#endif + +#define PI 3.14159265359 +#define SQRT_1_2 0.70710678118 + +#ifdef FFT_INVERSE +#define PI_DIR (+PI) +#else +#define PI_DIR (-PI) +#endif + +// Some GLES implementations have lower trancendental precision than desired which +// significantly affects the overall FFT precision. +// For these implementations it might make sense to add a LUT UBO with twiddle factors, +// which can be used here. + +// 4-component FP16 twiddles, pack in uvec4. +#if !defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8) +#define FFT_OUTPUT_STEP 4u +#define FFT_OUTPUT_SHIFT 2u +#define ctwiddle uvec4 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP vec4 angles = PI_DIR * (float(k) + vec4(0.0, 1.0, 2.0, 3.0)) / float(p); + FFT_HIGHP vec4 cos_a = cos(angles); + FFT_HIGHP vec4 sin_a = sin(angles); + return ctwiddle( + packHalf2x16(vec2(cos_a.x, sin_a.x)), + packHalf2x16(vec2(cos_a.y, sin_a.y)), + packHalf2x16(vec2(cos_a.z, sin_a.z)), + packHalf2x16(vec2(cos_a.w, sin_a.w))); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (uvec4(packHalf2x16(vec2(+SQRT_1_2, +SQRT_1_2)))) +#define TWIDDLE_3_8 (uvec4(packHalf2x16(vec2(-SQRT_1_2, +SQRT_1_2)))) +#else +#define TWIDDLE_1_8 (uvec4(packHalf2x16(vec2(+SQRT_1_2, -SQRT_1_2)))) +#define TWIDDLE_3_8 (uvec4(packHalf2x16(vec2(-SQRT_1_2, -SQRT_1_2)))) +#endif + +// 2-component twiddles, pack in vec4. +#elif (!defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC4)) || (defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8)) +#define FFT_OUTPUT_STEP 2u +#define FFT_OUTPUT_SHIFT 1u +#define ctwiddle vec4 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP vec2 angles = PI_DIR * (float(k) + vec2(0.0, 1.0)) / float(p); + FFT_HIGHP vec2 cos_a = cos(angles); + FFT_HIGHP vec2 sin_a = sin(angles); + return ctwiddle(cos_a.x, sin_a.x, cos_a.y, sin_a.y); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, +SQRT_1_2).xyxy) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, +SQRT_1_2).xyxy) +#else +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, -SQRT_1_2).xyxy) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, -SQRT_1_2).xyxy) +#endif + +// 1-component twiddle, pack in vec2. +#else + +#define FFT_OUTPUT_STEP 1u +#define FFT_OUTPUT_SHIFT 0u +#define ctwiddle vec2 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP float angle = PI_DIR * float(k) / float(p); + return ctwiddle(cos(angle), sin(angle)); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, +SQRT_1_2)) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, +SQRT_1_2)) +#else +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, -SQRT_1_2)) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, -SQRT_1_2)) +#endif + +#endif + +// Complex multiply by v * -j. Trivial case which can avoid mul/add. +vec4 cmul_minus_j(vec4 v) +{ + return vec4(v.y, -v.x, v.w, -v.z); +} + +vec2 cmul_minus_j(vec2 v) +{ + return vec2(v.y, -v.x); +} + +// Complex multiply by v * +j. Trivial case which can avoid mul/add. +vec4 cmul_plus_j(vec4 v) +{ + return vec4(-v.y, v.x, -v.w, v.z); +} + +vec2 cmul_plus_j(vec2 v) +{ + return vec2(-v.y, v.x); +} + +#ifdef FFT_INVERSE +#define cmul_dir_j(v) cmul_plus_j(v) +#else +#define cmul_dir_j(v) cmul_minus_j(v) +#endif + +// Calculate an in-place butterfly with twiddle factors. +// a ----------- a + wb +// \ / +// \ / +// X +// / \ +// / \ +// w * b ------- a - wb +// +void butterfly(inout vec4 a, inout vec4 b, vec4 w) +{ + vec4 t = cmul(b, w); + b = a - t; + a = a + t; +} + +// Computes butterflies, but the twiddle factors for the two butterflies are +// identical. +void butterfly(inout vec4 a, inout vec4 b, vec2 w) +{ + butterfly(a, b, w.xyxy); +} + +void butterfly(inout vec2 a, inout vec2 b, vec2 w) +{ + vec2 t = cmul(b, w); + b = a - t; + a = a + t; +} + +// First pass butterfly, special case where w = 1. +void butterfly_p1(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = a - t; + a = a + t; +} + +// First pass butterfly, but also multiply in a twiddle factor of -j to b afterwards. +// Used in P == 1 transforms for radix-4, radix-8 etc. +void butterfly_p1_minus_j(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = vec4(1.0, -1.0, 1.0, -1.0) * (a.yxwz - t.yxwz); + a = a + t; +} + +void butterfly_p1_plus_j(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = vec4(-1.0, 1.0, -1.0, 1.0) * (a.yxwz - t.yxwz); + a = a + t; +} + +void butterfly_p1(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = a - t; + a = a + t; +} + +void butterfly_p1_minus_j(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = vec2(1.0, -1.0) * (a.yx - t.yx); + a = a + t; +} + +void butterfly_p1_plus_j(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = vec2(-1.0, 1.0) * (a.yx - t.yx); + a = a + t; +} + +#ifdef FFT_INVERSE +#define butterfly_p1_dir_j(a, b) butterfly_p1_plus_j(a, b) +#else +#define butterfly_p1_dir_j(a, b) butterfly_p1_minus_j(a, b) +#endif + +#ifdef FFT_RESOLVE_REAL_TO_COMPLEX +vec2 r2c_twiddle(uint i, uint p) +{ + vec2 w = -twiddle(i, p); + return vec2(-w.y, w.x); +} + +// See http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM for +// how the real-to-complex and complex-to-real resolve passes work. +// The final real-to-complex transform pass is done by extracting two interleaved FFTs by conjugate symmetry. + +// If we have a real sequence: +// (r0, r1, r2, r3, r4, ...), we merge two adjacent real values to a sequence of complex numbers. +// We take the FFT of this complex sequence as normal. +// What we end up with really is: +// FFT((r0, r2, r4, r6, ...)) + FFT(j * (r1, r3, r5, r7, ...)). +// If we know the individual FFTs of the even and the odds we can complete the FFT by a single decimation-in-frequency stage. +// By conjugate symmetry, we can extract the even and odd FFTs and complex our transform. +// Complex-to-real is just the same thing, but in reverse. + +void FFT_real_to_complex(uvec2 i) +{ + uint stride = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * stride; + + if (i.x == 0u) + { +#ifdef FFT_INPUT_TEXTURE + vec2 x = load_texture(i); +#else + vec2 x = load_global(offset); +#endif + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i), vec2(x.x + x.y, 0.0)); + store(ivec2(i) + ivec2(stride, 0), vec2(x.x - x.y, 0.0)); +#else + store_global(2u * offset, vec2(x.x + x.y, 0.0)); + store_global(2u * offset + stride, vec2(x.x - x.y, 0.0)); +#endif + } + else + { +#ifdef FFT_INPUT_TEXTURE + vec2 a = load_texture(i); + vec2 b = load_texture(uvec2(stride - i.x, i.y)); +#else + vec2 a = load_global(offset + i.x); + vec2 b = load_global(offset + stride - i.x); +#endif + b = vec2(b.x, -b.y); + vec2 fe = a + b; + vec2 fo = cmul(a - b, r2c_twiddle(i.x, stride)); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i), 0.5 * (fe + fo)); +#else + store_global(2u * offset + i.x, 0.5 * (fe + fo)); +#endif + } +} +#endif + +#ifdef FFT_RESOLVE_COMPLEX_TO_REAL +vec2 c2r_twiddle(uint i, uint p) +{ + vec2 w = twiddle(i, p); + return vec2(-w.y, w.x); +} + +void FFT_complex_to_real(uvec2 i) +{ + uint stride = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * stride; + +#ifdef FFT_INPUT_TEXTURE + vec2 a = load_texture(i); + vec2 b = load_texture(uvec2(stride - i.x, i.y)); +#else + vec2 a = load_global(2u * offset + i.x); + vec2 b = load_global(2u * offset + stride - i.x); +#endif + b = vec2(b.x, -b.y); + vec2 even = a + b; + vec2 odd = cmul(a - b, c2r_twiddle(i.x, stride)); + + store_global(offset + i.x, even + odd); +} +#endif + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_main.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_main.glsl new file mode 100644 index 00000000..f240c412 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_main.glsl @@ -0,0 +1,163 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// P is the current accumulated radix factor. +// First pass in an FFT, P == 1, then P will be pass0.radix, then pass0.radix * pass1.radix, and so on ... +// Used to compute twiddle factors. + +#ifndef FFT_P1 +#define uP constant_data.p_stride_padding.x +#endif + +#if FFT_RADIX == 4 +// FFT4 implementation. +void FFT4_horiz() +{ +#ifdef FFT_P1 + FFT4_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT4_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT4_vert() +{ +#ifdef FFT_P1 + FFT4_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT4_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT4() +{ +#ifdef FFT_HORIZ + FFT4_horiz(); +#else + FFT4_vert(); +#endif +} +#endif + +#if FFT_RADIX == 8 +// FFT8 implementation. +void FFT8_horiz() +{ +#ifdef FFT_P1 + FFT8_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT8_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT8_vert() +{ +#ifdef FFT_P1 + FFT8_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT8_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT8() +{ +#ifdef FFT_HORIZ + FFT8_horiz(); +#else + FFT8_vert(); +#endif +} +#endif + +#if FFT_RADIX == 16 +void FFT16_horiz() +{ +#ifdef FFT_P1 + FFT16_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT16_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT16_vert() +{ +#ifdef FFT_P1 + FFT16_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT16_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT16() +{ +#ifdef FFT_HORIZ + FFT16_horiz(); +#else + FFT16_vert(); +#endif +} +#endif + +#if FFT_RADIX == 64 +void FFT64_horiz() +{ +#ifdef FFT_P1 + FFT64_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT64_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT64_vert() +{ +#ifdef FFT_P1 + FFT64_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT64_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT64() +{ +#ifdef FFT_HORIZ + FFT64_horiz(); +#else + FFT64_vert(); +#endif +} +#endif + +void main() +{ +#if defined(FFT_RESOLVE_REAL_TO_COMPLEX) + FFT_real_to_complex(gl_GlobalInvocationID.xy); +#elif defined(FFT_RESOLVE_COMPLEX_TO_REAL) + FFT_complex_to_real(gl_GlobalInvocationID.xy); +#elif FFT_RADIX == 4 + FFT4(); +#elif FFT_RADIX == 8 + FFT8(); +#elif FFT_RADIX == 16 + FFT16(); +#elif FFT_RADIX == 64 + FFT64(); +#else +#error Unimplemented FFT radix. +#endif +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix16.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix16.glsl new file mode 100644 index 00000000..c0600aef --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix16.glsl @@ -0,0 +1,189 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Radix 16 FFT is implemented by doing separate radix-4 FFTs in four threads, then the results are shared via shared memory, +// and the final radix-16 is completed by doing radix-4 FFT again. +// Radix-16 FFT can be implemented directly without shared memory, +// but the register pressure would likely degrade performance significantly over just using shared. + +// The radix-16 FFT would normally looks like this: +// cfloat a[i] = load_global(.... + i * quarter_samples); +// However, we interleave these into 4 separate threads (using LocalInvocationID.z) so that every thread +// gets its own FFT-4 transform. + +// Z == 0, (0, 4, 8, 12) +// Z == 1, (1, 5, 9, 13) +// Z == 2, (2, 6, 10, 14) +// Z == 3, (3, 7, 11, 15) + +// The FFT results are written in stockham autosort fashion to shared memory. +// The final FFT-4 transform is then read from shared memory with the same interleaving pattern used above. + +void FFT16_p1_horiz(uvec2 i) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 16u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2((block + 0u) * quarter_samples, 0u)); + cfloat b = load_texture(i + uvec2((block + 4u) * quarter_samples, 0u)); + cfloat c = load_texture(i + uvec2((block + 8u) * quarter_samples, 0u)); + cfloat d = load_texture(i + uvec2((block + 12u) * quarter_samples, 0u)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * quarter_samples); + cfloat b = load_global(offset + i.x + (block + 4u) * quarter_samples); + cfloat c = load_global(offset + i.x + (block + 8u) * quarter_samples); + cfloat d = load_global(offset + i.x + (block + 12u) * quarter_samples); +#endif + FFT4_p1(a, b, c, d); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + const uint p = 4u; + FFT4(a, b, c, d, FFT_OUTPUT_STEP * block, p); + + uint k = (FFT_OUTPUT_STEP * block) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * block - k) * 4u) + k; + +#ifndef FFT_OUTPUT_IMAGE + store_global(offset + 16u * i.x + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + 16u * i.x + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + 16u * i.x + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + 16u * i.x + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT16_horiz(uvec2 i, uint p) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 16u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * quarter_samples); + cfloat b = load_global(offset + i.x + (block + 4u) * quarter_samples); + cfloat c = load_global(offset + i.x + (block + 8u) * quarter_samples); + cfloat d = load_global(offset + i.x + (block + 12u) * quarter_samples); + + FFT4(a, b, c, d, FFT_OUTPUT_STEP * i.x, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 16u) + k; + + FFT4(a, b, c, d, k + block * p, 4u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + (block + 0u) * p, i.y), a); + store(ivec2(j + (block + 4u) * p, i.y), c); + store(ivec2(j + (block + 8u) * p, i.y), b); + store(ivec2(j + (block + 12u) * p, i.y), d); +#else + store_global(offset + ((j + (block + 0u) * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + (block + 4u) * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + (block + 8u) * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + (block + 12u) * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT16_p1_vert(uvec2 i) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2(0u, (block + 0u) * quarter_samples.y)); + cfloat b = load_texture(i + uvec2(0u, (block + 4u) * quarter_samples.y)); + cfloat c = load_texture(i + uvec2(0u, (block + 8u) * quarter_samples.y)); + cfloat d = load_texture(i + uvec2(0u, (block + 12u) * quarter_samples.y)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 4u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 12u) * y_stride); +#endif + FFT4_p1(a, b, c, d); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + const uint p = 4u; + FFT4(a, b, c, d, block, p); + +#ifndef FFT_OUTPUT_IMAGE + store_global((16u * i.y + block + 0u) * stride + i.x, a); + store_global((16u * i.y + block + 4u) * stride + i.x, c); + store_global((16u * i.y + block + 8u) * stride + i.x, b); + store_global((16u * i.y + block + 12u) * stride + i.x, d); +#endif +} + +void FFT16_vert(uvec2 i, uint p) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 4u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 12u) * y_stride); + + FFT4(a, b, c, d, i.y, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 16u) + k; + + FFT4(a, b, c, d, k + block * p, 4u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + (block + 0u) * p), a); + store(ivec2(i.x, j + (block + 4u) * p), c); + store(ivec2(i.x, j + (block + 8u) * p), b); + store(ivec2(i.x, j + (block + 12u) * p), d); +#else + store_global(stride * (j + (block + 0u) * p) + i.x, a); + store_global(stride * (j + (block + 4u) * p) + i.x, c); + store_global(stride * (j + (block + 8u) * p) + i.x, b); + store_global(stride * (j + (block + 12u) * p) + i.x, d); +#endif +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix4.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix4.glsl new file mode 100644 index 00000000..c933167e --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix4.glsl @@ -0,0 +1,163 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +void FFT4_p1(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d) +{ + butterfly_p1(a, c); + butterfly_p1_dir_j(b, d); + butterfly_p1(a, b); + butterfly_p1(c, d); +} + +// FFT4 is implemented by in-place radix-2 twice. +void FFT4(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, uint i, uint p) +{ + uint k = i & (p - 1u); + + ctwiddle w = twiddle(k, p); + butterfly(a, c, w); + butterfly(b, d, w); + + ctwiddle w0 = twiddle(k, 2u * p); + ctwiddle w1 = cmul_dir_j(w0); + butterfly(a, b, w0); + butterfly(c, d, w1); +} + +void FFT4_p1_horiz(uvec2 i) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 4u; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(quarter_samples, 0u)); + cfloat c = load_texture(i + uvec2(2u * quarter_samples, 0u)); + cfloat d = load_texture(i + uvec2(3u * quarter_samples, 0u)); +#else + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + quarter_samples); + cfloat c = load_global(offset + i.x + 2u * quarter_samples); + cfloat d = load_global(offset + i.x + 3u * quarter_samples); +#endif + FFT4_p1(a, b, c, d); + +#ifndef FFT_OUTPUT_IMAGE +#if FFT_CVECTOR_SIZE == 4 + store_global(offset + 4u * i.x + 0u, cfloat(a.x, c.x, b.x, d.x)); + store_global(offset + 4u * i.x + 1u, cfloat(a.y, c.y, b.y, d.y)); + store_global(offset + 4u * i.x + 2u, cfloat(a.z, c.z, b.z, d.z)); + store_global(offset + 4u * i.x + 3u, cfloat(a.w, c.w, b.w, d.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_global(offset + 4u * i.x + 0u, cfloat(a.xy, c.xy)); + store_global(offset + 4u * i.x + 1u, cfloat(b.xy, d.xy)); + store_global(offset + 4u * i.x + 2u, cfloat(a.zw, c.zw)); + store_global(offset + 4u * i.x + 3u, cfloat(b.zw, d.zw)); +#else + store_global(offset + 4u * i.x + 0u, a); + store_global(offset + 4u * i.x + 1u, c); + store_global(offset + 4u * i.x + 2u, b); + store_global(offset + 4u * i.x + 3u, d); +#endif +#endif +} + +void FFT4_p1_vert(uvec2 i) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(0u, quarter_samples.y)); + cfloat c = load_texture(i + uvec2(0u, 2u * quarter_samples.y)); + cfloat d = load_texture(i + uvec2(0u, 3u * quarter_samples.y)); +#else + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); +#endif + FFT4_p1(a, b, c, d); + +#ifndef FFT_OUTPUT_IMAGE + store_global((4u * i.y + 0u) * stride + i.x, a); + store_global((4u * i.y + 1u) * stride + i.x, c); + store_global((4u * i.y + 2u) * stride + i.x, b); + store_global((4u * i.y + 3u) * stride + i.x, d); +#endif +} + +void FFT4_horiz(uvec2 i, uint p) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 4u; + + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + quarter_samples); + cfloat c = load_global(offset + i.x + 2u * quarter_samples); + cfloat d = load_global(offset + i.x + 3u * quarter_samples); + FFT4(a, b, c, d, i.x * FFT_OUTPUT_STEP, p); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 4u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + 0u * p, i.y), a); + store(ivec2(j + 1u * p, i.y), c); + store(ivec2(j + 2u * p, i.y), b); + store(ivec2(j + 3u * p, i.y), d); +#else + store_global(offset + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT4_vert(uvec2 i, uint p) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + FFT4(a, b, c, d, i.y, p); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 4u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + 0u * p), a); + store(ivec2(i.x, j + 1u * p), c); + store(ivec2(i.x, j + 2u * p), b); + store(ivec2(i.x, j + 3u * p), d); +#else + store_global(stride * (j + 0u * p) + i.x, a); + store_global(stride * (j + 1u * p) + i.x, c); + store_global(stride * (j + 2u * p) + i.x, b); + store_global(stride * (j + 3u * p) + i.x, d); +#endif +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix64.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix64.glsl new file mode 100644 index 00000000..688bed95 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix64.glsl @@ -0,0 +1,222 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Basically the same as FFT16, but 2xFFT-8. See comments in fft_radix16.comp for more. + +void FFT64_p1_horiz(uvec2 i) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 64u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2((block + 0u) * octa_samples, 0u)); + cfloat b = load_texture(i + uvec2((block + 8u) * octa_samples, 0u)); + cfloat c = load_texture(i + uvec2((block + 16u) * octa_samples, 0u)); + cfloat d = load_texture(i + uvec2((block + 24u) * octa_samples, 0u)); + cfloat e = load_texture(i + uvec2((block + 32u) * octa_samples, 0u)); + cfloat f = load_texture(i + uvec2((block + 40u) * octa_samples, 0u)); + cfloat g = load_texture(i + uvec2((block + 48u) * octa_samples, 0u)); + cfloat h = load_texture(i + uvec2((block + 56u) * octa_samples, 0u)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * octa_samples); + cfloat b = load_global(offset + i.x + (block + 8u) * octa_samples); + cfloat c = load_global(offset + i.x + (block + 16u) * octa_samples); + cfloat d = load_global(offset + i.x + (block + 24u) * octa_samples); + cfloat e = load_global(offset + i.x + (block + 32u) * octa_samples); + cfloat f = load_global(offset + i.x + (block + 40u) * octa_samples); + cfloat g = load_global(offset + i.x + (block + 48u) * octa_samples); + cfloat h = load_global(offset + i.x + (block + 56u) * octa_samples); +#endif + FFT8_p1(a, b, c, d, e, f, g, h); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + const uint p = 8u; + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * block, p); + + uint k = (FFT_OUTPUT_STEP * block) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * block - k) * 8u) + k; + +#ifndef FFT_OUTPUT_IMAGE + store_global(offset + 64u * i.x + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + 64u * i.x + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + 64u * i.x + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + 64u * i.x + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + 64u * i.x + ((j + 4u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + 64u * i.x + ((j + 5u * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + 64u * i.x + ((j + 6u * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + 64u * i.x + ((j + 7u * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT64_horiz(uvec2 i, uint p) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 64u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * octa_samples); + cfloat b = load_global(offset + i.x + (block + 8u) * octa_samples); + cfloat c = load_global(offset + i.x + (block + 16u) * octa_samples); + cfloat d = load_global(offset + i.x + (block + 24u) * octa_samples); + cfloat e = load_global(offset + i.x + (block + 32u) * octa_samples); + cfloat f = load_global(offset + i.x + (block + 40u) * octa_samples); + cfloat g = load_global(offset + i.x + (block + 48u) * octa_samples); + cfloat h = load_global(offset + i.x + (block + 56u) * octa_samples); + + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * i.x, p); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 64u) + k; + + FFT8(a, b, c, d, e, f, g, h, k + block * p, 8u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + (block + 0u) * p, i.y), a); + store(ivec2(j + (block + 8u) * p, i.y), e); + store(ivec2(j + (block + 16u) * p, i.y), c); + store(ivec2(j + (block + 24u) * p, i.y), g); + store(ivec2(j + (block + 32u) * p, i.y), b); + store(ivec2(j + (block + 40u) * p, i.y), f); + store(ivec2(j + (block + 48u) * p, i.y), d); + store(ivec2(j + (block + 56u) * p, i.y), h); +#else + store_global(offset + ((j + (block + 0u) * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + (block + 8u) * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + ((j + (block + 16u) * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + (block + 24u) * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + ((j + (block + 32u) * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + (block + 40u) * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + ((j + (block + 48u) * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + ((j + (block + 56u) * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT64_p1_vert(uvec2 i) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2(0u, (block + 0u) * octa_samples.y)); + cfloat b = load_texture(i + uvec2(0u, (block + 8u) * octa_samples.y)); + cfloat c = load_texture(i + uvec2(0u, (block + 16u) * octa_samples.y)); + cfloat d = load_texture(i + uvec2(0u, (block + 24u) * octa_samples.y)); + cfloat e = load_texture(i + uvec2(0u, (block + 32u) * octa_samples.y)); + cfloat f = load_texture(i + uvec2(0u, (block + 40u) * octa_samples.y)); + cfloat g = load_texture(i + uvec2(0u, (block + 48u) * octa_samples.y)); + cfloat h = load_texture(i + uvec2(0u, (block + 56u) * octa_samples.y)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 16u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 24u) * y_stride); + cfloat e = load_global(offset + i.x + (block + 32u) * y_stride); + cfloat f = load_global(offset + i.x + (block + 40u) * y_stride); + cfloat g = load_global(offset + i.x + (block + 48u) * y_stride); + cfloat h = load_global(offset + i.x + (block + 56u) * y_stride); +#endif + + FFT8_p1(a, b, c, d, e, f, g, h); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + const uint p = 8u; + FFT8(a, b, c, d, e, f, g, h, block, p); + +#ifndef FFT_OUTPUT_IMAGE + store_global((64u * i.y + block + 0u) * stride + i.x, a); + store_global((64u * i.y + block + 8u) * stride + i.x, e); + store_global((64u * i.y + block + 16u) * stride + i.x, c); + store_global((64u * i.y + block + 24u) * stride + i.x, g); + store_global((64u * i.y + block + 32u) * stride + i.x, b); + store_global((64u * i.y + block + 40u) * stride + i.x, f); + store_global((64u * i.y + block + 48u) * stride + i.x, d); + store_global((64u * i.y + block + 56u) * stride + i.x, h); +#endif +} + +void FFT64_vert(uvec2 i, uint p) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 16u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 24u) * y_stride); + cfloat e = load_global(offset + i.x + (block + 32u) * y_stride); + cfloat f = load_global(offset + i.x + (block + 40u) * y_stride); + cfloat g = load_global(offset + i.x + (block + 48u) * y_stride); + cfloat h = load_global(offset + i.x + (block + 56u) * y_stride); + + FFT8(a, b, c, d, e, f, g, h, i.y, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 64u) + k; + + FFT8(a, b, c, d, e, f, g, h, k + block * p, 8u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + (block + 0u) * p), a); + store(ivec2(i.x, j + (block + 8u) * p), e); + store(ivec2(i.x, j + (block + 16u) * p), c); + store(ivec2(i.x, j + (block + 24u) * p), g); + store(ivec2(i.x, j + (block + 32u) * p), b); + store(ivec2(i.x, j + (block + 40u) * p), f); + store(ivec2(i.x, j + (block + 48u) * p), d); + store(ivec2(i.x, j + (block + 56u) * p), h); +#else + store_global(stride * (j + (block + 0u) * p) + i.x, a); + store_global(stride * (j + (block + 8u) * p) + i.x, e); + store_global(stride * (j + (block + 16u) * p) + i.x, c); + store_global(stride * (j + (block + 24u) * p) + i.x, g); + store_global(stride * (j + (block + 32u) * p) + i.x, b); + store_global(stride * (j + (block + 40u) * p) + i.x, f); + store_global(stride * (j + (block + 48u) * p) + i.x, d); + store_global(stride * (j + (block + 56u) * p) + i.x, h); +#endif +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix8.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix8.glsl new file mode 100644 index 00000000..a2460511 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_radix8.glsl @@ -0,0 +1,246 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +void FFT8_p1(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, inout cfloat e, inout cfloat f, inout cfloat g, inout cfloat h) +{ + butterfly_p1(a, e); + butterfly_p1(b, f); + butterfly_p1_dir_j(c, g); + butterfly_p1_dir_j(d, h); + + butterfly_p1(a, c); + butterfly_p1_dir_j(b, d); + butterfly_p1(e, g); + butterfly_p1(f, h); + + butterfly_p1(a, b); + butterfly_p1(c, d); + butterfly(e, f, TWIDDLE_1_8); + butterfly(g, h, TWIDDLE_3_8); +} + +void FFT8(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, inout cfloat e, inout cfloat f, inout cfloat g, inout cfloat h, uint i, uint p) +{ + uint k = i & (p - 1u); + + ctwiddle w = twiddle(k, p); + butterfly(a, e, w); + butterfly(b, f, w); + butterfly(c, g, w); + butterfly(d, h, w); + + ctwiddle w0 = twiddle(k, 2u * p); + ctwiddle w1 = cmul_dir_j(w0); + + butterfly(a, c, w0); + butterfly(b, d, w0); + butterfly(e, g, w1); + butterfly(f, h, w1); + + ctwiddle W0 = twiddle(k, 4u * p); + ctwiddle W1 = cmul(W0, TWIDDLE_1_8); + ctwiddle W2 = cmul_dir_j(W0); + ctwiddle W3 = cmul_dir_j(W1); + + butterfly(a, b, W0); + butterfly(c, d, W2); + butterfly(e, f, W1); + butterfly(g, h, W3); +} + +void FFT8_p1_horiz(uvec2 i) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 8u; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(octa_samples, 0u)); + cfloat c = load_texture(i + uvec2(2u * octa_samples, 0u)); + cfloat d = load_texture(i + uvec2(3u * octa_samples, 0u)); + cfloat e = load_texture(i + uvec2(4u * octa_samples, 0u)); + cfloat f = load_texture(i + uvec2(5u * octa_samples, 0u)); + cfloat g = load_texture(i + uvec2(6u * octa_samples, 0u)); + cfloat h = load_texture(i + uvec2(7u * octa_samples, 0u)); +#else + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + octa_samples); + cfloat c = load_global(offset + i.x + 2u * octa_samples); + cfloat d = load_global(offset + i.x + 3u * octa_samples); + cfloat e = load_global(offset + i.x + 4u * octa_samples); + cfloat f = load_global(offset + i.x + 5u * octa_samples); + cfloat g = load_global(offset + i.x + 6u * octa_samples); + cfloat h = load_global(offset + i.x + 7u * octa_samples); +#endif + FFT8_p1(a, b, c, d, e, f, g, h); + +#ifndef FFT_OUTPUT_IMAGE +#if FFT_CVECTOR_SIZE == 4 + store_global(offset + 8u * i.x + 0u, cfloat(a.x, e.x, c.x, g.x)); + store_global(offset + 8u * i.x + 1u, cfloat(b.x, f.x, d.x, h.x)); + store_global(offset + 8u * i.x + 2u, cfloat(a.y, e.y, c.y, g.y)); + store_global(offset + 8u * i.x + 3u, cfloat(b.y, f.y, d.y, h.y)); + store_global(offset + 8u * i.x + 4u, cfloat(a.z, e.z, c.z, g.z)); + store_global(offset + 8u * i.x + 5u, cfloat(b.z, f.z, d.z, h.z)); + store_global(offset + 8u * i.x + 6u, cfloat(a.w, e.w, c.w, g.w)); + store_global(offset + 8u * i.x + 7u, cfloat(b.w, f.w, d.w, h.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_global(offset + 8u * i.x + 0u, cfloat(a.xy, e.xy)); + store_global(offset + 8u * i.x + 1u, cfloat(c.xy, g.xy)); + store_global(offset + 8u * i.x + 2u, cfloat(b.xy, f.xy)); + store_global(offset + 8u * i.x + 3u, cfloat(d.xy, h.xy)); + store_global(offset + 8u * i.x + 4u, cfloat(a.zw, e.zw)); + store_global(offset + 8u * i.x + 5u, cfloat(c.zw, g.zw)); + store_global(offset + 8u * i.x + 6u, cfloat(b.zw, f.zw)); + store_global(offset + 8u * i.x + 7u, cfloat(d.zw, h.zw)); +#else + store_global(offset + 8u * i.x + 0u, a); + store_global(offset + 8u * i.x + 1u, e); + store_global(offset + 8u * i.x + 2u, c); + store_global(offset + 8u * i.x + 3u, g); + store_global(offset + 8u * i.x + 4u, b); + store_global(offset + 8u * i.x + 5u, f); + store_global(offset + 8u * i.x + 6u, d); + store_global(offset + 8u * i.x + 7u, h); +#endif +#endif +} + +void FFT8_p1_vert(uvec2 i) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(0u, octa_samples.y)); + cfloat c = load_texture(i + uvec2(0u, 2u * octa_samples.y)); + cfloat d = load_texture(i + uvec2(0u, 3u * octa_samples.y)); + cfloat e = load_texture(i + uvec2(0u, 4u * octa_samples.y)); + cfloat f = load_texture(i + uvec2(0u, 5u * octa_samples.y)); + cfloat g = load_texture(i + uvec2(0u, 6u * octa_samples.y)); + cfloat h = load_texture(i + uvec2(0u, 7u * octa_samples.y)); +#else + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + cfloat e = load_global(offset + i.x + 4u * y_stride); + cfloat f = load_global(offset + i.x + 5u * y_stride); + cfloat g = load_global(offset + i.x + 6u * y_stride); + cfloat h = load_global(offset + i.x + 7u * y_stride); +#endif + + FFT8_p1(a, b, c, d, e, f, g, h); + +#ifndef FFT_OUTPUT_IMAGE + store_global((8u * i.y + 0u) * stride + i.x, a); + store_global((8u * i.y + 1u) * stride + i.x, e); + store_global((8u * i.y + 2u) * stride + i.x, c); + store_global((8u * i.y + 3u) * stride + i.x, g); + store_global((8u * i.y + 4u) * stride + i.x, b); + store_global((8u * i.y + 5u) * stride + i.x, f); + store_global((8u * i.y + 6u) * stride + i.x, d); + store_global((8u * i.y + 7u) * stride + i.x, h); +#endif +} + +void FFT8_horiz(uvec2 i, uint p) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 8u; + + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + octa_samples); + cfloat c = load_global(offset + i.x + 2u * octa_samples); + cfloat d = load_global(offset + i.x + 3u * octa_samples); + cfloat e = load_global(offset + i.x + 4u * octa_samples); + cfloat f = load_global(offset + i.x + 5u * octa_samples); + cfloat g = load_global(offset + i.x + 6u * octa_samples); + cfloat h = load_global(offset + i.x + 7u * octa_samples); + + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * i.x, p); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 8u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + 0u * p, i.y), a); + store(ivec2(j + 1u * p, i.y), e); + store(ivec2(j + 2u * p, i.y), c); + store(ivec2(j + 3u * p, i.y), g); + store(ivec2(j + 4u * p, i.y), b); + store(ivec2(j + 5u * p, i.y), f); + store(ivec2(j + 6u * p, i.y), d); + store(ivec2(j + 7u * p, i.y), h); +#else + store_global(offset + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + ((j + 4u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + 5u * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + ((j + 6u * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + ((j + 7u * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT8_vert(uvec2 i, uint p) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + cfloat e = load_global(offset + i.x + 4u * y_stride); + cfloat f = load_global(offset + i.x + 5u * y_stride); + cfloat g = load_global(offset + i.x + 6u * y_stride); + cfloat h = load_global(offset + i.x + 7u * y_stride); + + FFT8(a, b, c, d, e, f, g, h, i.y, p); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 8u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + 0u * p), a); + store(ivec2(i.x, j + 1u * p), e); + store(ivec2(i.x, j + 2u * p), c); + store(ivec2(i.x, j + 3u * p), g); + store(ivec2(i.x, j + 4u * p), b); + store(ivec2(i.x, j + 5u * p), f); + store(ivec2(i.x, j + 6u * p), d); + store(ivec2(i.x, j + 7u * p), h); +#else + store_global(stride * (j + 0u * p) + i.x, a); + store_global(stride * (j + 1u * p) + i.x, e); + store_global(stride * (j + 2u * p) + i.x, c); + store_global(stride * (j + 3u * p) + i.x, g); + store_global(stride * (j + 4u * p) + i.x, b); + store_global(stride * (j + 5u * p) + i.x, f); + store_global(stride * (j + 6u * p) + i.x, d); + store_global(stride * (j + 7u * p) + i.x, h); +#endif +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_shared.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_shared.glsl new file mode 100644 index 00000000..5215a36a --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/fft_shared.glsl @@ -0,0 +1,179 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Most (all?) desktop GPUs have banked shared memory. +// We want to avoid bank conflicts as much as possible. +// If we don't pad the shared memory, threads in the same warp/wavefront will hit the same +// shared memory banks, and stall as each bank and only process a fixed number of requests per cycle. +// By padding, we "smear" out the requests to more banks, which greatly improves performance. + +// For architectures without banked shared memory, +// this design makes no sense, so it's a pretty important performance bit to set correctly. + +#ifndef FFT_SHARED_BANKED +#error FFT_SHARED_BANKED must be defined. +#endif + +#if FFT_SHARED_BANKED +#define FFT_BANK_CONFLICT_PADDING 1u +#else +#define FFT_BANK_CONFLICT_PADDING 0u +#endif + +#define FFT_SHARED_SIZE (uint(FFT_RADIX) + FFT_BANK_CONFLICT_PADDING) + +uint get_shared_base(uint fft) +{ + return FFT_SHARED_SIZE * (gl_LocalInvocationID.y * gl_WorkGroupSize.x + fft); +} + +#if FFT_SHARED_BANKED + +// Implementations with banked shared memory like to write 32-bit at a time, +// since that's typically how big transactions each shared memory bank can handle. +// If we try to write vec4s in one go (which will get split up to 4 writes anyways), +// we end up with 4-way bank conflicts no matter what we do. + +#if defined(FFT_VEC8) +shared uint tmpx[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpy[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpz[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpw[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#else +shared float tmpx[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared float tmpy[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#if defined(FFT_VEC4) +shared float tmpz[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared float tmpw[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#endif +#endif + +void store_shared(uint offset, cfloat v) +{ + tmpx[offset] = v.x; + tmpy[offset] = v.y; +#if defined(FFT_VEC4) || defined(FFT_VEC8) + tmpz[offset] = v.z; + tmpw[offset] = v.w; +#endif +} + +void load_shared(uint offset, out cfloat v) +{ + v.x = tmpx[offset]; + v.y = tmpy[offset]; +#if defined(FFT_VEC4) || defined(FFT_VEC8) + v.z = tmpz[offset]; + v.w = tmpw[offset]; +#endif +} +#else +// For non-banked architectures, just store and load directly. +shared cfloat tmp[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; + +void store_shared(uint offset, cfloat v) +{ + tmp[offset] = v; +} + +void load_shared(uint offset, out cfloat v) +{ + v = tmp[offset]; +} +#endif + +void store_shared(cfloat a, cfloat b, cfloat c, cfloat d, uint block, uint base) +{ + // Interleave and write out in bit-reversed order. +#if FFT_CVECTOR_SIZE == 4 + store_shared(base + 4u * block + 0u, cfloat(a.x, c.x, b.x, d.x)); + store_shared(base + 4u * block + 1u, cfloat(a.y, c.y, b.y, d.y)); + store_shared(base + 4u * block + 2u, cfloat(a.z, c.z, b.z, d.z)); + store_shared(base + 4u * block + 3u, cfloat(a.w, c.w, b.w, d.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_shared(base + 4u * block + 0u, cfloat(a.xy, c.xy)); + store_shared(base + 4u * block + 1u, cfloat(b.xy, d.xy)); + store_shared(base + 4u * block + 2u, cfloat(a.zw, c.zw)); + store_shared(base + 4u * block + 3u, cfloat(b.zw, d.zw)); +#else + store_shared(base + 4u * block + 0u, a); + store_shared(base + 4u * block + 1u, c); + store_shared(base + 4u * block + 2u, b); + store_shared(base + 4u * block + 3u, d); +#endif + + memoryBarrierShared(); + barrier(); +} + +void load_shared(out cfloat a, out cfloat b, out cfloat c, out cfloat d, uint block, uint base) +{ + load_shared(base + block + 0u * gl_WorkGroupSize.z, a); + load_shared(base + block + 1u * gl_WorkGroupSize.z, b); + load_shared(base + block + 2u * gl_WorkGroupSize.z, c); + load_shared(base + block + 3u * gl_WorkGroupSize.z, d); +} + +void store_shared(cfloat a, cfloat b, cfloat c, cfloat d, cfloat e, cfloat f, cfloat g, cfloat h, uint block, uint base) +{ + // Interleave and write out in bit-reversed order. +#if FFT_CVECTOR_SIZE == 4 + store_shared(base + 8u * block + 0u, cfloat(a.x, e.x, c.x, g.x)); + store_shared(base + 8u * block + 1u, cfloat(b.x, f.x, d.x, h.x)); + store_shared(base + 8u * block + 2u, cfloat(a.y, e.y, c.y, g.y)); + store_shared(base + 8u * block + 3u, cfloat(b.y, f.y, d.y, h.y)); + store_shared(base + 8u * block + 4u, cfloat(a.z, e.z, c.z, g.z)); + store_shared(base + 8u * block + 5u, cfloat(b.z, f.z, d.z, h.z)); + store_shared(base + 8u * block + 6u, cfloat(a.w, e.w, c.w, g.w)); + store_shared(base + 8u * block + 7u, cfloat(b.w, f.w, d.w, h.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_shared(base + 8u * block + 0u, cfloat(a.xy, e.xy)); + store_shared(base + 8u * block + 1u, cfloat(c.xy, g.xy)); + store_shared(base + 8u * block + 2u, cfloat(b.xy, f.xy)); + store_shared(base + 8u * block + 3u, cfloat(d.xy, h.xy)); + store_shared(base + 8u * block + 4u, cfloat(a.zw, e.zw)); + store_shared(base + 8u * block + 5u, cfloat(c.zw, g.zw)); + store_shared(base + 8u * block + 6u, cfloat(b.zw, f.zw)); + store_shared(base + 8u * block + 7u, cfloat(d.zw, h.zw)); +#else + store_shared(base + 8u * block + 0u, a); + store_shared(base + 8u * block + 1u, e); + store_shared(base + 8u * block + 2u, c); + store_shared(base + 8u * block + 3u, g); + store_shared(base + 8u * block + 4u, b); + store_shared(base + 8u * block + 5u, f); + store_shared(base + 8u * block + 6u, d); + store_shared(base + 8u * block + 7u, h); +#endif + + memoryBarrierShared(); + barrier(); +} + +void load_shared(out cfloat a, out cfloat b, out cfloat c, out cfloat d, out cfloat e, out cfloat f, out cfloat g, out cfloat h, uint block, uint base) +{ + load_shared(base + block + 0u * gl_WorkGroupSize.z, a); + load_shared(base + block + 1u * gl_WorkGroupSize.z, b); + load_shared(base + block + 2u * gl_WorkGroupSize.z, c); + load_shared(base + block + 3u * gl_WorkGroupSize.z, d); + load_shared(base + block + 4u * gl_WorkGroupSize.z, e); + load_shared(base + block + 5u * gl_WorkGroupSize.z, f); + load_shared(base + block + 6u * gl_WorkGroupSize.z, g); + load_shared(base + block + 7u * gl_WorkGroupSize.z, h); +} + diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/gravity_pass.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/gravity_pass.frag new file mode 100644 index 00000000..177e127c --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/gravity_pass.frag @@ -0,0 +1,9 @@ +uniform sampler1D tex; +uniform float diff; + +out vec4 fragment; +in vec4 gl_FragCoord; + +void main() { + fragment.r = texelFetch(tex, int(gl_FragCoord.x), 0).r - diff; +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/pass.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/pass.frag new file mode 100644 index 00000000..c0b8d48e --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/pass.frag @@ -0,0 +1,9 @@ +uniform sampler1D tex; + +out vec4 fragment; +in vec4 gl_FragCoord; + +/* 1D texture mapping */ +void main() { + fragment.r = texelFetch(tex, int(gl_FragCoord.x), 0).r; +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/premultiply.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/premultiply.frag new file mode 100644 index 00000000..b25c0592 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/premultiply.frag @@ -0,0 +1,15 @@ + +#if _PREMULTIPLY_ALPHA == 0 +#error __disablestage +#endif + +#request uniform "prev" tex +uniform sampler2D tex; + +out vec4 fragment; +in vec4 gl_FragCoord; + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + fragment.rgb *= fragment.a; +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth.glsl new file mode 100644 index 00000000..1df26e55 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth.glsl @@ -0,0 +1,81 @@ + #ifndef _SMOOTH_GLSL +#define _SMOOTH_GLSL + +#include ":util/common.glsl" + +#include "@smooth_parameters.glsl" +#include ":smooth_parameters.glsl" + +#define average 0 +#define maximum 1 +#define hybrid 2 + +float scale_audio(float idx) { + return -log((-(SAMPLE_RANGE) * idx) + 1) / (SAMPLE_SCALE); +} + +float iscale_audio(float idx) { + return -log((SAMPLE_RANGE) * idx) / (SAMPLE_SCALE); +} + +/* Note: the _SMOOTH_FACTOR macro is defined by GLava itself, from `#request setsmoothfactor`*/ + +float smooth_audio(in sampler1D tex, int tex_sz, highp float idx) { + + #if _PRE_SMOOTHED_AUDIO < 1 + float + smin = scale_audio(clamp(idx - _SMOOTH_FACTOR, 0, 1)) * tex_sz, + smax = scale_audio(clamp(idx + _SMOOTH_FACTOR, 0, 1)) * tex_sz; + float m = ((smax - smin) / 2.0F), s, w; + float rm = smin + m; /* middle */ + + #if SAMPLE_MODE == average + float avg = 0, weight = 0; + for (s = smin; s <= smax; s += 1.0F) { + w = ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + weight += w; + avg += texelFetch(tex, int(round(s)), 0).r * w; + } + avg /= weight; + return avg; + #elif SAMPLE_MODE == hybrid + float vmax = 0, avg = 0, weight = 0, v; + for (s = smin; s < smax; s += 1.0F) { + w = ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + weight += w; + v = texelFetch(tex, int(round(s)), 0).r * w; + avg += v; + if (vmax < v) + vmax = v; + } + return (vmax * (1 - SAMPLE_HYBRID_WEIGHT)) + ((avg / weight) * SAMPLE_HYBRID_WEIGHT); + #elif SAMPLE_MODE == maximum + float vmax = 0, v; + for (s = smin; s < smax; s += 1.0F) { + w = texelFetch(tex, int(round(s)), 0).r * ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + if (vmax < w) + vmax = w; + } + return vmax; + #endif + #else + return texelFetch(tex, int(round(idx * tex_sz)), 0).r; + #endif +} + +/* Applies the audio smooth sampling function three times to the adjacent values */ +float smooth_audio_adj(in sampler1D tex, int tex_sz, highp float idx, highp float pixel) { + float + al = smooth_audio(tex, tex_sz, max(idx - pixel, 0.0F)), + am = smooth_audio(tex, tex_sz, idx), + ar = smooth_audio(tex, tex_sz, min(idx + pixel, 1.0F)); + return (al + am + ar) / 3.0F; +} + +#ifdef TWOPI +#undef TWOPI +#endif +#ifdef PI +#undef PI +#endif +#endif /* _SMOOTH_GLSL */ diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth_pass.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth_pass.frag new file mode 100644 index 00000000..eb3fe7a6 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/util/smooth_pass.frag @@ -0,0 +1,16 @@ + +uniform sampler1D tex; +uniform int sz; +uniform int w; + +out vec4 fragment; +in vec4 gl_FragCoord; + +#undef _PRE_SMOOTHED_AUDIO +#define _PRE_SMOOTHED_AUDIO 0 + +#include ":util/smooth.glsl" + +void main() { + fragment = vec4(smooth_audio(tex, sz, gl_FragCoord.x / w), 0, 0, 0); +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave.glsl b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave.glsl new file mode 100644 index 00000000..f23848d0 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave.glsl @@ -0,0 +1,10 @@ +/* Min (vertical) line thickness */ +#define MIN_THICKNESS 1 +/* Max (vertical) line thickness */ +#define MAX_THICKNESS 6 +/* Base color to use, distance from center will multiply the RGB components */ +#define BASE_COLOR @fg:vec4(0.7, 0.2, 0.45, 1) +/* Amplitude */ +#define AMPLIFY 500 +/* Outline color */ +#define OUTLINE @bg:vec4(0.15, 0.15, 0.15, 1) diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/1.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/1.frag new file mode 100644 index 00000000..13522046 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/1.frag @@ -0,0 +1,39 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "wrange" +uniform sampler1D audio_l; + +out vec4 fragment; + +#include "@wave.glsl" +#include ":wave.glsl" + +#define index(offset) ((texture(audio_l, (gl_FragCoord.x + offset) / screen.x).r - 0.5) * AMPLIFY) + 0.5F + +void main() { + float + os = index(0), + adj0 = index(-1), + adj1 = index(1); + float + s0 = adj0 - os, + s1 = adj1 - os; + float + dmax = max(s0, s1), + dmin = min(s0, s1); + + float s = (os + (screen.y * 0.5F) - 0.5F); /* center to screen coords */ + float diff = gl_FragCoord.y - s; + if (abs(diff) < clamp(abs(s - (screen.y * 0.5)) * 6, MIN_THICKNESS, MAX_THICKNESS) + || (diff <= dmax && diff >= dmin)) { + fragment = BASE_COLOR + (abs((screen.y * 0.5F) - s) * 0.02); + } else { + fragment = vec4(0, 0, 0, 0); + } +} diff --git a/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/2.frag b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/2.frag new file mode 100644 index 00000000..5ff07067 --- /dev/null +++ b/share/dotfiles/.config/glava/glava_repo/shaders/glava/wave/2.frag @@ -0,0 +1,33 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +out vec4 fragment; /* output */ + +#include "@wave.glsl" +#include ":wave.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0 || gl_FragCoord.x == 0 || gl_FragCoord.x == screen.x - 1) + fragment = OUTLINE; + } +} diff --git a/share/dotfiles/.config/glava/graph.glsl b/share/dotfiles/.config/glava/graph.glsl new file mode 100644 index 00000000..337d3f1d --- /dev/null +++ b/share/dotfiles/.config/glava/graph.glsl @@ -0,0 +1,25 @@ + +/* Vertical scale, larger values will amplify output */ +#define VSCALE 300 +/* Rendering direction, either -1 (outwards) or 1 (inwards). */ +#define DIRECTION 1 + +/* Color gradient scale, (optionally) used in `COLOR` macro */ +#define GRADIENT 75 +/* Color definition. By default this is a gradient formed by mixing two colors. + `pos` represents the pixel position relative to the visualizer baseline. */ +#define COLOR @fg:mix(#802A2A, #4F4F92, clamp(pos / GRADIENT, 0, 1)) +/* 1 to draw outline, 0 to disable */ +#define DRAW_OUTLINE 0 +/* 1 to draw edge highlight, 0 to disable */ +#define DRAW_HIGHLIGHT 1 +/* Whether to anti-alias the border of the graph, creating a smoother curve. + This may have a small impact on performance. + Note: requires `xroot` or `none` opacity to be set */ +#define ANTI_ALIAS 0 +/* outline color */ +#define OUTLINE @bg:#262626 +/* 1 to join the two channels together in the middle, 0 to clamp both down to zero */ +#define JOIN_CHANNELS 0 +/* 1 to invert (vertically), 0 otherwise */ +#define INVERT 1 diff --git a/share/dotfiles/.config/glava/graph/1.frag b/share/dotfiles/.config/glava/graph/1.frag new file mode 100644 index 00000000..bfbf04a4 --- /dev/null +++ b/share/dotfiles/.config/glava/graph/1.frag @@ -0,0 +1,133 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +/* When we transform our audio, we need to go through the following steps: + + transform -> "window" + First, apply a window function to taper off the ends of the spectrum, helping + avoid artifacts in the FFT output. + + transform -> "fft" + Apply the Fast Fourier Transform algorithm to separate raw audio data (waves) + into their respective spectrums. + + transform -> "fft" + As part of the FFT process, we return spectrum magnitude on a log(n) scale, + as this is how the (decibel) dB scale functions. + + transform -> "gravity" + To help make our data more pleasing to look at, we apply our data received over + time to a buffer, taking the max of either the existing value in the buffer or + the data from the input. We then reduce the data by the 'gravity step', and + return the storage buffer. + + This makes frequent and abrupt changes in frequency less distracting, and keeps + short frequency responses on the screen longer. + + transform -> "avg" + As a final step, we take the average of several data frames (specified by + 'setavgframes') and return the result to further help smooth the resulting + animation. In order to mitigate abrupt changes to the average, the values + at each end of the average buffer can be weighted less with a window function + (the same window function used at the start of this step!). It can be disabled + with 'setavgwindow'. +*/ + +#include ":util/smooth.glsl" +#include "@graph.glsl" +#include ":graph.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +/* distance from center */ +#define CDIST (abs((screen.x / 2) - gl_FragCoord.x) / screen.x) +/* distance from sides (far) */ +#define FDIST (min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) + +#if DIRECTION < 0 +#define LEFT_IDX (gl_FragCoord.x) +#define RIGHT_IDX (-gl_FragCoord.x + screen.x) +/* distance from base frequencies */ +#define BDIST FDIST +/* distance from high frequencies */ +#define HDIST CDIST +#else +#define LEFT_IDX (half_w - gl_FragCoord.x) +#define RIGHT_IDX (gl_FragCoord.x - half_w) +#define BDIST CDIST +#define HDIST FDIST +#endif + +#define TWOPI 6.28318530718 + +float half_w; +float middle; +highp float pixel = 1.0F / float(screen.x); + +float get_line_height(in sampler1D tex, float idx) { + float s = smooth_audio_adj(tex, audio_sz, idx / half_w, pixel); + /* scale the data upwards so we can see it */ + s *= VSCALE; + /* clamp far ends of the screen down to make the ends of the graph smoother */ + + float fact = clamp((abs((screen.x / 2) - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + #if JOIN_CHANNELS > 0 + fact = -2 * pow(fact, 3) + 3 * pow(fact, 2); /* To avoid spikes */ + s = fact * s + (1 - fact) * middle; + #else + s *= fact; + #endif + + s *= clamp((min(gl_FragCoord.x, screen.x - gl_FragCoord.x) / screen.x) * 48, 0.0F, 1.0F); + + return s; +} + +void render_side(in sampler1D tex, float idx) { + float s = get_line_height(tex, idx); + + /* and finally set fragment color if we are in range */ + #if INVERT > 0 + float d = float(screen.y) - gl_FragCoord.y; + #else + float d = gl_FragCoord.y; + #endif + #define pos d + if (pos + 1.5 <= s) { + fragment = COLOR; + } else { + fragment = vec4(0, 0, 0, 0); + } +} + +void main() { + half_w = (screen.x / 2); + + middle = VSCALE * (smooth_audio_adj(audio_l, audio_sz, 1, pixel) + smooth_audio_adj(audio_r, audio_sz, 0, pixel)) / 2; + + if (gl_FragCoord.x < half_w) { + render_side(audio_l, LEFT_IDX); + } else { + render_side(audio_r, RIGHT_IDX); + } +} diff --git a/share/dotfiles/.config/glava/graph/2.frag b/share/dotfiles/.config/glava/graph/2.frag new file mode 100644 index 00000000..ff184452 --- /dev/null +++ b/share/dotfiles/.config/glava/graph/2.frag @@ -0,0 +1,44 @@ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if DRAW_OUTLINE == 0 && DRAW_HIGHLIGHT == 0 +#error __disablestage +#endif + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0) { + /* outline */ + #if DRAW_OUTLINE > 0 + fragment = OUTLINE; + #endif + } else if (avg.a < 1) { + /* creates a highlight along the edge of the spectrum */ + #if DRAW_HIGHLIGHT > 0 + fragment.rgb *= avg.a * 2; + #endif + } + } +} diff --git a/share/dotfiles/.config/glava/graph/3.frag b/share/dotfiles/.config/glava/graph/3.frag new file mode 100644 index 00000000..22631399 --- /dev/null +++ b/share/dotfiles/.config/glava/graph/3.frag @@ -0,0 +1,104 @@ + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +#include "@graph.glsl" +#include ":graph.glsl" + +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +/* Moves toward the border of the graph, gives the + y coordinate of the last colored pixel */ +float get_col_height_up(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y >= 0) { + #else + while (y < screen.y) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a <= 0) { + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + break; + } + #if INVERT > 0 + y -= 1; + #else + y += 1; + #endif + } + + return y; +} + +/* Moves toward the base of the graph, gives the + y coordinate of the first colored pixel */ +float get_col_height_down(float x, float oy) { + float y = oy; + #if INVERT > 0 + while (y < screen.y) { + #else + while (y >= 0) { + #endif + vec4 f = texelFetch(tex, ivec2(x, y), 0); + if (f.a > 0) { + break; + } + #if INVERT > 0 + y += 1; + #else + y -= 1; + #endif + } + + return y; +} + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + #if ANTI_ALIAS > 0 + + if (fragment.a <= 0) { + bool left_done = false; + float h2; + float a_fact = 0; + + if (texelFetch(tex, ivec2(gl_FragCoord.x - 1, gl_FragCoord.y), 0).a > 0) { + float h1 = get_col_height_up(gl_FragCoord.x - 1, gl_FragCoord.y); + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + + a_fact = clamp(abs((h1 - gl_FragCoord.y) / (h2 - h1)), 0.0, 1.0); + + left_done = true; + } + if (texelFetch(tex, ivec2(gl_FragCoord.x + 1, gl_FragCoord.y), 0).a > 0) { + if (!left_done) { + h2 = get_col_height_down(gl_FragCoord.x, gl_FragCoord.y); + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, h2), 0); + } + float h3 = get_col_height_up(gl_FragCoord.x + 1, gl_FragCoord.y); + + a_fact = max(a_fact, clamp(abs((h3 - gl_FragCoord.y) / (h2 - h3)), 0.0, 1.0)); + } + + fragment.a *= a_fact; + + } + + #endif +} diff --git a/share/dotfiles/.config/glava/graph/4.frag b/share/dotfiles/.config/glava/graph/4.frag new file mode 100644 index 00000000..f4b70595 --- /dev/null +++ b/share/dotfiles/.config/glava/graph/4.frag @@ -0,0 +1,5 @@ +#if ANTI_ALIAS == 0 +#error __disablestage +#endif + +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/radial.glsl b/share/dotfiles/.config/glava/radial.glsl new file mode 100644 index 00000000..ee5ea92c --- /dev/null +++ b/share/dotfiles/.config/glava/radial.glsl @@ -0,0 +1,36 @@ + +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 2 +/* outline color */ +#define OUTLINE @bg:#333333 +/* number of bars (use even values for best results) */ +#define NBARS 160 +/* width (in pixels) of each bar*/ +#define BAR_WIDTH 4.5 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 95 +/* Bar color. This is a gradient by default. */ +#define COLOR @fg:mix(#cc3333, #cca0a0, clamp(d / GRADIENT, 0, 1)) +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to swap left/right audio buffers, set to 1 to enable */ +#define INVERT 0 +/* Aliasing factors. Higher values mean more defined and jagged lines. + Note: aliasing does not have a notable impact on performance, but requires + `xroot` transparency to be enabled since it relies on alpha blending with + the background. */ +#define BAR_ALIAS_FACTOR 1.2 +#define C_ALIAS_FACTOR 1.8 +/* Offset (Y) of the visualization */ +#define CENTER_OFFSET_Y 0 +/* Offset (X) of the visualization */ +#define CENTER_OFFSET_X 0 + +/* (DEPRECATED) outline color */ +#define BAR_OUTLINE OUTLINE +/* (DEPRECATED) outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 0 diff --git a/share/dotfiles/.config/glava/radial/1.frag b/share/dotfiles/.config/glava/radial/1.frag new file mode 100644 index 00000000..f1942e00 --- /dev/null +++ b/share/dotfiles/.config/glava/radial/1.frag @@ -0,0 +1,116 @@ +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#include ":util/smooth.glsl" +#include "@radial.glsl" +#include ":radial.glsl" + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +#define TWOPI 6.28318530718 +#define PI 3.14159265359 + +void main() { + + #if _USE_ALPHA > 0 + #define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a)) + fragment = #00000000; + #else + #define APPLY_FRAG(f, c) f = c + #endif + + /* To handle jagged edges, we alias in the shader by using alpha layer blending. + Alpha layer blending is only applied when `xroot` transparency is enabled. */ + + float /* translate (x, y) to use (0, 0) as the center of the screen */ + dx = gl_FragCoord.x - (screen.x / 2) + CENTER_OFFSET_X, + dy = gl_FragCoord.y - (screen.y / 2) + CENTER_OFFSET_Y; + float theta = atan(dy, dx); /* fragment angle with the center of the screen as the origin */ + float d = sqrt((dx * dx) + (dy * dy)); /* distance */ + if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) { + APPLY_FRAG(fragment, OUTLINE); + #if _USE_ALPHA > 0 + fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1); + #else + return; /* return immediately if there is no alpha blending available */ + #endif + } + if (d > C_RADIUS) { + const float section = (TWOPI / NBARS); /* range (radians) for each bar */ + const float center = ((TWOPI / NBARS) / 2.0F); /* center line angle */ + float m = mod(theta, section); /* position in section (radians) */ + float ym = d * sin(center - m); /* distance from center line (cartesian coords) */ + if (abs(ym) < BAR_WIDTH / 2) { /* if within width, draw audio */ + float idx = theta + ROTATE; /* position (radians) in texture */ + float dir = mod(abs(idx), TWOPI); /* absolute position, [0, 2pi) */ + if (dir > PI) + idx = -sign(idx) * (TWOPI - dir); /* Re-correct position values to [-pi, pi) */ + #if INVERT == 0 + idx = -idx; /* Invert if needed */ + #endif + float pos = int(abs(idx) / section) / float(NBARS / 2); /* bar position, [0, 1) */ + #define smooth_f(tex) smooth_audio(tex, audio_sz, pos) /* smooth function format */ + float v; + if (idx > 0) v = smooth_f(audio_l); /* left buffer */ + else v = smooth_f(audio_r); /* right buffer */ + v *= AMPLIFY; /* amplify */ + #undef smooth_f + /* offset to fragment distance from inner circle */ + #if _USE_ALPHA > 0 + #define ALIAS_FACTOR (((BAR_WIDTH / 2) - abs(ym)) * BAR_ALIAS_FACTOR) + d -= C_RADIUS; /* start bar overlapping the inner circle for blending */ + #else + #define ALIAS_FACTOR 1 + d -= C_RADIUS + (float(C_LINE) / 2.0F); /* start bar after circle */ + #endif + if (d <= v - BAR_OUTLINE_WIDTH) { + vec4 r; + #if BAR_OUTLINE_WIDTH > 0 + if (abs(ym) < (BAR_WIDTH / 2) - BAR_OUTLINE_WIDTH) + r = COLOR; + else + r = BAR_OUTLINE; + #else + r = COLOR; + #endif + #if _USE_ALPHA > 0 + r.a *= ALIAS_FACTOR; + #endif + APPLY_FRAG(fragment, r); + return; + } + #if BAR_OUTLINE_WIDTH > 0 + if (d <= v) { + #if _USE_ALPHA > 0 + vec4 r = BAR_OUTLINE; + r.a *= ALIAS_FACTOR; + APPLY_FRAG(fragment, r); + #else + APPLY_FRAG(fragment, BAR_OUTLINE); + #endif + return; + } + #endif + } + } + fragment = APPLY_FRAG(fragment, vec4(0, 0, 0, 0)); /* default frag color */ +} diff --git a/share/dotfiles/.config/glava/radial/2.frag b/share/dotfiles/.config/glava/radial/2.frag new file mode 100644 index 00000000..66f7cd9a --- /dev/null +++ b/share/dotfiles/.config/glava/radial/2.frag @@ -0,0 +1 @@ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/rc.glsl b/share/dotfiles/.config/glava/rc.glsl new file mode 100644 index 00000000..a0d43ca2 --- /dev/null +++ b/share/dotfiles/.config/glava/rc.glsl @@ -0,0 +1,236 @@ + +/* The module to use. A module is a set of shaders used to produce + the visualizer. The structure for a module is the following: + + module_name [directory] + 1.frag [file: fragment shader], + 2.frag [file: fragment shader], + ... + + Shaders are loaded in numerical order, starting at '1.frag', + continuing indefinitely. The results of each shader (except + for the final pass) is given to the next shader in the list + as a 2D sampler. + + See documentation for more details. */ +#request mod bars + +/* Window hints */ +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false + +/* Set window background opacity mode. Possible values are: + + "native" - True transparency provided by the compositor. Can + reduce performance on some systems, depending on + the compositor used. + + "xroot" - Maintain a copy of the root window's pixmap + (usually the desktop background) to provide a + pseudo-transparent effect. Useful when no compositor + is available or native transparency isn't nessecary. + Has very little performance impact. + + "none" - Disable window opacity completely. */ +#request setopacity "native" + +/* Whether to average and mirror left and right audio input channels. + This may cause some modules to only render a single channel. */ +#request setmirror false + +/* OpenGL context and GLSL shader versions, do not change unless + you *absolutely* know what you are doing. */ +#request setversion 3 3 +#request setshaderversion 330 + +/* Window title */ +#request settitle "GLava" + +/* Window geometry (x, y, width, height) */ +#request setgeometry 0 0 800 600 + +/* Window background color (RGBA format). + Does not work with `setopacity "xroot"` */ +#request setbg 00000000 + +/* (X11 only) EWMH Window type. Possible values are: + + "desktop", "dock", "toolbar", "menu", + "utility", "splash", "dialog", "normal" + + This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE), + where (TYPE) is the one of the window types listed (after being + converted to uppercase). + + Alternatively, you can set this value to "!", which will cause + the window to be unmanaged. If this is set, then `addxwinstate` + will do nothing, but you can use "!+" and "!-" to stack on top + or below other windows. +*/ +#request setxwintype "normal" + +/* (X11 only) EWMH Window state atoms (multiple can be specified). + Possible values are: + + "modal", "sticky", "maximized_vert", "maximized_horz", + "shaded", "skip_taskbar", "skip_pager", "hidden", "fullscreen", + "above", "below", "demands_attention", "focused", "pinned" + + This will add _NET_WM_STATE_(TYPE) atoms to _NET_WM_STATE, + where (TYPE) is one of the window states listed (after being + converted to uppercase). + + The lines below (commented out by default) are of relevance + if you are trying to get GLava to behave as a desktop widget + and your WM is not correctly responding to the "desktop" value + for `setxwintype`. +*/ +// #request addxwinstate "sticky" +// #request addxwinstate "skip_taskbar" +// #request addxwinstate "skip_pager" +// #request addxwinstate "above" +// #request addxwinstate "pinned" + +/* (X11 only) Use the XShape extension to support clicking through + the GLava window. Useful when you want to interact with other + desktop windows (icons, menus, desktop shells). Enabled by + default when GLava itself is a desktop window. */ +#request setclickthrough false + +/* Audio source + + When the "pulseaudio" backend is set, this can be a number or + a name of an audio sink or device to record from. Set to "auto" + to use the default output device. + + When the "fifo" backend is set, "auto" is interpreted as + "/tmp/mpd.fifo". Otherwise, a valid path should be provided. */ +#request setsource "auto" + +/* Buffer swap interval (vsync), set to '0' to prevent + waiting for refresh, '1' (or more) to wait for the specified + amount of frames. */ +#request setswap 1 + +/* Linear interpolation for audio data frames. Drastically + improves smoothness with configurations that yield low UPS + (`setsamplerate` and `setsamplesize`), or monitors that have + high refresh rates. + + This feature itself, however, will effect performance as it + will have to interpolate data every frame on the CPU. It will + automatically (and temporarily) disable itself if the update + rate is close to, or higher than the framerate: + + if (update_rate / frame_rate > 0.9) disable_interpolation; + + This will delay data output by one update frame, so it can + desync audio with visual effects on low UPS configs. */ +#request setinterpolate false + +/* Frame limiter, set to the frames per second (FPS) desired or + simply set to zero (or lower) to disable the frame limiter. */ +#request setframerate 0 + +/* Suspends rendering if a fullscreen window is focused while + GLava is still visible (ie. on another monitor). This prevents + rendering from interfering with other graphically intensive + tasks. + + If GLava is minimized or completely obscured, it will not + render regardless of this option. */ +#request setfullscreencheck false + +/* Enable/disable printing framerate every second. 'FPS' stands + for 'Frames Per Second', and 'UPS' stands for 'Updates Per + Second'. Updates are performed when new data is submitted + by pulseaudio, and require transformations to be re-applied + (thus being a good measure of how much work your CPU has to + perform over time) */ +#request setprintframes true + +/* PulseAudio sample buffer size. Lower values result in more + frequent audio updates (also depends on sampling rate), but + will also require all transformations to be applied much + more frequently (CPU intensive). + + High (>2048, with 22050 Hz) values will decrease accuracy + (as some signals can be missed by transformations like FFT) + + The following settings (@22050 Hz) produce the listed rates: + + Sample UPS Description + - 2048 -> 43.0 (low accuracy, cheap), use with < 60 FPS + - 1024 -> 86.1 (high accuracy, expensive), use with >= 60 FPS + - 512 -> 172.3 (extreme accuracy, very expensive), use only + for graphing accurate spectrum data with + custom modules. + + If the framerate drops below the update rate, the update rate + will be locked to the framerate (to prevent wasting CPU time). + This behaviour means you can use a 1024 sample size on a 60Hz + monitor with vsync enabled to get 60FPS and 60UPS. + + For high refresh rate monitors (120+ Hz), it's recommended to + also stick with the 1024 sample size and use interpolation to + smooth the data, as accuracy beyond this setting is mostly + meaningless for visual purposes. +*/ +#request setsamplesize 1024 + +/* Audio buffer size to be used for processing and shaders. + Increasing this value can have the effect of adding 'gravity' + to FFT output, as the audio signal will remain in the buffer + longer. + + This value has a _massive_ effect on FFT performance and + quality for some modules. */ +#request setbufsize 4096 + +/* PulseAudio sample rate. Lower values can add 'gravity' to + FFT output, but can also reduce accuracy. Most hardware + samples at 44100Hz. + + Lower sample rates also can make output more choppy, when + not using interpolation. It's generally OK to leave this + value unless you have a strange PulseAudio configuration. + + This option does nothing when using the "fifo" audio + backend. Instead, an ideal rate should be be configured + in the application generating the output. */ +#request setsamplerate 22050 + +/* Enable GPU acceleration of the audio buffer's fourier transform. + This drastically reduces CPU usage, but should be avoided on + old integrated graphics hardware. + + Enabling this also enables acceleration for post-FFT processing + effects, such as gravity, averaging, windowing, and interpolation. */ +#request setaccelfft true + +/* ** DEPRECATED ** + Force window geometry (locking the window in place), useful + for some pesky WMs that try to reposition the window when + embedding in the desktop. + + This routinely sends X11 events and should be avoided. */ +#request setforcegeometry false + +/* ** DEPRECATED ** + Force window to be raised (focused in some WMs), useful for + WMs that have their own stacking order for desktop windows. + + This routinely sends X11 events and should be avoided. */ +#request setforceraised false + +/* ** DEPRECATED ** + Scale down the audio buffer before any operations are + performed on the data. Higher values are faster. + + This value can affect the output of various transformations, + since it applies (crude) averaging to the data when shrinking + the buffer. It is reccommended to use `setsamplerate` and + `setsamplesize` to improve performance or accuracy instead. */ +#request setbufscale 1 diff --git a/share/dotfiles/.config/glava/smooth_parameters.glsl b/share/dotfiles/.config/glava/smooth_parameters.glsl new file mode 100644 index 00000000..09e829fa --- /dev/null +++ b/share/dotfiles/.config/glava/smooth_parameters.glsl @@ -0,0 +1,78 @@ + +/* Settings for smoothing functions and transformations commonly + used to display FFT output. + + IMPORTANT: THESE VALUES CAN BE OVERRIDDEN IN MODULE CONFIG + FILES, IF CHANGING VALUES HERE DOES NOT WORK, CHECK + TO MAKE SURE THEY ARE NOT BEING SET ELSEWHERE. +*/ + +/* The type of formula to use for weighting values when smoothing. + Possible values: + + - circular heavily rounded points + - sinusoidal rounded at both low and high weighted values + like a sine wave + - linear not rounded at all; linear distance + */ +#define ROUND_FORMULA sinusoidal + +/* The sampling mode for processing raw FFT input: + + - average averages all the inputs in the sample range for + a given point. Produces smooth output, but peaks + are not well represented + - maximum obtains the best value from the closest peak in + the sample range. Very accurate peaks, but + output is jagged and sporadic. + - hybrid uses the results from both `average` and `maximum` + with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ +#define SAMPLE_MODE average +/* Weight should be provided in the range (0, 1). Higher values favour + averaged results. `hybrid` mode only. */ +#define SAMPLE_HYBRID_WEIGHT 0.65 + +/* Factor used to scale frequencies. Lower values allows lower + frequencies to occupy more space. */ +#define SAMPLE_SCALE 8 + +/* The frequency range to sample. 1.0 would be the entire FFT output, + and lower values reduce the displayed frequencies in a log-like + scale. */ +#define SAMPLE_RANGE 0.9 + +/* Factor for how to scale higher frequencies. Used in a linear equation + which is multiplied by the result of the fft transformation. */ +#request setfftscale 10.2 + +/* Cutoff for the bass end of the audio data when scaling frequencies. + Higher values cause more of the bass frequencies to be skipped when + scaling. */ +#request setfftcutoff 0.3 + +/* How many frames to queue and run through the average function. + Increasing this value will create latency between the audio and the + animation, but will make for much smoother results. */ +#request setavgframes 5 + +/* Whether to window frames ran through the average function (new & old + frames are weighted less). This massively helps smoothing out + spontaneous values in the animation. */ +#request setavgwindow true + +/* Gravity step, higher values means faster drops. The step is applied + in a rate independant method like so: + + val -= (gravitystep) * (seconds per update) */ +#request setgravitystep 4.2 + +/* Smoothing factor. Larger values mean more smoothing in the output, + however high values can be expensive to compute. Values are in + normalized width: [0.0, 1.0) */ +#request setsmoothfactor 0.025 + +/* Whether to use a separate pass for audio data while smoothing. On + most hardware, this will improve performance, but involves doing a + separate render step for each audio texture and will add some driver + (CPU) overhead. */ +#request setsmoothpass true diff --git a/share/dotfiles/.config/glava/test/1.frag b/share/dotfiles/.config/glava/test/1.frag new file mode 100644 index 00000000..5a7bd634 --- /dev/null +++ b/share/dotfiles/.config/glava/test/1.frag @@ -0,0 +1,33 @@ +/* Request transforms and basic uniforms to assert nothing here breaks */ + +#include ":util/smooth.glsl" + +in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; + +#request uniform "audio_sz" audio_sz +uniform int audio_sz; + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "fft" +#request transform audio_l "gravity" +#request transform audio_l "avg" +uniform sampler1D audio_l; + +#request uniform "audio_r" audio_r +#request transform audio_r "window" +#request transform audio_r "fft" +#request transform audio_r "gravity" +#request transform audio_r "avg" +uniform sampler1D audio_r; + +out vec4 fragment; + +void main() { + float dummy_result0 = smooth_audio(audio_l, audio_sz, gl_FragCoord.x / float(screen.x)); + float dummy_result1 = smooth_audio(audio_r, audio_sz, gl_FragCoord.x / float(screen.x)); + fragment = vec4(1.0, 0, 0, float(1) / float(3)); +} diff --git a/share/dotfiles/.config/glava/test/2.frag b/share/dotfiles/.config/glava/test/2.frag new file mode 100644 index 00000000..85498f85 --- /dev/null +++ b/share/dotfiles/.config/glava/test/2.frag @@ -0,0 +1,12 @@ +/* Pass the initial results to a dummy shader to assert that linking works correctly */ + +in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ + +out vec4 fragment; /* output */ + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); +} diff --git a/share/dotfiles/.config/glava/test/3.frag b/share/dotfiles/.config/glava/test/3.frag new file mode 100644 index 00000000..d5db2d25 --- /dev/null +++ b/share/dotfiles/.config/glava/test/3.frag @@ -0,0 +1,2 @@ +/* Assert that the premultiply step works */ +#include ":util/premultiply.frag" diff --git a/share/dotfiles/.config/glava/test_rc.glsl b/share/dotfiles/.config/glava/test_rc.glsl new file mode 100644 index 00000000..60ebf431 --- /dev/null +++ b/share/dotfiles/.config/glava/test_rc.glsl @@ -0,0 +1,27 @@ +#request mod test +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false +#request setopacity "native" +#request setmirror false +#request setversion 3 3 +#request setshaderversion 330 +#request settitle "GLava" +#request setgeometry 0 0 640 640 +#request setbg 00000000 +#request setxwintype "desktop" +#request setclickthrough false +#request setsource "auto" +#request setswap 0 +#request setinterpolate true +#request setframerate 0 +#request setfullscreencheck false +#request setprintframes true +#request setsamplesize 1024 +#request setbufsize 4096 +#request setsamplerate 22050 +#request setforcegeometry false +#request setforceraised false +#request setbufscale 1 +#request settesteval 55000055 diff --git a/share/dotfiles/.config/glava/util/average_pass.frag b/share/dotfiles/.config/glava/util/average_pass.frag new file mode 100644 index 00000000..43de1bc2 --- /dev/null +++ b/share/dotfiles/.config/glava/util/average_pass.frag @@ -0,0 +1,46 @@ +out vec4 fragment; +in vec4 gl_FragCoord; + +#include ":util/common.glsl" + +/* + This averaging shader uses compile-time loop generation to ensure two things: + + - We can avoid requiring GL 4.3 features to dynamically index texture arrays + - We ensure no branching occurs in this shader for optimial performance. + + The alternative is requiring the GLSL compiler to determine that a loop for + texture array indexes (which must be determined at compile-time in 3.3) can be + expanded if the bounds are constant. This is somewhat vendor-specific so GLava + provides a special `#expand` macro to solve this problem in the preprocessing + stage. +*/ + +#define SAMPLER(I) uniform sampler1D t##I; +#expand SAMPLER _AVG_FRAMES + +#define WIN_FUNC window_frame + +void main() { + float r = 0; + + /* Disable windowing for two frames (distorts results) */ + #if _AVG_FRAMES == 2 + #define _AVG_WINDOW 0 + #endif + + /* Use 'shallow' windowing for 3 frames to ensure the first & last + frames have a reasonable amount of weight */ + #if _AVG_FRAMES == 3 + #define WIN_FUNC window_shallow + #endif + + #if _AVG_WINDOW == 0 + #define F(I) r += texelFetch(t##I, int(gl_FragCoord.x), 0).r + #else + #define F(I) r += window(I, _AVG_FRAMES - 1) * texelFetch(t##I, int(gl_FragCoord.x), 0).r + #endif + #expand F _AVG_FRAMES + + fragment.r = r / _AVG_FRAMES; +} diff --git a/share/dotfiles/.config/glava/util/common.glsl b/share/dotfiles/.config/glava/util/common.glsl new file mode 100644 index 00000000..91e0777a --- /dev/null +++ b/share/dotfiles/.config/glava/util/common.glsl @@ -0,0 +1,23 @@ +#ifndef _COMMON_GLSL +#define _COMMON_GLSL + +#ifndef TWOPI +#define TWOPI 6.28318530718 +#endif + +#ifndef PI +#define PI 3.14159265359 +#endif + +/* Window value t that resides in range [0, sz] */ +#define window(t, sz) (0.53836 - (0.46164 * cos(TWOPI * t / sz))) +#define window_frame(t, sz) (0.6 - (0.4 * cos(TWOPI * t / sz))) +#define window_shallow(t, sz) (0.7 - (0.3 * cos(TWOPI * t / sz))) +/* Do nothing (used as an option for configuration) */ +#define linear(x) (x) +/* Take value x that scales linearly between [0, 1) and return its sinusoidal curve */ +#define sinusoidal(x) ((0.5 * sin((PI * (x)) - (PI / 2))) + 0.5) +/* Take value x that scales linearly between [0, 1) and return its circlar curve */ +#define circular(x) sqrt(1 - (((x) - 1) * ((x) - 1))) + +#endif diff --git a/share/dotfiles/.config/glava/util/fft_common.glsl b/share/dotfiles/.config/glava/util/fft_common.glsl new file mode 100644 index 00000000..c8f0e3cb --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_common.glsl @@ -0,0 +1,842 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#if defined(FFT_FP16) && defined(GL_ES) +precision mediump float; +#endif + +#define BINDING_SSBO_IN 0 +#define BINDING_SSBO_OUT 1 +#define BINDING_SSBO_AUX 2 +#define BINDING_UBO 3 +#define BINDING_TEXTURE0 4 +#define BINDING_TEXTURE1 5 +#define BINDING_IMAGE 6 + +layout(std140, binding = BINDING_UBO) uniform UBO +{ + uvec4 p_stride_padding; + vec4 texture_offset_scale; +} constant_data; +#define uStride constant_data.p_stride_padding.y + +// cfloat is the "generic" type used to hold complex data. +// GLFFT supports vec2, vec4 and "vec8" for its complex data +// to be able to work on 1, 2 and 4 complex values in a single vector. +// FFT_VEC2, FFT_VEC4, FFT_VEC8 defines which type we're using. +// The shaders are compiled on-demand. + +// FP16 values are packed as 2xfp16 in a uint. +// packHalf2x16 and unpackHalf2x16 are used to bitcast between these formats. + +// The complex number format is (real, imag, real, imag, ...) in an interleaved fashion. +// For complex-to-real or real-to-complex transforms, we consider two adjacent real samples to be a complex number as-is. +// Separate "resolve" passes are added to make the transform correct. + +#if defined(FFT_VEC2) +#define cfloat vec2 +#define cfloat_buffer_fp16 uint +#elif defined(FFT_VEC4) +#define cfloat vec4 +#define cfloat_buffer_fp16 uvec2 +#elif defined(FFT_VEC8) +#if !defined(FFT_INPUT_FP16) || !defined(FFT_OUTPUT_FP16) || !defined(FFT_FP16) +#error FFT_VEC8 must use FP16 everywhere. +#endif +#define cfloat uvec4 +#define cfloat_buffer_fp16 uvec4 +#else +#error FFT_VEC2, FFT_VEC4 or FFT_VEC8 must be defined. +#endif + +#ifdef FFT_INPUT_FP16 +#define cfloat_buffer_in cfloat_buffer_fp16 +#else +#define cfloat_buffer_in cfloat +#endif + +#ifdef FFT_OUTPUT_FP16 +#define cfloat_buffer_out cfloat_buffer_fp16 +#else +#define cfloat_buffer_out cfloat +#endif + +// Normally this would be sqrt(1 / radix), but we'd have to apply normalization +// for every pass instead of just half of them. Also, 1 / 2^n is "lossless" in FP math. +#ifdef FFT_NORMALIZE +#define FFT_NORM_FACTOR (1.0 / float(FFT_RADIX)) +#endif + +// FFT_CVECTOR_SIZE defines an interleaving stride for the first pass. +// The first FFT pass with stockham autosort needs to do some shuffling around if we're processing +// more than one complex value per vector. +// This is only needed for horizontal transforms since we vectorize horizontally and different elements +// in the vector are from different transforms when we do vertical transforms. + +#if defined(FFT_P1) && !defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8) +#define FFT_CVECTOR_SIZE 4 +#elif defined(FFT_P1) && ((!defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC4)) || (defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8))) +#define FFT_CVECTOR_SIZE 2 +#else +#define FFT_CVECTOR_SIZE 1 +#endif + +#ifdef GL_ES +#define FFT_HIGHP highp +#else +#define FFT_HIGHP +#endif + +#ifdef FFT_VEC8 + +// Currently unlikely to be useful. +uvec4 PADD(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) + unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) + unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) + unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) + unpackHalf2x16(b.w))); +} + +uvec4 PSUB(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) - unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) - unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) - unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) - unpackHalf2x16(b.w))); +} + +uvec4 PMUL(uvec4 a, uvec4 b) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(a.x) * unpackHalf2x16(b.x)), + packHalf2x16(unpackHalf2x16(a.y) * unpackHalf2x16(b.y)), + packHalf2x16(unpackHalf2x16(a.z) * unpackHalf2x16(b.z)), + packHalf2x16(unpackHalf2x16(a.w) * unpackHalf2x16(b.w))); +} + +uvec4 CONJ_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).yx), + packHalf2x16(unpackHalf2x16(v.y).yx), + packHalf2x16(unpackHalf2x16(v.z).yx), + packHalf2x16(unpackHalf2x16(v.w).yx)); +} + +uvec4 LDUP_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).xx), + packHalf2x16(unpackHalf2x16(v.y).xx), + packHalf2x16(unpackHalf2x16(v.z).xx), + packHalf2x16(unpackHalf2x16(v.w).xx)); +} + +uvec4 HDUP_SWIZZLE(uvec4 v) +{ + return uvec4( + packHalf2x16(unpackHalf2x16(v.x).yy), + packHalf2x16(unpackHalf2x16(v.y).yy), + packHalf2x16(unpackHalf2x16(v.z).yy), + packHalf2x16(unpackHalf2x16(v.w).yy)); +} + +// Sign-flip. Works for the cases we're interested in. +uvec4 cmul_minus_j(uvec4 v) +{ + return uvec4(0x80000000u) ^ CONJ_SWIZZLE(v); +} + +uvec4 cmul_plus_j(uvec4 v) +{ + return uvec4(0x00008000u) ^ CONJ_SWIZZLE(v); +} + +uvec4 cmul(uvec4 a, uvec4 b) +{ + uvec4 r3 = CONJ_SWIZZLE(a); + uvec4 r1 = LDUP_SWIZZLE(b); + uvec4 R0 = PMUL(a, r1); + uvec4 r2 = HDUP_SWIZZLE(b); + uvec4 R1 = PMUL(r2, r3); + return PADD(R0, uvec4(0x8000u) ^ R1); +} + +void butterfly(inout uvec4 a, inout uvec4 b, uvec4 w) +{ + uvec4 t = cmul(b, w); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly(inout uvec4 a, inout uvec4 b, vec4 w) +{ + uvec4 t = cmul(b, uvec2(packHalf2x16(w.xy), packHalf2x16(w.zw)).xxyy); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly(inout uvec4 a, inout uvec4 b, vec2 w) +{ + uvec4 t = cmul(b, uvec4(packHalf2x16(w))); + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly_p1(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = PSUB(a, t); + a = PADD(a, t); +} + +void butterfly_p1_minus_j(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = uvec4(0x80000000u) ^ (PSUB(CONJ_SWIZZLE(a), CONJ_SWIZZLE(t))); + a = PADD(a, t); +} + +void butterfly_p1_plus_j(inout uvec4 a, inout uvec4 b) +{ + uvec4 t = b; + b = uvec4(0x00008000u) ^ (PSUB(CONJ_SWIZZLE(a), CONJ_SWIZZLE(t))); + a = PADD(a, t); +} +#endif + +// Complex multiply. +vec4 cmul(vec4 a, vec4 b) +{ + vec4 r3 = a.yxwz; + vec4 r1 = b.xxzz; + vec4 R0 = a * r1; + vec4 r2 = b.yyww; + vec4 R1 = r2 * r3; + return R0 + vec4(-R1.x, R1.y, -R1.z, R1.w); +} + +vec2 cmul(vec2 a, vec2 b) +{ + vec2 r3 = a.yx; + vec2 r1 = b.xx; + vec2 R0 = a * r1; + vec2 r2 = b.yy; + vec2 R1 = r2 * r3; + return R0 + vec2(-R1.x, R1.y); +} + +#ifdef FFT_INPUT_TEXTURE + +#ifndef FFT_P1 +#error Input texture can only be used when P == 1. +#endif + +#ifdef GL_ES +#if defined(FFT_INPUT_FP16) || defined(FFT_FP16) +precision mediump sampler2D; +#else +precision highp sampler2D; +#endif +#endif + +#define uTexelOffset constant_data.texture_offset_scale.xy +#define uTexelScale constant_data.texture_offset_scale.zw + +layout(binding = BINDING_TEXTURE0) uniform sampler2D uTexture; +#ifdef FFT_CONVOLVE +layout(binding = BINDING_TEXTURE1) uniform sampler2D uTexture2; +#endif + +cfloat load_texture(sampler2D sampler, uvec2 coord) +{ + FFT_HIGHP vec2 uv = vec2(coord) * uTexelScale + uTexelOffset; + + // Quite messy, this :) +#if defined(FFT_VEC8) + #if defined(FFT_INPUT_REAL) + return uvec4( + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(4, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(5, 0)).x)), + packHalf2x16(vec2(textureLodOffset(sampler, uv, 0.0, ivec2(6, 0)).x, textureLodOffset(sampler, uv, 0.0, ivec2(7, 0)).x))); + #elif defined(FFT_DUAL) + vec4 c0 = textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)); + vec4 c1 = textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)); + return uvec4(packHalf2x16(c0.xy), packHalf2x16(c0.zw), packHalf2x16(c1.xy), packHalf2x16(c1.zw)); + #else + return uvec4( + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).xy), + packHalf2x16(textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).xy)); + #endif +#elif defined(FFT_VEC4) + #if defined(FFT_INPUT_REAL) + return vec4( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(2, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(3, 0)).x); + #elif defined(FFT_DUAL) + return textureLod(sampler, uv, 0.0); + #else + return vec4( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).xy, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).xy); + #endif +#elif defined(FFT_VEC2) + #if defined(FFT_INPUT_REAL) + return vec2( + textureLodOffset(sampler, uv, 0.0, ivec2(0, 0)).x, + textureLodOffset(sampler, uv, 0.0, ivec2(1, 0)).x); + #else + return textureLod(sampler, uv, 0.0).xy; + #endif +#endif +} + +cfloat load_texture(uvec2 coord) +{ +#ifdef FFT_CONVOLVE + // Convolution in frequency domain is multiplication. + cfloat c0 = load_texture(uTexture, coord); + cfloat c1 = load_texture(uTexture2, coord); + return cmul(c0, c1); +#else + return load_texture(uTexture, coord); +#endif +} + +// Implement a dummy load_global, or we have to #ifdef out lots of dead code elsewhere. +#ifdef FFT_VEC8 +cfloat load_global(uint offset) +{ + return cfloat(0u); +} +#else +cfloat load_global(uint offset) +{ + return cfloat(0.0); +} +#endif + +#else + +layout(std430, binding = BINDING_SSBO_IN) readonly buffer Block +{ + cfloat_buffer_in data[]; +} fft_in; + +#ifdef FFT_CONVOLVE +layout(std430, binding = BINDING_SSBO_AUX) readonly buffer Block2 +{ + cfloat_buffer_in data[]; +} fft_in2; + +cfloat load_global(uint offset) +{ + // Convolution in frequency domain is multiplication. +#if defined(FFT_INPUT_FP16) && defined(FFT_VEC2) + return cmul(unpackHalf2x16(fft_in.data[offset]), unpackHalf2x16(fft_in2.data[offset])); +#elif defined(FFT_INPUT_FP16) && defined(FFT_VEC4) + uvec2 data = fft_in.data[offset]; + uvec2 data2 = fft_in2.data[offset]; + return cmul(vec4(unpackHalf2x16(data.x), unpackHalf2x16(data.y)), vec4(unpackHalf2x16(data2.x), unpackHalf2x16(data2.y))); +#else + return cmul(fft_in.data[offset], fft_in2.data[offset]); +#endif +} +#else +cfloat load_global(uint offset) +{ +#if defined(FFT_INPUT_FP16) && defined(FFT_VEC2) + return unpackHalf2x16(fft_in.data[offset]); +#elif defined(FFT_INPUT_FP16) && defined(FFT_VEC4) + uvec2 data = fft_in.data[offset]; + return vec4(unpackHalf2x16(data.x), unpackHalf2x16(data.y)); +#else + return fft_in.data[offset]; +#endif +} +#endif +#endif + +#ifndef FFT_OUTPUT_IMAGE +layout(std430, binding = BINDING_SSBO_OUT) writeonly buffer BlockOut +{ + cfloat_buffer_out data[]; +} fft_out; + +void store_global(uint offset, cfloat v) +{ +#ifdef FFT_NORM_FACTOR +#ifdef FFT_VEC8 + v = PMUL(uvec4(packHalf2x16(vec2(FFT_NORM_FACTOR))), v); +#else + v *= FFT_NORM_FACTOR; +#endif +#endif + +#if defined(FFT_OUTPUT_FP16) && defined(FFT_VEC2) + fft_out.data[offset] = packHalf2x16(v); +#elif defined(FFT_OUTPUT_FP16) && defined(FFT_VEC4) + fft_out.data[offset] = uvec2(packHalf2x16(v.xy), packHalf2x16(v.zw)); +#else + fft_out.data[offset] = v; +#endif +} +#endif + +#ifdef FFT_OUTPUT_IMAGE + +#ifdef GL_ES +#ifdef FFT_OUTPUT_REAL +precision highp image2D; +#else +precision mediump image2D; +#endif +precision highp uimage2D; +#endif + +//#ifdef FFT_P1 +//#error FFT_OUTPUT_IMAGE is not supported in first pass. +//#endif + +// Currently, GLFFT only supports outputing to "fixed" formats like these. +// Should be possible to add options for this to at least choose between FP16/FP32 output, +// and maybe rgba8_unorm for FFT_DUAL case. +#if defined(FFT_DUAL) +layout(rgba16f, binding = BINDING_IMAGE) uniform writeonly image2D uImage; +#elif defined(FFT_OUTPUT_REAL) +layout(r32f, binding = BINDING_IMAGE) uniform writeonly image2D uImage; +#else +// GLES 3.1 doesn't support rg16f layout for some reason, so work around it ... +layout(r32ui, binding = BINDING_IMAGE) uniform writeonly uimage2D uImage; +#endif + +void store(ivec2 coord, vec4 value) +{ +#ifdef FFT_NORM_FACTOR + value *= FFT_NORM_FACTOR; +#endif + +#if defined(FFT_DUAL) + imageStore(uImage, coord, value); +#elif defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(3, 0), value.wwww); +#else + imageStore(uImage, coord + ivec2(0, 0), uvec4(packHalf2x16(value.xy))); + imageStore(uImage, coord + ivec2(1, 0), uvec4(packHalf2x16(value.zw))); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(4, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(3, 0), value.wwww); +#else + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), uvec4(packHalf2x16(value.xy))); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), uvec4(packHalf2x16(value.zw))); +#endif +#else +#error Inconsistent defines. +#endif +} + +#ifndef FFT_DUAL +void store(ivec2 coord, vec2 value) +{ +#ifdef FFT_NORM_FACTOR + value *= FFT_NORM_FACTOR; +#endif + +#if defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); +#else + imageStore(uImage, coord, uvec4(packHalf2x16(value.xy))); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value.yyyy); +#else + imageStore(uImage, coord, uvec4(packHalf2x16(value.xy))); +#endif +#else +#error Inconsistent defines. +#endif +} +#endif + +#ifdef FFT_VEC8 +void store(ivec2 coord, uvec4 value) +{ +#ifdef FFT_NORM_FACTOR + value = PMUL(value, uvec4(packHalf2x16(vec2(FFT_NORM_FACTOR)))); +#endif + +#if defined(FFT_DUAL) +#if defined(FFT_HORIZ) + imageStore(uImage, coord + ivec2(0, 0), vec4(unpackHalf2x16(value.x), unpackHalf2x16(value.y))); + imageStore(uImage, coord + ivec2(1, 0), vec4(unpackHalf2x16(value.z), unpackHalf2x16(value.w))); +#else + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), vec4(unpackHalf2x16(value.x), unpackHalf2x16(value.y))); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), vec4(unpackHalf2x16(value.z), unpackHalf2x16(value.w))); +#endif +#elif defined(FFT_HORIZ) +#ifdef FFT_OUTPUT_REAL + vec2 value0 = unpackHalf2x16(value.x); + vec2 value1 = unpackHalf2x16(value.y); + vec2 value2 = unpackHalf2x16(value.z); + vec2 value3 = unpackHalf2x16(value.w); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(0, 0), value0.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(1, 0), value0.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(2, 0), value1.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(3, 0), value1.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(4, 0), value2.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(5, 0), value2.yyyy); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(6, 0), value3.xxxx); + imageStore(uImage, coord * ivec2(2, 1) + ivec2(7, 0), value3.yyyy); +#else + imageStore(uImage, coord + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord + ivec2(3, 0), value.wwww); +#endif +#elif defined(FFT_VERT) +#ifdef FFT_OUTPUT_REAL + vec2 value0 = unpackHalf2x16(value.x); + vec2 value1 = unpackHalf2x16(value.y); + vec2 value2 = unpackHalf2x16(value.z); + vec2 value3 = unpackHalf2x16(value.w); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(0, 0), value0.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(1, 0), value0.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(2, 0), value1.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(3, 0), value1.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(4, 0), value2.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(5, 0), value2.yyyy); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(6, 0), value3.xxxx); + imageStore(uImage, coord * ivec2(8, 1) + ivec2(7, 0), value3.yyyy); +#else + imageStore(uImage, coord * ivec2(4, 1) + ivec2(0, 0), value.xxxx); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(1, 0), value.yyyy); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(2, 0), value.zzzz); + imageStore(uImage, coord * ivec2(4, 1) + ivec2(3, 0), value.wwww); +#endif +#else +#error Inconsistent defines. +#endif +} +#endif + +#endif + +#define PI 3.14159265359 +#define SQRT_1_2 0.70710678118 + +#ifdef FFT_INVERSE +#define PI_DIR (+PI) +#else +#define PI_DIR (-PI) +#endif + +// Some GLES implementations have lower trancendental precision than desired which +// significantly affects the overall FFT precision. +// For these implementations it might make sense to add a LUT UBO with twiddle factors, +// which can be used here. + +// 4-component FP16 twiddles, pack in uvec4. +#if !defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8) +#define FFT_OUTPUT_STEP 4u +#define FFT_OUTPUT_SHIFT 2u +#define ctwiddle uvec4 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP vec4 angles = PI_DIR * (float(k) + vec4(0.0, 1.0, 2.0, 3.0)) / float(p); + FFT_HIGHP vec4 cos_a = cos(angles); + FFT_HIGHP vec4 sin_a = sin(angles); + return ctwiddle( + packHalf2x16(vec2(cos_a.x, sin_a.x)), + packHalf2x16(vec2(cos_a.y, sin_a.y)), + packHalf2x16(vec2(cos_a.z, sin_a.z)), + packHalf2x16(vec2(cos_a.w, sin_a.w))); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (uvec4(packHalf2x16(vec2(+SQRT_1_2, +SQRT_1_2)))) +#define TWIDDLE_3_8 (uvec4(packHalf2x16(vec2(-SQRT_1_2, +SQRT_1_2)))) +#else +#define TWIDDLE_1_8 (uvec4(packHalf2x16(vec2(+SQRT_1_2, -SQRT_1_2)))) +#define TWIDDLE_3_8 (uvec4(packHalf2x16(vec2(-SQRT_1_2, -SQRT_1_2)))) +#endif + +// 2-component twiddles, pack in vec4. +#elif (!defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC4)) || (defined(FFT_DUAL) && defined(FFT_HORIZ) && defined(FFT_VEC8)) +#define FFT_OUTPUT_STEP 2u +#define FFT_OUTPUT_SHIFT 1u +#define ctwiddle vec4 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP vec2 angles = PI_DIR * (float(k) + vec2(0.0, 1.0)) / float(p); + FFT_HIGHP vec2 cos_a = cos(angles); + FFT_HIGHP vec2 sin_a = sin(angles); + return ctwiddle(cos_a.x, sin_a.x, cos_a.y, sin_a.y); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, +SQRT_1_2).xyxy) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, +SQRT_1_2).xyxy) +#else +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, -SQRT_1_2).xyxy) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, -SQRT_1_2).xyxy) +#endif + +// 1-component twiddle, pack in vec2. +#else + +#define FFT_OUTPUT_STEP 1u +#define FFT_OUTPUT_SHIFT 0u +#define ctwiddle vec2 +ctwiddle twiddle(uint k, uint p) +{ + // Trancendentals should always be done in highp. + FFT_HIGHP float angle = PI_DIR * float(k) / float(p); + return ctwiddle(cos(angle), sin(angle)); +} + +#ifdef FFT_INVERSE +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, +SQRT_1_2)) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, +SQRT_1_2)) +#else +#define TWIDDLE_1_8 (vec2(+SQRT_1_2, -SQRT_1_2)) +#define TWIDDLE_3_8 (vec2(-SQRT_1_2, -SQRT_1_2)) +#endif + +#endif + +// Complex multiply by v * -j. Trivial case which can avoid mul/add. +vec4 cmul_minus_j(vec4 v) +{ + return vec4(v.y, -v.x, v.w, -v.z); +} + +vec2 cmul_minus_j(vec2 v) +{ + return vec2(v.y, -v.x); +} + +// Complex multiply by v * +j. Trivial case which can avoid mul/add. +vec4 cmul_plus_j(vec4 v) +{ + return vec4(-v.y, v.x, -v.w, v.z); +} + +vec2 cmul_plus_j(vec2 v) +{ + return vec2(-v.y, v.x); +} + +#ifdef FFT_INVERSE +#define cmul_dir_j(v) cmul_plus_j(v) +#else +#define cmul_dir_j(v) cmul_minus_j(v) +#endif + +// Calculate an in-place butterfly with twiddle factors. +// a ----------- a + wb +// \ / +// \ / +// X +// / \ +// / \ +// w * b ------- a - wb +// +void butterfly(inout vec4 a, inout vec4 b, vec4 w) +{ + vec4 t = cmul(b, w); + b = a - t; + a = a + t; +} + +// Computes butterflies, but the twiddle factors for the two butterflies are +// identical. +void butterfly(inout vec4 a, inout vec4 b, vec2 w) +{ + butterfly(a, b, w.xyxy); +} + +void butterfly(inout vec2 a, inout vec2 b, vec2 w) +{ + vec2 t = cmul(b, w); + b = a - t; + a = a + t; +} + +// First pass butterfly, special case where w = 1. +void butterfly_p1(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = a - t; + a = a + t; +} + +// First pass butterfly, but also multiply in a twiddle factor of -j to b afterwards. +// Used in P == 1 transforms for radix-4, radix-8 etc. +void butterfly_p1_minus_j(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = vec4(1.0, -1.0, 1.0, -1.0) * (a.yxwz - t.yxwz); + a = a + t; +} + +void butterfly_p1_plus_j(inout vec4 a, inout vec4 b) +{ + vec4 t = b; + b = vec4(-1.0, 1.0, -1.0, 1.0) * (a.yxwz - t.yxwz); + a = a + t; +} + +void butterfly_p1(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = a - t; + a = a + t; +} + +void butterfly_p1_minus_j(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = vec2(1.0, -1.0) * (a.yx - t.yx); + a = a + t; +} + +void butterfly_p1_plus_j(inout vec2 a, inout vec2 b) +{ + vec2 t = b; + b = vec2(-1.0, 1.0) * (a.yx - t.yx); + a = a + t; +} + +#ifdef FFT_INVERSE +#define butterfly_p1_dir_j(a, b) butterfly_p1_plus_j(a, b) +#else +#define butterfly_p1_dir_j(a, b) butterfly_p1_minus_j(a, b) +#endif + +#ifdef FFT_RESOLVE_REAL_TO_COMPLEX +vec2 r2c_twiddle(uint i, uint p) +{ + vec2 w = -twiddle(i, p); + return vec2(-w.y, w.x); +} + +// See http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM for +// how the real-to-complex and complex-to-real resolve passes work. +// The final real-to-complex transform pass is done by extracting two interleaved FFTs by conjugate symmetry. + +// If we have a real sequence: +// (r0, r1, r2, r3, r4, ...), we merge two adjacent real values to a sequence of complex numbers. +// We take the FFT of this complex sequence as normal. +// What we end up with really is: +// FFT((r0, r2, r4, r6, ...)) + FFT(j * (r1, r3, r5, r7, ...)). +// If we know the individual FFTs of the even and the odds we can complete the FFT by a single decimation-in-frequency stage. +// By conjugate symmetry, we can extract the even and odd FFTs and complex our transform. +// Complex-to-real is just the same thing, but in reverse. + +void FFT_real_to_complex(uvec2 i) +{ + uint stride = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * stride; + + if (i.x == 0u) + { +#ifdef FFT_INPUT_TEXTURE + vec2 x = load_texture(i); +#else + vec2 x = load_global(offset); +#endif + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i), vec2(x.x + x.y, 0.0)); + store(ivec2(i) + ivec2(stride, 0), vec2(x.x - x.y, 0.0)); +#else + store_global(2u * offset, vec2(x.x + x.y, 0.0)); + store_global(2u * offset + stride, vec2(x.x - x.y, 0.0)); +#endif + } + else + { +#ifdef FFT_INPUT_TEXTURE + vec2 a = load_texture(i); + vec2 b = load_texture(uvec2(stride - i.x, i.y)); +#else + vec2 a = load_global(offset + i.x); + vec2 b = load_global(offset + stride - i.x); +#endif + b = vec2(b.x, -b.y); + vec2 fe = a + b; + vec2 fo = cmul(a - b, r2c_twiddle(i.x, stride)); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i), 0.5 * (fe + fo)); +#else + store_global(2u * offset + i.x, 0.5 * (fe + fo)); +#endif + } +} +#endif + +#ifdef FFT_RESOLVE_COMPLEX_TO_REAL +vec2 c2r_twiddle(uint i, uint p) +{ + vec2 w = twiddle(i, p); + return vec2(-w.y, w.x); +} + +void FFT_complex_to_real(uvec2 i) +{ + uint stride = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * stride; + +#ifdef FFT_INPUT_TEXTURE + vec2 a = load_texture(i); + vec2 b = load_texture(uvec2(stride - i.x, i.y)); +#else + vec2 a = load_global(2u * offset + i.x); + vec2 b = load_global(2u * offset + stride - i.x); +#endif + b = vec2(b.x, -b.y); + vec2 even = a + b; + vec2 odd = cmul(a - b, c2r_twiddle(i.x, stride)); + + store_global(offset + i.x, even + odd); +} +#endif + diff --git a/share/dotfiles/.config/glava/util/fft_main.glsl b/share/dotfiles/.config/glava/util/fft_main.glsl new file mode 100644 index 00000000..f240c412 --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_main.glsl @@ -0,0 +1,163 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// P is the current accumulated radix factor. +// First pass in an FFT, P == 1, then P will be pass0.radix, then pass0.radix * pass1.radix, and so on ... +// Used to compute twiddle factors. + +#ifndef FFT_P1 +#define uP constant_data.p_stride_padding.x +#endif + +#if FFT_RADIX == 4 +// FFT4 implementation. +void FFT4_horiz() +{ +#ifdef FFT_P1 + FFT4_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT4_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT4_vert() +{ +#ifdef FFT_P1 + FFT4_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT4_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT4() +{ +#ifdef FFT_HORIZ + FFT4_horiz(); +#else + FFT4_vert(); +#endif +} +#endif + +#if FFT_RADIX == 8 +// FFT8 implementation. +void FFT8_horiz() +{ +#ifdef FFT_P1 + FFT8_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT8_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT8_vert() +{ +#ifdef FFT_P1 + FFT8_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT8_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT8() +{ +#ifdef FFT_HORIZ + FFT8_horiz(); +#else + FFT8_vert(); +#endif +} +#endif + +#if FFT_RADIX == 16 +void FFT16_horiz() +{ +#ifdef FFT_P1 + FFT16_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT16_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT16_vert() +{ +#ifdef FFT_P1 + FFT16_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT16_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT16() +{ +#ifdef FFT_HORIZ + FFT16_horiz(); +#else + FFT16_vert(); +#endif +} +#endif + +#if FFT_RADIX == 64 +void FFT64_horiz() +{ +#ifdef FFT_P1 + FFT64_p1_horiz(gl_GlobalInvocationID.xy); +#else + FFT64_horiz(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT64_vert() +{ +#ifdef FFT_P1 + FFT64_p1_vert(gl_GlobalInvocationID.xy); +#else + FFT64_vert(gl_GlobalInvocationID.xy, uP); +#endif +} + +void FFT64() +{ +#ifdef FFT_HORIZ + FFT64_horiz(); +#else + FFT64_vert(); +#endif +} +#endif + +void main() +{ +#if defined(FFT_RESOLVE_REAL_TO_COMPLEX) + FFT_real_to_complex(gl_GlobalInvocationID.xy); +#elif defined(FFT_RESOLVE_COMPLEX_TO_REAL) + FFT_complex_to_real(gl_GlobalInvocationID.xy); +#elif FFT_RADIX == 4 + FFT4(); +#elif FFT_RADIX == 8 + FFT8(); +#elif FFT_RADIX == 16 + FFT16(); +#elif FFT_RADIX == 64 + FFT64(); +#else +#error Unimplemented FFT radix. +#endif +} + diff --git a/share/dotfiles/.config/glava/util/fft_radix16.glsl b/share/dotfiles/.config/glava/util/fft_radix16.glsl new file mode 100644 index 00000000..c0600aef --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_radix16.glsl @@ -0,0 +1,189 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Radix 16 FFT is implemented by doing separate radix-4 FFTs in four threads, then the results are shared via shared memory, +// and the final radix-16 is completed by doing radix-4 FFT again. +// Radix-16 FFT can be implemented directly without shared memory, +// but the register pressure would likely degrade performance significantly over just using shared. + +// The radix-16 FFT would normally looks like this: +// cfloat a[i] = load_global(.... + i * quarter_samples); +// However, we interleave these into 4 separate threads (using LocalInvocationID.z) so that every thread +// gets its own FFT-4 transform. + +// Z == 0, (0, 4, 8, 12) +// Z == 1, (1, 5, 9, 13) +// Z == 2, (2, 6, 10, 14) +// Z == 3, (3, 7, 11, 15) + +// The FFT results are written in stockham autosort fashion to shared memory. +// The final FFT-4 transform is then read from shared memory with the same interleaving pattern used above. + +void FFT16_p1_horiz(uvec2 i) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 16u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2((block + 0u) * quarter_samples, 0u)); + cfloat b = load_texture(i + uvec2((block + 4u) * quarter_samples, 0u)); + cfloat c = load_texture(i + uvec2((block + 8u) * quarter_samples, 0u)); + cfloat d = load_texture(i + uvec2((block + 12u) * quarter_samples, 0u)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * quarter_samples); + cfloat b = load_global(offset + i.x + (block + 4u) * quarter_samples); + cfloat c = load_global(offset + i.x + (block + 8u) * quarter_samples); + cfloat d = load_global(offset + i.x + (block + 12u) * quarter_samples); +#endif + FFT4_p1(a, b, c, d); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + const uint p = 4u; + FFT4(a, b, c, d, FFT_OUTPUT_STEP * block, p); + + uint k = (FFT_OUTPUT_STEP * block) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * block - k) * 4u) + k; + +#ifndef FFT_OUTPUT_IMAGE + store_global(offset + 16u * i.x + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + 16u * i.x + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + 16u * i.x + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + 16u * i.x + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT16_horiz(uvec2 i, uint p) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 16u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * quarter_samples); + cfloat b = load_global(offset + i.x + (block + 4u) * quarter_samples); + cfloat c = load_global(offset + i.x + (block + 8u) * quarter_samples); + cfloat d = load_global(offset + i.x + (block + 12u) * quarter_samples); + + FFT4(a, b, c, d, FFT_OUTPUT_STEP * i.x, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 16u) + k; + + FFT4(a, b, c, d, k + block * p, 4u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + (block + 0u) * p, i.y), a); + store(ivec2(j + (block + 4u) * p, i.y), c); + store(ivec2(j + (block + 8u) * p, i.y), b); + store(ivec2(j + (block + 12u) * p, i.y), d); +#else + store_global(offset + ((j + (block + 0u) * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + (block + 4u) * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + (block + 8u) * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + (block + 12u) * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT16_p1_vert(uvec2 i) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2(0u, (block + 0u) * quarter_samples.y)); + cfloat b = load_texture(i + uvec2(0u, (block + 4u) * quarter_samples.y)); + cfloat c = load_texture(i + uvec2(0u, (block + 8u) * quarter_samples.y)); + cfloat d = load_texture(i + uvec2(0u, (block + 12u) * quarter_samples.y)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 4u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 12u) * y_stride); +#endif + FFT4_p1(a, b, c, d); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + const uint p = 4u; + FFT4(a, b, c, d, block, p); + +#ifndef FFT_OUTPUT_IMAGE + store_global((16u * i.y + block + 0u) * stride + i.x, a); + store_global((16u * i.y + block + 4u) * stride + i.x, c); + store_global((16u * i.y + block + 8u) * stride + i.x, b); + store_global((16u * i.y + block + 12u) * stride + i.x, d); +#endif +} + +void FFT16_vert(uvec2 i, uint p) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 4u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 12u) * y_stride); + + FFT4(a, b, c, d, i.y, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 16u) + k; + + FFT4(a, b, c, d, k + block * p, 4u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + (block + 0u) * p), a); + store(ivec2(i.x, j + (block + 4u) * p), c); + store(ivec2(i.x, j + (block + 8u) * p), b); + store(ivec2(i.x, j + (block + 12u) * p), d); +#else + store_global(stride * (j + (block + 0u) * p) + i.x, a); + store_global(stride * (j + (block + 4u) * p) + i.x, c); + store_global(stride * (j + (block + 8u) * p) + i.x, b); + store_global(stride * (j + (block + 12u) * p) + i.x, d); +#endif +} + diff --git a/share/dotfiles/.config/glava/util/fft_radix4.glsl b/share/dotfiles/.config/glava/util/fft_radix4.glsl new file mode 100644 index 00000000..c933167e --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_radix4.glsl @@ -0,0 +1,163 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +void FFT4_p1(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d) +{ + butterfly_p1(a, c); + butterfly_p1_dir_j(b, d); + butterfly_p1(a, b); + butterfly_p1(c, d); +} + +// FFT4 is implemented by in-place radix-2 twice. +void FFT4(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, uint i, uint p) +{ + uint k = i & (p - 1u); + + ctwiddle w = twiddle(k, p); + butterfly(a, c, w); + butterfly(b, d, w); + + ctwiddle w0 = twiddle(k, 2u * p); + ctwiddle w1 = cmul_dir_j(w0); + butterfly(a, b, w0); + butterfly(c, d, w1); +} + +void FFT4_p1_horiz(uvec2 i) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 4u; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(quarter_samples, 0u)); + cfloat c = load_texture(i + uvec2(2u * quarter_samples, 0u)); + cfloat d = load_texture(i + uvec2(3u * quarter_samples, 0u)); +#else + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + quarter_samples); + cfloat c = load_global(offset + i.x + 2u * quarter_samples); + cfloat d = load_global(offset + i.x + 3u * quarter_samples); +#endif + FFT4_p1(a, b, c, d); + +#ifndef FFT_OUTPUT_IMAGE +#if FFT_CVECTOR_SIZE == 4 + store_global(offset + 4u * i.x + 0u, cfloat(a.x, c.x, b.x, d.x)); + store_global(offset + 4u * i.x + 1u, cfloat(a.y, c.y, b.y, d.y)); + store_global(offset + 4u * i.x + 2u, cfloat(a.z, c.z, b.z, d.z)); + store_global(offset + 4u * i.x + 3u, cfloat(a.w, c.w, b.w, d.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_global(offset + 4u * i.x + 0u, cfloat(a.xy, c.xy)); + store_global(offset + 4u * i.x + 1u, cfloat(b.xy, d.xy)); + store_global(offset + 4u * i.x + 2u, cfloat(a.zw, c.zw)); + store_global(offset + 4u * i.x + 3u, cfloat(b.zw, d.zw)); +#else + store_global(offset + 4u * i.x + 0u, a); + store_global(offset + 4u * i.x + 1u, c); + store_global(offset + 4u * i.x + 2u, b); + store_global(offset + 4u * i.x + 3u, d); +#endif +#endif +} + +void FFT4_p1_vert(uvec2 i) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(0u, quarter_samples.y)); + cfloat c = load_texture(i + uvec2(0u, 2u * quarter_samples.y)); + cfloat d = load_texture(i + uvec2(0u, 3u * quarter_samples.y)); +#else + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); +#endif + FFT4_p1(a, b, c, d); + +#ifndef FFT_OUTPUT_IMAGE + store_global((4u * i.y + 0u) * stride + i.x, a); + store_global((4u * i.y + 1u) * stride + i.x, c); + store_global((4u * i.y + 2u) * stride + i.x, b); + store_global((4u * i.y + 3u) * stride + i.x, d); +#endif +} + +void FFT4_horiz(uvec2 i, uint p) +{ + uint quarter_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * quarter_samples * 4u; + + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + quarter_samples); + cfloat c = load_global(offset + i.x + 2u * quarter_samples); + cfloat d = load_global(offset + i.x + 3u * quarter_samples); + FFT4(a, b, c, d, i.x * FFT_OUTPUT_STEP, p); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 4u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + 0u * p, i.y), a); + store(ivec2(j + 1u * p, i.y), c); + store(ivec2(j + 2u * p, i.y), b); + store(ivec2(j + 3u * p, i.y), d); +#else + store_global(offset + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), d); +#endif +} + +void FFT4_vert(uvec2 i, uint p) +{ + uvec2 quarter_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * quarter_samples.y; + uint offset = stride * i.y; + + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + FFT4(a, b, c, d, i.y, p); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 4u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + 0u * p), a); + store(ivec2(i.x, j + 1u * p), c); + store(ivec2(i.x, j + 2u * p), b); + store(ivec2(i.x, j + 3u * p), d); +#else + store_global(stride * (j + 0u * p) + i.x, a); + store_global(stride * (j + 1u * p) + i.x, c); + store_global(stride * (j + 2u * p) + i.x, b); + store_global(stride * (j + 3u * p) + i.x, d); +#endif +} + diff --git a/share/dotfiles/.config/glava/util/fft_radix64.glsl b/share/dotfiles/.config/glava/util/fft_radix64.glsl new file mode 100644 index 00000000..688bed95 --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_radix64.glsl @@ -0,0 +1,222 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Basically the same as FFT16, but 2xFFT-8. See comments in fft_radix16.comp for more. + +void FFT64_p1_horiz(uvec2 i) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 64u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2((block + 0u) * octa_samples, 0u)); + cfloat b = load_texture(i + uvec2((block + 8u) * octa_samples, 0u)); + cfloat c = load_texture(i + uvec2((block + 16u) * octa_samples, 0u)); + cfloat d = load_texture(i + uvec2((block + 24u) * octa_samples, 0u)); + cfloat e = load_texture(i + uvec2((block + 32u) * octa_samples, 0u)); + cfloat f = load_texture(i + uvec2((block + 40u) * octa_samples, 0u)); + cfloat g = load_texture(i + uvec2((block + 48u) * octa_samples, 0u)); + cfloat h = load_texture(i + uvec2((block + 56u) * octa_samples, 0u)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * octa_samples); + cfloat b = load_global(offset + i.x + (block + 8u) * octa_samples); + cfloat c = load_global(offset + i.x + (block + 16u) * octa_samples); + cfloat d = load_global(offset + i.x + (block + 24u) * octa_samples); + cfloat e = load_global(offset + i.x + (block + 32u) * octa_samples); + cfloat f = load_global(offset + i.x + (block + 40u) * octa_samples); + cfloat g = load_global(offset + i.x + (block + 48u) * octa_samples); + cfloat h = load_global(offset + i.x + (block + 56u) * octa_samples); +#endif + FFT8_p1(a, b, c, d, e, f, g, h); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + const uint p = 8u; + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * block, p); + + uint k = (FFT_OUTPUT_STEP * block) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * block - k) * 8u) + k; + +#ifndef FFT_OUTPUT_IMAGE + store_global(offset + 64u * i.x + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + 64u * i.x + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + 64u * i.x + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + 64u * i.x + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + 64u * i.x + ((j + 4u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + 64u * i.x + ((j + 5u * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + 64u * i.x + ((j + 6u * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + 64u * i.x + ((j + 7u * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT64_horiz(uvec2 i, uint p) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 64u; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * octa_samples); + cfloat b = load_global(offset + i.x + (block + 8u) * octa_samples); + cfloat c = load_global(offset + i.x + (block + 16u) * octa_samples); + cfloat d = load_global(offset + i.x + (block + 24u) * octa_samples); + cfloat e = load_global(offset + i.x + (block + 32u) * octa_samples); + cfloat f = load_global(offset + i.x + (block + 40u) * octa_samples); + cfloat g = load_global(offset + i.x + (block + 48u) * octa_samples); + cfloat h = load_global(offset + i.x + (block + 56u) * octa_samples); + + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * i.x, p); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 64u) + k; + + FFT8(a, b, c, d, e, f, g, h, k + block * p, 8u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + (block + 0u) * p, i.y), a); + store(ivec2(j + (block + 8u) * p, i.y), e); + store(ivec2(j + (block + 16u) * p, i.y), c); + store(ivec2(j + (block + 24u) * p, i.y), g); + store(ivec2(j + (block + 32u) * p, i.y), b); + store(ivec2(j + (block + 40u) * p, i.y), f); + store(ivec2(j + (block + 48u) * p, i.y), d); + store(ivec2(j + (block + 56u) * p, i.y), h); +#else + store_global(offset + ((j + (block + 0u) * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + (block + 8u) * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + ((j + (block + 16u) * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + (block + 24u) * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + ((j + (block + 32u) * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + (block + 40u) * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + ((j + (block + 48u) * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + ((j + (block + 56u) * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT64_p1_vert(uvec2 i) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i + uvec2(0u, (block + 0u) * octa_samples.y)); + cfloat b = load_texture(i + uvec2(0u, (block + 8u) * octa_samples.y)); + cfloat c = load_texture(i + uvec2(0u, (block + 16u) * octa_samples.y)); + cfloat d = load_texture(i + uvec2(0u, (block + 24u) * octa_samples.y)); + cfloat e = load_texture(i + uvec2(0u, (block + 32u) * octa_samples.y)); + cfloat f = load_texture(i + uvec2(0u, (block + 40u) * octa_samples.y)); + cfloat g = load_texture(i + uvec2(0u, (block + 48u) * octa_samples.y)); + cfloat h = load_texture(i + uvec2(0u, (block + 56u) * octa_samples.y)); +#else + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 16u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 24u) * y_stride); + cfloat e = load_global(offset + i.x + (block + 32u) * y_stride); + cfloat f = load_global(offset + i.x + (block + 40u) * y_stride); + cfloat g = load_global(offset + i.x + (block + 48u) * y_stride); + cfloat h = load_global(offset + i.x + (block + 56u) * y_stride); +#endif + + FFT8_p1(a, b, c, d, e, f, g, h); + + store_shared(a, b, c, d, e, f, g, h, block, base); + load_shared(a, b, c, d, e, f, g, h, block, base); + + const uint p = 8u; + FFT8(a, b, c, d, e, f, g, h, block, p); + +#ifndef FFT_OUTPUT_IMAGE + store_global((64u * i.y + block + 0u) * stride + i.x, a); + store_global((64u * i.y + block + 8u) * stride + i.x, e); + store_global((64u * i.y + block + 16u) * stride + i.x, c); + store_global((64u * i.y + block + 24u) * stride + i.x, g); + store_global((64u * i.y + block + 32u) * stride + i.x, b); + store_global((64u * i.y + block + 40u) * stride + i.x, f); + store_global((64u * i.y + block + 48u) * stride + i.x, d); + store_global((64u * i.y + block + 56u) * stride + i.x, h); +#endif +} + +void FFT64_vert(uvec2 i, uint p) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + uint fft = gl_LocalInvocationID.x; + uint block = gl_LocalInvocationID.z; + uint base = get_shared_base(fft); + + cfloat a = load_global(offset + i.x + (block + 0u) * y_stride); + cfloat b = load_global(offset + i.x + (block + 8u) * y_stride); + cfloat c = load_global(offset + i.x + (block + 16u) * y_stride); + cfloat d = load_global(offset + i.x + (block + 24u) * y_stride); + cfloat e = load_global(offset + i.x + (block + 32u) * y_stride); + cfloat f = load_global(offset + i.x + (block + 40u) * y_stride); + cfloat g = load_global(offset + i.x + (block + 48u) * y_stride); + cfloat h = load_global(offset + i.x + (block + 56u) * y_stride); + + FFT8(a, b, c, d, e, f, g, h, i.y, p); + + store_shared(a, b, c, d, block, base); + load_shared(a, b, c, d, block, base); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 64u) + k; + + FFT8(a, b, c, d, e, f, g, h, k + block * p, 8u * p); + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + (block + 0u) * p), a); + store(ivec2(i.x, j + (block + 8u) * p), e); + store(ivec2(i.x, j + (block + 16u) * p), c); + store(ivec2(i.x, j + (block + 24u) * p), g); + store(ivec2(i.x, j + (block + 32u) * p), b); + store(ivec2(i.x, j + (block + 40u) * p), f); + store(ivec2(i.x, j + (block + 48u) * p), d); + store(ivec2(i.x, j + (block + 56u) * p), h); +#else + store_global(stride * (j + (block + 0u) * p) + i.x, a); + store_global(stride * (j + (block + 8u) * p) + i.x, e); + store_global(stride * (j + (block + 16u) * p) + i.x, c); + store_global(stride * (j + (block + 24u) * p) + i.x, g); + store_global(stride * (j + (block + 32u) * p) + i.x, b); + store_global(stride * (j + (block + 40u) * p) + i.x, f); + store_global(stride * (j + (block + 48u) * p) + i.x, d); + store_global(stride * (j + (block + 56u) * p) + i.x, h); +#endif +} + diff --git a/share/dotfiles/.config/glava/util/fft_radix8.glsl b/share/dotfiles/.config/glava/util/fft_radix8.glsl new file mode 100644 index 00000000..a2460511 --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_radix8.glsl @@ -0,0 +1,246 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +void FFT8_p1(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, inout cfloat e, inout cfloat f, inout cfloat g, inout cfloat h) +{ + butterfly_p1(a, e); + butterfly_p1(b, f); + butterfly_p1_dir_j(c, g); + butterfly_p1_dir_j(d, h); + + butterfly_p1(a, c); + butterfly_p1_dir_j(b, d); + butterfly_p1(e, g); + butterfly_p1(f, h); + + butterfly_p1(a, b); + butterfly_p1(c, d); + butterfly(e, f, TWIDDLE_1_8); + butterfly(g, h, TWIDDLE_3_8); +} + +void FFT8(inout cfloat a, inout cfloat b, inout cfloat c, inout cfloat d, inout cfloat e, inout cfloat f, inout cfloat g, inout cfloat h, uint i, uint p) +{ + uint k = i & (p - 1u); + + ctwiddle w = twiddle(k, p); + butterfly(a, e, w); + butterfly(b, f, w); + butterfly(c, g, w); + butterfly(d, h, w); + + ctwiddle w0 = twiddle(k, 2u * p); + ctwiddle w1 = cmul_dir_j(w0); + + butterfly(a, c, w0); + butterfly(b, d, w0); + butterfly(e, g, w1); + butterfly(f, h, w1); + + ctwiddle W0 = twiddle(k, 4u * p); + ctwiddle W1 = cmul(W0, TWIDDLE_1_8); + ctwiddle W2 = cmul_dir_j(W0); + ctwiddle W3 = cmul_dir_j(W1); + + butterfly(a, b, W0); + butterfly(c, d, W2); + butterfly(e, f, W1); + butterfly(g, h, W3); +} + +void FFT8_p1_horiz(uvec2 i) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 8u; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(octa_samples, 0u)); + cfloat c = load_texture(i + uvec2(2u * octa_samples, 0u)); + cfloat d = load_texture(i + uvec2(3u * octa_samples, 0u)); + cfloat e = load_texture(i + uvec2(4u * octa_samples, 0u)); + cfloat f = load_texture(i + uvec2(5u * octa_samples, 0u)); + cfloat g = load_texture(i + uvec2(6u * octa_samples, 0u)); + cfloat h = load_texture(i + uvec2(7u * octa_samples, 0u)); +#else + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + octa_samples); + cfloat c = load_global(offset + i.x + 2u * octa_samples); + cfloat d = load_global(offset + i.x + 3u * octa_samples); + cfloat e = load_global(offset + i.x + 4u * octa_samples); + cfloat f = load_global(offset + i.x + 5u * octa_samples); + cfloat g = load_global(offset + i.x + 6u * octa_samples); + cfloat h = load_global(offset + i.x + 7u * octa_samples); +#endif + FFT8_p1(a, b, c, d, e, f, g, h); + +#ifndef FFT_OUTPUT_IMAGE +#if FFT_CVECTOR_SIZE == 4 + store_global(offset + 8u * i.x + 0u, cfloat(a.x, e.x, c.x, g.x)); + store_global(offset + 8u * i.x + 1u, cfloat(b.x, f.x, d.x, h.x)); + store_global(offset + 8u * i.x + 2u, cfloat(a.y, e.y, c.y, g.y)); + store_global(offset + 8u * i.x + 3u, cfloat(b.y, f.y, d.y, h.y)); + store_global(offset + 8u * i.x + 4u, cfloat(a.z, e.z, c.z, g.z)); + store_global(offset + 8u * i.x + 5u, cfloat(b.z, f.z, d.z, h.z)); + store_global(offset + 8u * i.x + 6u, cfloat(a.w, e.w, c.w, g.w)); + store_global(offset + 8u * i.x + 7u, cfloat(b.w, f.w, d.w, h.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_global(offset + 8u * i.x + 0u, cfloat(a.xy, e.xy)); + store_global(offset + 8u * i.x + 1u, cfloat(c.xy, g.xy)); + store_global(offset + 8u * i.x + 2u, cfloat(b.xy, f.xy)); + store_global(offset + 8u * i.x + 3u, cfloat(d.xy, h.xy)); + store_global(offset + 8u * i.x + 4u, cfloat(a.zw, e.zw)); + store_global(offset + 8u * i.x + 5u, cfloat(c.zw, g.zw)); + store_global(offset + 8u * i.x + 6u, cfloat(b.zw, f.zw)); + store_global(offset + 8u * i.x + 7u, cfloat(d.zw, h.zw)); +#else + store_global(offset + 8u * i.x + 0u, a); + store_global(offset + 8u * i.x + 1u, e); + store_global(offset + 8u * i.x + 2u, c); + store_global(offset + 8u * i.x + 3u, g); + store_global(offset + 8u * i.x + 4u, b); + store_global(offset + 8u * i.x + 5u, f); + store_global(offset + 8u * i.x + 6u, d); + store_global(offset + 8u * i.x + 7u, h); +#endif +#endif +} + +void FFT8_p1_vert(uvec2 i) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + +#ifdef FFT_INPUT_TEXTURE + cfloat a = load_texture(i); + cfloat b = load_texture(i + uvec2(0u, octa_samples.y)); + cfloat c = load_texture(i + uvec2(0u, 2u * octa_samples.y)); + cfloat d = load_texture(i + uvec2(0u, 3u * octa_samples.y)); + cfloat e = load_texture(i + uvec2(0u, 4u * octa_samples.y)); + cfloat f = load_texture(i + uvec2(0u, 5u * octa_samples.y)); + cfloat g = load_texture(i + uvec2(0u, 6u * octa_samples.y)); + cfloat h = load_texture(i + uvec2(0u, 7u * octa_samples.y)); +#else + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + cfloat e = load_global(offset + i.x + 4u * y_stride); + cfloat f = load_global(offset + i.x + 5u * y_stride); + cfloat g = load_global(offset + i.x + 6u * y_stride); + cfloat h = load_global(offset + i.x + 7u * y_stride); +#endif + + FFT8_p1(a, b, c, d, e, f, g, h); + +#ifndef FFT_OUTPUT_IMAGE + store_global((8u * i.y + 0u) * stride + i.x, a); + store_global((8u * i.y + 1u) * stride + i.x, e); + store_global((8u * i.y + 2u) * stride + i.x, c); + store_global((8u * i.y + 3u) * stride + i.x, g); + store_global((8u * i.y + 4u) * stride + i.x, b); + store_global((8u * i.y + 5u) * stride + i.x, f); + store_global((8u * i.y + 6u) * stride + i.x, d); + store_global((8u * i.y + 7u) * stride + i.x, h); +#endif +} + +void FFT8_horiz(uvec2 i, uint p) +{ + uint octa_samples = gl_NumWorkGroups.x * gl_WorkGroupSize.x; + uint offset = i.y * octa_samples * 8u; + + cfloat a = load_global(offset + i.x); + cfloat b = load_global(offset + i.x + octa_samples); + cfloat c = load_global(offset + i.x + 2u * octa_samples); + cfloat d = load_global(offset + i.x + 3u * octa_samples); + cfloat e = load_global(offset + i.x + 4u * octa_samples); + cfloat f = load_global(offset + i.x + 5u * octa_samples); + cfloat g = load_global(offset + i.x + 6u * octa_samples); + cfloat h = load_global(offset + i.x + 7u * octa_samples); + + FFT8(a, b, c, d, e, f, g, h, FFT_OUTPUT_STEP * i.x, p); + + uint k = (FFT_OUTPUT_STEP * i.x) & (p - 1u); + uint j = ((FFT_OUTPUT_STEP * i.x - k) * 8u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(j + 0u * p, i.y), a); + store(ivec2(j + 1u * p, i.y), e); + store(ivec2(j + 2u * p, i.y), c); + store(ivec2(j + 3u * p, i.y), g); + store(ivec2(j + 4u * p, i.y), b); + store(ivec2(j + 5u * p, i.y), f); + store(ivec2(j + 6u * p, i.y), d); + store(ivec2(j + 7u * p, i.y), h); +#else + store_global(offset + ((j + 0u * p) >> FFT_OUTPUT_SHIFT), a); + store_global(offset + ((j + 1u * p) >> FFT_OUTPUT_SHIFT), e); + store_global(offset + ((j + 2u * p) >> FFT_OUTPUT_SHIFT), c); + store_global(offset + ((j + 3u * p) >> FFT_OUTPUT_SHIFT), g); + store_global(offset + ((j + 4u * p) >> FFT_OUTPUT_SHIFT), b); + store_global(offset + ((j + 5u * p) >> FFT_OUTPUT_SHIFT), f); + store_global(offset + ((j + 6u * p) >> FFT_OUTPUT_SHIFT), d); + store_global(offset + ((j + 7u * p) >> FFT_OUTPUT_SHIFT), h); +#endif +} + +void FFT8_vert(uvec2 i, uint p) +{ + uvec2 octa_samples = gl_NumWorkGroups.xy * gl_WorkGroupSize.xy; + uint stride = uStride; + uint y_stride = stride * octa_samples.y; + uint offset = stride * i.y; + + cfloat a = load_global(offset + i.x + 0u * y_stride); + cfloat b = load_global(offset + i.x + 1u * y_stride); + cfloat c = load_global(offset + i.x + 2u * y_stride); + cfloat d = load_global(offset + i.x + 3u * y_stride); + cfloat e = load_global(offset + i.x + 4u * y_stride); + cfloat f = load_global(offset + i.x + 5u * y_stride); + cfloat g = load_global(offset + i.x + 6u * y_stride); + cfloat h = load_global(offset + i.x + 7u * y_stride); + + FFT8(a, b, c, d, e, f, g, h, i.y, p); + + uint k = i.y & (p - 1u); + uint j = ((i.y - k) * 8u) + k; + +#ifdef FFT_OUTPUT_IMAGE + store(ivec2(i.x, j + 0u * p), a); + store(ivec2(i.x, j + 1u * p), e); + store(ivec2(i.x, j + 2u * p), c); + store(ivec2(i.x, j + 3u * p), g); + store(ivec2(i.x, j + 4u * p), b); + store(ivec2(i.x, j + 5u * p), f); + store(ivec2(i.x, j + 6u * p), d); + store(ivec2(i.x, j + 7u * p), h); +#else + store_global(stride * (j + 0u * p) + i.x, a); + store_global(stride * (j + 1u * p) + i.x, e); + store_global(stride * (j + 2u * p) + i.x, c); + store_global(stride * (j + 3u * p) + i.x, g); + store_global(stride * (j + 4u * p) + i.x, b); + store_global(stride * (j + 5u * p) + i.x, f); + store_global(stride * (j + 6u * p) + i.x, d); + store_global(stride * (j + 7u * p) + i.x, h); +#endif +} + diff --git a/share/dotfiles/.config/glava/util/fft_shared.glsl b/share/dotfiles/.config/glava/util/fft_shared.glsl new file mode 100644 index 00000000..5215a36a --- /dev/null +++ b/share/dotfiles/.config/glava/util/fft_shared.glsl @@ -0,0 +1,179 @@ +/* Copyright (C) 2015 Hans-Kristian Arntzen <maister@archlinux.us> + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +// Most (all?) desktop GPUs have banked shared memory. +// We want to avoid bank conflicts as much as possible. +// If we don't pad the shared memory, threads in the same warp/wavefront will hit the same +// shared memory banks, and stall as each bank and only process a fixed number of requests per cycle. +// By padding, we "smear" out the requests to more banks, which greatly improves performance. + +// For architectures without banked shared memory, +// this design makes no sense, so it's a pretty important performance bit to set correctly. + +#ifndef FFT_SHARED_BANKED +#error FFT_SHARED_BANKED must be defined. +#endif + +#if FFT_SHARED_BANKED +#define FFT_BANK_CONFLICT_PADDING 1u +#else +#define FFT_BANK_CONFLICT_PADDING 0u +#endif + +#define FFT_SHARED_SIZE (uint(FFT_RADIX) + FFT_BANK_CONFLICT_PADDING) + +uint get_shared_base(uint fft) +{ + return FFT_SHARED_SIZE * (gl_LocalInvocationID.y * gl_WorkGroupSize.x + fft); +} + +#if FFT_SHARED_BANKED + +// Implementations with banked shared memory like to write 32-bit at a time, +// since that's typically how big transactions each shared memory bank can handle. +// If we try to write vec4s in one go (which will get split up to 4 writes anyways), +// we end up with 4-way bank conflicts no matter what we do. + +#if defined(FFT_VEC8) +shared uint tmpx[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpy[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpz[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared uint tmpw[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#else +shared float tmpx[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared float tmpy[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#if defined(FFT_VEC4) +shared float tmpz[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +shared float tmpw[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; +#endif +#endif + +void store_shared(uint offset, cfloat v) +{ + tmpx[offset] = v.x; + tmpy[offset] = v.y; +#if defined(FFT_VEC4) || defined(FFT_VEC8) + tmpz[offset] = v.z; + tmpw[offset] = v.w; +#endif +} + +void load_shared(uint offset, out cfloat v) +{ + v.x = tmpx[offset]; + v.y = tmpy[offset]; +#if defined(FFT_VEC4) || defined(FFT_VEC8) + v.z = tmpz[offset]; + v.w = tmpw[offset]; +#endif +} +#else +// For non-banked architectures, just store and load directly. +shared cfloat tmp[FFT_SHARED_SIZE * gl_WorkGroupSize.x * gl_WorkGroupSize.y]; + +void store_shared(uint offset, cfloat v) +{ + tmp[offset] = v; +} + +void load_shared(uint offset, out cfloat v) +{ + v = tmp[offset]; +} +#endif + +void store_shared(cfloat a, cfloat b, cfloat c, cfloat d, uint block, uint base) +{ + // Interleave and write out in bit-reversed order. +#if FFT_CVECTOR_SIZE == 4 + store_shared(base + 4u * block + 0u, cfloat(a.x, c.x, b.x, d.x)); + store_shared(base + 4u * block + 1u, cfloat(a.y, c.y, b.y, d.y)); + store_shared(base + 4u * block + 2u, cfloat(a.z, c.z, b.z, d.z)); + store_shared(base + 4u * block + 3u, cfloat(a.w, c.w, b.w, d.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_shared(base + 4u * block + 0u, cfloat(a.xy, c.xy)); + store_shared(base + 4u * block + 1u, cfloat(b.xy, d.xy)); + store_shared(base + 4u * block + 2u, cfloat(a.zw, c.zw)); + store_shared(base + 4u * block + 3u, cfloat(b.zw, d.zw)); +#else + store_shared(base + 4u * block + 0u, a); + store_shared(base + 4u * block + 1u, c); + store_shared(base + 4u * block + 2u, b); + store_shared(base + 4u * block + 3u, d); +#endif + + memoryBarrierShared(); + barrier(); +} + +void load_shared(out cfloat a, out cfloat b, out cfloat c, out cfloat d, uint block, uint base) +{ + load_shared(base + block + 0u * gl_WorkGroupSize.z, a); + load_shared(base + block + 1u * gl_WorkGroupSize.z, b); + load_shared(base + block + 2u * gl_WorkGroupSize.z, c); + load_shared(base + block + 3u * gl_WorkGroupSize.z, d); +} + +void store_shared(cfloat a, cfloat b, cfloat c, cfloat d, cfloat e, cfloat f, cfloat g, cfloat h, uint block, uint base) +{ + // Interleave and write out in bit-reversed order. +#if FFT_CVECTOR_SIZE == 4 + store_shared(base + 8u * block + 0u, cfloat(a.x, e.x, c.x, g.x)); + store_shared(base + 8u * block + 1u, cfloat(b.x, f.x, d.x, h.x)); + store_shared(base + 8u * block + 2u, cfloat(a.y, e.y, c.y, g.y)); + store_shared(base + 8u * block + 3u, cfloat(b.y, f.y, d.y, h.y)); + store_shared(base + 8u * block + 4u, cfloat(a.z, e.z, c.z, g.z)); + store_shared(base + 8u * block + 5u, cfloat(b.z, f.z, d.z, h.z)); + store_shared(base + 8u * block + 6u, cfloat(a.w, e.w, c.w, g.w)); + store_shared(base + 8u * block + 7u, cfloat(b.w, f.w, d.w, h.w)); +#elif FFT_CVECTOR_SIZE == 2 + store_shared(base + 8u * block + 0u, cfloat(a.xy, e.xy)); + store_shared(base + 8u * block + 1u, cfloat(c.xy, g.xy)); + store_shared(base + 8u * block + 2u, cfloat(b.xy, f.xy)); + store_shared(base + 8u * block + 3u, cfloat(d.xy, h.xy)); + store_shared(base + 8u * block + 4u, cfloat(a.zw, e.zw)); + store_shared(base + 8u * block + 5u, cfloat(c.zw, g.zw)); + store_shared(base + 8u * block + 6u, cfloat(b.zw, f.zw)); + store_shared(base + 8u * block + 7u, cfloat(d.zw, h.zw)); +#else + store_shared(base + 8u * block + 0u, a); + store_shared(base + 8u * block + 1u, e); + store_shared(base + 8u * block + 2u, c); + store_shared(base + 8u * block + 3u, g); + store_shared(base + 8u * block + 4u, b); + store_shared(base + 8u * block + 5u, f); + store_shared(base + 8u * block + 6u, d); + store_shared(base + 8u * block + 7u, h); +#endif + + memoryBarrierShared(); + barrier(); +} + +void load_shared(out cfloat a, out cfloat b, out cfloat c, out cfloat d, out cfloat e, out cfloat f, out cfloat g, out cfloat h, uint block, uint base) +{ + load_shared(base + block + 0u * gl_WorkGroupSize.z, a); + load_shared(base + block + 1u * gl_WorkGroupSize.z, b); + load_shared(base + block + 2u * gl_WorkGroupSize.z, c); + load_shared(base + block + 3u * gl_WorkGroupSize.z, d); + load_shared(base + block + 4u * gl_WorkGroupSize.z, e); + load_shared(base + block + 5u * gl_WorkGroupSize.z, f); + load_shared(base + block + 6u * gl_WorkGroupSize.z, g); + load_shared(base + block + 7u * gl_WorkGroupSize.z, h); +} + diff --git a/share/dotfiles/.config/glava/util/gravity_pass.frag b/share/dotfiles/.config/glava/util/gravity_pass.frag new file mode 100644 index 00000000..177e127c --- /dev/null +++ b/share/dotfiles/.config/glava/util/gravity_pass.frag @@ -0,0 +1,9 @@ +uniform sampler1D tex; +uniform float diff; + +out vec4 fragment; +in vec4 gl_FragCoord; + +void main() { + fragment.r = texelFetch(tex, int(gl_FragCoord.x), 0).r - diff; +} diff --git a/share/dotfiles/.config/glava/util/pass.frag b/share/dotfiles/.config/glava/util/pass.frag new file mode 100644 index 00000000..c0b8d48e --- /dev/null +++ b/share/dotfiles/.config/glava/util/pass.frag @@ -0,0 +1,9 @@ +uniform sampler1D tex; + +out vec4 fragment; +in vec4 gl_FragCoord; + +/* 1D texture mapping */ +void main() { + fragment.r = texelFetch(tex, int(gl_FragCoord.x), 0).r; +} diff --git a/share/dotfiles/.config/glava/util/premultiply.frag b/share/dotfiles/.config/glava/util/premultiply.frag new file mode 100644 index 00000000..b25c0592 --- /dev/null +++ b/share/dotfiles/.config/glava/util/premultiply.frag @@ -0,0 +1,15 @@ + +#if _PREMULTIPLY_ALPHA == 0 +#error __disablestage +#endif + +#request uniform "prev" tex +uniform sampler2D tex; + +out vec4 fragment; +in vec4 gl_FragCoord; + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + fragment.rgb *= fragment.a; +} diff --git a/share/dotfiles/.config/glava/util/smooth.glsl b/share/dotfiles/.config/glava/util/smooth.glsl new file mode 100644 index 00000000..1df26e55 --- /dev/null +++ b/share/dotfiles/.config/glava/util/smooth.glsl @@ -0,0 +1,81 @@ + #ifndef _SMOOTH_GLSL +#define _SMOOTH_GLSL + +#include ":util/common.glsl" + +#include "@smooth_parameters.glsl" +#include ":smooth_parameters.glsl" + +#define average 0 +#define maximum 1 +#define hybrid 2 + +float scale_audio(float idx) { + return -log((-(SAMPLE_RANGE) * idx) + 1) / (SAMPLE_SCALE); +} + +float iscale_audio(float idx) { + return -log((SAMPLE_RANGE) * idx) / (SAMPLE_SCALE); +} + +/* Note: the _SMOOTH_FACTOR macro is defined by GLava itself, from `#request setsmoothfactor`*/ + +float smooth_audio(in sampler1D tex, int tex_sz, highp float idx) { + + #if _PRE_SMOOTHED_AUDIO < 1 + float + smin = scale_audio(clamp(idx - _SMOOTH_FACTOR, 0, 1)) * tex_sz, + smax = scale_audio(clamp(idx + _SMOOTH_FACTOR, 0, 1)) * tex_sz; + float m = ((smax - smin) / 2.0F), s, w; + float rm = smin + m; /* middle */ + + #if SAMPLE_MODE == average + float avg = 0, weight = 0; + for (s = smin; s <= smax; s += 1.0F) { + w = ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + weight += w; + avg += texelFetch(tex, int(round(s)), 0).r * w; + } + avg /= weight; + return avg; + #elif SAMPLE_MODE == hybrid + float vmax = 0, avg = 0, weight = 0, v; + for (s = smin; s < smax; s += 1.0F) { + w = ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + weight += w; + v = texelFetch(tex, int(round(s)), 0).r * w; + avg += v; + if (vmax < v) + vmax = v; + } + return (vmax * (1 - SAMPLE_HYBRID_WEIGHT)) + ((avg / weight) * SAMPLE_HYBRID_WEIGHT); + #elif SAMPLE_MODE == maximum + float vmax = 0, v; + for (s = smin; s < smax; s += 1.0F) { + w = texelFetch(tex, int(round(s)), 0).r * ROUND_FORMULA(clamp((m - abs(rm - s)) / m, 0, 1)); + if (vmax < w) + vmax = w; + } + return vmax; + #endif + #else + return texelFetch(tex, int(round(idx * tex_sz)), 0).r; + #endif +} + +/* Applies the audio smooth sampling function three times to the adjacent values */ +float smooth_audio_adj(in sampler1D tex, int tex_sz, highp float idx, highp float pixel) { + float + al = smooth_audio(tex, tex_sz, max(idx - pixel, 0.0F)), + am = smooth_audio(tex, tex_sz, idx), + ar = smooth_audio(tex, tex_sz, min(idx + pixel, 1.0F)); + return (al + am + ar) / 3.0F; +} + +#ifdef TWOPI +#undef TWOPI +#endif +#ifdef PI +#undef PI +#endif +#endif /* _SMOOTH_GLSL */ diff --git a/share/dotfiles/.config/glava/util/smooth_pass.frag b/share/dotfiles/.config/glava/util/smooth_pass.frag new file mode 100644 index 00000000..eb3fe7a6 --- /dev/null +++ b/share/dotfiles/.config/glava/util/smooth_pass.frag @@ -0,0 +1,16 @@ + +uniform sampler1D tex; +uniform int sz; +uniform int w; + +out vec4 fragment; +in vec4 gl_FragCoord; + +#undef _PRE_SMOOTHED_AUDIO +#define _PRE_SMOOTHED_AUDIO 0 + +#include ":util/smooth.glsl" + +void main() { + fragment = vec4(smooth_audio(tex, sz, gl_FragCoord.x / w), 0, 0, 0); +} diff --git a/share/dotfiles/.config/glava/wave.glsl b/share/dotfiles/.config/glava/wave.glsl new file mode 100644 index 00000000..f23848d0 --- /dev/null +++ b/share/dotfiles/.config/glava/wave.glsl @@ -0,0 +1,10 @@ +/* Min (vertical) line thickness */ +#define MIN_THICKNESS 1 +/* Max (vertical) line thickness */ +#define MAX_THICKNESS 6 +/* Base color to use, distance from center will multiply the RGB components */ +#define BASE_COLOR @fg:vec4(0.7, 0.2, 0.45, 1) +/* Amplitude */ +#define AMPLIFY 500 +/* Outline color */ +#define OUTLINE @bg:vec4(0.15, 0.15, 0.15, 1) diff --git a/share/dotfiles/.config/glava/wave/1.frag b/share/dotfiles/.config/glava/wave/1.frag new file mode 100644 index 00000000..13522046 --- /dev/null +++ b/share/dotfiles/.config/glava/wave/1.frag @@ -0,0 +1,39 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +#request uniform "audio_l" audio_l +#request transform audio_l "window" +#request transform audio_l "wrange" +uniform sampler1D audio_l; + +out vec4 fragment; + +#include "@wave.glsl" +#include ":wave.glsl" + +#define index(offset) ((texture(audio_l, (gl_FragCoord.x + offset) / screen.x).r - 0.5) * AMPLIFY) + 0.5F + +void main() { + float + os = index(0), + adj0 = index(-1), + adj1 = index(1); + float + s0 = adj0 - os, + s1 = adj1 - os; + float + dmax = max(s0, s1), + dmin = min(s0, s1); + + float s = (os + (screen.y * 0.5F) - 0.5F); /* center to screen coords */ + float diff = gl_FragCoord.y - s; + if (abs(diff) < clamp(abs(s - (screen.y * 0.5)) * 6, MIN_THICKNESS, MAX_THICKNESS) + || (diff <= dmax && diff >= dmin)) { + fragment = BASE_COLOR + (abs((screen.y * 0.5F) - s) * 0.02); + } else { + fragment = vec4(0, 0, 0, 0); + } +} diff --git a/share/dotfiles/.config/glava/wave/2.frag b/share/dotfiles/.config/glava/wave/2.frag new file mode 100644 index 00000000..5ff07067 --- /dev/null +++ b/share/dotfiles/.config/glava/wave/2.frag @@ -0,0 +1,33 @@ + +layout(pixel_center_integer) in vec4 gl_FragCoord; + +#request uniform "prev" tex +uniform sampler2D tex; /* screen texture */ +#request uniform "screen" screen +uniform ivec2 screen; /* screen dimensions */ + +out vec4 fragment; /* output */ + +#include "@wave.glsl" +#include ":wave.glsl" + +void main() { + fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0); + + vec4 + a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0), + a2 = texelFetch(tex, ivec2((gl_FragCoord.x + 0), (gl_FragCoord.y + 1)), 0), + a3 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0), + + a4 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0), + a5 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 1)), 0), + a6 = texelFetch(tex, ivec2((gl_FragCoord.x - 0), (gl_FragCoord.y - 1)), 0), + a7 = texelFetch(tex, ivec2((gl_FragCoord.x - 1), (gl_FragCoord.y - 0)), 0); + + vec4 avg = (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7) / 8.0; + if (avg.a > 0){ + if (fragment.a <= 0 || gl_FragCoord.x == 0 || gl_FragCoord.x == screen.x - 1) + fragment = OUTLINE; + } +} diff --git a/share/dotfiles/.config/gtk-3.0/settings.ini b/share/dotfiles/.config/gtk-3.0/settings.ini index c364e2db..731cea3f 100644 --- a/share/dotfiles/.config/gtk-3.0/settings.ini +++ b/share/dotfiles/.config/gtk-3.0/settings.ini @@ -1,7 +1,7 @@ [Settings] gtk-theme-name=Adwaita -gtk-icon-theme-name=Papirus -gtk-font-name=Cantarell 11 +gtk-icon-theme-name=Adwaita +gtk-font-name=Inter Medium 11 gtk-cursor-theme-name=Bibata-Modern-Ice gtk-cursor-theme-size=24 gtk-toolbar-style=GTK_TOOLBAR_ICONS diff --git a/share/dotfiles/.config/gtk-4.0/settings.ini b/share/dotfiles/.config/gtk-4.0/settings.ini index 5dbd750c..2f15a7fb 100644 --- a/share/dotfiles/.config/gtk-4.0/settings.ini +++ b/share/dotfiles/.config/gtk-4.0/settings.ini @@ -1,2 +1,3 @@ [Settings] gtk-application-prefer-dark-theme=true +gtk-hint-font-metrics=1 \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/autostart.conf b/share/dotfiles/.config/hypr/conf/autostart.conf index 5da5dd51..01643289 100644 --- a/share/dotfiles/.config/hypr/conf/autostart.conf +++ b/share/dotfiles/.config/hypr/conf/autostart.conf @@ -2,14 +2,20 @@ # Autostart # ----------------------------------------------------- -# Setup XDG for screen sharing and start waypaper and waybar +# run bitwarden float script +exec = ~/.config/hypr/scripts/BitwardenFloat.sh + +# Setup XDG for screen sharing exec-once = ~/.config/hypr/scripts/xdg.sh # Start Polkit exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Load Dunst Notification Manager -exec-once = dunst +# exec-once = dunst + +# Restore wallpaper and launch waybar +exec-once = ~/.config/hypr/scripts/wallpaper-restore.sh # Load GTK settings exec-once = ~/.config/hypr/scripts/gtk.sh @@ -18,16 +24,78 @@ exec-once = ~/.config/hypr/scripts/gtk.sh exec-once = hypridle # Load cliphist history -exec-once = wl-paste --watch cliphist store +# exec-once = wl-paste --watch cliphist store # Autostart ML4W App exec-once = ~/.config/ml4w/scripts/ml4w-autostart.sh # Start ewww daemon -exec-once = ~/.config/ml4w/scripts/ags.sh +exec = pgrep eww || eww daemon # Start autostart cleanup exec-once = ~/.config/hypr/scripts/cleanup.sh # Load configuration from ML4W Hyprland Settings App exec = ~/.config/ml4w-hyprland-settings/hyprctl.sh + + +# Start Kanshi +exec = pgrep kanshi || kanshi +exec = kanshictl reload + + +#start nautlilus +exec-once = nautilus -w + +# disable tailscale at boot +exec-once = tailscale down + +# Load Dunst Notification Manager +exec-once = swaync + +# start copyq +exec = pgrep copyq || copyq --start-server + + +# Start ewww daemon +exec = pgrep ags || ags run + +# Start Albert +exec = pgrep -x albert || albert + + +# Start wlsunset +exec = pgrep wlsunset || wlsunset -l 28.7 -L 77.1 + +# Start wifi tray +exec-once = nm-applet + +# start eclone +exec-once = rclone mount googledrive: ~/googledriv + +# start dropbox +exec-once = pgrep dropbox || dropbox + +# start sticky notes +exec-once = sticky-notes + +# start valent +exec = pgrep valent || valent --gapplication-service + +# start avizo or swayosd +# exec-once = avizo-service +exec = pgrep swayosd-server || swayosd-server + +# start waycorner and hyprspace plugin +exec = pgrep waycorner || exec waycorner +# exec-once = hyprctl plugin load ~/.config/hypr/plugins/Hyprspace/Hyprspace.so + + +# start syncthing +exec = pgrep syncthing || syncthing serve --no-browser + +# start obsidian +# exec = /usr/bin/pgrep -f "obsidian/app.asar" || obsidian +exec = ps aux | grep -v grep | grep obsidian || obsidian + +# exec = pgrep glava || glava \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/cursor.conf b/share/dotfiles/.config/hypr/conf/cursor.conf index 311593d3..b3b34935 100644 --- a/share/dotfiles/.config/hypr/conf/cursor.conf +++ b/share/dotfiles/.config/hypr/conf/cursor.conf @@ -1,6 +1 @@ exec-once = hyprctl setcursor Bibata-Modern-Ice 24 - -# No Hardware Cursor -cursor { - no_hardware_cursors = true -} diff --git a/share/dotfiles/.config/hypr/conf/custom.conf b/share/dotfiles/.config/hypr/conf/custom.conf index deaec0e9..d394219b 100644 --- a/share/dotfiles/.config/hypr/conf/custom.conf +++ b/share/dotfiles/.config/hypr/conf/custom.conf @@ -1,25 +1,4 @@ -# Add your additional Hyprland configurations here -# -# This is an additional key binding -# bind = $mainMod CTRL, up, workspace, empty -# -# Example for xwayland -# xwayland { -# force_zero_scaling = true -# } -# qt5ct environment variable -# env = QT_QPA_PLATFORMTHEME,qt5ct # SDL version -env = SDL_VIDEODRIVER,wayland -# env = SDL_VIDEODRIVER,x11 - -# No Hardware Cursor -# cursor { -# no_hardware_cursors = false -# } - -# Load nwg-dock-hyprland -# Install it first with the installation options -exec-once = ~/.config/nwg-dock-hyprland/launch.sh \ No newline at end of file +env = SDL_VIDEODRIVER,wayland \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/decorations/default.conf b/share/dotfiles/.config/hypr/conf/decorations/default.conf index 86adbde5..417e13d9 100644 --- a/share/dotfiles/.config/hypr/conf/decorations/default.conf +++ b/share/dotfiles/.config/hypr/conf/decorations/default.conf @@ -6,7 +6,7 @@ decoration { rounding = 10 active_opacity = 1.0 - inactive_opacity = 0.8 + inactive_opacity = 1.0 fullscreen_opacity = 1.0 blur { diff --git a/share/dotfiles/.config/hypr/conf/environments/kvm.conf b/share/dotfiles/.config/hypr/conf/environments/kvm.conf index 87b16a18..e0163dd5 100644 --- a/share/dotfiles/.config/hypr/conf/environments/kvm.conf +++ b/share/dotfiles/.config/hypr/conf/environments/kvm.conf @@ -7,4 +7,4 @@ # KVM Environment env = WLR_RENDERER_ALLOW_SOFTWARE, 1 -# env = LIBGL_ALWAYS_SOFTWARE,1 \ No newline at end of file +env = LIBGL_ALWAYS_SOFTWARE,1 \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/environments/nvidia.conf b/share/dotfiles/.config/hypr/conf/environments/nvidia.conf index c10643e1..0fe64b2d 100644 --- a/share/dotfiles/.config/hypr/conf/environments/nvidia.conf +++ b/share/dotfiles/.config/hypr/conf/environments/nvidia.conf @@ -6,24 +6,12 @@ # Default Settings in ml4w.conf # NVIDIA https://wiki.hyprland.org/Nvidia/ -env = GBM_BACKEND,nvidia-drm env = LIBVA_DRIVER_NAME,nvidia -env = SDL_VIDEODRIVER,wayland -env = WLR_DRM_NO_ATOMIC,1 -# env = __GL_VRR_ALLOWED,1 +env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidia -env = __NV_PRIME_RENDER_OFFLOAD,1 -env = __VK_LAYER_NV_optimus,NVIDIA_only - -# FOR VM and POSSIBLY NVIDIA -env = WLR_NO_HARDWARE_CURSORS,1 # On hyprland >v0.41, now configured on variable cursor section -env = WLR_RENDERER_ALLOW_SOFTWARE,1 - -# nvidia firefox (for hardware acceleration on FF)? -# check this post https://github.com/elFarto/nvidia-vaapi-driver#configuration -env = MOZ_DISABLE_RDD_SANDBOX,1 -env = EGL_PLATFORM,wayland +# env = __GL_VRR_ALLOWED,1 +# env = WLR_DRM_NO_ATOMIC,1 cursor { no_hardware_cursors = true -} +} \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/keybindings/default.conf b/share/dotfiles/.config/hypr/conf/keybindings/default.conf index a1bd1a9f..b0d1d413 100644 --- a/share/dotfiles/.config/hypr/conf/keybindings/default.conf +++ b/share/dotfiles/.config/hypr/conf/keybindings/default.conf @@ -9,7 +9,10 @@ $HYPRSCRIPTS = ~/.config/hypr/scripts $SCRIPTS = ~/.config/ml4w/scripts # Applications -bind = $mainMod, RETURN, exec, ~/.config/ml4w/settings/terminal.sh # Open the terminal +bind = $mainMod, RETURN, exec, foot # Open the terminal +bind = $mainMod, N, exec, ~/.config/hypr/scripts/custom_scratchpad.sh -n # Open file manager +bind = $mainMod, X, exec, ~/.config/hypr/scripts/custom_scratchpad.sh -s # Open file manager + bind = $mainMod, B, exec, ~/.config/ml4w/settings/browser.sh # Open the browser bind = $mainMod, E, exec, ~/.config/ml4w/settings/filemanager.sh # Open the filemanager bind = $mainMod CTRL, E, exec, ~/.config/ml4w/settings/emojipicker.sh # Open the emoji picker @@ -17,32 +20,46 @@ bind = $mainMod CTRL, C, exec, ~/.config/ml4w/settings/calculator.sh # Open the # Windows bind = $mainMod, Q, killactive # Kill active window -bind = $mainMod, F, fullscreen # Set active window to fullscreen -bind = $mainMod, T, togglefloating # Toggle active windows into floating mode +# bind = $mainMod, Q,exec, ~/.config/hypr/scripts/hyprcmd -q # Kill active window + +bind = $mainMod SHIFT, Q, exec, python ~/.config/hypr/scripts/kill_hypr.py # Force Kill select window +bind = $mainMod SHIFT, E, exec, swaynag -t warning -m 'Do you really want to exit Hyprland' -b 'Yes, exit Hyprland' 'hyprctl dispatch exit' # warning before kill +bindl = $mainMod, Delete, exec, systemctl hibernate -i + +# bind = $mainMod, F, fullscreen # Set active window to fullscreen +bind = $mainMod, F, exec, ~/.config/hypr/scripts/hyprcmd -f # Set active window to fullscreen + +bind = $mainMod, Space, togglefloating # Toggle active windows into floating mode bind = $mainMod SHIFT, T, exec, $HYPRSCRIPTS/toggleallfloat.sh # Toggle all windows into floating mode bind = $mainMod, J, togglesplit # Toggle split bind = $mainMod, left, movefocus, l # Move focus left bind = $mainMod, right, movefocus, r # Move focus right bind = $mainMod, up, movefocus, u # Move focus up -bind = $mainMod, down, movefocus, d # Move focus down +# bind = $mainMod, down, movefocus, d # Move focus down bindm = $mainMod, mouse:272, movewindow # Move window with the mouse + bindm = $mainMod, mouse:273, resizewindow # Resize window with the mouse bind = $mainMod SHIFT, right, resizeactive, 100 0 # Increase window width with keyboard bind = $mainMod SHIFT, left, resizeactive, -100 0 # Reduce window width with keyboard bind = $mainMod SHIFT, down, resizeactive, 0 100 # Increase window height with keyboard bind = $mainMod SHIFT, up, resizeactive, 0 -100 # Reduce window height with keyboard -bind = $mainMod, G, togglegroup # Toggle window group +bind = $mainMod, M, togglegroup # Toggle window group +bind = ALT, TAB, changegroupactive, f # Switch between grouped windows bind = $mainMod, K, swapsplit # Swapsplit +bind = $mainMod, down, exec, ~/.config/hypr/scripts/toggleSpecialWorkspace.sh # toggle to special workspace # Actions bind = $mainMod SHIFT, A, exec, $HYPRSCRIPTS/toggle-animations.sh # Toggle animations bind = $mainMod, PRINT, exec, $HYPRSCRIPTS/screenshot.sh # Take a screenshot -bind = $mainMod SHIFT, S, exec, $HYPRSCRIPTS/screenshot.sh # Take a screenshot +bind = $mainMod SHIFT, P, exec, ~/.scripts/screenshot # Take a screenshot +bind = $mainMod, P, exec, grim -g "$(slurp)" - | wl-copy --type image/png # Take clip bind = $mainMod CTRL, Q, exec, wlogout # Start wlogout bind = $mainMod SHIFT, W, exec, waypaper --random # Change the wallpaper bind = $mainMod CTRL, W, exec, waypaper # Open wallpaper selector bind = $mainMod ALT, W, exec, $HYPRSCRIPTS/wallpaper-automation.sh # Start random wallpaper script -bind = $mainMod CTRL, RETURN, exec, pkill rofi || rofi -show drun -replace -i # Open application launcher +bind = $mainMod CTRL, RETURN, exec, rofi -show drun -replace -i # Open application launcher +bind = $mainMod, D, exec, albert toggle # Open application launcher + bind = $mainMod CTRL, K, exec, $HYPRSCRIPTS/keybindings.sh # Show keybindings bind = $mainMod SHIFT, B, exec, ~/.config/waybar/launch.sh # Reload waybar bind = $mainMod CTRL, B, exec, ~/.config/waybar/toggle.sh # Toggle waybar @@ -53,6 +70,8 @@ bind = $mainMod CTRL, S, exec, ~/.config/ml4w/apps/ML4W_Dotfiles_Settings-x86_64 bind = $mainMod SHIFT, H, exec, $HYPRSCRIPTS/hyprshade.sh # Toggle screenshader bind = $mainMod ALT, G, exec, $HYPRSCRIPTS/gamemode.sh # Toggle game mode bind = $mainMod, Z, exec, missioncenter # Open Mission Center +bind = CTRL, Escape, exec, swaync-client -t # Show notification hitory +bind = $mainMod, L, exec, hyprlock # Open screenlock # Workspaces bind = $mainMod, 1, workspace, 1 # Open workspace 1 @@ -101,20 +120,30 @@ bind = $mainMod CTRL, down, workspace, empty # Open the next empty workspace # bind = SUPER, Escape, submap, reset # Get SUPER key back from virtual machine # submap = reset -# Fn keys -bind = , XF86MonBrightnessUp, exec, brightnessctl -q s +10% # Increase brightness by 10% -bind = , XF86MonBrightnessDown, exec, brightnessctl -q s 10%- # Reduce brightness by 10% -bind = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% # Increase volume by 5% -bind = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5% # Reduce volume by 5% -bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle # Toggle mute +# # Fn keys +# bind = , XF86MonBrightnessUp, exec, brightnessctl -q s +10% # Increase brightness by 10% +# bind = , XF86MonBrightnessDown, exec, brightnessctl -q s 10%- # Reduce brightness by 10% + +binde = , XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise +binde = , XF86AudioLowerVolume, exec, swayosd-client --output-volume lower +binde = , XF86MonBrightnessUp, exec, swayosd-client --brightness raise +binde = , XF86MonBrightnessDown, exec, swayosd-client --brightness lower +bind = , XF86AudioMute, exec, swayosd-client --output-volume mute-toggle +bind = , XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle + + +# bind = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% # Increase volume by 5% +# bind = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5% # Reduce volume by 5% +# bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle # Toggle mute bind = , XF86AudioPlay, exec, playerctl play-pause # Audio play pause bind = , XF86AudioPause, exec, playerctl pause # Audio pause bind = , XF86AudioNext, exec, playerctl next # Audio next bind = , XF86AudioPrev, exec, playerctl previous # Audio previous -bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle # Toggle microphone +# bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle # Toggle microphone bind = , XF86Calculator, exec, ~/.config/ml4w/settings/calculator.sh # Open calculator bind = , XF86Lock, exec, hyprlock # Open screenlock -bind = , XF86Tools, exec, $(cat ~/.config/ml4w/settings/terminal.sh) --class dotfiles-floating -e ~/.config/ml4w/apps/ML4W_Dotfiles_Settings-x86_64.AppImage # Open ML4W Dotfiles Settings app +bind = , XF86Tools, exec, alacritty --class dotfiles-floating -e ~/.config/ml4w/apps/ML4W_Dotfiles_Settings-x86_64.AppImage # Open ML4W Dotfiles Settings app bind = , code:238, exec, brightnessctl -d smc::kbd_backlight s +10 bind = , code:237, exec, brightnessctl -d smc::kbd_backlight s 10- + diff --git a/share/dotfiles/.config/hypr/conf/misc.conf b/share/dotfiles/.config/hypr/conf/misc.conf index 982954c7..1521cf26 100644 --- a/share/dotfiles/.config/hypr/conf/misc.conf +++ b/share/dotfiles/.config/hypr/conf/misc.conf @@ -1,9 +1 @@ -# ----------------------------------------------------- -# Misc settings -# ----------------------------------------------------- - -misc { - disable_hyprland_logo = true - disable_splash_rendering = true - initial_workspace_tracking = 1 -} +source = ~/.config/hypr/conf/misc/default.conf diff --git a/share/dotfiles/.config/hypr/conf/misc/dark.conf b/share/dotfiles/.config/hypr/conf/misc/dark.conf new file mode 100644 index 00000000..655f6346 --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/misc/dark.conf @@ -0,0 +1,25 @@ +# ----------------------------------------------------- +# Misc settings +# ----------------------------------------------------- + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + initial_workspace_tracking = 1 + focus_on_activate = true +} + +group { + col.border_active = 0x00D8B2AD + auto_group = false + merge_groups_on_drag = false + + groupbar{ + height = 25 + font_size = 11 + col.active = 0xff2d2d2d + col.inactive = 0xdd333333 + text_color = 0xffDDDDDD + font_family = Fira Sans Semibold + } +} \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/misc/default.conf b/share/dotfiles/.config/hypr/conf/misc/default.conf new file mode 120000 index 00000000..295a594a --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/misc/default.conf @@ -0,0 +1 @@ +/home/kushy/.config/hypr/conf/misc/light.conf \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/misc/light.conf b/share/dotfiles/.config/hypr/conf/misc/light.conf new file mode 100644 index 00000000..c0b86c91 --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/misc/light.conf @@ -0,0 +1,25 @@ +# ----------------------------------------------------- +# Misc settings +# ----------------------------------------------------- + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + initial_workspace_tracking = 1 + focus_on_activate = true +} + +group { + col.border_active = 0x00D8B2AD + auto_group = false + merge_groups_on_drag = false + + groupbar{ + height = 25 + font_size = 11 + col.active = 0xffDED6D6 + col.inactive = 0xffebebeb + text_color = 0xff000000 + font_family = Fira Sans Semibold + } +} \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/ml4w.conf b/share/dotfiles/.config/hypr/conf/ml4w.conf index 15ac063a..396ddd54 100644 --- a/share/dotfiles/.config/hypr/conf/ml4w.conf +++ b/share/dotfiles/.config/hypr/conf/ml4w.conf @@ -94,7 +94,7 @@ env = XDG_SESSION_DESKTOP,Hyprland # QT env = QT_QPA_PLATFORM,wayland;xcb env = QT_QPA_PLATFORMTHEME,qt6ct -env = QT_QPA_PLATFORMTHEME,qt5ct +# env = QT_QPA_PLATFORMTHEME,qt5ct env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 env = QT_AUTO_SCREEN_SCALE_FACTOR,1 diff --git a/share/dotfiles/.config/hypr/conf/plugin.conf b/share/dotfiles/.config/hypr/conf/plugin.conf new file mode 100644 index 00000000..68a2963b --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/plugin.conf @@ -0,0 +1 @@ +source = ~/.config/hypr/conf/plugins/default.conf diff --git a/share/dotfiles/.config/hypr/conf/plugins/default.conf b/share/dotfiles/.config/hypr/conf/plugins/default.conf new file mode 100644 index 00000000..8fade9f7 --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/plugins/default.conf @@ -0,0 +1,22 @@ +plugin { + + hyprexpo { + columns = 2 + gap_size = 5 + bg_col = rgb(111111) + workspace_method = center current # [center/first] [workspace] e.g. first 1 or center m+1 + + enable_gesture = true # laptop touchpad + gesture_fingers = 3 # 3 or 4 + gesture_distance = 300 # how far is the "max" + gesture_positive = true # positive = swipe down. Negative = swipe up. + } + overview { + panelHeight = 1000 + } + hyprwinwrap { + # class is an EXACT match and NOT a regex! + class = GLava + } +} + diff --git a/share/dotfiles/.config/hypr/conf/windowrules/default.conf b/share/dotfiles/.config/hypr/conf/windowrules/default.conf index b9bae08b..ebcd442b 100644 --- a/share/dotfiles/.config/hypr/conf/windowrules/default.conf +++ b/share/dotfiles/.config/hypr/conf/windowrules/default.conf @@ -9,8 +9,45 @@ windowrule = float,^(pavucontrol)$ windowrule = float,^(blueman-manager)$ windowrule = float,^(nm-connection-editor)$ windowrule = float,^(qalculate-gtk)$ +windowrule = float,^(foot)$ +windowrule = float,^(valent)$ +windowrule = float,^(org.gnome.Nautilus)$ +windowrule = float,^(org.qbittorrent.qBittorrent)$ +windowrule = float,^(nwg-look)$ +windowrule = float,^(electron)$ +windowrule = float,^(marktext)$ + # Browser Picture in Picture windowrulev2 = float, title:^(Picture-in-Picture)$ windowrulev2 = pin, title:^(Picture-in-Picture)$ windowrulev2 = move 69.5% 4%, title:^(Picture-in-Picture)$ +windowrule = move 1000 450, albert + + +# open/save dilogues +windowrule = float, title:^(Open|Save|Share)\s(File|Folder|Files|As)$ +windowrule = float,^(xdg-desktop-portal-gtk)$ + + +windowrule = workspace 4, vesktop +windowrule = workspace 4, obsidian +windowrule = workspace 1, firefox +windowrule = workspace 2, firefox_trade +windowrule = workspace 3, codium + + +# start sticky notes hidden +windowrule = float,^(com.vixalien.sticky)$ +# windowrule = workspace special:sticky silent,^(com.vixalien.sticky)$ +# windowrule = workspace special:sticky silent,kitty +windowrule = workspace special:nautilus silent,^(org.gnome.Nautilus)$ + +## no auto fullscreen + +windowrulev2 = suppressevent fullscreen , class:albert +windowrulev2 = suppressevent fullscreen , class:(vesktop) + + +#bitwarden +windowrulev2 = float, class:^(firefox)(.*), title:(Extension)(.*)(Bitwarden)(.*) \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/workspace.conf b/share/dotfiles/.config/hypr/conf/workspace.conf new file mode 100644 index 00000000..2dd3bfba --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/workspace.conf @@ -0,0 +1 @@ +source = ~/.config/hypr/conf/workspaces/default.conf \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/conf/workspaces/default.conf b/share/dotfiles/.config/hypr/conf/workspaces/default.conf new file mode 100644 index 00000000..eebdb63b --- /dev/null +++ b/share/dotfiles/.config/hypr/conf/workspaces/default.conf @@ -0,0 +1,28 @@ + +# workspace = 1,monitor:HDMI-A-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = 2,monitor:HDMI-A-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = 3,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = 4,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = 5,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = 6,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8,persistent:true +# workspace = special:nautilus,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8 +# workspace = special:sticky,monitor:DP-1,rounding:true,decorate:true,gapsin:1,gapsout:8 + +workspace = 1,monitor:HDMI-A-1,default:true,rounding:true,decorate:true,persistent:true +workspace = 2,monitor:HDMI-A-1,rounding:true,decorate:true,persistent:true +workspace = 3,monitor:DP-1,default:true,rounding:true,decorate:true,persistent:true +workspace = 4,monitor:DP-1,rounding:true,decorate:true,persistent:true +workspace = 5,monitor:DP-1,rounding:true,decorate:true,persistent:true +workspace = 6,monitor:DP-1,rounding:true,decorate:true,persistent:true +workspace = special:nautilus,monitor:DP-1,rounding:true,decorate:true +workspace = special:sticky,monitor:DP-1,rounding:true,decorate:true + + + +# smart gaps , how does it work ? +workspace = w[tv1], gapsout:0, gapsin:0 +workspace = f[1], gapsout:0, gapsin:0 +windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1] +windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1] +windowrulev2 = bordersize 0, floating:0, onworkspace:f[1] +windowrulev2 = rounding 0, floating:0, onworkspace:f[1] \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/hyprland.conf b/share/dotfiles/.config/hypr/hyprland.conf index 69b80f9c..dd8260c1 100644 --- a/share/dotfiles/.config/hypr/hyprland.conf +++ b/share/dotfiles/.config/hypr/hyprland.conf @@ -10,6 +10,13 @@ # Create your own custom configuration variation instead. # https://github.com/mylinuxforwork/dotfiles/wiki/Configuration-Variations + +# ----------------------------------------------------- +# Environment for xdg-desktop-portal-hyprland +# ----------------------------------------------------- +# exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + + # ----------------------------------------------------- # Monitor # ----------------------------------------------------- @@ -20,6 +27,12 @@ source = ~/.config/hypr/conf/monitor.conf # ----------------------------------------------------- source = ~/.config/hypr/conf/cursor.conf +# ----------------------------------------------------- +# Plugins +# ----------------------------------------------------- +source = ~/.config/hypr/conf/plugin.conf + + # ----------------------------------------------------- # Environment # ----------------------------------------------------- @@ -49,6 +62,7 @@ source = ~/.config/hypr/conf/layout.conf source = ~/.config/hypr/conf/misc.conf source = ~/.config/hypr/conf/keybinding.conf source = ~/.config/hypr/conf/windowrule.conf +source = ~/.config/hypr/conf/workspace.conf # ----------------------------------------------------- # Animation @@ -64,8 +78,3 @@ source = ~/.config/hypr/conf/custom.conf # ML4W Configuration # ----------------------------------------------------- source = ~/.config/hypr/conf/ml4w.conf - -# ----------------------------------------------------- -# Environment for xdg-desktop-portal-hyprland -# ----------------------------------------------------- -exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/BitwardenFloat.sh b/share/dotfiles/.config/hypr/scripts/BitwardenFloat.sh new file mode 100755 index 00000000..a25bddfe --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/BitwardenFloat.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +handle() { + case $1 in + windowtitle*) + # Extract the window ID from the line + window_id=${1#*>>} + + # Fetch the list of windows and parse it using jq to find the window by its decimal ID + window_info=$(hyprctl clients -j | jq --arg id "0x$window_id" '.[] | select(.address == ($id))') + + # Extract the title from the window info + window_title=$(echo "$window_info" | jq '.title') + + # Check if the title matches the characteristics of the Bitwarden popup window + if [[ "$window_title" == *"(Bitwarden Password Manager) - Bitwarden"* ]]; then + + # echo $window_id, $window_title + # hyprctl dispatch togglefloating address:0x$window_id + # hyprctl dispatch resizewindowpixel exact 20% 40%,address:0x$window_id + # hyprctl dispatch movewindowpixel exact 40% 30%,address:0x$window_id + + hyprctl --batch "dispatch togglefloating address:0x$window_id ; dispatch resizewindowpixel exact 20% 40%,address:0x$window_id ; dispatch movewindowpixel exact 40% 30%,address:0x$window_id" + fi + ;; + esac +} + + +exec 32> "/tmp/bitwarden.lock" +if ! flock -n 32; then + printf 'another instance is running\n'; + exit 1 +fi + + +# Listen to the Hyprland socket for events and process each line with the handle function +socat -U - UNIX-CONNECT:/run/user/1000/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done +echo "?" \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/close.sh b/share/dotfiles/.config/hypr/scripts/close.sh new file mode 100644 index 00000000..e69de29b diff --git a/share/dotfiles/.config/hypr/scripts/custom_scratchpad.sh b/share/dotfiles/.config/hypr/scripts/custom_scratchpad.sh new file mode 100755 index 00000000..dbb53989 --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/custom_scratchpad.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# current_workspace=$(hyprctl activeworkspace -j | jq '.id' ) +# nautilus_address=$(hyprctl clients -j | jq -r '.[] | select(.class == "org.gnome.Nautilus") | .address') +# nautilus_workspace=$(hyprctl clients -j | jq -r '.[] | select(.class == "org.gnome.Nautilus") | .workspace.id') + +# nautlus_scratchpad="special" +# sticky_scratchpad="sticky" + +# if [ -z $nautilus_workspace ] ;then +# echo "no nautilus window" +# nautilus -w & disown +# elif [ $current_workspace -ne $nautilus_workspace ]; then +# echo "nautilus in another workspace" +# echo \"$current_workspace,address:$nautilus_address\" +# hyprctl dispatch movetoworkspacesilent "$current_workspace,address:$nautilus_address" +# else +# # echo "nautilus in same workspace" +# hyprctl dispatch movetoworkspacesilent "name:$scratchpad,address:$nautilus_address" +# fi + + +current_workspace=$(hyprctl activeworkspace -j | jq '.id' ) + +toggle_app() { + + class="$1" + run_command="$2" + workspace="$3" + + echo $class $run_command $workspace + app_workspace=$(hyprctl clients -j | jq --arg class $class -r '.[] | select(.class == $class) | .workspace.id') + + address=$(hyprctl clients -j | jq --arg class $class -r '.[] | select(.class == $class) | .address') + + if [ -z $app_workspace ] ;then + echo "no window" + # nautilus -w & disown + eval "$run_command" & disown + hyprctl dispatch togglespecialworkspace $workspace + elif [ $current_workspace -ne $app_workspace ]; then + echo "app in another workspace {app_workspace}" + echo \"$current_workspace,address:$address\" + hyprctl dispatch movetoworkspacesilent "$current_workspace,address:$address" + else + echo "nautilus in same workspace $app_workspace, moving to special:$workspace" + hyprctl dispatch movetoworkspacesilent "special:${workspace},address:$address" + fi +} + + +toggle_workspace() { + + class="$1" + run_command="$2" + workspace="$3" + + echo $class $run_command $workspace + app_workspace=$(hyprctl clients -j | jq --arg class $class -r '.[] | select(.class == $class) | .workspace.id') + + address=$(hyprctl clients -j | jq --arg class $class -r '.[] | select(.class == $class) | .address') + + if [ -z $app_workspace ] ;then + echo "no window" + # nautilus -w & disown + eval "$2" & disown + fi + hyprctl dispatch togglespecialworkspace $workspace + # fi +} + +#!/bin/bash +verbose='false' +while getopts 'nsv' flag; do + case "${flag}" in + n) class="org.gnome.Nautilus" + run_command="nautilus -w" + workspace="nautilus" + toggle_workspace "$class" "$run_command" "$workspace" + ;; + s) class="com.vixalien.sticky" + run_command="sticky-notes" + workspace="sticky" + toggle_app "$class" "$run_command" "$workspace" + # toggle_workspace "$class" "$run_command" "$workspace" + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + +exec 101> "/tmp/toggle_floating.lock" +if ! flock -n 101; then + printf 'another instance is running\n'; + exit 1 +fi \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/diagnosis.sh b/share/dotfiles/.config/hypr/scripts/diagnosis.sh new file mode 100755 index 00000000..752e4c76 --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/diagnosis.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# ____ _ _ +# | _ \(_) __ _ __ _ _ __ ___ ___(_)___ +# | | | | |/ _` |/ _` | '_ \ / _ \/ __| / __| +# | |_| | | (_| | (_| | | | | (_) \__ \ \__ \ +# |____/|_|\__,_|\__, |_| |_|\___/|___/_|___/ +# |___/ +# + +clear +sleep 0.5 +figlet -f smslant "Diagnosis" +echo +echo "This script will check that essential packages and " +echo "execution commands are available on your system." +echo + +_commandExists() { + package="$1"; + if ! type $package > /dev/null 2>&1; then + echo ":: ERROR: $package doesn't exists. Please install it with yay -S $2" + else + echo ":: OK: $package found." + fi +} + +_folderExists() { + folder="$1"; + if [ ! -d $folder ]; then + echo ":: ERROR: $folder doesn't exists." + else + echo ":: OK: $folder found." + fi +} + +_commandExists "rofi" "rofi-wayland" +_commandExists "dunst" "dunst" +_commandExists "waybar" "waybar" +_commandExists "hyprpaper" "hyprpaper" +_commandExists "hyprlock" "hyprpaper" +_commandExists "hypridle" "hyprpaper" +_commandExists "hyprshade" "hyprshade" +_commandExists "wal" "python-pywal" +_commandExists "gum" "gum" +_commandExists "wlogout" "wlogout" +_commandExists "ags" "ags" +_commandExists "magick" "imagemagick" +_commandExists "figlet" "figlet" +_commandExists "waypaper" "waypaper" + +echo +echo "Press return to exit" +read \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/hyprcmd b/share/dotfiles/.config/hypr/scripts/hyprcmd new file mode 100755 index 00000000..93bfd081 --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/hyprcmd @@ -0,0 +1,80 @@ +#!/bin/bash +class="$( hyprctl activewindow -j | jq '.class' -r)" +title="$( hyprctl activewindow -j | jq '.title' -r)" + +# do_not_fullscreen=("albert") +do_not_fullscreen=("ulauncher" "albert") + +do_not_kill=("ulauncher" "albert" "org.gnome.Nautilus" ) +do_not_run_launcher=("csgo_linux64" "VirtualBox Machinetext") + +function fullscreen() { + for value in "${do_not_fullscreen[@]}"; do + # echo $value + if [[ $value == $class ]];then + # echo "no fullscreen" + exit 0 + fi + done + hyprctl dispatch fullscreen +} + +function close(){ + for value in "${do_not_kill[@]}"; do + # if [[ $app_id == *"$value"* || $class == *"$value"* || $title == *"$value"* ]];then + if [[ $class == "org.gnome.Nautilus" ]];then + ~/.config/hypr/scripts/custom_scratchpad.sh -n + elif [[ $class == *"$value"* ]];then + + # echo "no kill app" + exit 0 + fi + done + hyprctl dispatch killactive +} + +function albert(){ + for value in "${do_not_run_launcher[@]}"; do + # echo $value + if [[ $app_id == *"$value"* || $class == *"$value"* ]];then + # echo "$value not matching" + exit 0 + fi + done + # swaymsg fullscreen off & /bin/albert toggle + # /bin/albert toggle + # swaymsg fullscreen off & /usr/bin/ulauncher-toggle +} + + +verbose='false' +while getopts 'fqad:s:v' flag; do + case "${flag}" in + a) albert + #pactl -- set-sink-volume $sink +$val% + ;; + f) val="${OPTARG}" + fullscreen + ;; + q) val="${OPTARG}" + close + ;; + + d) val="${OPTARG}" + pulseaudio-ctl down $val && dunstify "Volume $volume" -h int:value:$(pamixer --get-volume) -a sound -r $msgId -u low + ;; + s) val="${OPTARG}" + set_volume $val + #pactl -- set-sink-volume $sink $val% + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + +exec 25> "/tmp/swaycommand..lock" +if ! flock -n 25 ; then + printf 'another instance is running\n'; + exit 1 +fi + diff --git a/share/dotfiles/.config/hypr/scripts/hyprshade.sh b/share/dotfiles/.config/hypr/scripts/hyprshade.sh index 092aa6fa..3c358c1a 100755 --- a/share/dotfiles/.config/hypr/scripts/hyprshade.sh +++ b/share/dotfiles/.config/hypr/scripts/hyprshade.sh @@ -28,7 +28,7 @@ if [[ "$1" == "rofi" ]]; then else # Toggle Hyprshade based on the selected filter - hyprshade_filter="blue-light-filter-50" + hyprshade_filter="blue-light-filter" # Check if hyprshade.sh settings file exists and load if [ -f ~/.config/ml4w/settings/hyprshade.sh ] ;then diff --git a/share/dotfiles/.config/hypr/scripts/kill_hypr.py b/share/dotfiles/.config/hypr/scripts/kill_hypr.py new file mode 100644 index 00000000..a337586f --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/kill_hypr.py @@ -0,0 +1,91 @@ +import os +import subprocess +import json +import signal + + + + +output = subprocess.check_output(["slurp", "-p"]) # shell=False +output = output.decode('utf-8').strip() +x,y = output.split(' ')[0].split(',') +x = int(x) +y = int(y) +print(f"coordinates are {x}, {y}") + + + +output = subprocess.check_output(["hyprctl", "activeworkspace", "-j"]) +output = output.decode('utf-8').strip() +workspace = json.loads(output)['id'] +print(f"workspace is {workspace}") + + + +output = subprocess.check_output(["hyprctl", "clients", "-j"]) # shell=False +output = output.decode('utf-8').strip() + +window_list = [] +windows = json.loads(output) +# windows.reverse() +for window in windows: + a = window['at'][0] + b = window['at'][1] + c = a + window['size'][0] + d = b + window['size'][1] + w_workspace = window['workspace']['id'] + # print(a,b,c,d, window['initialTitle']) + if x >= a and x <=c and y >=b and y <=d and workspace == w_workspace: + # print(f"focussed window is {window['initialTitle']}") + window_list.append(window) + pid = window['pid'] + # os.kill(pid, signal.SIGTERM) + # exit(0) + + +sorted_array = sorted( + window_list, + key=lambda x: (-x['floating'], x['focusHistoryID']) # Sort by 'floating', then 'focusid' in ascending order +) + +for window in window_list: + print(json.dumps(window, indent=2)) +window = sorted_array[0] +print(f"focussed window is {window['initialTitle']}") +pid = window['pid'] +os.kill(pid, signal.SIGTERM) + +# if len(window_list) == 1: +# window = window_list[0] +# print(f"single window") +# pid = window['pid'] +# os.kill(pid, signal.SIGTERM) +# else: +# for index, window in enumerate(window_list): +# if index == len(window_list) -1 or window_list[index+1]['floating'] == False: +# print(f"last window, killing it") +# if window['floating'] == True and window_list[index+1]['floating'] == False: +# print(f"killing floating window, next is tiling") +# else: + + + +# import json + +# # Sample array of JSON objects +# json_array = [ +# {"floating": True, "focusid": 5}, +# {"floating": False, "focusid": 3}, +# {"floating": True, "focusid": 1}, +# {"floating": True, "focusid": 4}, +# {"floating": False, "focusid": 2}, +# ] + +# # Sort the JSON array +# sorted_array = sorted( +# windows, +# key=lambda x: (-x['floating'], x['focusid']) # Sort by 'floating', then 'focusid' in ascending order +# ) + +# # Print the sorted array +# print(json.dumps(sorted_array, indent=2)) \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/loadconfig.sh b/share/dotfiles/.config/hypr/scripts/loadconfig.sh index a51ce6da..1755ae40 100755 --- a/share/dotfiles/.config/hypr/scripts/loadconfig.sh +++ b/share/dotfiles/.config/hypr/scripts/loadconfig.sh @@ -1,2 +1,3 @@ #!/bin/bash -hyprctl reload \ No newline at end of file +hyprctl reload +~/.config/waybar/launch.sh \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh b/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh new file mode 100755 index 00000000..0566294e --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/ml4w-autostart.sh @@ -0,0 +1,25 @@ +#!/bin/bash +if [ -f ~/.config/ml4w/version/compare.sh ] ;then + $HOME/.config/ml4w/version/compare.sh +fi + +if [ ! -f ~/.cache/ml4w-post-install ] ;then + if [ ! -f $HOME/.cache/ml4w-welcome-autostart ] ;then + echo ":: Autostart of ML4W Welcome App enabled." + if [ -f $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage ] ;then + echo ":: Starting ML4W Welcome App ..." + sleep 2 + $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage + else + echo ":: ML4W Welcome App not found." + fi + + else + echo ":: Autostart of ML4W Welcome App disabled." + fi +else + rm ~/.cache/ml4w-post-install + terminal=$(cat ~/.config/ml4w/settings/terminal.sh) + $terminal --class dotfiles-floating -e ~/.config/ml4w/postinstall.sh + $HOME/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage +fi diff --git a/share/dotfiles/.config/hypr/scripts/scroll_workspaces.sh b/share/dotfiles/.config/hypr/scripts/scroll_workspaces.sh new file mode 100755 index 00000000..a46c3425 --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/scroll_workspaces.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +current_workspace=$(hyprctl activeworkspace -j | jq '.id' ) +current_monitor=$(hyprctl activeworkspace -j | jq '.monitor' ) +# current_monitorID=$(echo $current_monitorID | bc ) + +last_workspace=$(hyprctl workspaces -j | jq --argjson monitor "$current_monitor" 'map(select(.monitor == $monitor and (.name | test("special") | not))) | max_by(.id) | .id') +first_workspace=$(hyprctl workspaces -j | jq --argjson monitor "$current_monitor" 'map(select(.monitor == $monitor and (.name | test("special") | not))) | min_by(.id) | .id') + + + + +echo $current_workspace $current_monitor $last_workspace +if [ $current_workspace -lt $last_workspace ];then + hyprctl dispatch workspace r+1 +else + hyprctl dispatch workspace $first_workspace +fi + + diff --git a/share/dotfiles/.config/hypr/scripts/toggleSpecialWorkspace.sh b/share/dotfiles/.config/hypr/scripts/toggleSpecialWorkspace.sh new file mode 100755 index 00000000..4941ae2c --- /dev/null +++ b/share/dotfiles/.config/hypr/scripts/toggleSpecialWorkspace.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# if speical workspace is active , toggle it, otherwise send it back to special workspace + +workspace=$(hyprctl activewindow -j | jq '.workspace.name' | sed 's|.*:||;s|\"||') +is_special=$(hyprctl activewindow -j | jq '.workspace.name' | grep special) + +if [ -z $is_special ];then + hyprctl dispatch movetoworkspacesilent special +else + hyprctl dispatch togglespecialworkspace $workspace +fi \ No newline at end of file diff --git a/share/dotfiles/.config/hypr/scripts/wallpaper.sh b/share/dotfiles/.config/hypr/scripts/wallpaper.sh index 11917429..c054fcc1 100755 --- a/share/dotfiles/.config/hypr/scripts/wallpaper.sh +++ b/share/dotfiles/.config/hypr/scripts/wallpaper.sh @@ -10,11 +10,14 @@ # Check to use wallpaper cache # ----------------------------------------------------- -if [ -f ~/.config/ml4w/settings/wallpaper_cache ]; then +use_cache=0 +if [ -f ~/.config/ml4w/settings/wallpaper_cache ] ;then use_cache=1 +fi + +if [ "$use_cache" == "1" ] ;then echo ":: Using Wallpaper Cache" else - use_cache=0 echo ":: Wallpaper Cache disabled" fi @@ -23,80 +26,80 @@ fi # ----------------------------------------------------- force_generate=0 -generatedversions="$HOME/.config/ml4w/cache/wallpaper-generated" -waypaperrunning=$HOME/.config/ml4w/cache/waypaper-running -cachefile="$HOME/.config/ml4w/cache/current_wallpaper" -blurredwallpaper="$HOME/.config/ml4w/cache/blurred_wallpaper.png" -squarewallpaper="$HOME/.config/ml4w/cache/square_wallpaper.png" -rasifile="$HOME/.config/ml4w/cache/current_wallpaper.rasi" -blurfile="$HOME/.config/ml4w/settings/blur.sh" -defaultwallpaper="$HOME/wallpaper/default.jpg" -wallpapereffect="$HOME/.config/ml4w/settings/wallpaper-effect.sh" +generated_versions="$HOME/.config/ml4w/cache/wallpaper-generated" +waypaper_running=$HOME/.config/ml4w/cache/waypaper-running +cache_file="$HOME/.config/ml4w/cache/current_wallpaper" +blurred_wallpaper="$HOME/.config/ml4w/cache/blurred_wallpaper.png" +square_wallpaper="$HOME/.config/ml4w/cache/square_wallpaper.png" +rasi_file="$HOME/.config/ml4w/cache/current_wallpaper.rasi" +blur_file="$HOME/.config/ml4w/settings/blur.sh" +default_wallpaper="$HOME/wallpaper/default.jpg" +wallpaper_effect="$HOME/.config/ml4w/settings/wallpaper-effect.sh" blur="50x30" -blur=$(cat $blurfile) +blur=$(cat $blur_file) # Ensures that the script only run once if wallpaper effect enabled -if [ -f $waypaperrunning ]; then - rm $waypaperrunning +if [ -f $waypaper_running ] ;then + rm $waypaper_running exit fi # Create folder with generated versions of wallpaper if not exists -if [ ! -d $generatedversions ]; then - mkdir $generatedversions +if [ ! -d $generated_versions ] ;then + mkdir $generated_versions fi # ----------------------------------------------------- # Get selected wallpaper # ----------------------------------------------------- -if [ -z $1 ]; then - if [ -f $cachefile ]; then - wallpaper=$(cat $cachefile) +if [ -z $1 ] ;then + if [ -f $cache_file ] ;then + wallpaper=$(cat $cache_file) else - wallpaper=$defaultwallpaper + wallpaper=$default_wallpaper fi else wallpaper=$1 fi used_wallpaper=$wallpaper -echo ":: Setting wallpaper with source image $wallpaper" -tmpwallpaper=$wallpaper +echo ":: Setting wallpaper with original image $wallpaper" +tmp_wallpaper=$wallpaper # ----------------------------------------------------- # Copy path of current wallpaper to cache file # ----------------------------------------------------- -if [ ! -f $cachefile ]; then - touch $cachefile +if [ ! -f $cache_file ] ;then + touch $cache_file fi -echo "$wallpaper" > $cachefile -echo ":: Path of current wallpaper copied to $cachefile" +echo "$wallpaper" > $cache_file +echo ":: Path of current wallpaper copied to $cache_file" # ----------------------------------------------------- # Get wallpaper filename # ----------------------------------------------------- -wallpaperfilename=$(basename $wallpaper) -echo ":: Wallpaper Filename: $wallpaperfilename" +wallpaper_filename=$(basename $wallpaper) +echo ":: Wallpaper Filename: $wallpaper_filename" # ----------------------------------------------------- # Wallpaper Effects # ----------------------------------------------------- -if [ -f $wallpapereffect ]; then - effect=$(cat $wallpapereffect) - if [ ! "$effect" == "off" ]; then - used_wallpaper=$generatedversions/$effect-$wallpaperfilename - if [ -f $generatedversions/$effect-$wallpaperfilename ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ]; then - echo ":: Use cached wallpaper $effect-$wallpaperfilename" +if [ -f $wallpaper_effect ] ;then + effect=$(cat $wallpaper_effect) + if [ ! "$effect" == "off" ] ;then + used_wallpaper=$generated_versions/$effect-$wallpaper_filename + if [ -f $generated_versions/$effect-$wallpaper_filename ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + echo ":: Use cached wallpaper $effect-$wallpaper_filename" else - echo ":: Generate new cached wallpaper $effect-$wallpaperfilename with effect $effect" - dunstify "Using wallpaper effect $effect..." "with image $wallpaperfilename" -h int:value:33 -h string:x-dunst-stack-tag:wallpaper + echo ":: Generate new cached wallpaper $effect-$wallpaper_filename with effect $effect" + dunstify "Using wallpaper effect $effect..." "with image $wallpaper_filename" -h int:value:10 -h string:x-dunst-stack-tag:wallpaper source $HOME/.config/hypr/effects/wallpaper/$effect fi - echo ":: Loading wallpaper $generatedversions/$effect-$wallpaperfilename with effect $effect" + echo ":: Loading wallpaper $generated_versions/$effect-$wallpaper_filename with effect $effect" echo ":: Setting wallpaper with $used_wallpaper" - touch $waypaperrunning + touch $waypaper_running waypaper --wallpaper $used_wallpaper else echo ":: Wallpaper effect is set to off" @@ -105,69 +108,61 @@ else effect="off" fi -# ----------------------------------------------------- -# Stop all running waybar instances -# ----------------------------------------------------- - -echo ":: Stop all running waybar instances" -killall waybar -pkill waybar # ----------------------------------------------------- # Execute pywal # ----------------------------------------------------- echo ":: Execute pywal with $used_wallpaper" -wal -q -i "$used_wallpaper" +if [[ $(darkman get) == "light" ]];then + wal -q -l -i $used_wallpaper +else + wal -q -i $used_wallpaper +fi source "$HOME/.cache/wal/colors.sh" # ----------------------------------------------------- # Reload Waybar # ----------------------------------------------------- - ~/.config/waybar/launch.sh # ----------------------------------------------------- -# Pywalfox +# Reload AGS # ----------------------------------------------------- - -if type pywalfox > /dev/null 2>&1; then - pywalfox update -fi - +killall ags +ags & +eww reload # ----------------------------------------------------- # Created blurred wallpaper # ----------------------------------------------------- -if [ -f $generatedversions/blur-$blur-$effect-$wallpaperfilename.png ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ]; then - echo ":: Use cached wallpaper blur-$blur-$effect-$wallpaperfilename" +if [ -f $generated_versions/blur-$blur-$effect-$wallpaper_filename.png ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ] ;then + echo ":: Use cached wallpaper blur-$blur-$effect-$wallpaper_filename" else - echo ":: Generate new cached wallpaper blur-$blur-$effect-$wallpaperfilename with blur $blur" - dunstify "Generate new blurred version" "with blur $blur" -h int:value:66 -h string:x-dunst-stack-tag:wallpaper - magick $used_wallpaper -resize 75% $blurredwallpaper + echo ":: Generate new cached wallpaper blur-$blur-$effect-$wallpaper_filename with blur $blur" + magick $used_wallpaper -resize 75% $blurred_wallpaper echo ":: Resized to 75%" - if [ ! "$blur" == "0x0" ]; then - magick $blurredwallpaper -blur $blur $blurredwallpaper - cp $blurredwallpaper $generatedversions/blur-$blur-$effect-$wallpaperfilename.png + if [ ! "$blur" == "0x0" ] ;then + magick $blurred_wallpaper -blur $blur $blurred_wallpaper + cp $blurred_wallpaper $generated_versions/blur-$blur-$effect-$wallpaper_filename.png echo ":: Blurred" fi fi -cp $generatedversions/blur-$blur-$effect-$wallpaperfilename.png $blurredwallpaper +cp $generated_versions/blur-$blur-$effect-$wallpaper_filename.png $blurred_wallpaper # ----------------------------------------------------- # Create rasi file # ----------------------------------------------------- -if [ ! -f $rasifile ]; then - touch $rasifile +if [ ! -f $rasi_file ] ;then + touch $rasi_file fi -echo "* { current-image: url(\"$blurredwallpaper\", height); }" > "$rasifile" +echo "* { current-image: url(\"$blurred_wallpaper\", height); }" > "$rasi_file" # ----------------------------------------------------- # Created square wallpaper # ----------------------------------------------------- -echo ":: Generate new cached wallpaper square-$wallpaperfilename" -magick $tmpwallpaper -gravity Center -extent 1:1 $squarewallpaper -cp $squarewallpaper $generatedversions/square-$wallpaperfilename.png - +echo ":: Generate new cached wallpaper square-$wallpaper_filename" +magick $tmp_wallpaper -gravity Center -extent 1:1 $square_wallpaper +cp $square_wallpaper $generated_versions/square-$wallpaper_filename.png diff --git a/share/dotfiles/.config/hypr/scripts/xdg.sh b/share/dotfiles/.config/hypr/scripts/xdg.sh index 1fb182f6..6177b64a 100755 --- a/share/dotfiles/.config/hypr/scripts/xdg.sh +++ b/share/dotfiles/.config/hypr/scripts/xdg.sh @@ -6,11 +6,9 @@ # /_/\_\____/ \____| # -# Setup Timers -_sleep1="0.1" -_sleep2="0.5" +sleep 1 -# Kill all possible running xdg-desktop-portals +# kill all possible running xdg-desktop-portals killall -e xdg-desktop-portal-hyprland killall -e xdg-desktop-portal-gnome killall -e xdg-desktop-portal-kde @@ -18,39 +16,18 @@ killall -e xdg-desktop-portal-lxqt killall -e xdg-desktop-portal-wlr killall -e xdg-desktop-portal-gtk killall -e xdg-desktop-portal +sleep 1 -# Set required environment variables -dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=hyprland - -# Stop all services -systemctl --user stop pipewire -systemctl --user stop wireplumber -systemctl --user stop xdg-desktop-portal -systemctl --user stop xdg-desktop-portal-gnome -systemctl --user stop xdg-desktop-portal-kde -systemctl --user stop xdg-desktop-portal-wlr -systemctl --user stop xdg-desktop-portal-hyprland -sleep $_sleep1 - -# Start xdg-desktop-portal-hyprland +# start xdg-desktop-portal-hyprland /usr/lib/xdg-desktop-portal-hyprland & -sleep $_sleep1 +sleep 2 -# Start xdg-desktop-portal-gtk +# start xdg-desktop-portal-gtk if [ -f /usr/lib/xdg-desktop-portal-gtk ] ;then /usr/lib/xdg-desktop-portal-gtk & - sleep $_sleep1 + sleep 1 fi -# Start xdg-desktop-portal +# start xdg-desktop-portal /usr/lib/xdg-desktop-portal & -sleep $_sleep2 - -# Start required services -systemctl --user start pipewire -systemctl --user start wireplumber -systemctl --user start xdg-desktop-portal -systemctl --user start xdg-desktop-portal-hyprland - -# Run wallpaper-restore with waypaper and waybar -~/.config/hypr/scripts/wallpaper-restore.sh +sleep 1 \ No newline at end of file diff --git a/share/dotfiles/.config/interception/SUPERKEY_LAUNCHER.yaml b/share/dotfiles/.config/interception/SUPERKEY_LAUNCHER.yaml new file mode 100755 index 00000000..fadce2c4 --- /dev/null +++ b/share/dotfiles/.config/interception/SUPERKEY_LAUNCHER.yaml @@ -0,0 +1,8 @@ +TIMING: + TAP_MILLISEC: 200 + DOUBLE_TAP_MILLISEC: 0 + +MAPPINGS: + - KEY: KEY_LEFTMETA + TAP: [KEY_LEFTMETA,KEY_D,] + HOLD: KEY_LEFTMETA diff --git a/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml b/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml new file mode 100755 index 00000000..eb65fd79 --- /dev/null +++ b/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml @@ -0,0 +1,15 @@ +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "AT Translated Set 2 keyboard" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Gaming KB Gaming KB " +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Compx 2.4G Wireless Receiver" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Keychron Keychron Q1 Keyboard" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*Qwertykeys.*" diff --git a/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml.bak b/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml.bak new file mode 100755 index 00000000..fc747d3d --- /dev/null +++ b/share/dotfiles/.config/interception/udevmon.d/udevmon.yaml.bak @@ -0,0 +1,6 @@ +-JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "AT Translated Set 2 keyboard" +#-JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" +# DEVICE: +# NAME: "Gaming KB Gaming KB Keyboard" diff --git a/share/dotfiles/.config/interception/udevmon.yaml b/share/dotfiles/.config/interception/udevmon.yaml new file mode 100755 index 00000000..bfee8272 --- /dev/null +++ b/share/dotfiles/.config/interception/udevmon.yaml @@ -0,0 +1,37 @@ +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "AT Translated Set 2 keyboard" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Gaming KB Gaming KB " +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Compx 2.4G Wireless Receiver" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: "Keychron Keychron Q1 Keyboard" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*Qwertykeys.*" +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*Laneware.*" + +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*CannonKeys.*" + +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*Keychron.*" + + +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*Elantech.*" + + + +- JOB: "intercept -g $DEVNODE | dual-function-keys -c /etc/interception/SUPERKEY_LAUNCHER.yaml | uinput -d $DEVNODE" + DEVICE: + NAME: ".*mw60.*" diff --git a/share/dotfiles/.config/kanshi/config b/share/dotfiles/.config/kanshi/config new file mode 100755 index 00000000..7f732f80 --- /dev/null +++ b/share/dotfiles/.config/kanshi/config @@ -0,0 +1,31 @@ +profile { + output "HDMI-A-1" mode 2560x1440@59.95Hz position 0,0 scale 1 + output "DP-1" mode 2560x1440@59.95Hz position 2560,0 scale 1 + output "eDP-1" disable + #output "eDP-1" mode 1920x1080@60.00300Hz position 5120,0 scale 1 + # displayport is required for wayland adaptive sync +} + +profile { + output "eDP-1" mode 1920x1080@60.0031Hz position 0,0 scale 1 +} + +profile left { + output "HDMI-A-1" mode 2560x1440@59.95Hz position 0,0 scale 1 + output "DP-1" disable + output "eDP-1" disable +} + +profile right { + output "HDMI-A-1" disable + output "DP-1" mode 2560x1440@59.95Hz position 2560,0 scale 1 + output "eDP-1" disable +} + +profile all { + output "HDMI-A-1" mode 2560x1440@59.95Hz position 0,0 scale 1 + output "DP-1" mode 2560x1440@59.95Hz position 2560,0 scale 1 + output "eDP-1" disable + #output "eDP-1" mode 1920x1080@60.00300Hz position 5120,0 scale 1 + # displayport is required for wayland adaptive sync +} diff --git a/share/dotfiles/.config/mimeapps.list b/share/dotfiles/.config/mimeapps.list new file mode 100644 index 00000000..01c2e226 --- /dev/null +++ b/share/dotfiles/.config/mimeapps.list @@ -0,0 +1,179 @@ +[Added Associations] +application/x-csv=codium.desktop;libreoffice-calc.desktop; +text/x-csv=codium.desktop;libreoffice-calc.desktop; +application/octet-stream=codium.desktop;codium-uri-handler.desktop; +binary/octet-stream=codium-uri-handler.desktop; +image/jpeg=gimp.desktop;imv.desktop;org.gnome.eog.desktop;imv-custom.desktop;imv-folder.desktop;imv-dir.desktop; +image/svg+xml=org.inkscape.Inkscape.desktop;imv-custom.desktop;imv.desktop;codium.desktop;viewnior.desktop; +text/csv=codium.desktop;libreoffice-calc.desktop; +application/json=codium.desktop; +application/x-shellscript=codium.desktop; +application/pdf=firefox-personal.desktop;masterpdfeditor4.desktop;gimp.desktop;libreoffice-draw.desktop;org.gnome.Evince.desktop; +application/rss+xml=firefox-personal.desktop; +image/webp=imv-folder.desktop;imv-custom.desktop;imv-dir.desktop; +video/mp2t=mpv.desktop; +video/x-matroska=mpv.desktop;vlc.desktop; +application/x-markdown=appimagekit_ae58fba2d9c98999889b4f293f413722-MarkText.desktop +text/plain=codium.desktop;xed.desktop;org.gnome.gedit.desktop;imv-folder.desktop; +application/x-yaml=codium.desktop; +text/x-python=codium.desktop;org.gnome.gedit.desktop; +x-scheme-handler/msteams=teams.desktop +application/vnd.ms-publisher=codium-uri-handler.desktop; +text/css=codium.desktop; +audio/mp4=vlc.desktop; +application/x-bittorrent=org.qbittorrent.qBittorrent.desktop;wtransmission-gtk.desktop; +image/png=gimp.desktop;imv-folder.desktop;imv.desktop; +font/ttf=org.gnome.gedit.desktop;codium-uri-handler.desktop;org.gnome.FontViewer.desktop; +font/woff=org.gnome.FontManager.desktop; +application/zip=org.gnome.Nautilus.desktop;org.gnome.FileRoller.desktop;libreoffice-calc.desktop; +application/x-ms-dos-executable=wine.desktop;org.gnome.FileRoller.desktop; +application/x-wine-extension-ini=org.gnome.gedit.desktop;codium-uri-handler.desktop; +audio/ogg=vlc.desktop; +application/sql=codium.desktop; +x-scheme-handler/http=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +video/ogg=vlc.desktop; +video/x-ogm=vlc.desktop; +video/x-theora+ogg=vlc.desktop; +video/x-theora=vlc.desktop; +video/x-ms-asf=vlc.desktop; +video/x-ms-asf-plugin=vlc.desktop; +video/x-ms-asx=vlc.desktop; +video/x-ms-wm=vlc.desktop; +video/x-ms-wmv=vlc.desktop; +video/x-ms-wmx=vlc.desktop; +video/x-ms-wvx=vlc.desktop; +video/x-msvideo=vlc.desktop; +video/divx=vlc.desktop; +video/msvideo=vlc.desktop; +video/vnd.divx=vlc.desktop; +video/avi=vlc.desktop; +video/x-avi=vlc.desktop; +video/vnd.rn-realvideo=vlc.desktop; +video/mpeg=vlc.desktop; +video/mpeg-system=vlc.desktop; +video/x-mpeg=vlc.desktop; +video/x-mpeg2=vlc.desktop; +video/x-mpeg-system=vlc.desktop; +video/mp4v-es=vlc.desktop; +video/x-m4v=vlc.desktop; +video/quicktime=vlc.desktop; +video/webm=vlc.desktop; +video/3gp=vlc.desktop; +video/3gpp=vlc.desktop; +video/3gpp2=vlc.desktop; +video/vnd.mpegurl=vlc.desktop; +video/dv=vlc.desktop; +video/x-anim=vlc.desktop; +video/x-nsv=vlc.desktop; +video/fli=vlc.desktop; +video/flv=vlc.desktop; +video/x-flc=vlc.desktop; +video/x-fli=vlc.desktop; +video/x-flv=vlc.desktop; +application/x-subrip=codium.desktop; +application/vnd.adobe.flash.movie=flashplayer.desktop; +image/vnd.microsoft.icon=gimp.desktop;viewnior.desktop;org.gnome.eog.desktop; +text/x-maven+xml=codium.desktop;codium-uri-handler.desktop; +text/x-log=codium.desktop; +text/x-matlab=codium.desktop; +x-scheme-handler/https=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +x-scheme-handler/chrome=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +text/html=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/x-extension-htm=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/x-extension-html=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/x-extension-shtml=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/xhtml+xml=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/x-extension-xhtml=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +application/x-extension-xht=firefox-personal.desktop;firefox-personal.desktop;firefox.desktop; +image/gif=imv-folder.desktop;imv-custom.desktop; +application/vnd.appimage=org.gnome.FileRoller.desktop; +text/x-tex=codium.desktop; +inode/directory=org.gnome.Nautilus.desktop; +application/x-zerosize=vlc.desktop;imv.desktop;codium.desktop;MarkText.desktop; +x-scheme-handler/tonsite=org.telegram.desktop.desktop; +application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop; +application/x-java=jetbrains-idea-ce-b3a3aa12-3205-430a-8f91-9a72ae786405.desktop; + +[Default Applications] +x-scheme-handler/msteams=teams.desktop +image/svg+xml=imv-custom.desktop +application/json=codium.desktop +image/webp=imv-dir.desktop +application/pdf=org.gnome.Evince.desktop +x-scheme-handler/http=firefox.desktop +x-scheme-handler/https=firefox.desktop +image/jpeg=imv-dir.desktop +image/png=imv.desktop +video/mp4=vlc.desktop +x-scheme-handler/postman=Postman.desktop +inode/directory=org.gnome.Nautilus.desktop +video/mp2t=vlc.desktop +text/html=firefox.desktop +x-scheme-handler/about=firefox-personal.desktop +x-scheme-handler/unknown=firefox-personal.desktop +video/x-ogm+ogg=vlc.desktop +video/ogg=vlc.desktop +video/x-ogm=vlc.desktop +video/x-theora+ogg=vlc.desktop +video/x-theora=vlc.desktop +video/x-ms-asf=vlc.desktop +video/x-ms-asf-plugin=vlc.desktop +video/x-ms-asx=vlc.desktop +video/x-ms-wm=vlc.desktop +video/x-ms-wmv=vlc.desktop +video/x-ms-wmx=vlc.desktop +video/x-ms-wvx=vlc.desktop +video/x-msvideo=vlc.desktop +video/divx=vlc.desktop +video/msvideo=vlc.desktop +video/vnd.divx=vlc.desktop +video/avi=vlc.desktop +video/x-avi=vlc.desktop +video/vnd.rn-realvideo=vlc.desktop +video/mpeg=vlc.desktop +video/mpeg-system=vlc.desktop +video/x-mpeg=vlc.desktop +video/x-mpeg2=vlc.desktop +video/x-mpeg-system=vlc.desktop +video/mp4v-es=vlc.desktop +video/x-m4v=vlc.desktop +video/quicktime=vlc.desktop +video/x-matroska=vlc.desktop +video/webm=vlc.desktop +video/3gp=vlc.desktop +video/3gpp=vlc.desktop +video/3gpp2=vlc.desktop +video/vnd.mpegurl=vlc.desktop +video/dv=vlc.desktop +video/x-anim=vlc.desktop +video/x-nsv=vlc.desktop +video/fli=vlc.desktop +video/flv=vlc.desktop +video/x-flc=vlc.desktop +video/x-fli=vlc.desktop +video/x-flv=vlc.desktop +x-scheme-handler/eclipse+command x-scheme-handler/eclipse+mpc=_opt_eclipse_.desktop +application/vnd.adobe.flash.movie=flashplayer.desktop +x-scheme-handler/mailto=firefox-personal.desktop +x-scheme-handler/chrome=firefox.desktop +application/x-extension-htm=firefox.desktop +application/x-extension-html=firefox.desktop +application/x-extension-shtml=firefox.desktop +application/xhtml+xml=firefox.desktop +application/x-extension-xhtml=firefox.desktop +application/x-extension-xht=firefox.desktop +image/gif=imv-custom.desktop +inode/directory=org.gnome.Nautilus.desktop; +application/x-zerosize=MarkText.desktop +application/x-csv=codium.desktop;libreoffice-calc.desktop; +text/x-csv=codium.desktop;libreoffice-calc.desktop; +text/csv=codium.desktop +text/markdown=appimagekit_ae58fba2d9c98999889b4f293f413722-MarkText.desktop +application/x-markdown=appimagekit_ae58fba2d9c98999889b4f293f413722-MarkText.desktop +text/plain=codium.desktop +font/ttf=org.gnome.FontViewer.desktop +x-scheme-handler/tonsite=org.telegram.desktop.desktop +application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop +x-scheme-handler/jetbrains=jetbrains-toolbox.desktop +application/x-java=jetbrains-idea-ce-b3a3aa12-3205-430a-8f91-9a72ae786405.desktop +hoppscotch=hoppscotch-handler.desktop diff --git a/share/dotfiles/.config/swaync/config.json b/share/dotfiles/.config/swaync/config.json new file mode 100755 index 00000000..95e30128 --- /dev/null +++ b/share/dotfiles/.config/swaync/config.json @@ -0,0 +1,74 @@ +{ + "$schema": "/etc/xdg/swaync/configSchema.json", + "positionX": "center", + "positionY": "top", + "layer": "top", + "cssPriority": "application", + "control-center-margin-top": 0, + "control-center-margin-bottom": 0, + "control-center-margin-right": 0, + "control-center-margin-left": 0, + "notification-icon-size": 64, + "notification-body-image-height": 100, + "notification-body-image-width": 200, + "timeout": 10, + "timeout-low": 5, + "timeout-critical": 0, + "fit-to-screen": true, + "control-center-width": 500, + "control-center-height": 600, + "notification-window-width": 500, + "keyboard-shortcuts": true, + "image-visibility": "when-available", + "transition-time": 200, + "hide-on-clear": false, + "hide-on-action": true, + "script-fail-notify": false, + "scripts": { + "example-script": { + "exec": "echo 'Do something...'", + "urgency": "Normal" + }, + "example-action-script": { + "exec": "echo 'Do something actionable!'", + "urgency": "Normal", + "run-on": "action" + } + }, + "notification-visibility": { + "example-name": { + "state": "muted", + "urgency": "Low", + "app-name": "Spotify" + } + }, + "widgets": [ + "inhibitors", + "title", + "dnd", + "notifications" + ], + "widget-config": { + "inhibitors": { + "text": "Inhibitors", + "button-text": "Clear All", + "clear-all-button": true + }, + "title": { + "text": "Notifications", + "clear-all-button": true, + "button-text": "Clear All" + }, + "dnd": { + "text": "Do Not Disturb" + }, + "label": { + "max-lines": 5, + "text": "Label Text" + }, + "mpris": { + "image-size": 96, + "image-radius": 12 + } + } +} diff --git a/share/dotfiles/.config/swaync/style.css b/share/dotfiles/.config/swaync/style.css new file mode 100755 index 00000000..f8e9a77b --- /dev/null +++ b/share/dotfiles/.config/swaync/style.css @@ -0,0 +1,318 @@ +/* + * vim: ft=less + */ + +@define-color cc-bg rgba(0, 0, 0, 0.7); + +@define-color noti-border-color rgba(255, 255, 255, 0.15); +@define-color noti-bg rgb(48, 48, 48); +@define-color noti-bg-hover rgb(56, 56, 56); +@define-color noti-bg-focus rgba(68, 68, 68, 0.6); +@define-color noti-close-bg rgba(255, 255, 255, 0.1); +@define-color noti-close-bg-hover rgba(255, 255, 255, 0.15); + +@define-color bg-selected rgb(0, 128, 255); + +.notification-row { + outline: none; +} + +.notification-row:focus, +.notification-row:hover { + background: @noti-bg-focus; +} + +.notification { + border-radius: 12px; + margin: 6px 12px; + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.7), + 0 2px 6px 2px rgba(0, 0, 0, 0.3); + padding: 0; +} + +/* Uncomment to enable specific urgency colors +.low { + background: yellow; + padding: 6px; + border-radius: 12px; +} + +.normal { + background: green; + padding: 6px; + border-radius: 12px; +} + */ +.critical { + background: red; + padding: 6px; + border-radius: 12px; +} + + +.notification-content { + background: transparent; + padding: 6px; + border-radius: 12px; +} + +.close-button { + background: @noti-close-bg; + color: white; + text-shadow: none; + padding: 0; + border-radius: 100%; + margin-top: 10px; + margin-right: 16px; + box-shadow: none; + border: none; + min-width: 24px; + min-height: 24px; +} + +.close-button:hover { + box-shadow: none; + background: @noti-close-bg-hover; + transition: all 0.15s ease-in-out; + border: none; +} + +.notification-default-action, +.notification-action { + padding: 4px; + margin: 0; + box-shadow: none; + background: @noti-bg; + border: 1px solid @noti-border-color; + color: white; +} + +.notification-default-action:hover, +.notification-action:hover { + -gtk-icon-effect: none; + background: @noti-bg-hover; +} + +.notification-default-action { + border-radius: 12px; +} + +/* When alternative actions are visible */ +.notification-default-action:not(:only-child) { + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +.notification-action { + border-radius: 0px; + border-top: none; + border-right: none; +} + +/* add bottom border radius to eliminate clipping */ +.notification-action:first-child { + border-bottom-left-radius: 10px; +} + +.notification-action:last-child { + border-bottom-right-radius: 10px; + border-right: 1px solid @noti-border-color; +} + +.image { +} + +.body-image { + margin-top: 6px; + background-color: white; + border-radius: 12px; +} + +.summary { + font-size: 16px; + font-weight: bold; + background: transparent; + color: white; + text-shadow: none; +} + +.time { + font-size: 16px; + font-weight: bold; + background: transparent; + color: white; + text-shadow: none; + margin-right: 18px; +} + +.body { + font-size: 15px; + font-weight: normal; + background: transparent; + color: white; + text-shadow: none; +} + +.control-center { + background: @cc-bg; +} + +.control-center-list { + background: transparent; +} + +.control-center-list-placeholder { + opacity: 0.5; +} + +.floating-notifications { + background: transparent; +} + +/* Window behind control center and on all other monitors */ +.blank-window { + background: alpha(black, 0.25); +} + +/*** Widgets ***/ + +/* Title widget */ +.widget-title { + margin: 8px; + font-size: 1.5rem; +} +.widget-title > button { + font-size: initial; + color: white; + text-shadow: none; + background: @noti-bg; + border: 1px solid @noti-border-color; + box-shadow: none; + border-radius: 12px; +} +.widget-title > button:hover { + background: @noti-bg-hover; +} + +/* DND widget */ +.widget-dnd { + margin: 8px; + font-size: 1.1rem; +} +.widget-dnd > switch { + font-size: initial; + border-radius: 12px; + background: @noti-bg; + border: 1px solid @noti-border-color; + box-shadow: none; +} +.widget-dnd > switch:checked { + background: @bg-selected; +} +.widget-dnd > switch slider { + background: @noti-bg-hover; + border-radius: 12px; +} + +/* Label widget */ +.widget-label { + margin: 8px; +} +.widget-label > label { + font-size: 1.1rem; +} + +/* Mpris widget */ +.widget-mpris { + /* The parent to all players */ +} +.widget-mpris-player { + padding: 8px; + margin: 8px; +} +.widget-mpris-title { + font-weight: bold; + font-size: 1.25rem; +} +.widget-mpris-subtitle { + font-size: 1.1rem; +} + +/* Buttons widget */ +.widget-buttons-grid { + padding: 8px; + margin: 8px; + border-radius: 12px; + background-color: @noti-bg; +} + +.widget-buttons-grid>flowbox>flowboxchild>button{ + background: @noti-bg; + border-radius: 12px; +} + +.widget-buttons-grid>flowbox>flowboxchild>button:hover { + background: @noti-bg-hover; +} + +/* Menubar widget */ +.widget-menubar>box>.menu-button-bar>button { + border: none; + background: transparent; +} + +/* .AnyName { Name defined in config after # + background-color: @noti-bg; + padding: 8px; + margin: 8px; + border-radius: 12px; +} + +.AnyName>button { + background: transparent; + border: none; +} + +.AnyName>button:hover { + background-color: @noti-bg-hover; +} */ + +.topbar-buttons>button { /* Name defined in config after # */ + border: none; + background: transparent; +} + +/* Volume widget */ + +.widget-volume { + background-color: @noti-bg; + padding: 8px; + margin: 8px; + border-radius: 12px; +} + +/* Backlight widget */ +.widget-backlight { + background-color: @noti-bg; + padding: 8px; + margin: 8px; + border-radius: 12px; +} + +/* Title widget */ +.widget-inhibitors { + margin: 8px; + font-size: 1.5rem; +} +.widget-inhibitors > button { + font-size: initial; + color: white; + text-shadow: none; + background: @noti-bg; + border: 1px solid @noti-border-color; + box-shadow: none; + border-radius: 12px; +} +.widget-inhibitors > button:hover { + background: @noti-bg-hover; +} diff --git a/share/dotfiles/.config/user-dirs.dirs b/share/dotfiles/.config/user-dirs.dirs new file mode 100644 index 00000000..1d8f7f2b --- /dev/null +++ b/share/dotfiles/.config/user-dirs.dirs @@ -0,0 +1,15 @@ +# This file is written by xdg-user-dirs-update +# If you want to change or add directories, just edit the line you're +# interested in. All local changes will be retained on the next run. +# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped +# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an +# absolute path. No other format is supported. +# +XDG_DESKTOP_DIR="$HOME/" +XDG_DOWNLOAD_DIR="$HOME/Downloads" +XDG_TEMPLATES_DIR="$HOME/" +XDG_PUBLICSHARE_DIR="$HOME/" +XDG_DOCUMENTS_DIR="$HOME/Documents" +XDG_MUSIC_DIR="$HOME/" +XDG_PICTURES_DIR="$HOME/Pictures" +XDG_VIDEOS_DIR="$HOME/Videos" diff --git a/share/dotfiles/.config/waybar/launch.sh b/share/dotfiles/.config/waybar/launch.sh index ec70cf96..bf016957 100755 --- a/share/dotfiles/.config/waybar/launch.sh +++ b/share/dotfiles/.config/waybar/launch.sh @@ -11,23 +11,16 @@ # ----------------------------------------------------- # Quit all running waybar instances # ----------------------------------------------------- +$HOME/.config/waybar/scripts/silent info + killall waybar pkill waybar sleep 0.5 -# ----------------------------------------------------- -# Reload AGS -# ----------------------------------------------------- - -echo ":: Reload ags" -ags quit & -sleep 0.2 -ags run & - # ----------------------------------------------------- # Default theme: /THEMEFOLDER;/VARIATION # ----------------------------------------------------- -themestyle="/ml4w;/ml4w/light" +themestyle="/ml4w-blur;/ml4w-blur/white" # ----------------------------------------------------- # Get current theme information from ~/.config/ml4w/settings/waybar-theme.sh diff --git a/share/dotfiles/.config/waybar/modules.json b/share/dotfiles/.config/waybar/modules.json index 3d3f2e51..43d8f21e 100644 --- a/share/dotfiles/.config/waybar/modules.json +++ b/share/dotfiles/.config/waybar/modules.json @@ -9,10 +9,12 @@ // Workspaces "hyprland/workspaces": { "on-scroll-up": "hyprctl dispatch workspace r-1", - "on-scroll-down": "hyprctl dispatch workspace r+1", + "on-scroll-down": "~/.config/hypr/scripts/scroll_workspaces.sh", "on-click": "activate", - "active-only": false, - "all-outputs": true, + "active-only": true, + "all-outputs": false, + "show-special":false, + "ignore-workspaces": ["(special:.*)", "nautilus"], "format": "{}", "format-icons": { "urgent": "", @@ -20,18 +22,20 @@ "default": "" }, "persistent-workspaces": { - "*": 5 + "HDMI-A-1": [ 1, 2 ], + "DP-1": [ 3,4,5 ], } }, // Taskbar "wlr/taskbar": { "format": "{icon}", - "icon-size": 18, + "icon-size": 22, "tooltip-format": "{title}", "on-click": "activate", "on-click-middle": "close", - "ignore-list": ["Alacritty", "kitty"], + "ignore-list": ["Alacritty", "kitty","GLava"], + "all-outputs": false, "app_ids-mapping": { "firefoxdeveloperedition": "firefox-developer-edition" }, @@ -55,8 +59,8 @@ // ML4W Welcome App "custom/ml4w-welcome": { - "on-click": "sleep 0.1 && ~/.config/ml4w/settings/ml4w-sidebar.sh", - "on-click-right": "sleep 0.1 && com.ml4w.welcome", + "on-click": "ags toggle sidebar", + "on-click-right": "sleep 0.1 && ~/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage", "format": " ", "tooltip-format": "Open Sidebar" }, @@ -78,12 +82,12 @@ "on-click": "sleep 0.1 && ~/.config/ml4w/scripts/cliphist.sh", "on-click-right": "sleep 0.1 && ~/.config/ml4w/scripts/cliphist.sh d", "on-click-middle": "sleep 0.1 && ~/.config/ml4w/scripts/cliphist.sh w", - "tooltip-format": "Left: Open clipboard Manager\nRight: Delete an entry\nMiddle: Clear list" + "tooltip-format": "Clipboard Manager" }, // Updates Count "custom/updates": { - "format": " {}", + "format": " {}", "escape": true, "return-type": "json", "exec": "~/.config/ml4w/scripts/updates.sh", @@ -110,7 +114,7 @@ // Settings "custom/settings": { "format": "", - "on-click": "sleep 0.1 && com.ml4w.dotfilessettings", + "on-click": "com.ml4w.dotfilessettings", "tooltip-format": "ML4W Dotfiles Settings" }, @@ -147,7 +151,7 @@ // START APPS LABEL "format": "Apps", // END APPS LABEL - "on-click": "sleep 0.2;pkill rofi || rofi -show drun -replace", + "on-click": "sleep 0.2;rofi -show drun -replace", "on-click-right": "~/.config/hypr/scripts/keybindings.sh", "tooltip-format": "Left: Open the application launcher\nRight: Show all keybindings" }, @@ -155,15 +159,15 @@ // Rofi Application Launcher "custom/appmenuicon": { "format": "", - "on-click": "sleep 0.2;rofi -show drun -replace", - "on-click-right": "~/.config/hypr/scripts/keybindings.sh", - "tooltip-format": "Left: Open the application launcher\nRight: Show all keybindings" + "on-click": "hyprctl dispatch hyprexpo:expo toggle", + // "on-click-right": "~/.config/hypr/scripts/keybindings.sh", + // "tooltip-format": "Left: Open the application launcher\nRight: Show all keybindings" }, // Power Menu "custom/exit": { "format": "", - "on-click": "~/.config/ml4w/scripts/wlogout.sh", + "on-click": "wlogout", "tooltip-format": "Power Menu" }, @@ -200,16 +204,19 @@ // System tray "tray": { - "icon-size": 21, + "icon-size": 18, "spacing": 10 }, // Clock "clock": { - "format": "{:%H:%M %a}", - "on-click": "ags toggle calendar", - "timezone": "", - "tooltip": false + "format": "{:%a %b %d %I:%M %p}", + // "on-click": "ags toggle calendar", + "on-click": "exec $HOME/.config/waybar/scripts/calendar", + + "tooltip": false, + "on-scroll-up":"hyprctl dispatch workspace r-1", + "on-scroll-down":"~/.config/hypr/scripts/scroll_workspaces.sh", }, // System @@ -304,8 +311,9 @@ "tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n up: {bandwidthUpBits} down: {bandwidthDownBits}", "tooltip-format-disconnected": "Disconnected", "max-length": 50, - "on-click": "~/.config/ml4w/settings/networkmanager.sh", - "on-click-right": "~/.config/ml4w/scripts/nm-applet.sh toggle", + "on-click": "$(cat ~/.config/ml4w/settings/terminal.sh) --class dotfiles-floating -e nmtui", + "on-click-right": "~/.config/ml4w/settings/networkmanager.sh", + }, // Battery @@ -342,7 +350,13 @@ "car": " ", "default": ["", "", ""] }, - "on-click": "pavucontrol" + // "on-scroll-up": "swayosd-client --output-volume raise", + // "on-scroll-down": " swayosd-client --output-volume lower" , + "on-click": "swayosd-client --output-volume mute-toggle", + "on-click-right": "pavucontrol", + "on-click-middle":"/home/kushy/.local/share/albert/python/venv/bin/python /home/kushy/.local/share/albert/python/plugins/audio_switcher/audio_autoswitch.py" + + }, // Bluetooth @@ -383,5 +397,34 @@ "" ], "scroll-step": 1 - } + }, + +"custom/music": { + "format": "{}{icon}", + "format-icons": { + // "Playing": " ", // Uncomment if not using caway + "Paused": " ", + "Stopped": "‭ﭥ " // This stop symbol is RTL. So ‭ is left-to-right override. + }, + "escape": true, + "tooltip": true, + "exec": "~/.scripts/caway", + "return-type": "json", + "on-click": "playerctl play-pause", + "on-scroll-up": "playerctl previous", + "on-scroll-down": "playerctl next", + "on-click-right": "g4music", + "max-length": 35, + "min-length": 35 + }, + + "custom/silent": { + "format": "{}", + "exec": "exec cat /tmp/silent ", + "tooltip": "false", + "on-click": "exec $HOME/.config/waybar/scripts/silent toggle", + "signal": 5, + "return-type": "json" + } + } diff --git a/share/dotfiles/.config/waybar/scripts/PBPbattery.sh b/share/dotfiles/.config/waybar/scripts/PBPbattery.sh new file mode 100755 index 00000000..1cf34da0 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/PBPbattery.sh @@ -0,0 +1,21 @@ + +#!/bin/bash +#simple Shellscript for waybar/i3blocks/polybar on Pinebook pro +#05012020 geri123@gmx.net Gerhard S. + +PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity) +STATUS=$(cat /sys/class/power_supply/cw2015-battery/status) +case $(( + $PERCENT >= 0 && $PERCENT <= 20 ? 1 : + $PERCENT > 20 && $PERCENT <= 40 ? 2 : + $PERCENT > 40 && $PERCENT <= 60 ? 3 : + $PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in +# + (1) echo $STATUS:"":$PERCENT%;; + (2) echo $STATUS:"":$PERCENT%;; + (3) echo $STATUS:"":$PERCENT%;; + (4) echo $STATUS:"":$PERCENT%;; + (5) echo $STATUS:"":$PERCENT%;; +esac + + diff --git a/share/dotfiles/.config/waybar/scripts/calendar b/share/dotfiles/.config/waybar/scripts/calendar new file mode 100755 index 00000000..842fde10 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/calendar @@ -0,0 +1,18 @@ +#!/bin/bash + +monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .model') +echo $monitor +windows="$(eww active-windows)" + +# echo "$windows" +IFS=$'\n' +for window in ${windows[@]}; do + echo $windowe + if [ $window == "calendar: calendar" ];then + eww close calendar & eww close calendar-closer + exit 0 + fi +done +eww open --screen "$monitor" --toggle calendar & +eww open --screen "$monitor" --toggle calendar-closer & +exit 0 \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/calendar.sh b/share/dotfiles/.config/waybar/scripts/calendar.sh new file mode 100755 index 00000000..f0de40ad --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/calendar.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +monitor=$(swaymsg -t get_outputs --raw | jq '. | map(select(.focused == true)) | .[0].name' -r) +if [[ $monitor == 'DP-1' ]]; then + screen=1 +else + screen=0 +fi +# echo $screen +eww open --toggle info-center --screen $screen +eww open --toggle info-center-closer --screen $screen \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/cookies.txt b/share/dotfiles/.config/waybar/scripts/cookies.txt new file mode 100644 index 00000000..faf21fdf --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/cookies.txt @@ -0,0 +1,10 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +.nseindia.com TRUE / FALSE 1721642253 bm_sz 22CC09BF365BA22867B22F06C28D65D8~YAAQVG/ZF/Nk9ZuQAQAAP0ME2RiVMfXDZ2Zq1LvjUnL3Mu0DgKsAUXQw24gNVrssDF0D6dX87LKXAExycK6w10VydrsFIQPvqyu7RFAZX2ZIw2L9Yt4k7e/HPlHnINUybCJ9eQtQgGYOw4G7CY7QMkWBI7Yb9lmGJRAF/Lf6jR/1yw1eLDyePZ1GkHaOAH/VO8WE3X4HV9SwzB6reQ1TPjVj4kVYMantGhAdMbqJVK9zAG/TD5r69lEhuwsTqtNXSqwk+6pmxroKIdsEc4SnyZYpAmLhS022ux2NasEOKvS6A4RIe8dVumJLrijjiSANCjY30defKUDZe6+VSXaSTddUCvXWyStSWPFMz4CPaBqQathk0+8pbu8zXW/2i6EnLZvjoxSF2yPtVEmpB08=~3686724~3486513 +.nseindia.com TRUE / FALSE 1721635053 ak_bmsc EC10041E8120D080664E020BD3DCE839~000000000000000000000000000000~YAAQVG/ZF/Fk9ZuQAQAAP0ME2Rg0xc/6Fl0jMSTD6z2ZLVjLntbJUrdgnCUrGlZUP4L9yz6KNNJPOR0TIsjnyw3cdHEQVGEqSV4Km3wsnhTd/vZ9uhNcF9jJdBiNv/hhFLlrDU1l9Qg/P3809HTjB4TAMbNQ2Auer/TZS5gDaXN3vfYLcYsJJ610mkLiPeJkm+Y0QV3iyBZnAnSyWr8en6AwpeDd4hVgIy4JTsJqQaVqDejTWoF+OhzccQRNiTTPSABwqDmDf9mkH+4bSuOXPfAzsv4lZpmt2bajx6AkPSPfCTz2+Dl7TzniFbWyqe42LN1PcRwuvC/5coP65CtjNA/7HkycsVP5LY2FJlxDx+MJ0KjykB/xXjLDjcmWoi+RLKJCUv7a91QIYzaQ +.nseindia.com TRUE / TRUE 1753163853 _abck 3E2105E91EDAEB0935C20388D2E6E565~-1~YAAQVG/ZF/Bk9ZuQAQAAP0ME2QzI6eX0Izj6JGf7bqHc9Xo9gMrNkiLgvp9MSCiCUjHCoJBeBHevtyxtBgPvK7PRzrNLGZy1rTi+ul0o+ypSkJqp4NGJIh93RM5Tt3S/uxdvTPjpPIoL5zqCKo6tvTQeBTKifA/9qjEpc8dgvXLV8YxYENWXEsNPq+mu6HYoj0ILO+yaejwh6zSkUoXMYdEXFYpKII7STNM1QB6uwrQTzlCxDlGoIDWwW0Iv+zHmdkO1YO4xX2a9ANtxbn+PMkU3lue92j2N+a2YddQpSPFrbiFGCHmnQR0Nz3bRRHnye+wvTj7TXYYxkeUYcO9tV9QjVypfDwdkqws4JaWMCIY1cC58L+qAlV1L8kfT+g==~-1~-1~-1 +#HttpOnly_.nseindia.com TRUE / TRUE 1721631453 AKA_A2 A +#HttpOnly_www.nseindia.com FALSE / TRUE 1721635053 nseappid eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcGkubnNlIiwiYXVkIjoiYXBpLm5zZSIsImlhdCI6MTcyMTYyNzg1MywiZXhwIjoxNzIxNjM1MDUzfQ.1U295qKUFOeE5CClSWCEKOYnyvOk_vgml89EQGU8hLI +#HttpOnly_www.nseindia.com FALSE / TRUE 1721635053 nsit hySmbv-gXFlGFnz8x7mE2P3n diff --git a/share/dotfiles/.config/waybar/scripts/keyhint.sh b/share/dotfiles/.config/waybar/scripts/keyhint.sh new file mode 100755 index 00000000..01f3396b --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/keyhint.sh @@ -0,0 +1,2 @@ +#!/bin/sh +yad --title="EndeavourOS Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(xfce4-terminal)" "+d" "Application Menu" "(wofi)" "+p" "Activities" "(wofi)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(wofi)" "+t" "open keybinding helper" "full list" diff --git a/share/dotfiles/.config/waybar/scripts/khal.sh b/share/dotfiles/.config/waybar/scripts/khal.sh new file mode 100755 index 00000000..f07a0c31 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/khal.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +### usage +#### add weekly event to khal +# khal new -a private 06/04/2023 08:00 AM Weekly Expiry -r weekly + + + +status(){ + khal at --format "{title}" | sed 1d | sed -z "s|\n|, |g;s|,.$||g" +} + + + + + + +verbose='false' +while getopts 'twa:d:sv' flag; do + case "${flag}" in + s) status + ;; + w) val="${OPTARG}" + switch_source + ;; + a) val="${OPTARG}" + inc_volume $val + #pactl -- set-sink-volume $sink +$val% + ;; + d) val="${OPTARG}" + pulseaudio-ctl down $val && dunstify "Volume $volume" -h int:value:$(pamixer --get-volume) -a sound -r $msgId -u low + ;; + s) val="${OPTARG}" + set_volume $val + #pactl -- set-sink-volume $sink $val% + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + +exec 27> "/tmp/khal.lock" +if ! flock -n 27 ; then + printf 'another instance is running\n'; + exit 1 + fi \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/polypomo b/share/dotfiles/.config/waybar/scripts/polypomo new file mode 100755 index 00000000..cb92f773 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/polypomo @@ -0,0 +1,323 @@ +#!/usr/bin/python3 -u +# -*- coding: utf-8 -*- + +import os +import sys +import socket +import argparse +import operator +import time +import select +from contextlib import contextmanager +from subprocess import call, DEVNULL +import datetime + + +SOCKDIR = os.environ.get("XDG_RUNTIME_DIR", "/var/tmp") +SOCKFILE = os.path.join(SOCKDIR, "polypomo.sock") +#TOMATO = u"\U0001F345" +TOMATO = u"\U0000f0f3" +#BREAK = u"\U0001F3D6" +BREAK = u"\U0000F236" + + + +hourglass_end = u"\U0000f253" +hourglass_half = u"\U0000f252" +hourglass_start = u"\U0000f251" + + +class Timer: + def __init__(self, remtime): + self.time = remtime + self.notified = False + self.tick() + + def __str__(self): + return self.format_time() + + def tick(self): + self.previous = time.time() + + def format_time(self): + day_factor = 86400 + hour_factor = 3600 + minute_factor = 60 + + if self.time > 0: + rem = self.time + neg = "" + else: + rem = -self.time + neg = "-" + days = int(rem // day_factor) + rem -= days * day_factor + hours = int(rem // hour_factor) + rem -= hours * hour_factor + minutes = int(rem // minute_factor) + rem -= minutes * minute_factor + seconds = int(rem // 1) + + strtime = [] + if days > 0: + strtime.append(str(days)) + if days > 0 or hours > 0: + strtime.append("{:02d}".format(hours)) + + # Always append minutes and seconds + strtime.append(" {:02d}".format(minutes)) + strtime.append("{:02d}".format(seconds)) + + return neg + ":".join(strtime) + + def update(self): #not_here + now = time.time() + delta = now - self.previous + self.time -= delta + + # Send a notification when timer reaches 0 + if not self.notified and self.time < 0: + self.notified = True + try: + call(["notify-send", "-t", "0", "-u", "critical","Tasker", + "Time's Up Dude","-i","/home/kushagra/.icons/custom/alarm.png"], stdout=DEVNULL, stderr=DEVNULL) + except FileNotFoundError: + # Skip if notify-send isn't installed + pass + + def change(self, op, seconds): + self.time = op(self.time, seconds) + + +class Status: + def __init__(self, worktime, breaktime): + self.worktime = worktime + self.breaktime = breaktime + self.status = "work" # or "break" + self.timer = Timer(self.worktime) + self.active = False + self.locked = False + + def show(self): + currentDT = datetime.datetime.now().second + status = TOMATO if self.status == "work" else BREAK + # status = hourglass_start if currentDT%3 == 0 else hourglass_half + # status = hourglass_half if currentDT%3 == 1 else hourglass_end + # status = hourglass_end if currentDT%3 == 2 else hourglass_start + + sys.stdout.write("{}{}\n".format(status, self.timer)) + sys.stdout.flush() + + def toggle(self): + self.active = not self.active + + def toggle_lock(self): + self.locked = not self.locked + + def update(self): + if self.active: + self.timer.update() + # This ensures the timer counts time since the last iteration + # and not since it was initialized + self.timer.tick() + + def change(self, op, seconds): + if self.locked: + return + + seconds = int(seconds) + op = operator.add if op == "add" else operator.sub + self.timer.change(op, seconds) + + def next_timer(self): + self.active = False + + if self.status == "work": + self.status = "break" + self.timer = Timer(self.breaktime) + elif self.status == "break": + self.status = "work" + self.timer = Timer(self.worktime) + + +@contextmanager +def setup_listener(): + s = socket.socket(socket.AF_UNIX, + socket.SOCK_DGRAM) + + # If there's an existing socket, replace it + # this isn't nice to active polypomo instances but ensures we can start + try: + os.remove(SOCKFILE) + except OSError: + pass + + s.bind(SOCKFILE) + + try: + yield s + finally: + s.close() + try: + os.remove(SOCKFILE) + except OSError: + pass + + +@contextmanager +def setup_client(): + # creates socket object + s = socket.socket(socket.AF_UNIX, + socket.SOCK_DGRAM) + + s.connect(SOCKFILE) + + try: + yield s + finally: + s.close() + + # tm = s.recv(1024) # msg can only be 1024 bytes long + + +def check_actions(sock, status): + timeout = time.time() + 0.9 + + data = "" + + while True: + ready = select.select([sock], [], [], .2) + if time.time() > timeout: + break + if ready[0]: + try: + data = sock.recv(1024) + if data: + break + except socket.error as e: + # TODO replace this by logging + print('Lost connection to client. Printing buffer...', e) + break + + if not data: + return + + action = data.decode("utf8") + if action == "toggle": + status.toggle() + elif action == "end": + status.next_timer() + elif action == "lock": + status.toggle_lock() + elif action.startswith("time"): + _, op, seconds = action.split(" ") + status.change(op, seconds) + + +def action_display(args): + # TODO logging = print("Running display", args) + + status = Status(args.worktime, args.breaktime) + + # Listen on socket + with setup_listener() as sock: + while True: + status.show() + status.update() + check_actions(sock, status) + + +def action_toggle(args): + # TODO logging = print("Running toggle", args) + with setup_client() as s: + msg = "toggle" + s.send(msg.encode("utf8")) + + +def action_end(args): + # TODO logging = print("Running end", args) + with setup_client() as s: + msg = "end" + s.send(msg.encode("utf8")) + + +def action_lock(args): + # TODO logging = print("Running lock", args) + with setup_client() as s: + msg = "lock" + s.send(msg.encode("utf8")) + + +def action_time(args): + # TODO logging = print("Running time", args) + with setup_client() as s: + msg = "time " + " ".join(args.delta) + s.send(msg.encode("utf8")) + + +class ValidateTime(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + if values[0] not in '-+': + parser.error("Time format should be +num or -num to add or remove time, respectively") + if not values[1:].isdigit(): + parser.error("Expected number after +/- but saw '{}'".format(values[1:])) + + # action = operator.add if values[0] == '+' else operator.sub + # value = int(values[1:]) + action = "add" if values[0] == '+' else "sub" + value = values[1:] + + setattr(namespace, self.dest, (action, value)) + + +def parse_args(): + parser = argparse.ArgumentParser( + description="Pomodoro timer to be used with polybar") + # Display - main loop showing status + parser.add_argument("--worktime", + type=int, + default=15 * 60, + help="Default work timer time in seconds") + parser.add_argument("--breaktime", + type=int, + default=3 * 60, + help="Default break timer time in seconds") + parser.set_defaults(func=action_display) + + sub = parser.add_subparsers() + + # start/stop timer + toggle = sub.add_parser("toggle", + help="start/stop timer") + toggle.set_defaults(func=action_toggle) + + # end timer + end = sub.add_parser("end", + help="end current timer") + end.set_defaults(func=action_end) + + # lock timer changes + lock = sub.add_parser("lock", + help="lock time actions - prevent changing time") + lock.set_defaults(func=action_lock) + + # change timer + time = sub.add_parser("time", + help="add/remove time to current timer") + time.add_argument("delta", + action=ValidateTime, + help="Time to add/remove to current timer (in seconds)") + time.set_defaults(func=action_time) + + return parser.parse_args() + + +def main(): + args = parse_args() + args.func(args) + + +if __name__ == "__main__": + main() + +# vim: ai sts=4 et sw=4 diff --git a/share/dotfiles/.config/waybar/scripts/power-menu.sh b/share/dotfiles/.config/waybar/scripts/power-menu.sh new file mode 100755 index 00000000..edaa5d61 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/power-menu.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +entries="Logout Suspend Reboot Shutdown" + +selected=$(printf '%s\n' $entries | wofi --conf=$HOME/.config/wofi/config.power --style=$HOME/.config/wofi/style.widgets.css | awk '{print tolower($1)}') + +case $selected in + logout) + swaymsg exit;; + suspend) + exec systemctl suspend;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac diff --git a/share/dotfiles/.config/waybar/scripts/shared_libraries b/share/dotfiles/.config/waybar/scripts/shared_libraries new file mode 120000 index 00000000..5edc3032 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/shared_libraries @@ -0,0 +1 @@ +/home/kushy/Syncthing/Projects/Shoonya/shared_libraries \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/shoonya.py b/share/dotfiles/.config/waybar/scripts/shoonya.py new file mode 100755 index 00000000..88d2807b --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/shoonya.py @@ -0,0 +1,40 @@ +import os,sys +import yaml +import requests +from datetime import datetime + +config_file = "/home/kushy/Syncthing/Projects/Shoonya/shared_libraries/config.yaml" +with open(config_file) as f: + config = yaml.load(f, Loader=yaml.FullLoader) +consul_host = config['consul']['host'] +# print(consul_host) + +headers = { + 'Content-Type': 'application/json', +} + +def getTrades(): + trades_req = requests.get(f"http://{consul_host}:8500/v1/kv/shoonya/tradeCount?raw", headers=headers, timeout=10) + trades = trades_req.content.decode("utf-8") + return trades + +def getPnl(): + pnl_req = requests.get(f"http://{consul_host}:8500/v1/kv/shoonya/pnl?raw", headers=headers, timeout=10) + pnl = pnl_req.content.decode("utf-8") + return pnl +# for content in trades_req: + +trades = getTrades() +pnl = getPnl() +output = f"trades: {trades} pnl: {pnl}" + + +start_time = datetime.now().replace(hour=9,minute=15) +end_time = datetime.now().replace(hour=15,minute=40) +current_time = datetime.now() + +if current_time >= start_time and current_time <= end_time: + print(f"{{\"text\":\"{output}\",\"alt\":\"123\",\"tooltip\":\" deets\",\"class\":\"shoonya\"}}") + + if int(pnl) < -5000: + os.system('systemctl poweroff') diff --git a/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.py b/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.py new file mode 100644 index 00000000..6517b505 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.py @@ -0,0 +1,169 @@ +import os, sys, time +import math +import yaml +import json +import argparse + + +from datetime import datetime +from shared_libraries.helper_scripts import consulHelper, misc +from shared_libraries.helper_scripts.mibianLib import mibian + + +config_file = "shared_libraries/config.yaml" +with open(config_file) as f: + config = yaml.load(f, Loader=yaml.FullLoader) + +bar_output = "{\"text\": \"text\", \"alt\": \"alt\", \"tooltip\": \"tooltip\", \"class\": \"shoonya\", \"percentage\": \"percentage\" }" + +MAX_TRADES = 15 +MAX_TRADES_HARD = 40 + +MAX_DRAWDOWN = 6000 + +def validTime(): + + starttime = datetime.today().replace(hour=9, minute=0, second=0, microsecond=0) + endtime = datetime.today().replace(hour=15, minute=30, second=0, microsecond=0) + # endtime = datetime.today().replace(hour=23, minute=59, second=0, microsecond=0) + + session_status = consulHelper.getConsulVar('shoonya/endSession') + if session_status == '1': + # print(f"session status is {session_status}1") + return False + + if datetime.today() > starttime and datetime.today() < endtime: + return True + return False + + +def maxLoss(): + return consulHelper.getConsulVar('shoonya/maxLoss') + +def tradeCount(): + return consulHelper.getConsulVar('shoonya/tradeCount') + +def endSession(): + consulHelper.setConsulVar('shoonya/endSession', 1) + os.system('systemctl poweroff') + +def killswitch(pnl, peakPnl, tradeCount, maxLoss): + if validTime(): + current_date = datetime.today().strftime('%d-%m-%y') + consul_date = consulHelper.getConsulVar('shoonya/date') + + shutdown=0 + # shut down if max loss crossed + if current_date == consul_date and pnl < maxLoss* -1: + misc.sendNotif(config,"max loss crossed", 'shutting down') + shutdown=1 + # shut down if max pnl gets eroded + if peakPnl >= MAX_DRAWDOWN and pnl <= peakPnl / 2: + misc.sendNotif(config,"max profit eroded", 'shutting down') + shutdown=1 + # shut down if max trades crossed + if tradeCount > MAX_TRADES and pnl < 1000: + misc.sendNotif(config,"Too many trades", 'limit trading now') + shutdown=1 + + + if shutdown == 1: + endSession() + + +def getPnl(): + pnl = consulHelper.getConsulVar('shoonya/pnl') + peakPnl = consulHelper.getConsulVar('shoonya/peakPnl') + tradeCount = consulHelper.getConsulVar('shoonya/tradeCount') + if pnl != None: + maxxLoss = consulHelper.getConsulVar('shoonya/maxLoss') + killswitch(float(pnl), float(peakPnl), int(tradeCount), float(maxxLoss)) + return round(int(pnl),1) + + +def getLatestCE(): + latestCE = consulHelper.getConsulVar('shoonya/ceOtm') + return latestCE + +def getLatestPE(): + latestPE = consulHelper.getConsulVar('shoonya/peOtm') + return latestPE + +# fix this +def checkValidDay(): + global bar_output + current_date = datetime.now().strftime('%d-%m-%y') + consul_date = consulHelper.getConsulVar('shoonya/date') + if consul_date != current_date or misc.isValidDay(current_date) == False: + # if consul_date != current_date : + bar_output = bar_output.replace(": \"text",": \"") + # print(consul_date, current_date) + print(bar_output) + exit(0) + + +def getBarInfo(): + global bar_output + output = "" + # if validTime(): + if True: + trades = tradeCount() + pnl = getPnl() + output = f"trades: {trades} pnl: {pnl}" + # bar_output = f'{{\"text\":\"{output}\",\"alt\":\"123\",\"tooltip\":\" deets\",\"class\":\"shoonya\"}}' + # return json.loads(bar_output) + # bar_output = output + "\n" + "trading details" + "\n" + "shoonya"' + return bar_output.replace(": \"text",": \""+output) + # print(bar_output) + # return bar_output + + +def getBarInfoOption(): + global bar_output + output = "" + if validTime(): + # if True: + # print(f"valid time", flush=True) + latestCE = getLatestCE() + latestPE = getLatestPE() + output = f"{latestCE} {latestPE}" + # bar_output = f'{{\"text\":\"{output}\",\"alt\":\"123\",\"tooltip\":\" deets\",\"class\":\"shoonya\"}}' + # return json.loads(bar_output) + # bar_output = output + "\n" + "trading details" + "\n" + "shoonya"' + return bar_output.replace(": \"text",": \""+output) + # print(bar_output) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--getMaxLoss', action='store_true', default=None) + parser.add_argument('--getPnl', action='store_true', default=None) + parser.add_argument('--getTradeCount', action='store_true', default=None) + parser.add_argument('--getLatestCE', action='store_true', default=None) + parser.add_argument('--getLatestPE', action='store_true', default=None) + parser.add_argument('--getBarInfo', action='store_true', default=None) + parser.add_argument('--getBarInfoOption', action='store_true', default=None) + + args = parser.parse_args() + + # checkVadlidDay() + + if args.getMaxLoss is not None: + print(maxLoss()) + + if args.getPnl is not None: + print(getPnl()) + + if args.getTradeCount is not None: + print(tradeCount()) + + if args.getLatestCE is not None: + print(getLatestCE()) + + if args.getLatestPE is not None: + print(getLatestPE()) + + if args.getBarInfo is not None: + print(getBarInfo()) + + if args.getBarInfoOption is not None: + print(getBarInfoOption()) \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.sh b/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.sh new file mode 100755 index 00000000..f010b298 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/shoonya_taskbar.sh @@ -0,0 +1,25 @@ +#!/bin/bash +source /home/kushy/Syncthing/Projects/Shoonya/venv/bin/activate +cd /home/kushy/.config/waybar/scripts/ +# python $HOME/.config/waybar/scripts/shoonya_taskbar.py --getBarInfo +# exit 0 + +getOtmOptions() { + python $HOME/.config/waybar/scripts/shoonya_taskbar.py --getBarInfoOption +} + +getPnl() { + python $HOME/.config/waybar/scripts/shoonya_taskbar.py --getBarInfo +} +verbose='false' +while getopts 'opv' flag; do + case "${flag}" in + o) getOtmOptions + ;; + p) getPnl + ;; + v) verbose='true' ;; + *) error "Unexpected option ${flag}" ;; + esac +done + diff --git a/share/dotfiles/.config/waybar/scripts/silent b/share/dotfiles/.config/waybar/scripts/silent new file mode 100755 index 00000000..177ea9ce --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/silent @@ -0,0 +1,65 @@ +#!/bin/bash + +# toggle_on= +# toggle_off= + +toggle_on= +toggle_off= + +out_file="/tmp/silent" + + + +info (){ + val=$(swaync-client -D) + # if [[ $? -ne 0 ]];then + # echo "{\"text\":\"No clue brp\",\"alt\":\"dnd on\",\"tooltip\":\" dnd on\",\"class\":\"on\"}" + # fi + case "$val" in + "false") + echo "{\"text\":\"dnd $toggle_on\",\"alt\":\"dnd off\",\"tooltip\":\"session active\",\"class\":\"off\"}" > $out_file + ;; + "true") + echo "{\"text\":\"dnd $toggle_off\",\"alt\":\"dnd on\",\"tooltip\":\" dnd on\",\"class\":\"on\"}" > $out_file + ;; + *) + echo "{\"text\":\"No clue brp\",\"alt\":\"dnd on\",\"tooltip\":\" dnd on\",\"class\":\"on\"}" > $out_file + ;; + esac +} + + +toggle (){ + val=$(swaync-client -D) + case "$val" in + "false") + swaync-client -dn + ;; + "true") + swaync-client -df + ;; + esac + info + pkill -RTMIN+5 waybar +} + + + +exec 13> "/tmp/silent.lock" +if ! flock -n 13 ; then + printf 'another instance is running\n'; + exit 1 + fi + + +if [ ! -f $out_file ]; then + info +fi + + +case "$1" in + "info") info ;; + "toggle") toggle ;; + *) info ;; + +esac \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/volume b/share/dotfiles/.config/waybar/scripts/volume new file mode 100755 index 00000000..ed499b20 --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/volume @@ -0,0 +1,93 @@ +#!/bin/bash + +# get list of sinks/cards (for settings CARD1/CARD2) +# pacmd list-sinks | awk '/name:/ {print $0};' | awk '{ print $2}' | sed 's/<//g; s/>//g' + +CARD1="alsa_output.usb-C-Media_INC._C-Media_USB_Audio-00" +CARD2="alsa_output.usb-Kingston_HyperX_Virtual_Surround_Sound_00000000-00" + +CURRENT_SINK=$(pacmd stat | awk -F": " '/^Default sink name: /{print $2}' | awk 'BEGIN{FS=OFS="."} NF--' | sed 's/alsa_output/alsa_output/g') + + +function setCard() { + + if [ "$CURRENT_SINK" == "$1" ] + then + echo "Already using this Sink" + exit 1 + fi + + NEW_SINK=$(pacmd list-sinks | awk '/index:/ {print $1 $2 $3} /name:/ {print $0};' | grep -m1 -B1 $1 | grep index | awk '{print $1}' | cut -d ":" -f2) + SINK=$(pacmd set-default-sink $NEW_SINK) + INPUT=$(pacmd list-sink-inputs | grep index | awk '{print $2}') + + pacmd move-sink-input $INPUT $NEW_SINK + echo "Moving input: $INPUT to sink: $NEW_SINK"; + echo "Setting default sink to: $NEW_SINK"; + + notify-send --urgency=low "Audio Switching" "SINK: $NEW_SINK" +} + +function toggleSinks() { + if [ "$CURRENT_SINK" == "$CARD1" ] + then + setCard $CARD2 + else + setCard $CARD1 + fi +} + + +function showHelp() { + echo "------------------------------------" + echo "AUDIO SINK SWITCHER" + echo " " + echo "$0 [options]" + echo " " + echo "options:" + echo "-h --help What you are looking at.." + echo "-g, --gaming Sets Gaming headset as output device" + echo "-s, --speakers Sets Speakers as output device" + echo "-t, --toggle Toggles the different output devices" + echo " " + echo "------------------------------------" +} + +# check args length +if [ $# -eq 0 ] + then + echo "Toggling output devices (Speakers/Headset)" + toggleSinks +fi + + +# arg options +while test $# -gt 0; do + case "$1" in + + -h|--help) + showHelp + exit 1 + ;; + + -g|--gaming) + setCard $CARD2 + exit 1 + ;; + + -s|--speakers) + setCard $CARD1 + exit 1 + ;; + + -t|--toggle) + toggleSinks + echo "Toggling output devices (Speakers/Headset)" + exit 1 + ;; + *) + showHelp + exit 1 + ;; + esac +done \ No newline at end of file diff --git a/share/dotfiles/.config/waybar/scripts/weather.sh b/share/dotfiles/.config/waybar/scripts/weather.sh new file mode 100755 index 00000000..b03cd1cc --- /dev/null +++ b/share/dotfiles/.config/waybar/scripts/weather.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +LOC="$1" +# HTML encode string as %20 +LOCATION=$(sed -e "s/ /%20/g" <<<"$LOC") +content=$(curl -sS "https://thisdavej.azurewebsites.net/api/weather/current?loc=$LOCATION°=C") +ICON=$(curl -s 'https://wttr.in/?format=1' | sed 's/[+0-9a-cA-Z°-]//g' ) +# echo $ICON +TEMP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)"' | sed 's/"//g') +TOOLTIP=$(echo $content | jq -r '. | "\(.temperature)°\(.degType)\n\(.skytext)"' | sed 's/"//g') +CLASS=$(echo $content | jq .skytext) +echo '{"text": "'$TEMP'", "tooltip": "'$ICON $TOOLTIP $LOC'", "class": '$CLASS' }' + diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/config b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/config index 463150d5..504160ca 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/config +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur-bottom/config @@ -26,12 +26,12 @@ // Modules Left "modules-left": [ - "custom/appmenu", +"custom/appmenu", "group/links", - "group/settings", - //"wlr/taskbar", +"group/settings", +//"wlr/taskbar", "group/quicklinks", - "hyprland/window", +"hyprland/window", "custom/empty" ], @@ -44,13 +44,13 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", +"network", "group/hardware", "group/tools", - "tray", +"tray", "custom/exit", "custom/ml4w-welcome", "clock" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/config b/share/dotfiles/.config/waybar/themes/ml4w-blur/config index 1d8a69db..050300f6 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/config +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/config @@ -26,12 +26,12 @@ // Modules Left "modules-left": [ - "custom/appmenu", +"custom/appmenu", "group/links", - "group/settings", - //"wlr/taskbar", +"group/settings", +//"wlr/taskbar", "group/quicklinks", - "hyprland/window", +"hyprland/window", "custom/empty" ], @@ -44,13 +44,13 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", +"network", "group/hardware", "group/tools", - "tray", +"tray", "custom/exit", "custom/ml4w-welcome", "clock" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-blur/style.css b/share/dotfiles/.config/waybar/themes/ml4w-blur/style.css index 12734d31..6e797b91 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-blur/style.css +++ b/share/dotfiles/.config/waybar/themes/ml4w-blur/style.css @@ -85,9 +85,9 @@ window#waybar { * ----------------------------------------------------- */ tooltip { - border-radius: 16px; + border-radius: 10px; background-color: @backgroundlight; - opacity:0.9; + opacity:0.8; padding:20px; margin:0px; } diff --git a/share/dotfiles/.config/waybar/themes/ml4w-bottom/config b/share/dotfiles/.config/waybar/themes/ml4w-bottom/config index 950df373..666ee026 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-bottom/config +++ b/share/dotfiles/.config/waybar/themes/ml4w-bottom/config @@ -14,8 +14,8 @@ "margin-top": 0, "margin-bottom": 14, "layer": "top", - "margin-left": 14, - "margin-right": 14, + "margin-left": 0, + "margin-right": 0, "spacing": 0, // Load Modules @@ -26,12 +26,12 @@ // Modules Left "modules-left": [ - "custom/appmenu", +"custom/appmenu", "group/links", - "group/settings", - //"wlr/taskbar", +"group/settings", +//"wlr/taskbar", "group/quicklinks", - "hyprland/window" +"hyprland/window", ], // Modules Center @@ -44,13 +44,13 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", +"network", "group/hardware", "group/tools", - "tray", +"tray", "custom/exit", "custom/ml4w-welcome", "clock" diff --git a/share/dotfiles/.config/waybar/themes/ml4w-minimal/config b/share/dotfiles/.config/waybar/themes/ml4w-minimal/config index b242242a..0055fe3f 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-minimal/config +++ b/share/dotfiles/.config/waybar/themes/ml4w-minimal/config @@ -35,39 +35,41 @@ }, // Pulseaudio - "pulseaudio": { - // "scroll-step": 1, // %, can be a float - "format": "{icon} {volume}%", - "format-bluetooth": "{volume}% {icon} {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": " {format_source}", - "format-source": "{volume}% ", - "format-source-muted": "", - "format-icons": { - "headphone": " ", - "hands-free": " ", - "headset": " ", - "phone": " ", - "portable": " ", - "car": " ", - "default": [" ", " ", " "] - }, - "on-click": "pavucontrol" - }, + // "pulseaudio": { + // // "scroll-step": 1, // %, can be a float + // "format": "{icon} {volume}%", + // "format-bluetooth": "{volume}% {icon} {format_source}", + // "format-bluetooth-muted": " {icon} {format_source}", + // "format-muted": " {format_source}", + // "format-source": "{volume}% ", + // "format-source-muted": "", + // "format-icons": { + // "headphone": " ", + // "hands-free": " ", + // "headset": " ", + // "phone": " ", + // "portable": " ", + // "car": " ", + // "default": [" ", " ", " "] + // }, + // "on-click": "pavucontrol" + // }, // Modules Left "modules-left": [ - "custom/appmenuicon", +"custom/appmenuicon", "hyprland/workspaces", - "group/links", - "group/settings", - "group/quicklinks", + // "group/links", + // "group/quicklinks", + "wlr/taskbar", "custom/empty" ], // Modules Center "modules-center": [ - "hyprland/window", + "clock", + "custom/silent", +// "hyprland/window", "custom/empty" ], @@ -75,15 +77,16 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", - "group/hardware", +// "network", + // "group/hardware", "group/tools", - "custom/exit", - "clock", - "tray", - "custom/ml4w-welcome" + // "custom/exit", + "group/settings", + // "clock", +"tray", + "custom/ml4w-welcome", ] } diff --git a/share/dotfiles/.config/waybar/themes/ml4w-minimal/style.css b/share/dotfiles/.config/waybar/themes/ml4w-minimal/style.css index be884b63..f22ca45c 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w-minimal/style.css +++ b/share/dotfiles/.config/waybar/themes/ml4w-minimal/style.css @@ -14,6 +14,10 @@ * Import Pywal colors * ----------------------------------------------------- */ /* @import 'style-light.css'; */ + +@import url('../../../../.cache/wal/colors-waybar.css'); + + @define-color backgroundlight #FFFFFF; @define-color backgrounddark #FFFFFF; @define-color workspacesbackground1 #FFFFFF; @@ -35,7 +39,7 @@ } window#waybar { - background-color: rgba(0,0,0,0.4); + background-color: rgba(0,0,0,0.7); border-bottom: 0px solid #ffffff; /* color: #FFFFFF; */ transition-property: background-color; @@ -81,15 +85,16 @@ window#waybar { * ----------------------------------------------------- */ tooltip { - border-radius: 16px; + border-radius: 10px; background-color: @backgroundlight; - opacity:0.9; + opacity:0.8; padding:20px; margin:0px; } tooltip label { color: @textcolor2; + font-weight: normal; } /* ----------------------------------------------------- @@ -125,6 +130,7 @@ window#waybar.empty #window { * ----------------------------------------------------- */ #custom-brave, +#custom-silent, #custom-browser, #custom-keybindings, #custom-outlook, @@ -428,4 +434,55 @@ window#waybar.empty #window { #tray > .needs-attention { -gtk-icon-effect: highlight; background-color: #eb4d4b; -} \ No newline at end of file +} + + + +#custom-music.Playing { + /* background: rgb(137, 180, 250); + background: radial-gradient(circle, rgba(137, 180, 250, 120) 0%, rgba(142, 179, 250, 120) 6%, rgba(148, 226, 213, 1) 14%, rgba(147, 178, 250, 1) 14%, rgba(155, 176, 249, 1) 18%, rgba(245, 194, 231, 1) 28%, rgba(158, 175, 249, 1) 28%, rgba(181, 170, 248, 1) 58%, rgba(205, 214, 244, 1) 69%, rgba(186, 169, 248, 1) 69%, rgba(195, 167, 247, 1) 72%, rgba(137, 220, 235, 1) 73%, rgba(198, 167, 247, 1) 78%, rgba(203, 166, 247, 1) 100%); */ + background-size: 400% 400%; + animation: gradient_f 9s cubic-bezier(.72, .39, .21, 1) infinite; + text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377); + font-weight: bold; + color: #fff; +} + +#custom-music.Paused, +#custom-music.Stopped { + background: #161925; +} + +#taskbar button { + margin : 4px 0px; + /* border-radius : 4px; + background: 20% rgba(99,99,99,0.5) ; */ +} + +#taskbar button.active { + margin : 4px 0px; + border-radius : 4px; + background: 20% rgba(99,99,99,0.7) ; +} + + + +#custom-silent { + padding: 0px 6px; + border-radius: 10px; + /* font-size: 2x; */ + font-weight: 600; +} + + +#custom-silent.on{ + /* border : 1px solid black; */ + /* background-color: #F5F5F5; */ + /* font-size: large; */ + color: @color11; + /* box-shadow: 0px 0px 4px rgba(0,0,0,0.5); */ + background-size: 5px; + /* margin : 5px 1px; + border-radius: 6px; */ + /* color:; */ +} diff --git a/share/dotfiles/.config/waybar/themes/ml4w/config b/share/dotfiles/.config/waybar/themes/ml4w/config index 29cf4155..50e4ae3e 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/config +++ b/share/dotfiles/.config/waybar/themes/ml4w/config @@ -25,12 +25,12 @@ // Modules Left "modules-left": [ - "custom/appmenu", +"custom/appmenu", "group/links", - "group/settings", - //"wlr/taskbar", +"group/settings", +//"wlr/taskbar", "group/quicklinks", - "hyprland/window", +"hyprland/window", "custom/empty" ], @@ -43,13 +43,13 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", +"network", "group/hardware", "group/tools", - "tray", +"tray", "custom/exit", "custom/ml4w-welcome", "clock" diff --git a/share/dotfiles/.config/waybar/themes/ml4w/style.css b/share/dotfiles/.config/waybar/themes/ml4w/style.css index 68a179c4..f84fb8d6 100644 --- a/share/dotfiles/.config/waybar/themes/ml4w/style.css +++ b/share/dotfiles/.config/waybar/themes/ml4w/style.css @@ -82,9 +82,9 @@ window#waybar { * ----------------------------------------------------- */ tooltip { - border-radius: 16px; + border-radius: 10px; background-color: @backgroundlight; - opacity:0.9; + opacity:0.8; padding:20px; margin:0px; } diff --git a/share/dotfiles/.config/waybar/themes/starter/config b/share/dotfiles/.config/waybar/themes/starter/config index 6e9c7477..5087f42d 100644 --- a/share/dotfiles/.config/waybar/themes/starter/config +++ b/share/dotfiles/.config/waybar/themes/starter/config @@ -33,13 +33,13 @@ // Modules Left "modules-left": [ - "custom/appmenu", +"custom/appmenu", "custom/settings", "custom/waybarthemes", "custom/wallpaper", //"wlr/taskbar", "group/quicklinks", - "hyprland/window", +"hyprland/window", "custom/starter" ], @@ -52,15 +52,15 @@ "modules-right": [ "custom/updates", "pulseaudio", - //"backlight", +//"backlight", "bluetooth", "battery", - "network", +"network", "group/hardware", "custom/cliphist", "custom/hypridle", "custom/hyprshade", - "tray", +"tray", "custom/exit", "custom/ml4w-welcome", "clock" diff --git a/share/dotfiles/.config/waybar/themes/starter/modules.json b/share/dotfiles/.config/waybar/themes/starter/modules.json index 51e0addf..be88d8d6 100644 --- a/share/dotfiles/.config/waybar/themes/starter/modules.json +++ b/share/dotfiles/.config/waybar/themes/starter/modules.json @@ -148,8 +148,8 @@ // ML4W Welcome App "custom/ml4w-welcome": { - "on-click": "sleep 0.1 && ~/.config/ml4w/settings/ml4w-sidebar.sh", - "on-click-right": "sleep 0.1 && com.ml4w.welcome", + "on-click": "ags -t sidebar", + "on-click-right": "sleep 0.1 && ~/.config/ml4w/apps/ML4W_Welcome-x86_64.AppImage", "format": " ", "tooltip-format": "Open Sidebar" }, diff --git a/share/dotfiles/.config/waybar/themes/starter/style.css b/share/dotfiles/.config/waybar/themes/starter/style.css index 21fdcfa6..58e8d547 100644 --- a/share/dotfiles/.config/waybar/themes/starter/style.css +++ b/share/dotfiles/.config/waybar/themes/starter/style.css @@ -85,9 +85,9 @@ window#waybar { * ----------------------------------------------------- */ tooltip { - border-radius: 16px; + border-radius: 10px; background-color: @backgroundlight; - opacity:0.9; + opacity:0.8; padding:20px; margin:0px; } diff --git a/share/dotfiles/.config/waycorner/config.toml b/share/dotfiles/.config/waycorner/config.toml new file mode 100644 index 00000000..f6a10d36 --- /dev/null +++ b/share/dotfiles/.config/waycorner/config.toml @@ -0,0 +1,43 @@ +[left] +# Shell commands to execute when hotcorner is triggered, +# at least one is required. + +# Command to run when cursor enters hotcorner. +# `command` is an alias for `enter_command`. +#enter_command = [ "notify-send", "start" ] +# enter_command = [ "hyprctl" ,"dispatch", "overview:toggle" ] +enter_command = [ "hyprctl" ,"dispatch", "hyprexpo:expo", "toggle" ] + +# Command to run when cursor exits hotcorner. +# exit_command = [ "notify-send", "exit" ] + +# Locations of the hot corners. +# Options: +# - for corners: top_left, top_right, bottom_right, and bottom_left; +# - for edges: top, bottom, right, left. +locations = ["top_right", "top_left"] # default + +# Size of the hot corners in pixels, for edges the size means the width +# for vertical edges, and height for horizontal edges. The other dimension +# will be the width/height of your display - the set margin. +size = 10 # default + +# Margin on the sides of the hot edges, only applicable to edge locations. +# See the comment with sizes attribute above. +margin = 20 # default + +# Timeout in milliseconds before command is triggered. +timeout_ms = 400 # default + +# Hex color of the corner when previewed, supports transparency. (#AARRGGBB or #RRGGBB) +# (Useful for debugging purposes when setting up several hot corners.) +color = "#00FF0000" # default + +# Optional output config to specify what output to use. +[left.output] +# Regex to match output descriptions on. +# Regex engine is similar to RE2: https://github.com/rust-lang/regex +# +# Use `swaymsg -t get_outputs` to get a list of outputs in the format: +# Output ${NAME} '${DESCRIPTION}' +description = "" # default, empty means all outputs \ No newline at end of file diff --git a/share/dotfiles/.config/zshrc/00-init b/share/dotfiles/.config/zshrc/00-init index 21833ae1..399cf5d7 100644 --- a/share/dotfiles/.config/zshrc/00-init +++ b/share/dotfiles/.config/zshrc/00-init @@ -5,6 +5,6 @@ # ----------------------------------------------------- # Exports # ----------------------------------------------------- -export EDITOR=nvim +export EDITOR=nano export PATH="/usr/lib/ccache/bin/:$PATH" export ZSH="$HOME/.oh-my-zsh" diff --git a/share/dotfiles/.config/zshrc/20-customization b/share/dotfiles/.config/zshrc/20-customization index 81bfefb2..6c282999 100644 --- a/share/dotfiles/.config/zshrc/20-customization +++ b/share/dotfiles/.config/zshrc/20-customization @@ -1,7 +1,6 @@ # ----------------------------------------------------- # CUSTOMIZATION # ----------------------------------------------------- -POSH=agnoster # ----------------------------------------------------- # oh-myzsh themes: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes @@ -39,8 +38,14 @@ SAVEHIST=10000 setopt appendhistory # ----------------------------------------------------- -# Prompt +# Starship promt # ----------------------------------------------------- +# eval "$(starship init zsh)" + +# ----------------------------------------------------- +# oh-my-posh promt +# ----------------------------------------------------- +# Custom Theme eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)" # Shipped Theme diff --git a/share/dotfiles/.config/zshrc/25-aliases b/share/dotfiles/.config/zshrc/25-aliases index 358301e5..eff6e1bc 100644 --- a/share/dotfiles/.config/zshrc/25-aliases +++ b/share/dotfiles/.config/zshrc/25-aliases @@ -9,9 +9,9 @@ alias c='clear' alias nf='fastfetch' alias pf='fastfetch' alias ff='fastfetch' -alias ls='eza -a --icons=always' -alias ll='eza -al --icons=always' -alias lt='eza -a --tree --level=1 --icons=always' +alias ls='eza -a --icons' +alias ll='eza -al --icons' +alias lt='eza -a --tree --level=1 --icons' alias shutdown='systemctl poweroff' alias v='$EDITOR' alias vim='$EDITOR' @@ -25,8 +25,7 @@ alias cleanup='~/.config/ml4w/scripts/cleanup.sh' alias ml4w='com.ml4w.welcome' alias ml4w-settings='com.ml4w.dotfilessettings' alias ml4w-hyprland='com.ml4w.hyprland.settings' -alias ml4w-options='ml4w-hyprland-setup -m options' -alias ml4w-sidebar='ags toggle sidebar' +alias ml4w-sidebar='ags -t sidebar' alias ml4w-diagnosis='~/.config/hypr/scripts/diagnosis.sh' alias ml4w-hyprland-diagnosis='~/.config/hypr/scripts/diagnosis.sh' alias ml4w-qtile-diagnosis='~/.config/ml4w/qtile/scripts/diagnosis.sh' @@ -39,6 +38,19 @@ alias ml4w-update='~/.config/ml4w/update.sh' alias Qtile='startx' # Hyprland with Hyprland +# ----------------------------------------------------- +# Git +# ----------------------------------------------------- +alias gs="git status" +alias ga="git add" +alias gc="git commit -m" +alias gp="git push" +alias gpl="git pull" +alias gst="git stash" +alias gsp="git stash; git pull" +alias gcheck="git checkout" +alias gcredential="git config credential.helper store" + # ----------------------------------------------------- # Scripts # ----------------------------------------------------- @@ -54,4 +66,4 @@ alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg' # ----------------------------------------------------- alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 120' alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 120' -alias setkb='setxkbmap de;echo "Keyboard set back to de."' +alias setkb='setxkbmap de;echo "Keyboard set back to de."' \ No newline at end of file diff --git a/share/dotfiles/.config/zshrc/custom/00-init b/share/dotfiles/.config/zshrc/custom/00-init new file mode 100644 index 00000000..391d7741 --- /dev/null +++ b/share/dotfiles/.config/zshrc/custom/00-init @@ -0,0 +1,27 @@ +# ----------------------------------------------------- +# INIT +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Exports +# ----------------------------------------------------- +export EDITOR=nano +export PATH="/usr/lib/ccache/bin/:$PATH" +export ZSH="$HOME/.oh-my-zsh" + + +export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/ +export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/ +export PATH=$PATH:$ANDROID_ROOT/emulator +export PATH=$PATH:$ANDROID_SDK_ROOT/tools/ + + +# Path +NPM_PACKAGES="${HOME}/.npm-packages" +export PATH="$PATH:$NPM_PACKAGES/bin" +NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" +export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/.config/sway/scripts:$HOME/.scripts:$GOPATH/bin:$HOME/.cargo/bin:$JAVA_HOME:$PATH +export PATH=/var/lib/snapd/snap/bin/:$PATH +export XDG_DATA_DIRS=/home/kushy/.local/share:$XDG_DATA_DIRS +# unset MANPATH # delete if you already modified MANPATH elsewhere in your config +MANPATH="$NPM_PACKAGES/share/man:$(manpath)" diff --git a/share/dotfiles/.config/zshrc/custom/20-customization b/share/dotfiles/.config/zshrc/custom/20-customization new file mode 100644 index 00000000..fa54d615 --- /dev/null +++ b/share/dotfiles/.config/zshrc/custom/20-customization @@ -0,0 +1,73 @@ +# ----------------------------------------------------- +# CUSTOMIZATION +# ----------------------------------------------------- + +# ----------------------------------------------------- +# oh-myzsh themes: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +# ----------------------------------------------------- +# ZSH_THEME=robbyrussell + +# ----------------------------------------------------- +# oh-myzsh plugins +# ----------------------------------------------------- +plugins=( + git + sudo + web-search + archlinux + zsh-autosuggestions + zsh-syntax-highlighting + fast-syntax-highlighting + copyfile + copybuffer + dirhistory +) + +# Set-up oh-my-zsh +source $ZSH/oh-my-zsh.sh + +# ----------------------------------------------------- +# Set-up FZF key bindings (CTRL R for fuzzy history finder) +# ----------------------------------------------------- +source <(fzf --zsh) + +# zsh history +HISTFILE=~/.zsh_history +HISTSIZE=10000 +SAVEHIST=10000 +setopt appendhistory + +# ----------------------------------------------------- +# Starship promt +# ----------------------------------------------------- +# eval "$(starship init zsh)" + +# ----------------------------------------------------- +# oh-my-posh promt +# ----------------------------------------------------- +# Custom Theme +eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)" + +# Shipped Theme +# eval "$(oh-my-posh init zsh --config /usr/share/oh-my-posh/themes/agnoster.omp.json)" + + +### tab comletion by latest ### +autoload -U compinit +compinit +zstyle ':completion:*' file-sort modification reverse + +bindkey '^H' backward-kill-word +zmodload zsh/mathfunc + +WORDCHARS='' + + + +psg () { + name=$1 + # echo $name + # echo "$(ps -aux | grep -i $name | grep -v grep)" + ps -aux | grep --color=always -i $name | grep --color=always -v grep + +} \ No newline at end of file diff --git a/share/dotfiles/.config/zshrc/custom/25-aliases b/share/dotfiles/.config/zshrc/custom/25-aliases new file mode 100644 index 00000000..bd3ca780 --- /dev/null +++ b/share/dotfiles/.config/zshrc/custom/25-aliases @@ -0,0 +1,75 @@ +# ----------------------------------------------------- +# ALIASES +# ----------------------------------------------------- + +# ----------------------------------------------------- +# General +# ----------------------------------------------------- +alias c='clear' +alias nf='fastfetch' +alias pf='fastfetch' +alias ff='fastfetch' +alias ls='eza -a -s modified --icons=always' +alias ll='eza -al --icons=always' +alias lt='eza -a --tree --level=1 --icons' +alias shutdown='systemctl poweroff' +alias v='$EDITOR' +alias vim='$EDITOR' +alias ts='~/.config/ml4w/scripts/snapshot.sh' +alias wifi='nmtui' +alias cleanup='~/.config/ml4w/scripts/cleanup.sh' +# ----------------------------------------------------- +# ML4W Apps +# ----------------------------------------------------- +alias ml4w='com.ml4w.welcome' +alias ml4w-settings='com.ml4w.dotfilessettings' +alias ml4w-hyprland='com.ml4w.hyprland.settings' +alias ml4w-sidebar='ags -t sidebar' +alias ml4w-diagnosis='~/.config/hypr/scripts/diagnosis.sh' +alias ml4w-hyprland-diagnosis='~/.config/hypr/scripts/diagnosis.sh' +alias ml4w-qtile-diagnosis='~/.config/ml4w/qtile/scripts/diagnosis.sh' +alias ml4w-update='~/.config/ml4w/update.sh' + +# ----------------------------------------------------- +# Window Managers +# ----------------------------------------------------- + +alias Qtile='startx' +# Hyprland with Hyprland + +# ----------------------------------------------------- +# Git +# ----------------------------------------------------- +alias gs="git status" +alias ga="git add" +alias gc="git commit -m" +alias gp="git push" +alias gpl="git pull" +alias gst="git stash" +alias gsp="git stash; git pull" +alias gcheck="git checkout" +alias gcredential="git config credential.helper store" + +# ----------------------------------------------------- +# Scripts +# ----------------------------------------------------- +alias ascii='~/.config/ml4w/scripts/figlet.sh' + +# ----------------------------------------------------- +# System +# ----------------------------------------------------- +alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg' + +# ----------------------------------------------------- +# Qtile +# ----------------------------------------------------- +alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 120' +alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 120' +alias setkb='setxkbmap de;echo "Keyboard set back to de."' + + +## custom +alias code="codium --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations" +alias gc='git clone' +alias btop='bpytop' + diff --git a/share/dotfiles/.config/zshrc/custom/30-autostart b/share/dotfiles/.config/zshrc/custom/30-autostart new file mode 100644 index 00000000..fd848831 --- /dev/null +++ b/share/dotfiles/.config/zshrc/custom/30-autostart @@ -0,0 +1,23 @@ +# ----------------------------------------------------- +# AUTOSTART +# ----------------------------------------------------- + +# ----------------------------------------------------- +# Pywal +# ----------------------------------------------------- +cat ~/.cache/wal/sequences + +# ----------------------------------------------------- +# Fastfetch +# ----------------------------------------------------- +if [[ $(tty) == *"pts"* ]]; then + fastfetch --config examples/13 +else + echo + if [ -f /bin/qtile ]; then + echo "Start Qtile X11 with command Qtile" + fi + if [ -f /bin/hyprctl ]; then + echo "Start Hyprland with command Hyprland" + fi +fi diff --git a/share/packages/arch/options/terminal.sh b/share/packages/arch/options/terminal.sh index 10537257..ea96b647 100644 --- a/share/packages/arch/options/terminal.sh +++ b/share/packages/arch/options/terminal.sh @@ -1,4 +1,5 @@ optdepends=( "kitty" "alacritty" + "foot" ); \ No newline at end of file diff --git a/share/packages/arch/special/eww b/share/packages/arch/special/eww new file mode 100644 index 00000000..6620a07a --- /dev/null +++ b/share/packages/arch/special/eww @@ -0,0 +1 @@ +$aur_helper --noconfirm -S "eww" &>> $(_getLogFile) \ No newline at end of file