Page MenuHome

Cleanup: Use const arguments for volume code
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Apr 7 2021, 7:47 PM.

Details

Summary

I encountered this issue when working on support for volumes in the
bounding box node. For geometry nodes there is an important distinction
between getting data "for read" and "for write", with the former
returning a const version of the data.

However, for volumes it was necessary to cast away const, since all of
the relevant functions in volume.cc didn't have const versions. This
patch adds const in these places, distinguising between "for read"
and "for write" versions of functions where necessary.

The downside is that loading and unloading in the global volume cache
needs const write-access to some member variables. I see that as an
inherent problem that comes up with caching that never has a beautiful
solution anyway.

Some of the const-ness could probably be propogated futher in EEVEE code,
but I'll leave that out, since another level of caching gets involved there.

Diff Detail

Repository
rB Blender
Branch
cleanup-volume-const (branched from master)
Build Status
Buildable 13929
Build 13929: arc lint + arc unit