Set viewport in `gl_average_texture_color()` to global `vp_width` and
`vp_height` as the projection matrix has been initialized to these dimensions
as well.
Related: a7bd48f5abe5769cfe1966b4466c7251978c95b8
- Query maximum supported dimensions of `glViewport()` when initializing
so we don't have to worry about differently sized textures when
rendering (usually the same as the maximum supported texture size, but
dependend on the driver).
- Set projection matrix in all shaders at startup to queried viewport
dimensions. Allows using screen coordinates for all vertex positions
without having to keep track of framebuffer dimensions.
- Follow recommendations and set `glViewport()` to queried maximum dimensions
for each draw call (`glDraw*()`, `glClear()`).
Related: #349
In gl_image_apply_alpha, the call to _gl_fill uses 0 as the target
framebuffer, so the alpha is not applied to the target texture.
Fix that by using the correct framebuffer.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously some fiedls of gl_texture allocated in gl_image_decouple are
not initialized.
This commit replaces cmalloc with ccalloc to make sure the allocated
gl_texture is zero initialized.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Prevent a useless error message from glGetUniformLocationChecked, as
"opacity" is not used by the dummy shader, we will fail to get its
location.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If the user is using custom shaders, picom will naturally fail to get
some uniform locations if the given uniform is not used in the shader.
So we really shouldn't report error for it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead of allocating new textures everytime gl_average_texture_color is
called, we keep two textures per gl_image and reuse those.
Doing this significantly improves CPU usage on AMDGPU driver for some
reason. But in general, less texture allocation is always better.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
leftovers:
1) config file path. Has to implement compatibility functionalities before
we can change it.
2) links in man pages. Has to migrate the repo first.
3) _COMPTON_SHADOW, it has become a defacto standard, so we have to keep
supporting it.
4) dbus names, undecided whether we should/could change it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead of rendering into the back buffer, render into a intermediate
texture.
This is a preparation for partial screen updating, which is necessary to
eliminate artifacts visible when using blur and use-damage together.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This is done by extending the blur area internally when process
blurring.
Ping: #50, cause this fixes that problem but only when using the
experiemental backends.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
To prepare for different blur methods, the blur interface of backends
has been splitted into two parts.
Now to use blur, a blur context must be created first; then, the blur
method should be called with the blur context created.
Updated the existing backends to the new interface. Also implemented
handling of the new blur options.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Also fill the center of parsed kernel with 1. This shouldn't change the
behavior of the old backends since they will modify the center of the
kernels.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>