Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend: gl: do not leak back and default mask textures #1009

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

absolutelynothelix
Copy link
Collaborator

@absolutelynothelix absolutelynothelix commented Jan 24, 2023

remove an unused function and fix two issues reported by leaktrace:

$ apitrace leaks picom.trace
33: error: texture 1 was not destroyed until 7003
40: error: texture 2 was not destroyed until 7003
$ apitrace dump --calls=20-49 picom.trace
// process.name = "/home/helix/Work/picom/build/src/picom"
20 glGenQueries(n = 2, ids = {1, 2})
21 glDisable(cap = GL_DEPTH_TEST)
22 glDepthMask(flag = GL_FALSE)
23 glEnable(cap = GL_BLEND)
24 glBlendFunc(sfactor = GL_ONE, dfactor = GL_ONE_MINUS_SRC_ALPHA)
25 glDisable(cap = GL_STENCIL_TEST)
26 glStencilMask(mask = 1)
27 glStencilFunc(func = GL_EQUAL, ref = 1, mask = 1)
28 glGetIntegerv(pname = GL_MAX_VIEWPORT_DIMS, params = {32768, 32768})
29 glViewport(x = 0, y = 0, width = 32768, height = 32768)
30 glClearColor(red = 0, green = 0, blue = 0, alpha = 1)
31 glClear(mask = GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
32 glGenFramebuffers(n = 1, framebuffers = &1)
33 glGenTextures(n = 1, textures = &1)
34 glBindTexture(target = GL_TEXTURE_2D, texture = 1)
35 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_LINEAR)
36 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_LINEAR)
37 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_CLAMP_TO_EDGE)
38 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_CLAMP_TO_EDGE)
39 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
40 glGenTextures(n = 1, textures = &2)
41 glBindTexture(target = GL_TEXTURE_2D, texture = 2)
42 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param = GL_NEAREST)
43 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param = GL_NEAREST)
44 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_S, param = GL_REPEAT)
45 glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_WRAP_T, param = GL_REPEAT)
46 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
47 glBindTexture(target = GL_TEXTURE_2D, texture = 2)
48 glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_RED, width = 1, height = 1, border = 0, format = GL_RED, type = GL_UNSIGNED_BYTE, pixels = blob(1))
49 glBindTexture(target = GL_TEXTURE_2D, texture = 0)

@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Merging #1009 (8245de2) into next (5b6f6ec) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #1009      +/-   ##
==========================================
+ Coverage   37.58%   37.59%   +0.01%     
==========================================
  Files          49       49              
  Lines       11155    11157       +2     
==========================================
+ Hits         4193     4195       +2     
  Misses       6962     6962              
Impacted Files Coverage Δ
src/backend/gl/gl_common.h 30.23% <ø> (ø)
src/backend/gl/gl_common.c 25.40% <100.00%> (+0.18%) ⬆️

@absolutelynothelix
Copy link
Collaborator Author

absolutelynothelix commented Jan 24, 2023

it wasn't used and it's hard to call it a shortcut
they're generated during backend initialization and now deleted during
deinitialization
@absolutelynothelix absolutelynothelix changed the title backend: gl: fix leak in gl_deinit backend: gl: do not leak back and default mask textures Jun 12, 2023
@yshui yshui merged commit 6b80280 into yshui:next Jun 13, 2023
6 checks passed
@absolutelynothelix absolutelynothelix deleted the fix-gl-deinit-leak branch June 13, 2023 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants