Provide scale offset to WindowVertex calculation
ClosedPublic

Authored by davidedmundson on Nov 25 2016, 10:25 AM.

Details

Summary

WindowVertex contains the x position and also the relative texture x position

Our textures are scaled bigger than kwin's resolution, so this makes sure we set the right
texture position.

Otherwise our final array ends up using 0 to 0.5 of the texture, not 0 to 1.

Test Plan

Opened some 2x windows, on a 1x output.
It looked how it should do, instead of it being double the size and cropped

Tested some things that use quads, like wobbly windows

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson retitled this revision from to Provide scale offset to WindowVertex calculation.
davidedmundson updated this object.
davidedmundson edited the test plan for this revision. (Show Details)
davidedmundson added a reviewer: Plasma.
Restricted Application added a project: KWin. · View Herald TranscriptNov 25 2016, 10:25 AM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
graesslin requested changes to this revision.Nov 25 2016, 2:27 PM
graesslin added a reviewer: graesslin.
graesslin added a subscriber: graesslin.

I'm extremely scared of changing the WindowQuad. This is opening pandora's box. We have potentially any effect breaking here.

What about using a textureMatrix and do the mapping in the shader?

This revision now requires changes to proceed.Nov 25 2016, 2:27 PM

What about using a textureMatrix and do the mapping in the shader?

In an earlier version I did have

Scene::renderWindow
if (node == ContentLeaf) {    setScale(topLevel->scale);  }

which I think is effectively what you're suggesting?

It does sort of work; but that just opens a different pandoras box. You now have a WindowVertex with a textureX and textureY which are just wrong.
Any effect that (implicitly) relies on them, is now broken.

In either case it's going to be a case of manually trying every effect and seeing what's broken.

What about using a textureMatrix and do the mapping in the shader?

In an earlier version I did have

Scene::renderWindow
if (node == ContentLeaf) {    setScale(topLevel->scale);  }

which I think is effectively what you're suggesting?

no, I suggest using a TextureMatrix and do the scaling through the matrix. We used to have a texture matrix by default in the shaders, but seems we don't use it any more.

We still have a texture matrix which is used: blur effect

This revision was automatically updated to reflect the committed changes.