mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-09 10:29:49 +01:00
renderer: untransform textures matching display transform
fixes #6754 This will break if the client uses a transform that is not equal to the display, reverting to old behavior. Combining transforms is left as a todo for the future.
This commit is contained in:
parent
5979ceb56b
commit
1797319a07
3 changed files with 18 additions and 8 deletions
|
@ -406,6 +406,9 @@ void CWLSurfaceResource::commitPendingState() {
|
||||||
pending.damage.clear();
|
pending.damage.clear();
|
||||||
pending.bufferDamage.clear();
|
pending.bufferDamage.clear();
|
||||||
|
|
||||||
|
if (current.buffer && current.buffer->texture)
|
||||||
|
current.buffer->texture->m_eTransform = wlTransformToHyprutils(current.transform);
|
||||||
|
|
||||||
if (current.buffer && !bufferReleased) {
|
if (current.buffer && !bufferReleased) {
|
||||||
current.buffer->update(accumulateCurrentBufferDamage());
|
current.buffer->update(accumulateCurrentBufferDamage());
|
||||||
|
|
||||||
|
|
|
@ -1277,9 +1277,13 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
|
||||||
static auto PDIMINACTIVE = CConfigValue<Hyprlang::INT>("decoration:dim_inactive");
|
static auto PDIMINACTIVE = CConfigValue<Hyprlang::INT>("decoration:dim_inactive");
|
||||||
static auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
|
static auto PDT = CConfigValue<Hyprlang::INT>("debug:damage_tracking");
|
||||||
|
|
||||||
// get transform
|
// get the needed transform for this texture
|
||||||
const auto TRANSFORM = wlTransformToHyprutils(invertTransform(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform));
|
const bool TRANSFORMS_MATCH = wlTransformToHyprutils(m_RenderData.pMonitor->transform) == tex->m_eTransform; // FIXME: combine them properly!!!
|
||||||
float matrix[9];
|
eTransform TRANSFORM = HYPRUTILS_TRANSFORM_NORMAL;
|
||||||
|
if (m_bEndFrame || TRANSFORMS_MATCH)
|
||||||
|
TRANSFORM = wlTransformToHyprutils(invertTransform(m_RenderData.pMonitor->transform));
|
||||||
|
|
||||||
|
float matrix[9];
|
||||||
projectBox(matrix, newBox, TRANSFORM, newBox.rot, m_RenderData.monitorProjection.data());
|
projectBox(matrix, newBox, TRANSFORM, newBox.rot, m_RenderData.monitorProjection.data());
|
||||||
|
|
||||||
float glMatrix[9];
|
float glMatrix[9];
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include <aquamarine/buffer/Buffer.hpp>
|
#include <aquamarine/buffer/Buffer.hpp>
|
||||||
|
#include <hyprutils/math/Misc.hpp>
|
||||||
|
|
||||||
class IHLBuffer;
|
class IHLBuffer;
|
||||||
HYPRUTILS_FORWARD(Math, CRegion);
|
HYPRUTILS_FORWARD(Math, CRegion);
|
||||||
|
using namespace Hyprutils::Math;
|
||||||
|
|
||||||
enum TEXTURETYPE {
|
enum TEXTURETYPE {
|
||||||
TEXTURE_INVALID, // Invalid
|
TEXTURE_INVALID, // Invalid
|
||||||
|
@ -33,11 +35,12 @@ class CTexture {
|
||||||
void allocate();
|
void allocate();
|
||||||
void update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage);
|
void update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const CRegion& damage);
|
||||||
|
|
||||||
TEXTURETYPE m_iType = TEXTURE_RGBA;
|
TEXTURETYPE m_iType = TEXTURE_RGBA;
|
||||||
GLenum m_iTarget = GL_TEXTURE_2D;
|
GLenum m_iTarget = GL_TEXTURE_2D;
|
||||||
GLuint m_iTexID = 0;
|
GLuint m_iTexID = 0;
|
||||||
Vector2D m_vSize;
|
Vector2D m_vSize = {};
|
||||||
void* m_pEglImage = nullptr;
|
void* m_pEglImage = nullptr;
|
||||||
|
eTransform m_eTransform = HYPRUTILS_TRANSFORM_NORMAL;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size);
|
void createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size);
|
||||||
|
|
Loading…
Reference in a new issue