Skip to content

Commit 75a5bfb

Browse files
committed
Allocation reduction.
1 parent 78e8f93 commit 75a5bfb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Nu/Nu/Render/Renderer3d.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,11 @@ type private SortableLight =
915915
SortableLightDesireFog : int
916916
mutable SortableLightDistance : single }
917917

918+
// TODO: P0: put the result in a struct with a comparison definition that doesn't allocate.
918919
static member private project light =
919920
let directionalWeight = match light.SortableLightType with 2 -> -1 | _ -> 0
920921
let desiredShadowsWeight = -light.SortableLightDesireShadows
921-
(directionalWeight, light.SortableLightDistance, desiredShadowsWeight)
922+
(directionalWeight :> IComparable, light.SortableLightDistance :> IComparable, desiredShadowsWeight :> IComparable) // OPTIMIZATION: boxing here to avoid it downstream.
922923

923924
/// Sort shadowing point lights.
924925
/// TODO: see if we can get rid of allocation here.

0 commit comments

Comments
 (0)