Skip to content

Commit

Permalink
ResourceManagement: turned exn into warning temporarily to track down…
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldsteinlechner committed Dec 21, 2020
1 parent 888bd9b commit fb873f7
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/Aardvark.Base.Rendering/ResourceManagement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -211,23 +211,25 @@ type Resource<'h, 'v when 'v : unmanaged>(kind : ResourceKind) =

member private x.PerformUpdate(token : AdaptiveToken, t : RenderToken) =
if refCount <= 0 then
failwithf "[Resource] cannot update unreferenced resource"

let h = x.Create(token, t,current)
info <- x.GetInfo h
setHandle x h

match current with
| Some old when Unchecked.equals old h ->
t.InPlaceResourceUpdate(kind)

| Some old ->
current <- Some h
t.ReplacedResource(kind)

| None ->
current <- Some h
t.CreatedResource(kind)
// [hs 21.12.2020] was (and should be) exn. https://github.com/vrvis/PRo3D/issues/3
// untill no artificial repro is found, we need to go with this.
Log.warn "[Resource] cannot update unreferenced resource (refCount = %d, x.IsDisposed = %b, th = %A)" refCount x.IsDisposed th
else
let h = x.Create(token, t,current)
info <- x.GetInfo h
setHandle x h

match current with
| Some old when Unchecked.equals old h ->
t.InPlaceResourceUpdate(kind)

| Some old ->
current <- Some h
t.ReplacedResource(kind)

| None ->
current <- Some h
t.CreatedResource(kind)


member x.AddRef() =
Expand Down

0 comments on commit fb873f7

Please sign in to comment.