summaryrefslogtreecommitdiff
path: root/src/render/gl/GLTexture.hpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2026-03-29 00:41:45 +0300
committerGitHub <noreply@github.com>2026-03-28 21:41:45 +0000
commit38a7f03cf0e5ee116794a78581634ba3dab508fa (patch)
tree969891411b2af4e437a183004018cfc359a3057e /src/render/gl/GLTexture.hpp
parentef2e8dfd5f7e6ee55fa7bc48e44974e64938d14a (diff)
renderer: refactor part 7: api fixes (#13631)
Part 7 of ujin's refactors --------- Co-authored-by: Vaxry <vaxry@vaxry.net>
Diffstat (limited to 'src/render/gl/GLTexture.hpp')
-rw-r--r--src/render/gl/GLTexture.hpp87
1 files changed, 45 insertions, 42 deletions
diff --git a/src/render/gl/GLTexture.hpp b/src/render/gl/GLTexture.hpp
index 34510e90..07b51d9a 100644
--- a/src/render/gl/GLTexture.hpp
+++ b/src/render/gl/GLTexture.hpp
@@ -4,46 +4,49 @@
#include <aquamarine/buffer/Buffer.hpp>
#include <hyprutils/math/Misc.hpp>
-class CGLTexture : public ITexture {
- public:
- using ITexture::ITexture;
-
- CGLTexture(CGLTexture&) = delete;
- CGLTexture(CGLTexture&&) = delete;
- CGLTexture(const CGLTexture&&) = delete;
- CGLTexture(const CGLTexture&) = delete;
-
- CGLTexture(bool opaque = false);
- CGLTexture(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size, bool keepDataCopy = false, bool opaque = false);
- CGLTexture(const Aquamarine::SDMABUFAttrs&, void* image, bool opaque = false);
- CGLTexture(std::span<const float> lut3D, size_t N);
- ~CGLTexture();
-
- void allocate(const Vector2D& size, uint32_t drmFormat = 0) override;
- void update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage) override;
- void bind() override;
- void unbind() override;
- void setTexParameter(GLenum pname, GLint param) override;
- bool ok() override;
- bool isDMA() override;
-
- private:
- void* m_eglImage = nullptr;
-
- enum eTextureParam : uint8_t {
- TEXTURE_PAR_WRAP_S = 0,
- TEXTURE_PAR_WRAP_T,
- TEXTURE_PAR_MAG_FILTER,
- TEXTURE_PAR_MIN_FILTER,
- TEXTURE_PAR_SWIZZLE_R,
- TEXTURE_PAR_SWIZZLE_B,
- TEXTURE_PAR_LAST,
+namespace Render::GL {
+
+ class CGLTexture : public ITexture {
+ public:
+ using ITexture::ITexture;
+
+ CGLTexture(CGLTexture&) = delete;
+ CGLTexture(CGLTexture&&) = delete;
+ CGLTexture(const CGLTexture&&) = delete;
+ CGLTexture(const CGLTexture&) = delete;
+
+ CGLTexture(bool opaque = false);
+ CGLTexture(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size, bool keepDataCopy = false, bool opaque = false);
+ CGLTexture(const Aquamarine::SDMABUFAttrs&, void* image, bool opaque = false);
+ CGLTexture(std::span<const float> lut3D, size_t N);
+ ~CGLTexture();
+
+ void allocate(const Vector2D& size, uint32_t drmFormat = 0) override;
+ void update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage) override;
+ void bind() override;
+ void unbind() override;
+ void setTexParameter(GLenum pname, GLint param) override;
+ bool ok() override;
+ bool isDMA() override;
+
+ private:
+ void* m_eglImage = nullptr;
+
+ enum eTextureParam : uint8_t {
+ TEXTURE_PAR_WRAP_S = 0,
+ TEXTURE_PAR_WRAP_T,
+ TEXTURE_PAR_MAG_FILTER,
+ TEXTURE_PAR_MIN_FILTER,
+ TEXTURE_PAR_SWIZZLE_R,
+ TEXTURE_PAR_SWIZZLE_B,
+ TEXTURE_PAR_LAST,
+ };
+
+ GLenum m_target = GL_TEXTURE_2D;
+
+ void swizzle(const std::array<GLint, 4>& colors);
+ constexpr std::optional<size_t> getCacheStateIndex(GLenum pname);
+
+ std::array<std::optional<GLint>, TEXTURE_PAR_LAST> m_cachedStates;
};
-
- GLenum m_target = GL_TEXTURE_2D;
-
- void swizzle(const std::array<GLint, 4>& colors);
- constexpr std::optional<size_t> getCacheStateIndex(GLenum pname);
-
- std::array<std::optional<GLint>, TEXTURE_PAR_LAST> m_cachedStates;
-};
+}