Bouncyrock / TaleSpire-Beta-Public-Issue-Tracker

Issue tracker for the TaleSpire Beta
33 stars 17 forks source link

Out of shader state slots #403

Open cbaggers opened 4 years ago

cbaggers commented 4 years ago

Spinning out from https://github.com/Bouncyrock/TaleSpire-Beta-Public-Issue-Tracker/issues/235

Describe the bug After pasting a bunch of things I get and exception about being out of shader state ids. Following that I get a tonne of errors 'out of range error's

To Reproduce Steps to reproduce the behavior:

  1. Keep copy/pasting things until issue occurs

Log https://drive.google.com/file/d/1dZVMCTWTrdu9ps-BvRfJybiOzZKRXI4A/view?usp=sharing

Additional context

original exception

Exception: Out of state state slots :(
  at DataModel.ShaderStateManager.AquireShaderStateIds[T] (Unity.Collections.NativeArray`1[T] localShaderState, Bounce.Unmanaged.NativeSharedInt stateHead, Bounce.Unmanaged.NativeFixedStack`1+ParallelPopper[T] holes, Unity.Collections.NativeArray`1[T] destination, T stateGenerator) [0x00063] in <38906bb2e272405f887a2b7b9e4b7ce8>:0 
  at DataModel.ShaderStateManager.AquireShaderStateIds[T] (Unity.Collections.NativeArray`1[T] shaderIds, T stateGenerator) [0x0000c] in <38906bb2e272405f887a2b7b9e4b7ce8>:0 
  at Slab.PushToStaticAssetBlock (DataModel.IPresenter presenter, StaticAssetBlock block, DataModel.Copied copied, Bounce.Unmanaged.NativeIdGeneratorInt64 layoutIdGenerator) [0x00049] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at Slab.Spawn (DataModel.IPresenter presenter, DataModel.Copied copied) [0x000dc] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at BoardBuilder.Paste () [0x000b6] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at DefaultBoardTool.OnActionEvent (BoardTool+ActionEvent action) [0x00051] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at BoardToolManager.CheckAction (UnityEngine.KeyCode key, BoardTool+Action action) [0x00064] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at BoardToolManager.CheckForActions () [0x00061] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at BoardToolManager.Update () [0x00000] in <99583b6b583b44dea7978fa7bbadf94d>:0 

Example of the thousands of exceptions that follow

ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: Bad indices/count arguments (nativeBufferStartIndex:0 computeBufferStartIndex:0 count:1048663)
  at UnityEngine.ComputeBuffer.SetData[T] (Unity.Collections.NativeArray`1[T] data, System.Int32 nativeBufferStartIndex, System.Int32 computeBufferStartIndex, System.Int32 count) [0x0003f] in <40c0e6fe295245dab933f5d3ac69460a>:0 
  at DataModel.ShaderStateManager.Sync () [0x00019] in <38906bb2e272405f887a2b7b9e4b7ce8>:0 
  at StaticAssetPresenter.LateUpdate () [0x00000] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at BoardSessionManager+Active.LateUpdate () [0x00009] in <99583b6b583b44dea7978fa7bbadf94d>:0 
  at StateMBehaviour`2+BaseState[StateMKind,StateKind].AroundLateUpdate () [0x00000] in <6c3f02c038c04328864d01ad2826ad61>:0 
  at StateMBehaviour`2[StateMKind,StateKind].LateUpdate () [0x0000f] in <6c3f02c038c04328864d01ad2826ad61>:0 
cbaggers commented 4 years ago

I've mitigated the SetData issue with a clamp of the range uploaded but clearly we need a strategy for running out of ids.

I didnt expect to run out so quickly. I need to see if we are leaking anywhere

gabefoster commented 4 years ago

Hey Baggers-- just a heads up, I'm experiencing this. It happened after copy/pasting (and undo/redoing) a quite large slab from talesbazaar here.

Here's a screenshot of some console logs leading up to the error.

ExceptionOutOfShaderStateSlots

I suspect this is heavily related to the copy/pasting unexpectedly large amounts of objects bug (#301)-- that would cause I think a few dozen (at least) copies of large slabs to paste, causing large amounts of ids to be allocated. Anyway, let me know if there's anything else I can do to help.

gabefoster commented 4 years ago

Ah, and the next time I tried to ctrl-x something, I received the following error:

Board update failed: Unhandled exception. Error ID: 0ACE7A95-5760-4647-BDD9-3A002B6CC875.

After loading back in, no issues with cutting the same slab. That points to stale shaders cleared on board exit to me-- maybe something isn't getting deallocated on undo or cut?

[EDIT, after another few cut/pastes] Aaand back to being out of shader slots, to go along with a reporting error. [x2]

This has all lead me to one more theory: Maybe this has to do with ctrl-x and then right-clicking/escaping not clearing shader allocation?