Hyprland/src/render/OpenGL.hpp

383 lines
16 KiB
C++
Raw Normal View History

2022-04-04 19:44:25 +02:00
#pragma once
#include "../defines.hpp"
#include "../helpers/Monitor.hpp"
#include "../helpers/Color.hpp"
#include "../helpers/time/Timer.hpp"
#include "../helpers/math/Math.hpp"
#include "../helpers/Format.hpp"
#include "../helpers/sync/SyncTimeline.hpp"
#include <GLES3/gl32.h>
#include <cstdint>
2022-04-04 19:44:25 +02:00
#include <list>
#include <string>
#include <stack>
#include <map>
2022-04-04 19:44:25 +02:00
2022-07-10 15:41:26 +02:00
#include <cairo/cairo.h>
2022-04-04 19:44:25 +02:00
#include "Shader.hpp"
2022-04-05 14:33:54 +02:00
#include "Texture.hpp"
2022-04-05 20:49:15 +02:00
#include "Framebuffer.hpp"
#include "Renderbuffer.hpp"
#include "../desktop/DesktopTypes.hpp"
#include "pass/Pass.hpp"
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2ext.h>
#include <aquamarine/buffer/Buffer.hpp>
core: begin using CFileDescriptor from hyprutils (#9122) * config: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * hyprctl: make fd use CFileDescriptor make use of the new hyprutils CFileDescriptor instead of manual FD handling. * ikeyboard: make fd use CFileDescriptor make use of the new CFileDescriptor instead of manual FD handling, also in sendKeymap remove dead code, it already early returns if keyboard isnt valid, and dont try to close the FD that ikeyboard owns. * core: make SHMFile functions use CFileDescriptor make SHMFile misc functions use CFileDescriptor and its associated usage in dmabuf and keyboard. * core: make explicit sync use CFileDescriptor begin using CFileDescriptor in explicit sync and its timelines and eglsync usage in opengl, there is still a bit left with manual handling that requires future aquamarine change aswell. * eventmgr: make fd and sockets use CFileDescriptor make use of the hyprutils CFileDescriptor instead of manual FD and socket handling and closing. * eventloopmgr: make timerfd use CFileDescriptor make the timerfd use CFileDescriptor instead of manual fd handling * opengl: make gbm fd use CFileDescriptor make the gbm rendernode fd use CFileDescriptor instead of manual fd handling * core: make selection source/offer use CFileDescriptor make data selection source and offers use CFileDescriptor and its associated use in xwm and protocols * protocols: convert protocols fd to CFileDescriptor make most fd handling use CFileDescriptor in protocols * shm: make SHMPool use CfileDescriptor make SHMPool use CFileDescriptor instead of manual fd handling. * opengl: duplicate fd with CFileDescriptor duplicate fenceFD with CFileDescriptor duplicate instead. * xwayland: make sockets and fds use CFileDescriptor instead of manual opening/closing make sockets and fds use CFileDescriptor * keybindmgr: make sockets and fds use CFileDescriptor make sockets and fds use CFileDescriptor instead of manual handling.
2025-01-30 12:30:12 +01:00
#include <hyprutils/os/FileDescriptor.hpp>
#include <hyprgraphics/resource/resources/ImageResource.hpp>
2022-04-04 19:44:25 +02:00
2023-07-20 17:47:49 +02:00
#include "../debug/TracyDefines.hpp"
#include "../protocols/core/Compositor.hpp"
#include "ShaderLoader.hpp"
#include "gl/GLFramebuffer.hpp"
#include "gl/GLRenderbuffer.hpp"
#include "pass/TexPassElement.hpp"
#define GLFB(ifb) dc<CGLFramebuffer*>(ifb.get())
2023-07-20 17:47:49 +02:00
struct gbm_device;
class IHyprRenderer;
namespace Config {
class CGradientValueData;
}
struct SVertex {
float x, y; // position
float u, v; // uv
};
constexpr std::array<SVertex, 4> fullVerts = {{
{0.0f, 0.0f, 0.0f, 0.0f}, // top-left
{0.0f, 1.0f, 0.0f, 1.0f}, // bottom-left
{1.0f, 0.0f, 1.0f, 0.0f}, // top-right
{1.0f, 1.0f, 1.0f, 1.0f}, // bottom-right
}};
inline const float fanVertsFull[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f};
2022-04-04 21:45:35 +02:00
struct SRenderModifData {
enum eRenderModifType : uint8_t {
2024-01-07 18:35:44 +01:00
RMOD_TYPE_SCALE, /* scale by a float */
RMOD_TYPE_SCALECENTER, /* scale by a float from the center */
RMOD_TYPE_TRANSLATE, /* translate by a Vector2D */
RMOD_TYPE_ROTATE, /* rotate by a float in rad from top left */
RMOD_TYPE_ROTATECENTER, /* rotate by a float in rad from center */
};
std::vector<std::pair<eRenderModifType, std::any>> modifs;
void applyToBox(CBox& box);
2024-04-03 14:09:58 +01:00
void applyToRegion(CRegion& rg);
float combinedScale();
bool enabled = true;
};
enum eMonitorRenderFBs : uint8_t {
FB_MONITOR_RENDER_MAIN = 0,
FB_MONITOR_RENDER_CURRENT = 1,
FB_MONITOR_RENDER_OUT = 2,
};
enum eMonitorExtraRenderFBs : uint8_t {
FB_MONITOR_RENDER_EXTRA_OFFLOAD = 0,
FB_MONITOR_RENDER_EXTRA_MIRROR,
FB_MONITOR_RENDER_EXTRA_MIRROR_SWAP,
FB_MONITOR_RENDER_EXTRA_OFF_MAIN,
FB_MONITOR_RENDER_EXTRA_MONITOR_MIRROR,
FB_MONITOR_RENDER_EXTRA_BLUR,
};
renderer: shader code refactor (#12926) * shader: begin the shader refactor make SShader a class and rename it to CShader, move createprogram, compileshader, logshadererror to CShader. * shader: move uniform creation to CShader move uniform creation to CShader, reduces tons of duplicated effort, however forcing uniform names to be same in all shaders. * shader: move to array based frag handling use an array with an enum so it gets easier dealing with multiple shaders, move creating program to a for loop and array, reduces line of code a lot. * shader: use shared ptr for frags with smart pointers we can now rename useProgram to useShader and return the shader directly, means only place we have to decide the shader frag is when calling useShader. easier for future shader splitting to reduce branching. * shader: move unneded public members to private move structs and uniforms to private add a get/set for initialtime and add a getUniformLocation to make the code tell what its doing, instead of direct array getting when all we wanted to get was its value, also limits the setting of uniformLocations to the createProgram as it should be. * shader: fix style nits set first enum member to 0 , remove extra {} * shader: dont show a failed notif on success the logic got inverted in the refactor here. * shader: split CM shader to rgba/rgbx variants split shader to rgba/rgbx variants, use bool, and reduce branching. * shader: split up blurprepare CM and non CM split up blurprepare, remove skipcm, move gain to gain.glsl. remove ternary operator and reduce branching by using step() and mix() use vec3 for gain, make brightness a cheap mulitplication with max. * shader: split up border to CM/noncm variants splitup border shader to CM/noncm variant, move common used things to border.glsl , there is room for optimisations here but its a complex shader im putting it for future PR. * shader: touchup blurfinish make brightness a cheap multiplication instead of branching. mod is redundant, fract in hash already returns a value in [0.0, 1.0]
2026-01-12 18:27:16 +01:00
struct SFragShaderDesc {
Render::ePreparedFragmentShader id;
const char* file;
renderer: shader code refactor (#12926) * shader: begin the shader refactor make SShader a class and rename it to CShader, move createprogram, compileshader, logshadererror to CShader. * shader: move uniform creation to CShader move uniform creation to CShader, reduces tons of duplicated effort, however forcing uniform names to be same in all shaders. * shader: move to array based frag handling use an array with an enum so it gets easier dealing with multiple shaders, move creating program to a for loop and array, reduces line of code a lot. * shader: use shared ptr for frags with smart pointers we can now rename useProgram to useShader and return the shader directly, means only place we have to decide the shader frag is when calling useShader. easier for future shader splitting to reduce branching. * shader: move unneded public members to private move structs and uniforms to private add a get/set for initialtime and add a getUniformLocation to make the code tell what its doing, instead of direct array getting when all we wanted to get was its value, also limits the setting of uniformLocations to the createProgram as it should be. * shader: fix style nits set first enum member to 0 , remove extra {} * shader: dont show a failed notif on success the logic got inverted in the refactor here. * shader: split CM shader to rgba/rgbx variants split shader to rgba/rgbx variants, use bool, and reduce branching. * shader: split up blurprepare CM and non CM split up blurprepare, remove skipcm, move gain to gain.glsl. remove ternary operator and reduce branching by using step() and mix() use vec3 for gain, make brightness a cheap mulitplication with max. * shader: split up border to CM/noncm variants splitup border shader to CM/noncm variant, move common used things to border.glsl , there is room for optimisations here but its a complex shader im putting it for future PR. * shader: touchup blurfinish make brightness a cheap multiplication instead of branching. mod is redundant, fract in hash already returns a value in [0.0, 1.0]
2026-01-12 18:27:16 +01:00
};
struct SPreparedShaders {
// SPreparedShaders() {
// for (auto& f : frag) {
// f = makeShared<CShader>();
// }
// }
std::string TEXVERTSRC;
std::string TEXVERTSRC320;
// std::array<SP<CShader>, SH_FRAG_LAST> frag;
// std::map<uint8_t, SP<CShader>> fragVariants;
std::array<std::map<Render::ShaderFeatureFlags, SP<CShader>>, Render::SH_FRAG_LAST> fragVariants;
};
2022-04-04 19:44:25 +02:00
struct SCurrentRenderData {
PHLMONITORREF pMonitor;
Mat3x3 projection;
Mat3x3 savedProjection;
Mat3x3 monitorProjection;
SP<IFramebuffer> currentFB = nullptr; // current rendering to
SP<IFramebuffer> mainFB = nullptr; // main to render to
SP<IFramebuffer> outFB = nullptr; // out to render to (if offloaded, etc)
CRegion damage;
CRegion finalDamage; // damage used for funal off -> main
SRenderModifData renderModif;
float mouseZoomFactor = 1.f;
bool mouseZoomUseMouse = true; // true by default
bool useNearestNeighbor = false;
bool blockScreenShader = false;
bool simplePass = false;
bool transformDamage = true;
bool noSimplify = false;
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
CBox clipBox = {}; // scaled coordinates
CRegion clipRegion;
uint32_t discardMode = DISCARD_OPAQUE;
float discardOpacity = 0.f;
PHLLSREF currentLS;
PHLWINDOWREF currentWindow;
WP<CWLSurfaceResource> surface;
2022-04-04 19:44:25 +02:00
};
class CEGLSync {
public:
static UP<CEGLSync> create();
~CEGLSync();
syncobj: use eventfd instead of stalling fd checks (#9437) * syncobj: cleanup and use uniqueptrs cleanup a bit missing removals if resource not good, erasing from containers etc. make use of unique ptrs instead. and add default destructors. * syncobj: rework syncobj entirerly remove early buffer release that was breaking explicit sync, the buffer needs to exist until the surface commit event has been emitted and draw calls added egl sync points, move to eventfd signaling instead of stalling sync point checks, and recommit pending commits if waiting on a signal. add a CDRMSyncPointState helper class. move a few weak pointers to shared pointers so they dont destruct before we need to use them. * syncobj: queue pending states for eventfd eventfd requires us to queue pending stats until ready and then apply to current, and also when no ready state exist commit the client commit on the current existing buffer, if there is one. * syncobj: clear current buffer damage clear current buffer damage on current buffer commits. * syncobj: cleanup code and fix hyprlock remove unused code, and ensure we dont commit a empty texture causing locksession protocol and gtk4-layer-shell misbehaving. * syncobj: ensure buffers are cleaned up ensure the containers having the various buffers actually gets cleaned up from their containers, incase the CSignal isnt signaled because of expired smart pointers or just wrong order destruction because mishaps. also move the acquire/point setting to buffer attaching. instead of on precommit. * syncobj: remove unused code, optimize remove unused code and merge sync fds if fence is valid, remove manual directscanout buffer dropping that signals release point on pageflip, it can cause us to signal the release point while still keeping the current buffer and rendering it yet again causing wrong things. * syncobj: delay buffer release on non syncobj delay buffer releases on non syncobj surfaces until next commit, and check on async buffers if syncobj and drop and signal the release point on backend buffer release. * syncobj: ensure we follow protocol ensure we follow protocol by replacing acquire/release points if they arrive late and replace already existing ones. also remove unneded brackets, and dont try to manual lock/release buffers when it comes to explicit protocol. it doesnt care about buffer releases only about acquire and release points and signaling them. * syncobj: lets not complicate things set points in precommit, before checking protocol errors and we catch any pending acquire/release points arriving late. * syncobj: move SSurfaceState to types remove destructor resource destroying, let resources destroys them on their events, and move SSurfaceStates to types/SurfaceState.hpp * syncobj: actually store the merged fd have to actually store the mergedfd to use it. * syncobj: cleanup a bit around fences ensure the current asynchronous buffer is actually released on pageflip not the previous. cleanup a bit FD handling in commitPendingAndDoExplicitSync, and reuse the in fence when syncing surfaces. * syncobjs: ensure fence FD doesnt leak calling resetexplicitfence without properly ensuring the FD is closed before will leak it, store it per monitor and let it close itself with the CFileDescriptor class. * syncobj: ensure buffers are actually released buffers were never being sent released properly. * types: Defer buffer sync releaser until unlock * syncobj: store directscanout fence in monitor ensure the infence fd survives the scope of attemptdirectscanout so it doesnt close before it should have. * syncobj: check if if acquire is expired we might hit a race to finish on exit where the timeline just has destructed but the buffer waiter is still pending. and such we removeAllWaiters null dereferences. * syncobj: code style changes remove quack comment, change to m_foo and use a std::vector and weakpointer in the waiter for removal instead of a std::list. * syncobj: remove unused async buffer drop remove unused async buffer drop, only related to directscanout and is handled elsewhere. --------- Co-authored-by: Lee Bousfield <ljbousfield@gmail.com>
2025-03-14 15:08:20 +01:00
Hyprutils::OS::CFileDescriptor& fd();
Hyprutils::OS::CFileDescriptor&& takeFd();
bool isValid();
private:
CEGLSync() = default;
Hyprutils::OS::CFileDescriptor m_fd;
EGLSyncKHR m_sync = EGL_NO_SYNC_KHR;
bool m_valid = false;
friend class CHyprOpenGLImpl;
};
2022-04-04 19:44:25 +02:00
class CHyprOpenGLImpl {
public:
2022-04-04 19:44:25 +02:00
CHyprOpenGLImpl();
~CHyprOpenGLImpl();
2022-04-04 19:44:25 +02:00
struct SRectRenderData {
const CRegion* damage = nullptr;
int round = 0;
float roundingPower = 2.F;
bool blur = false;
float blurA = 1.F;
bool xray = false;
};
struct STextureRenderData {
bool blur = false;
float blurA = 1.F, overallA = 1.F;
bool blockBlurOptimization = false;
SP<ITexture> blurredBG;
const CRegion* damage = nullptr;
SP<CWLSurfaceResource> surface = nullptr;
float a = 1.F;
int round = 0;
float roundingPower = 2.F;
bool discardActive = false;
bool allowCustomUV = false;
bool allowDim = true;
bool noAA = false; // unused
GLenum wrapX = GL_CLAMP_TO_EDGE, wrapY = GL_CLAMP_TO_EDGE;
bool cmBackToSRGB = false;
bool finalMonitorCM = false;
SP<CMonitor> cmBackToSRGBSource;
uint32_t discardMode = DISCARD_OPAQUE;
float discardOpacity = 0.f;
CRegion clipRegion;
PHLLSREF currentLS;
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1);
};
2022-04-04 19:44:25 +02:00
struct SBorderRenderData {
int round = 0;
float roundingPower = 2.F;
int borderSize = 1;
float a = 1.0;
int outerRound = -1; /* use round */
};
void makeEGLCurrent();
void begin(PHLMONITOR, const CRegion& damage, SP<IFramebuffer> fb = nullptr, std::optional<CRegion> finalDamage = {});
void beginSimple(PHLMONITOR, const CRegion& damage, SP<IRenderbuffer> rb = nullptr, SP<IFramebuffer> fb = nullptr);
void end();
2022-04-04 19:44:25 +02:00
void renderRect(const CBox&, const CHyprColor&, SRectRenderData data);
void renderTexture(SP<ITexture>, const CBox&, STextureRenderData data);
void renderRoundedShadow(const CBox&, int round, float roundingPower, int range, const CHyprColor& color, float a = 1.0);
void renderInnerGlow(const CBox&, int round, float roundingPower, int range, const CHyprColor& color, int glowPower, float a = 1.0);
void renderBorder(const CBox&, const Config::CGradientValueData&, SBorderRenderData data);
void renderBorder(const CBox&, const Config::CGradientValueData&, const Config::CGradientValueData&, float lerp, SBorderRenderData data);
void renderTextureMatte(SP<ITexture> tex, const CBox& pBox, SP<IFramebuffer> matte);
void renderTexturePrimitive(SP<ITexture> tex, const CBox& box);
2022-04-19 19:01:23 +02:00
void setViewport(GLint x, GLint y, GLsizei width, GLsizei height);
void setCapStatus(int cap, bool status);
void blend(bool enabled);
2022-09-13 15:25:42 +02:00
void clear(const CHyprColor&);
void scissor(const CBox&, bool transform = true);
void scissor(const pixman_box32*, bool transform = true);
void scissor(const int x, const int y, const int w, const int h, bool transform = true);
2022-12-01 13:36:07 +00:00
void destroyMonitorResources(PHLMONITORREF);
void preRender(PHLMONITOR);
void saveBufferForMirror(const CBox&);
2023-10-21 14:15:48 +01:00
void applyScreenShader(const std::string& path);
void renderOffToMain(IFramebuffer* off);
std::vector<SDRMFormat> getDRMFormats();
std::vector<uint64_t> getDRMFormatModifiers(DRMFormat format);
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
bool initShaders(const std::string& path = "");
WP<CShader> useShader(WP<CShader> prog);
bool explicitSyncSupported();
WP<CShader> getShaderVariant(Render::ePreparedFragmentShader frag, Render::ShaderFeatureFlags features = 0);
bool m_shadersInitialized = false;
SP<SPreparedShaders> m_shaders;
2022-04-04 19:44:25 +02:00
Hyprutils::OS::CFileDescriptor m_gbmFD;
gbm_device* m_gbmDevice = nullptr;
EGLContext m_eglContext = nullptr;
EGLDisplay m_eglDisplay = nullptr;
EGLDeviceEXT m_eglDevice = nullptr;
2022-12-01 13:36:07 +00:00
std::map<PHLMONITORREF, SP<IFramebuffer>> m_monitorBGFBs;
2022-04-05 20:49:15 +02:00
struct {
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = nullptr;
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR = nullptr;
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = nullptr;
PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT = nullptr;
PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT = nullptr;
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = nullptr;
PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR = nullptr;
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT = nullptr;
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT = nullptr;
PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT = nullptr;
PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR = nullptr;
PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = nullptr;
PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID = nullptr;
PFNEGLWAITSYNCKHRPROC eglWaitSyncKHR = nullptr;
} m_proc;
struct {
bool EXT_read_format_bgra = false;
bool EXT_image_dma_buf_import = false;
bool EXT_image_dma_buf_import_modifiers = false;
bool KHR_context_flush_control = false;
bool KHR_display_reference = false;
bool IMG_context_priority = false;
bool EXT_create_context_robustness = false;
bool EGL_ANDROID_native_fence_sync_ext = false;
} m_exts;
enum eEGLContextVersion : uint8_t {
EGL_CONTEXT_GLES_2_0 = 0,
EGL_CONTEXT_GLES_3_0,
EGL_CONTEXT_GLES_3_2,
};
2025-07-20 14:51:10 +02:00
eEGLContextVersion m_eglContextVersion = EGL_CONTEXT_GLES_3_2;
enum eCachedCapStatus : uint8_t {
CAP_STATUS_BLEND = 0,
CAP_STATUS_SCISSOR_TEST,
CAP_STATUS_STENCIL_TEST,
CAP_STATUS_END
};
2025-07-20 14:51:10 +02:00
private:
renderer: reduce a lot of glcalls and cache various states (#10757) * opengl: cache viewport state according to nvidia docs calling glViewPort unnecessarily on the same already set viewport is wasteful and can cause state changes when not needed. cache it in a struct and only call it when the viewport is actually changing. * opengl: cache glenable/gldisable state avoid making multiple glenable/gldisable calls on already set caps, can cause state changes and incur driver overhead. * opengl: cache glscissor box only call glscissor if the box actually has changed, try to avoid state changes. * opengl: cache gluniform calls cache the gluniform calls, the uniform values are cached in driver per program only the drawcalls setting the uniform yet again with the same value on same location is causing more overhead then caching it ourself and just no oping on it if no changes. * shader: rewrite handling of uniforms and state this is way faster as we don't need to mess with maps (hashing, etc) and instead can just use an array * opengl: stuff and 300 shaders * opengl: typo * opengl: get the uniform locations properly now that the legacy shaders are gone get the uniformlocations for SKIP_CM etc, so they can be properly set and used depending on if cm_enabled is set to false or true, before it was falling back to a legacy shader that didnt even have those uniforms. * opengl: check epsilon on float and remove extra glcall seems an extra unset glcall was added, remove it. and check the float epsilon on the glfloat. * opengl: remove instanced shader draw remove the instanced boolean from the vertex shader, might be neglible differences, needs more benchmark/work to see if its even worth it. * texture: cache texture paramaters parameters where occasionally set twice or more on same texture, short version wrap it and cache it. and move gpu churn to cpu churn. add a bind/unbind to texture aswell. * texture: use fast std::array caching cache the texparameter values in fast array lookups and incase we dont want it cached, apply it anyways. * shader: fix typo and hdr typo actually use Matrix4x2fv in the 4x2fv cache function, and send the proper float array for hdr. * texture: make caching not linear lookup make caching of texture params not linear. * minor style changes * opengl: revert drawarrays revert the mostly code style reduce loc change of drawarrays, and focus on the caching. its a if else case going wrong here breaking blur/contrast amongst others drawing. --------- Co-authored-by: Vaxry <vaxry@vaxry.net>
2025-06-25 12:42:32 +02:00
struct {
GLint x = 0;
GLint y = 0;
GLsizei width = 0;
GLsizei height = 0;
} m_lastViewport;
std::array<bool, CAP_STATUS_END> m_capStatus = {};
std::vector<SDRMFormat> m_drmFormats;
bool m_hasModifiers = false;
int m_drmFD = -1;
std::string m_extensions;
bool m_fakeFrame = false;
bool m_applyFinalShader = false;
bool m_blend = false;
bool m_offloadedFramebuffer = false;
bool m_cmSupported = true;
SP<CShader> m_finalScreenShader;
GLuint m_currentProgram = 0;
void initDRMFormats();
void initEGL(bool gbm);
EGLDeviceEXT eglDeviceFromDRMFD(int drmFD);
// for the final shader
std::array<CTimer, POINTER_PRESSED_HISTORY_LENGTH> m_pressedHistoryTimers = {};
std::array<Vector2D, POINTER_PRESSED_HISTORY_LENGTH> m_pressedHistoryPositions = {};
GLint m_pressedHistoryKilled = 0;
GLint m_pressedHistoryTouched = 0;
//
std::optional<std::vector<uint64_t>> getModsForFormat(EGLint format);
2022-04-14 16:43:29 +02:00
// returns the out FB, can be either Mirror or MirrorSwap
SP<IFramebuffer> blurFramebufferWithDamage(float a, CRegion* damage, CGLFramebuffer& source);
void passCMUniforms(WP<CShader>, const NColorManagement::PImageDescription imageDescription, const NColorManagement::PImageDescription targetImageDescription,
bool modifySDR = false, float sdrMinLuminance = -1.0f, int sdrMaxLuminance = -1);
void passCMUniforms(WP<CShader>, const NColorManagement::PImageDescription imageDescription);
void renderRectInternal(const CBox&, const CHyprColor&, const SRectRenderData& data);
void renderRectWithBlurInternal(const CBox&, const CHyprColor&, const SRectRenderData& data);
void renderRectWithDamageInternal(const CBox&, const CHyprColor&, const SRectRenderData& data);
WP<CShader> renderToOutputInternal();
WP<CShader> renderToFBInternal(const STextureRenderData& data, eTextureType texType, const CBox& newBox);
void renderTextureInternal(SP<ITexture>, const CBox&, const STextureRenderData& data);
void renderTextureWithBlurInternal(SP<ITexture>, const CBox&, const STextureRenderData& data);
friend class IHyprRenderer;
friend class CHyprGLRenderer;
friend class CTexPassElement;
friend class CPreBlurElement;
friend class CSurfacePassElement;
2022-04-04 19:44:25 +02:00
};
inline UP<CHyprOpenGLImpl> g_pHyprOpenGL;