962580115a99d5fb29c22ae4098353cf39a56e6f
- Author
- outfoxxed <outfoxxed@outfoxxed.me>
- Committer
- outfoxxed <outfoxxed@outfoxxed.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/flake.lock b/flake.lock
2index bc03b7b2223ffee1193be0ed7d04fdff420082c9..51641dc19da0bb015d75e312b21f85c8b7a4cbbb 100644
3--- a/flake.lock
4+++ b/flake.lock
5@@ -20,11 +20,11 @@
6 ]
7 },
8 "locked": {
9- "lastModified": 1765900596,
10- "narHash": "sha256-+hn8v9jkkLP9m+o0Nm5SiEq10W0iWDSotH2XfjU45fA=",
11+ "lastModified": 1767024902,
12+ "narHash": "sha256-sMdk6QkMDhIOnvULXKUM8WW8iyi551SWw2i6KQHbrrU=",
13 "owner": "hyprwm",
14 "repo": "aquamarine",
15- "rev": "d83c97f8f5c0aae553c1489c7d9eff3eadcadace",
16+ "rev": "b8a0c5ba5a9fbd2c660be7dd98bdde0ff3798556",
17 "type": "github"
18 },
19 "original": {
20@@ -36,15 +36,15 @@
21 "flake-compat": {
22 "flake": false,
23 "locked": {
24- "lastModified": 1761588595,
25- "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
26- "owner": "edolstra",
27+ "lastModified": 1767039857,
28+ "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
29+ "owner": "NixOS",
30 "repo": "flake-compat",
31- "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
32+ "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
33 "type": "github"
34 },
35 "original": {
36- "owner": "edolstra",
37+ "owner": "NixOS",
38 "repo": "flake-compat",
39 "type": "github"
40 }
41@@ -116,11 +116,11 @@
42 ]
43 },
44 "locked": {
45- "lastModified": 1763733840,
46- "narHash": "sha256-JnET78yl5RvpGuDQy3rCycOCkiKoLr5DN1fPhRNNMco=",
47+ "lastModified": 1766946335,
48+ "narHash": "sha256-MRD+Jr2bY11MzNDfenENhiK6pvN+nHygxdHoHbZ1HtE=",
49 "owner": "hyprwm",
50 "repo": "hyprgraphics",
51- "rev": "8f1bec691b2d198c60cccabca7a94add2df4ed1a",
52+ "rev": "4af02a3925b454deb1c36603843da528b67ded6c",
53 "type": "github"
54 },
55 "original": {
56@@ -146,17 +146,17 @@
57 "xdph": "xdph"
58 },
59 "locked": {
60- "lastModified": 1767388857,
61- "narHash": "sha256-h70Tlpce8NEkwWqw/DDpeOKPzPyfq7P2t0HtGM5Z3Cw=",
62+ "lastModified": 1768908865,
63+ "narHash": "sha256-KkzYP2+FVo3wIb2oom2BT7RRGmlvTiEaDJApCpTdcWw=",
64 "owner": "hyprwm",
65 "repo": "hyprland",
66- "rev": "ab1d80f3d6aebd57a0971b53a1993b1c1dfe0b09",
67+ "rev": "8f547c6fa089f91e7577947c426f692397e9a5cb",
68 "type": "github"
69 },
70 "original": {
71 "owner": "hyprwm",
72 "repo": "hyprland",
73- "rev": "ab1d80f3d6aebd57a0971b53a1993b1c1dfe0b09",
74+ "rev": "8f547c6fa089f91e7577947c426f692397e9a5cb",
75 "type": "github"
76 }
77 },
78@@ -193,11 +193,11 @@
79 ]
80 },
81 "locked": {
82- "lastModified": 1765643131,
83- "narHash": "sha256-CCGohW5EBIRy4B7vTyBMqPgsNcaNenVad/wszfddET0=",
84+ "lastModified": 1767023960,
85+ "narHash": "sha256-R2HgtVS1G3KSIKAQ77aOZ+Q0HituOmPgXW9nBNkpp3Q=",
86 "owner": "hyprwm",
87 "repo": "hyprland-guiutils",
88- "rev": "e50ae912813bdfa8372d62daf454f48d6df02297",
89+ "rev": "c2e906261142f5dd1ee0bfc44abba23e2754c660",
90 "type": "github"
91 },
92 "original": {
93@@ -324,11 +324,11 @@
94 ]
95 },
96 "locked": {
97- "lastModified": 1766160771,
98- "narHash": "sha256-roINUGikWRqqgKrD4iotKbGj3ZKJl3hjMz5l/SyKrHw=",
99+ "lastModified": 1766253372,
100+ "narHash": "sha256-1+p4Kw8HdtMoFSmJtfdwjxM4bPxDK9yg27SlvUMpzWA=",
101 "owner": "hyprwm",
102 "repo": "hyprutils",
103- "rev": "5ac060bfcf2f12b3a6381156ebbc13826a05b09f",
104+ "rev": "51a4f93ce8572e7b12b7284eb9e6e8ebf16b4be9",
105diff --git a/flake.nix b/flake.nix
106index d3e2df9ed89fc17c316990d7c3f9dffb21307546..acc511613f1588f12206e0753414c11624c1b908 100644
107--- a/flake.nix
108+++ b/flake.nix
109@@ -1,6 +1,6 @@
110 {
111 inputs = {
112- hyprland.url = "github:hyprwm/hyprland/ab1d80f3d6aebd57a0971b53a1993b1c1dfe0b09";
113+ hyprland.url = "github:hyprwm/hyprland/8f547c6fa089f91e7577947c426f692397e9a5cb";
114 };
115
116 outputs = {
117diff --git a/src/render.cpp b/src/render.cpp
118index 9ec65d8ac59ccdaee24b1b1110fd1899f52054a3..18710356d5523a6bdc2a80ca023f45a0186c9cf9 100644
119--- a/src/render.cpp
120+++ b/src/render.cpp
121@@ -3,6 +3,7 @@
122 #include <GLES2/gl2.h>
123 #include <hyprland/src/helpers/math/Math.hpp>
124 #include <hyprland/src/render/OpenGL.hpp>
125+#include <hyprland/src/render/Shader.hpp>
126 #include <hyprutils/math/Box.hpp>
127 #include <hyprutils/math/Misc.hpp>
128 #include <hyprutils/math/Vector2D.hpp>
129@@ -35,7 +36,7 @@ void Hy3Render::renderTab(
130
131 auto glMatrix = rdata.projection.copy().multiply(matrix);
132
133- g_pHyprOpenGL->useProgram(shader.program);
134+ g_pHyprOpenGL->useShader(shader.program);
135
136 #ifndef GLES2
137 glUniformMatrix3fv(shader.proj, 1, GL_TRUE, glMatrix.getMatrix().data());
138@@ -85,12 +86,9 @@ void Hy3Render::renderTab(
139 glUniform1f(shader.outerRadius, radius);
140 glUniform1f(shader.borderWidth, borderWidth);
141
142- glVertexAttribPointer(shader.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
143- glEnableVertexAttribArray(shader.posAttrib);
144-
145+ glBindVertexArray(shader.program->getUniformLocation(SHADER_SHADER_VAO));
146 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
147-
148- glDisableVertexAttribArray(shader.posAttrib);
149+ glBindVertexArray(0);
150
151 if (blur) {
152 glBindTexture(blurTex->m_target, 0);
153diff --git a/src/shaders.cpp b/src/shaders.cpp
154index de565497526f066fa804de2b41d9b638b7edf323..c5694521dc7a787be6ca666ca2e4c42190b50d37 100644
155--- a/src/shaders.cpp
156+++ b/src/shaders.cpp
157@@ -1,6 +1,8 @@
158 #include "shaders.hpp"
159 #include <csignal>
160+#include <exception>
161 #include <string>
162+#include <stdexcept>
163
164 #include <GLES2/gl2.h>
165 #include <hyprland/src/render/OpenGL.hpp>
166@@ -10,24 +12,25 @@
167 Hy3Shaders::Hy3Shaders() {
168 {
169 auto& s = this->tab;
170- s.program = g_pHyprOpenGL->createProgram(std::string(SHADER_TAB_VERT), std::string(SHADER_TAB_FRAG));
171- s.posAttrib = glGetAttribLocation(s.program, "pos");
172- s.proj = glGetUniformLocation(s.program, "proj");
173- s.monitorSize = glGetUniformLocation(s.program, "monitorSize");
174- s.pixelOffset = glGetUniformLocation(s.program, "pixelOffset");
175- s.pixelSize = glGetUniformLocation(s.program, "pixelSize");
176- s.applyBlur = glGetUniformLocation(s.program, "applyBlur");
177- s.blurTex = glGetUniformLocation(s.program, "blurTex");
178- s.opacity = glGetUniformLocation(s.program, "opacity");
179- s.fillColor = glGetUniformLocation(s.program, "fillColor");
180- s.borderColor = glGetUniformLocation(s.program, "borderColor");
181- s.borderWidth = glGetUniformLocation(s.program, "borderWidth");
182- s.outerRadius = glGetUniformLocation(s.program, "outerRadius");
183+ s.program = makeShared<CShader>();
184+ if (!s.program->createProgram(std::string(SHADER_TAB_VERT), std::string(SHADER_TAB_FRAG))) {
185+ throw std::runtime_error("hy3 tab shader compilation fails");
186+ }
187+ auto program = s.program->program();
188+ s.proj = glGetUniformLocation(program, "proj");
189+ s.monitorSize = glGetUniformLocation(program, "monitorSize");
190+ s.pixelOffset = glGetUniformLocation(program, "pixelOffset");
191+ s.pixelSize = glGetUniformLocation(program, "pixelSize");
192+ s.applyBlur = glGetUniformLocation(program, "applyBlur");
193+ s.blurTex = glGetUniformLocation(program, "blurTex");
194+ s.opacity = glGetUniformLocation(program, "opacity");
195+ s.fillColor = glGetUniformLocation(program, "fillColor");
196+ s.borderColor = glGetUniformLocation(program, "borderColor");
197+ s.borderWidth = glGetUniformLocation(program, "borderWidth");
198+ s.outerRadius = glGetUniformLocation(program, "outerRadius");
199 }
200 }
201
202-Hy3Shaders::~Hy3Shaders() { glDeleteProgram(this->tab.program); }
203-
204 Hy3Shaders* Hy3Shaders::instance() {
205 static auto* INSTANCE = new Hy3Shaders();
206 return INSTANCE;
207diff --git a/src/shaders.hpp b/src/shaders.hpp
208index 500c6020f9f814d9fab17e262ef9c59a0d458428..ed15b94e192035d3fad8661e6f986b92217ecfae 100644
209--- a/src/shaders.hpp
210+++ b/src/shaders.hpp
211@@ -2,12 +2,12 @@
212
213 #include <GLES2/gl2.h>
214 #include <hyprland/src/render/OpenGL.hpp>
215+#include <hyprland/src/render/Shader.hpp>
216
217 class Hy3Shaders {
218 public:
219 struct {
220- GLuint program;
221- GLuint posAttrib;
222+ SP<CShader> program;
223 GLint proj;
224 GLint monitorSize;
225 GLint pixelOffset;
226@@ -25,5 +25,4 @@ public:
227
228 private:
229 Hy3Shaders();
230- ~Hy3Shaders();
231 };