Page MenuHome

Cleanup: Array types, const, math API in workbench code
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Mon, Jan 23, 8:53 PM.

Details

Summary

Some miscellaneous cleanups left over from a fix/cleanup combo:

  • Use const variables
  • Use the C++ math namespace functions
  • Use std::array for arrays with size known at compile time
  • Use MutableSpan instead of reference to array

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Mon, Jan 23, 8:53 PM
Hans Goudey (HooglyBoogly) created this revision.

Use std::array, which is better than Array in this case because the size is known at compile time.

Since this patch is not trivially correct, I'll commit a simplified fix for now. The cleanup can be done separately. I can't start a debug build with --debug currently.

source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc
47–48

This looks wrong.

@Jacques Lucke (JacquesLucke) Sorry for the trouble!
I'll make sure to check the --debug mode often.

About the cleanup itself, I'm ok with it.

source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc
47–48

Yes, this should be drop_front(i + 1).

Personally, I find this option less readable. If anything I would change it for:
for (const int j : IndexRange(i + 1, samples.size())

The same for the outer loop.

Hans Goudey (HooglyBoogly) planned changes to this revision.Tue, Jan 24, 11:00 PM

Thanks for the feedback.

Hans Goudey (HooglyBoogly) retitled this revision from Fix: Memory leak from non-trivial C++ global variable to Cleanup: Array types, const, math API in workbench code.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Fri, Jan 27, 12:09 AM