Page MenuHome

UI: Adaptive HDRI preview resolution
ClosedPublic

Authored by Ivan Perevala (ivpe) on Oct 29 2020, 12:15 PM.

Details

Summary

HDRI preview should have resolution dependent on dpi, viewport scale and HDRI gizmo size.


Diff Detail

Repository
rB Blender
Branch
adaptive-world-gizmo (branched from master)
Build Status
Buildable 11117
Build 11117: arc lint + arc unit

Event Timeline

Ivan Perevala (ivpe) requested review of this revision.Oct 29 2020, 12:15 PM
Ivan Perevala (ivpe) created this revision.
Ivan Perevala (ivpe) retitled this revision from UI: Adaptive HDRI gizmo resolution to UI: Adaptive HDRI preview resolution.Oct 29 2020, 12:20 PM
Ivan Perevala (ivpe) edited the summary of this revision. (Show Details)
Ivan Perevala (ivpe) edited the summary of this revision. (Show Details)
  • Tweak comment
  • Update max lan/lon _res
Clément Foucault (fclem) requested changes to this revision.Oct 30 2020, 12:59 PM

Updating a batch based on viewport state is a bad idea because the batch could be recreated every redraw for each viewport.

A better solution is to have maybe 2 level of details and switch based on the display size.

So prefer having DRW_cache_hdri_sphere_get(int lod) or something like that.

This revision now requires changes to proceed.Oct 30 2020, 12:59 PM
  • Refactor to simple level of details algorithm
source/blender/draw/intern/draw_cache.h
60–64

I'm not sure about placement

source/blender/draw/intern/draw_cache.c
567

use typed enum, not const int. This is more clearer for the user what is needed, without going over the implementation.

567

would change DRW_cache_sphere_get and use DRW_LOD_LOW for other usages.

source/blender/draw/intern/draw_cache.h
61

Would remove HDRI PREVIEW from this enum.
Would also use a typed enum so it is clear for devs where it is being used.

  • Refactor level of details enumerator
Ivan Perevala (ivpe) marked 3 inline comments as done.Nov 2 2020, 4:23 PM

