02:58uis: For some reason glInvalidateFramebuffer(color)+glClear(depth) is slower than glClear(color+depth)
03:00uis: Maybe I did something very wrong, but here are sources: https://gitlab.com/xonotic/darkplaces/-/commit/c1d95aa27dabb8a5fa7a57983f0eeecc56e02cb8#e1eb9608c0ead6ba5d5f6d520b521266dcf29171_2104_2107
03:01uis: RK3328
03:02uis: Mali-400
03:03uis: Mesa, lima. Will post versions later if will not forget.
06:02anarsoul|2: uis: clear is essentially free on lima
06:10anarsoul|2: uis: glInvalidateFramebuffer() won't speed up clear
06:11anarsoul|2: it is useful if you don't need depth/stencil or color buffer *after* draw
06:11anarsoul|2: on lima if you invalidate depth/stencil buffer after draw it will speed up things since it won't need to write depth/stencil buffer into memory
06:11anarsoul|2: but back to your code
06:14anarsoul|2: Mali4x0 is a tiler, so when you draw, it has to load old contents from memory into tile buffer, do the drawing, then write it back to memory
06:14anarsoul|2: when you do glClear() you can skip loading old contents from memory into tile buffer
06:15anarsoul|2: so rule of thumb: always do glClear() at the start of the frame on tilers :)
06:15anarsoul|2: glInvalidateFramebuffer() can't replace glClear()
06:22anarsoul|2: I guess we can skip reloading in invalidate as well if job is empty
06:22anarsoul|2: but it won't be faster than clear
11:32uis: So it generally should be used before swapbuffers on stencil/depth? Thanks.
15:17enunes: uis: maybe you already saw this but ARM had a related post about it: https://community.arm.com/arm-community-blogs/b/graphics-gaming-and-vr-blog/posts/mali-performance-2-how-to-correctly-handle-framebuffers
15:17enunes: you want to clear the beginning of a frame and invalidate the buffers you won't need to reuse, by the end of the frame after drawing everything
16:06uis: Thanks. How to tell OGL that I don't care about initial content of colorbuffer?
16:21enunes: uis: glClear will take care of that and skip any reload of previous contents, as long as it is the first thing you do in the frame before drawing anything
16:22uis: So invalidate after clear? Just on mesa intel invalidation instead of clearing gives ~10 fps.
16:31enunes: no; clear first, draw everything, invalidate what you don't need (depth/stencil most likely), then swap/switch framebuffer/flush
19:00uis: Thanks. I mean color buffer invalidation without clearing gives more performance on desktop.
19:40enunes: I think invalidation before end of frame is basically a no-op since the buffer will be marked valid again once you draw something, and by not clearing at the start of the frame it means a buffer might need to be reloaded which should actually negatively affect performance