Now it is typedef enum eDRWLevelOfDetails { DRW_LOD_LOW ... at top of header file with all dependencies. So now it can be easy to understand and reuse.

I'm ok with the implementation. However I would wait until D9452 lands in master (since it conflicts with this patch) and rebase this patch on top.

source/blender/draw/engines/eevee/eevee_lookdev.c
64

Don't include this if it is not used. Might have been useful for debugging but I would not include that in final code.

  • Removed unused debug code
Ivan Perevala (ivpe) marked an inline comment as done.Nov 4 2020, 6:30 PM

@Clément Foucault (fclem) for sure, I removed it. I think if someone want to test it due to review (for example, on 4K or 8K display), it was not a big deal to write the same by himself. Thank you for advice!

When using this patch a memory leak is detected

You can start blender with --debug-memory option to get this report.

Error: Not freed memory blocks: 484, total unfreed memory 33.919922 MB
GLVertBuf len: 504 0x7f90312fa0b8
acquire_data len: 124992 0x7f903130c538
GLBatch len: 168 0x7f9032d05238
GLVertBuf len: 504 0x7f90316be238
acquire_data len: 124992 0x7f903174b7f8
GLBatch len: 168 0x7f90316c0638
GLVertBuf len: 504 0x7f903217cab8
acquire_data len: 124992 0x7f902ec00ef8
GLBatch len: 168 0x7f90318cd238
GLVertBuf len: 504 0x7f903217cd38
acquire_data len: 124992 0x7f902ec21d78
GLBatch len: 168 0x7f90318cd338
GLVertBuf len: 504 0x7f903217be38
acquire_data len: 124992 0x7f902ec42878
GLBatch len: 168 0x7f90318cd438
GLVertBuf len: 504 0x7f903217d238
acquire_data len: 124992 0x7f902ec63f38
GLBatch len: 168 0x7f90318cd538
GLVertBuf len: 504 0x7f903217d4b8
acquire_data len: 124992 0x7f902ec84bb8
GLBatch len: 168 0x7f90318cd638
GLVertBuf len: 504 0x7f903217c338
acquire_data len: 124992 0x7f902eca52f8
GLBatch len: 168 0x7f90318cd738
GLVertBuf len: 504 0x7f903217d738
acquire_data len: 124992 0x7f902ecc62f8
GLBatch len: 168 0x7f90318cd838
GLVertBuf len: 504 0x7f903217d9b8
acquire_data len: 124992 0x7f902ece72b8
GLBatch len: 168 0x7f9031942038
GLVertBuf len: 504 0x7f903217dc38
acquire_data len: 124992 0x7f902ed08538
GLBatch len: 168 0x7f9031942138
GLVertBuf len: 504 0x7f903217deb8
acquire_data len: 124992 0x7f902ed29ef8
GLBatch len: 168 0x7f9031942238
GLVertBuf len: 504 0x7f903217e138
acquire_data len: 124992 0x7f902ed4a5b8
GLBatch len: 168 0x7f9031942338
GLVertBuf len: 504 0x7f903217e3b8
acquire_data len: 124992 0x7f902ed6b338
GLBatch len: 168 0x7f9031942438
GLVertBuf len: 504 0x7f903217e638
acquire_data len: 124992 0x7f902ed8c6b8
GLBatch len: 168 0x7f9031955b38
GLVertBuf len: 504 0x7f903217e8b8
acquire_data len: 124992 0x7f902edad538
GLBatch len: 168 0x7f9031955c38
GLVertBuf len: 504 0x7f903217eb38
acquire_data len: 124992 0x7f9036803af8
GLBatch len: 168 0x7f9031955d38
GLVertBuf len: 504 0x7f903217edb8
acquire_data len: 124992 0x7f90368294f8
GLBatch len: 168 0x7f9031955e38
GLVertBuf len: 504 0x7f9036824038
acquire_data len: 124992 0x7f903684ab38
GLBatch len: 168 0x7f9031961938
GLVertBuf len: 504 0x7f90368242b8
acquire_data len: 124992 0x7f902edceff8
GLBatch len: 168 0x7f9031961a38
GLVertBuf len: 504 0x7f9036824538
acquire_data len: 124992 0x7f902edef7f8
GLBatch len: 168 0x7f9031961b38
GLVertBuf len: 504 0x7f90368247b8
acquire_data len: 124992 0x7f902ee10638
GLBatch len: 168 0x7f9031961c38
GLVertBuf len: 504 0x7f9036824a38
acquire_data len: 124992 0x7f902ee31438
GLBatch len: 168 0x7f9031961d38
GLVertBuf len: 504 0x7f9036824cb8
acquire_data len: 124992 0x7f902ee52ef8
GLBatch len: 168 0x7f9031961e38
GLVertBuf len: 504 0x7f9036824f38
acquire_data len: 124992 0x7f902ee73278
GLBatch len: 168 0x7f9031961f38
GLVertBuf len: 504 0x7f90368251b8
acquire_data len: 124992 0x7f902ee94178
GLBatch len: 168 0x7f9031f44f38
GLVertBuf len: 504 0x7f9036825438
acquire_data len: 124992 0x7f902eeb5078
GLBatch len: 168 0x7f9031f4e038
GLVertBuf len: 504 0x7f90368256b8
acquire_data len: 124992 0x7f902eed65b8
GLBatch len: 168 0x7f9031f4e138
GLVertBuf len: 504 0x7f90333d1438
acquire_data len: 124992 0x7f902ae8e6b8
GLBatch len: 168 0x7f902ae2f638
GLVertBuf len: 504 0x7f90316bb2b8
acquire_data len: 124992 0x7f902af706f8
GLBatch len: 168 0x7f90322bc638
GLVertBuf len: 504 0x7f902afac9b8
acquire_data len: 124992 0x7f902f349278
GLBatch len: 168 0x7f9032df7a38
GLVertBuf len: 504 0x7f902afacc38
acquire_data len: 124992 0x7f9030240038
GLBatch len: 168 0x7f9032df7b38
GLVertBuf len: 504 0x7f903179bd38
acquire_data len: 124992 0x7f902f6b38b8
GLBatch len: 168 0x7f902f650138
GLVertBuf len: 504 0x7f903179c238
acquire_data len: 124992 0x7f902f7f31b8
GLBatch len: 168 0x7f902f650038
GLVertBuf len: 504 0x7f903179bfb8
acquire_data len: 124992 0x7f902f814e38
GLBatch len: 168 0x7f902f68ba38
GLVertBuf len: 504 0x7f902afa9038
acquire_data len: 124992 0x7f902b10a4f8
GLBatch len: 168 0x7f902f68b938
GLVertBuf len: 504 0x7f902afab338
acquire_data len: 124992 0x7f902b12b2f8
GLBatch len: 168 0x7f902f68b838
GLVertBuf len: 504 0x7f902afabfb8
acquire_data len: 124992 0x7f902b14c038
GLBatch len: 168 0x7f902f68b738
GLVertBuf len: 504 0x7f902afabab8
acquire_data len: 124992 0x7f902b16dff8
GLBatch len: 168 0x7f902f68b638
GLVertBuf len: 504 0x7f902afabd38
acquire_data len: 124992 0x7f902b18e978
GLBatch len: 168 0x7f902f68b438
GLVertBuf len: 504 0x7f902afab5b8
acquire_data len: 124992 0x7f902b1af538
GLBatch len: 168 0x7f902f68b238
GLVertBuf len: 504 0x7f902afab0b8
acquire_data len: 124992 0x7f902b1d0178
GLBatch len: 168 0x7f902f68b138
GLVertBuf len: 504 0x7f902afaabb8
acquire_data len: 124992 0x7f902b1f13f8
GLBatch len: 168 0x7f902f68b038
GLVertBuf len: 504 0x7f902afaae38
acquire_data len: 124992 0x7f902b212578
GLBatch len: 168 0x7f9032346f38
GLVertBuf len: 504 0x7f902afaa6b8
acquire_data len: 124992 0x7f902b2336b8
GLBatch len: 168 0x7f9032346c38
GLVertBuf len: 504 0x7f902afaa938
acquire_data len: 124992 0x7f902b2548f8
GLBatch len: 168 0x7f9032346b38
GLVertBuf len: 504 0x7f902afaa438
acquire_data len: 124992 0x7f902b275a38
GLBatch len: 168 0x7f9032346a38
GLVertBuf len: 504 0x7f902afaa1b8
acquire_data len: 124992 0x7f902b296578
GLBatch len: 168 0x7f902f650438
GLVertBuf len: 504 0x7f902afa9f38
acquire_data len: 124992 0x7f902b2b7578
GLBatch len: 168 0x7f902f68bf38
GLVertBuf len: 504 0x7f902afa9a38
acquire_data len: 124992 0x7f902b2d8bf8
GLBatch len: 168 0x7f902f68be38
GLVertBuf len: 504 0x7f902afa9cb8
acquire_data len: 124992 0x7f902b2f9678
GLBatch len: 168 0x7f902f68bc38
GLVertBuf len: 504 0x7f902afa97b8
acquire_data len: 124992 0x7f902b31a6f8
GLBatch len: 168 0x7f902f68b538
GLVertBuf len: 504 0x7f902afa9538
acquire_data len: 124992 0x7f902b33bf78
GLBatch len: 168 0x7f902f68b338
GLVertBuf len: 504 0x7f902afa92b8
acquire_data len: 124992 0x7f902b35ce78
GLBatch len: 168 0x7f9032346e38
GLVertBuf len: 504 0x7f9031799cb8
acquire_data len: 124992 0x7f902b37da78
GLBatch len: 168 0x7f9032346d38
GLVertBuf len: 504 0x7f903179b0b8
acquire_data len: 124992 0x7f902b39eeb8
GLBatch len: 168 0x7f902f650738
GLVertBuf len: 504 0x7f903179b338
acquire_data len: 124992 0x7f902b3bf2f8
GLBatch len: 168 0x7f902f650638
GLVertBuf len: 504 0x7f903179b5b8
acquire_data len: 124992 0x7f902b3e04b8
GLBatch len: 168 0x7f9032304e38
GLVertBuf len: 504 0x7f903179b838
acquire_data len: 124992 0x7f902b401178
GLBatch len: 168 0x7f9032304d38
GLVertBuf len: 504 0x7f903179bab8
acquire_data len: 124992 0x7f902b4229f8
GLBatch len: 168 0x7f902f650938
GLVertBuf len: 504 0x7f902afab838
acquire_data len: 124992 0x7f902b443d78
GLBatch len: 168 0x7f9032de3538
GLVertBuf len: 504 0x7f902afaceb8
acquire_data len: 124992 0x7f902b464678
GLBatch len: 168 0x7f9032de3638
GLVertBuf len: 504 0x7f902afad138
acquire_data len: 124992 0x7f9030272ab8
GLBatch len: 168 0x7f9032df7c38
GLVertBuf len: 504 0x7f902afad3b8
acquire_data len: 124992 0x7f9030293538
GLBatch len: 168 0x7f9031301e38
GLVertBuf len: 504 0x7f902afad638
acquire_data len: 124992 0x7f90302b4238
GLBatch len: 168 0x7f9031301f38
GLVertBuf len: 504 0x7f902afad8b8
acquire_data len: 124992 0x7f90302d5878
GLBatch len: 168 0x7f9031306038
GLVertBuf len: 504 0x7f902f31b538
acquire_data len: 796320 0x7f902fccc0b8
GLBatch len: 168 0x7f903132ee38
GLVertBuf len: 504 0x7f902fdc5438
GLBatch len: 168 0x7f902be3e138
GLVertBuf len: 504 0x7f902fdc5938
acquire_data len: 124992 0x7f90302fb138
GLBatch len: 168 0x7f902be3e238
GLVertBuf len: 504 0x7f902fdc56b8
acquire_data len: 124992 0x7f903031caf8
GLBatch len: 168 0x7f902be3e338
GLVertBuf len: 504 0x7f902fdc5bb8
acquire_data len: 796320 0x7f902bea72f8
GLBatch len: 168 0x7f902be3e438
GLVertBuf len: 504 0x7f902fdc5e38
GLBatch len: 168 0x7f902be3e538
GLVertBuf len: 504 0x7f902fdc60b8
acquire_data len: 124992 0x7f902bf88e78
GLBatch len: 168 0x7f9033160138
GLVertBuf len: 504 0x7f902fdc6338
acquire_data len: 124992 0x7f902bfa9d78
GLBatch len: 168 0x7f9033160238
GLVertBuf len: 504 0x7f902fdc65b8
acquire_data len: 796320 0x7f902bfca1f8
GLBatch len: 168 0x7f9033160338
GLVertBuf len: 504 0x7f902fdc6838
GLBatch len: 168 0x7f9033160438
GLVertBuf len: 504 0x7f902fdc6ab8
acquire_data len: 124992 0x7f902c1a0b78
GLBatch len: 168 0x7f9033160538
GLVertBuf len: 504 0x7f902fdc6d38
acquire_data len: 124992 0x7f902c1c1db8
GLBatch len: 168 0x7f9033160638
GLVertBuf len: 504 0x7f902fdc7238
acquire_data len: 796320 0x7f902c0abbf8
GLBatch len: 168 0x7f9033160738
GLVertBuf len: 504 0x7f902fdc74b8
GLBatch len: 168 0x7f9033160838
GLVertBuf len: 504 0x7f902fdc7738
acquire_data len: 124992 0x7f902c2c3138
GLBatch len: 168 0x7f9033160938
GLVertBuf len: 504 0x7f902fdc79b8
acquire_data len: 124992 0x7f902c2e48f8
GLBatch len: 168 0x7f9033160a38
GLVertBuf len: 504 0x7f902fdc7c38
acquire_data len: 796320 0x7f902c1e2038
GLBatch len: 168 0x7f9033160b38
GLVertBuf len: 504 0x7f902fdc7eb8
GLBatch len: 168 0x7f9033160c38
GLVertBuf len: 504 0x7f902fdc8138
acquire_data len: 124992 0x7f902c3e6ff8
GLBatch len: 168 0x7f9033160d38
GLVertBuf len: 504 0x7f902fdc83b8
acquire_data len: 124992 0x7f902c407238
GLBatch len: 168 0x7f9031292538
GLVertBuf len: 504 0x7f902fdc6fb8
acquire_data len: 796320 0x7f902c3055f8
GLBatch len: 168 0x7f9031292638
GLVertBuf len: 504 0x7f902fdc88b8
GLBatch len: 168 0x7f9031292738
GLVertBuf len: 504 0x7f902fdc8b38
acquire_data len: 124992 0x7f902c509638
GLBatch len: 168 0x7f9031790a38
GLVertBuf len: 504 0x7f902fdc8db8
acquire_data len: 124992 0x7f902c52a6f8
GLBatch len: 168 0x7f902bbcc638
GLVertBuf len: 504 0x7f902b9dc038
acquire_data len: 796320 0x7f902c428078
GLBatch len: 168 0x7f902bbcc738
GLVertBuf len: 504 0x7f902b9dc2b8
GLBatch len: 168 0x7f902bbcc838
GLVertBuf len: 504 0x7f902b9dc538
acquire_data len: 124992 0x7f902c62cf38
GLBatch len: 168 0x7f902bbcc938
GLVertBuf len: 504 0x7f902b9dc7b8
acquire_data len: 124992 0x7f902c64d678
GLBatch len: 168 0x7f902bbcca38
GLVertBuf len: 504 0x7f902fdc8638
acquire_data len: 796320 0x7f902c54b778
GLBatch len: 168 0x7f902bbccc38
GLVertBuf len: 504 0x7f902b9dccb8
GLBatch len: 168 0x7f902bbccd38
GLVertBuf len: 504 0x7f902b9dcf38
acquire_data len: 124992 0x7f902c74f0f8
GLBatch len: 168 0x7f902bbcce38
GLVertBuf len: 504 0x7f902b9dd1b8
acquire_data len: 124992 0x7f902c770a78
GLBatch len: 168 0x7f902bbccf38
GLVertBuf len: 504 0x7f902b9dd6b8
acquire_data len: 796320 0x7f902c66e338
GLBatch len: 168 0x7f902be3e038
GLVertBuf len: 504 0x7f902b9dd938
GLBatch len: 168 0x7f902be3e638
GLVertBuf len: 504 0x7f902b9ddbb8
acquire_data len: 124992 0x7f902c872ef8
GLBatch len: 168 0x7f902be3e738
GLVertBuf len: 504 0x7f902b9dde38
acquire_data len: 124992 0x7f902c893c38
GLBatch len: 168 0x7f902be3e838
GLVertBuf len: 504 0x7f902b9dca38
acquire_data len: 796320 0x7f902c791638
GLBatch len: 168 0x7f902be3e938
GLVertBuf len: 504 0x7f902b9de338
GLBatch len: 168 0x7f9031292838
GLVertBuf len: 504 0x7f902b9de5b8
acquire_data len: 124992 0x7f902c995ff8
GLBatch len: 168 0x7f9031294038
GLVertBuf len: 504 0x7f902b9de838
acquire_data len: 124992 0x7f902c9b6678
GLBatch len: 168 0x7f9031294138
GLVertBuf len: 504 0x7f902b9dd438
acquire_data len: 796320 0x7f902c8b42f8
GLBatch len: 168 0x7f9031294238
GLVertBuf len: 504 0x7f902b9deab8
GLBatch len: 168 0x7f9031294338
GLVertBuf len: 504 0x7f902b9ded38
acquire_data len: 124992 0x7f902cab8738
GLBatch len: 168 0x7f9031294438
GLVertBuf len: 504 0x7f902b9defb8
acquire_data len: 124992 0x7f902cad9978
GLBatch len: 168 0x7f9031294538
GLVertBuf len: 504 0x7f902b9de0b8
acquire_data len: 796320 0x7f902c9d7338
GLBatch len: 168 0x7f90312f2138
GLVertBuf len: 504 0x7f902b9df4b8
GLBatch len: 168 0x7f90312f2438
GLVertBuf len: 504 0x7f902b9df738
acquire_data len: 124992 0x7f902cbdb7b8
GLBatch len: 168 0x7f90319a5838
GLVertBuf len: 504 0x7f902b9df9b8
acquire_data len: 124992 0x7f902cbfcbb8
GLBatch len: 168 0x7f90319a5938
GLVertBuf len: 504 0x7f902b9df238
acquire_data len: 796320 0x7f902cafa978
GLBatch len: 168 0x7f90319a5d38
GLVertBuf len: 504 0x7f902b9dfeb8
GLBatch len: 168 0x7f90319a5e38
GLVertBuf len: 504 0x7f902b9e0138
acquire_data len: 124992 0x7f902ccfe9b8
GLBatch len: 168 0x7f90319a5f38
GLVertBuf len: 504 0x7f902b9e03b8
acquire_data len: 124992 0x7f902cd1fdb8
GLBatch len: 168 0x7f90319b0038
GLVertBuf len: 504 0x7f902f31ce38
acquire_data len: 796320 0x7f902cc1dc38
GLBatch len: 168 0x7f90319a5a38
GLVertBuf len: 504 0x7f902f31d338
GLBatch len: 168 0x7f9031961038
GLVertBuf len: 504 0x7f902f31d0b8
acquire_data len: 124992 0x7f90303572f8
GLBatch len: 168 0x7f90316c4a38
GLVertBuf len: 504 0x7f902f31d5b8
acquire_data len: 124992 0x7f9030394b78
GLBatch len: 168 0x7f90316c4938
GLVertBuf len: 504 0x7f902b9e0638
acquire_data len: 796320 0x7f902cd408f8
GLBatch len: 168 0x7f90316c4838
GLVertBuf len: 504 0x7f902fdc4538
GLBatch len: 168 0x7f90316c4738
GLVertBuf len: 504 0x7f902fdc4038
acquire_data len: 124992 0x7f902ce210b8
GLBatch len: 168 0x7f90316c4638
GLVertBuf len: 504 0x7f902fdc42b8
acquire_data len: 124992 0x7f902ce421f8
GLBatch len: 168 0x7f90316c4438
GLVertBuf len: 504 0x7f902f31f8b8
acquire_data len: 796320 0x7f9026b00bb8
GLBatch len: 168 0x7f90316c4238
GLVertBuf len: 504 0x7f902f31f638
GLBatch len: 168 0x7f90316c4138
GLVertBuf len: 504 0x7f902f31f138
acquire_data len: 124992 0x7f902ce63238
GLBatch len: 168 0x7f90316c4038
GLVertBuf len: 504 0x7f902f31f3b8
acquire_data len: 124992 0x7f902ce84cb8
GLBatch len: 168 0x7f90316c0f38
GLVertBuf len: 504 0x7f902f31fb38
acquire_data len: 796320 0x7f9026be14f8
GLBatch len: 168 0x7f90316c0c38
GLVertBuf len: 504 0x7f902f31eeb8
GLBatch len: 168 0x7f90316c0b38
GLVertBuf len: 504 0x7f902f31e9b8
acquire_data len: 124992 0x7f902cea5ff8
GLBatch len: 168 0x7f90316c0a38
GLVertBuf len: 504 0x7f902f31e738
acquire_data len: 124992 0x7f902cec6e38
GLBatch len: 168 0x7f9031f4e238
GLVertBuf len: 504 0x7f902f31e4b8
acquire_data len: 796320 0x7f9026cc29b8
GLBatch len: 168 0x7f9031942b38
GLVertBuf len: 504 0x7f902f31dfb8
GLBatch len: 168 0x7f90316c4e38
GLVertBuf len: 504 0x7f902f31e238
acquire_data len: 124992 0x7f9026e84038
GLBatch len: 168 0x7f90316c4c38
GLVertBuf len: 504 0x7f902f31dd38
acquire_data len: 124992 0x7f9026ea5d38
GLBatch len: 168 0x7f90316c4538
GLVertBuf len: 504 0x7f902f31dab8
acquire_data len: 796320 0x7f9026da3238
GLBatch len: 168 0x7f90316c4338
GLVertBuf len: 504 0x7f902f31d838
GLBatch len: 168 0x7f90316c0e38
GLVertBuf len: 504 0x7f902f31bf38
acquire_data len: 124992 0x7f9026fa7778
GLBatch len: 168 0x7f90316c0d38
GLVertBuf len: 504 0x7f902f31c438
acquire_data len: 124992 0x7f9026fc88f8
GLBatch len: 168 0x7f9031f4ec38
GLVertBuf len: 504 0x7f902f31c1b8
acquire_data len: 796320 0x7f9026ec6db8
GLBatch len: 168 0x7f9031f4eb38
GLVertBuf len: 504 0x7f902f31ec38
GLBatch len: 168 0x7f903133c038
GLVertBuf len: 504 0x7f902f31c938
acquire_data len: 124992 0x7f90270caa78
GLBatch len: 168 0x7f903132ef38
GLVertBuf len: 504 0x7f902f31c6b8
acquire_data len: 124992 0x7f90270eb278
GLBatch len: 168 0x7f9031fe6438
GLVertBuf len: 504 0x7f902f31cbb8
acquire_data len: 796320 0x7f9026fe9e78
GLBatch len: 168 0x7f9031fe6338
GLVertBuf len: 504 0x7f902f31fdb8
GLBatch len: 168 0x7f903133c138
GLVertBuf len: 504 0x7f902b9dfc38
acquire_data len: 124992 0x7f90271ed1f8
GLBatch len: 168 0x7f903169df38
GLVertBuf len: 504 0x7f902b9e08b8
acquire_data len: 124992 0x7f902720ea78
GLBatch len: 168 0x7f90316c0038
GLVertBuf len: 504 0x7f902b9e0b38
acquire_data len: 796320 0x7f902710c778
GLBatch len: 168 0x7f90316c0138
GLVertBuf len: 504 0x7f902b9e0db8
GLBatch len: 168 0x7f90316c0238
GLVertBuf len: 504 0x7f902fddb038
acquire_data len: 124992 0x7f90273101b8
GLBatch len: 168 0x7f90316c0338
GLVertBuf len: 504 0x7f902fddb2b8
acquire_data len: 124992 0x7f9027331478
GLBatch len: 168 0x7f90316c0438
GLVertBuf len: 504 0x7f902fddb538
acquire_data len: 796320 0x7f902722f6b8
GLBatch len: 168 0x7f90316c0538
GLVertBuf len: 504 0x7f902fddb7b8
GLBatch len: 168 0x7f90316c0738
GLVertBuf len: 504 0x7f902fddba38
acquire_data len: 124992 0x7f9027433738
GLBatch len: 168 0x7f90316c0838
GLVertBuf len: 504 0x7f902fddbcb8
acquire_data len: 124992 0x7f9027454c38
GLBatch len: 168 0x7f90316c0938
GLVertBuf len: 504 0x7f902fddbf38
acquire_data len: 796320 0x7f9027352db8
GLBatch len: 168 0x7f90316c4b38
GLVertBuf len: 504 0x7f902fddc1b8
GLBatch len: 168 0x7f90316c4d38
GLVertBuf len: 504 0x7f902fddc438
acquire_data len: 124992 0x7f9027556b38
GLBatch len: 168 0x7f90319a5b38
GLVertBuf len: 504 0x7f902fddc6b8
acquire_data len: 124992 0x7f9027577478
GLBatch len: 168 0x7f90319b0138
GLVertBuf len: 504 0x7f902fddc938
acquire_data len: 796320 0x7f9027475538
GLBatch len: 168 0x7f90319b0238
GLVertBuf len: 504 0x7f902fddcbb8
GLBatch len: 168 0x7f90319b0338
GLVertBuf len: 504 0x7f902fddce38
acquire_data len: 124992 0x7f90276790f8
GLBatch len: 168 0x7f90319b0438
GLVertBuf len: 504 0x7f902fddd0b8
acquire_data len: 124992 0x7f902769ae78
GLBatch len: 168 0x7f90319b0538
GLVertBuf len: 504 0x7f902fddd338
acquire_data len: 796320 0x7f90275988f8
GLBatch len: 168 0x7f90319b0638
GLVertBuf len: 504 0x7f902fddd5b8
GLBatch len: 168 0x7f9031ae2238
GLVertBuf len: 504 0x7f902fddd838
acquire_data len: 124992 0x7f902779c6f8
GLBatch len: 168 0x7f903203d338
GLVertBuf len: 504 0x7f902fdddab8
acquire_data len: 124992 0x7f90277bda38
GLBatch len: 168 0x7f903203d438
source/blender/draw/intern/draw_cache.c
526

Nitpick. Enumeration type names + parameter names should be in singular form as they represent a single item in the enumeration. When using bit flags it is good to use plural names.

I like the visual of the new spheres! it makes the feature more polished. thanks for the patch. The memory leak is the only thing that is holding it back from my side.

source/blender/draw/intern/draw_cache.c
562

batch_sphere needs to be assigned to the SHC.drw_sphere_lod* to fix the memory leak. Now the batch is created but never freed.
Best way how to do this is to change the drw_sphere_lod* into an array drw_sphere_lod[DRW_LOD_MAX], cast the level_of_detail parameter to an index and use this to retrieve the cached instance (in stead of the first switch statement) and at the end to store the created batch in the SHC.

Jeroen Bakker (jbakker) requested changes to this revision.Nov 9 2020, 11:32 AM
This revision now requires changes to proceed.Nov 9 2020, 11:32 AM
  • Updated due to D9452 changes
  • Enumerator name is in unary form for now
  • Fixed memory leak in DRW_cache_sphere_get
Ivan Perevala (ivpe) marked 2 inline comments as done.EditedNov 9 2020, 6:01 PM

@Jeroen Bakker (jbakker) You are a great teacher for me!)

I make it more integrated to existing code to simplify possible dependency search.
About memory leakage for now I got the same as on master branch:
("Debug" CMake predefined target):

Error: Not freed memory blocks: 8, total unfreed memory 0.004242 MB
rna_global_pool len: 64 000001228DFB7628
memory pool len: 48 000001228DD8DAD8
BLI_Mempool Chunk len: 2024 000001228C6D6318
rna_id len: 64 000001228DFA77E8
ghash_buckets_resize len: 40 000001228DD67228
memory pool len: 48 000001228DD66B48
BLI_Mempool Chunk len: 2024 000001228C55DF48
ghash_buckets_resize len: 136 0000012287519028

("Release" CMake predefined target):

Error: Not freed memory blocks: 28, total unfreed memory 0.008423 MB
rna_global_pool len: 64 000002D4FF580F38
memory pool len: 48 000002D4FF85AA58
BLI_Mempool Chunk len: 2024 000002D4FF795638
GLShader len: 104 000002D489393378
GLShaderInterface len: 208 000002D489372878
GLShaderInterface len: 80 000002D4893E9518
name_buffer len: 68 000002D4893E93D8
GLShader len: 104 000002D4893932B8
GLShaderInterface len: 208 000002D489372238
GLShaderInterface len: 128 000002D4893931F8
name_buffer len: 104 000002D489393138
GLShader len: 104 000002D489393078
GLShaderInterface len: 208 000002D4893720F8
GLShaderInterface len: 416 000002D489477838
name_buffer len: 332 000002D4894710F8
GLShader len: 104 000002D489392FB8
GLShaderInterface len: 208 000002D489371FB8
GLShaderInterface len: 352 000002D489470F38
name_buffer len: 264 000002D4893672B8
GLShader len: 104 000002D489392EF8
GLShaderInterface len: 208 000002D489371E78
GLShaderInterface len: 592 000002D489F33438
name_buffer len: 488 000002D48935FB38
ghash_buckets_resize len: 136 000002D489EE6438
rna_id len: 64 000002D489AB0E38
ghash_buckets_resize len: 40 000002D4FD2BFB68
memory pool len: 48 000002D4FD2BFBD8
BLI_Mempool Chunk len: 2024 000002D489A920B8

If you need any help committing please poke me!

This revision was not accepted when it landed; it landed in state Needs Review.Nov 13 2020, 8:27 AM
This revision was automatically updated to reflect the committed changes.