sabaatworld / HyperionScreenCap

Screen capture program for Hyperion ambilight. Updated to support DirectX 11, multiple displays and multiple Hyperion servers.
MIT License
118 stars 18 forks source link

Fix Error 0x8007000E Out of memory #17

Closed thymoze closed 6 years ago

thymoze commented 6 years ago

Resolve #5 by unmapping the previously mapped _stagingTexture after use in ToRGBArray().

sabaatworld commented 6 years ago

Thanks for helping out with this. Were you able to test this out?

thymoze commented 6 years ago

Yes, this fixed the issue for me. But it would of course be better if @eugeniumegherea, @Moimemeici, @flautze and @schadEigentlich could test it to confirm if it works for them, too.

Here is the .exe build with this change, should just work as a drop-in replacement, I think.

eugeniumegherea commented 6 years ago

I just tested the last build you mentioned @thymoze. It works with default settings. 0 CPU/GPU load whatsoever, that's amazing.

Moimemeici commented 6 years ago

Is good for me

sabaatworld commented 6 years ago

That you everyone for testing the build!

The only thing that I'm not sure about is if the UnmapSubresource method can throw an exception or not. There should not be any exceptions thrown from the finally block. If the method throws exceptions we can wrap it in a try-catch like line 230.

thymoze commented 6 years ago

Well it does not throw any exceptions/crash when trying to unmap a resource that wasn't mapped, I tested that. (Of course it does show the error Attempting to Unmap a resource that was not Mapped! in the DirectX Debug log, but only if you explicitly enable that by creating the device with the debug flag _device = new SharpDX.Direct3D11.Device(_adapter, DeviceCreationFlags.Debug); so I think this is fine)

Not sure about any other cases that would need to be checked..

sabaatworld commented 6 years ago

Thanks again for helping me out with this!

flautze commented 6 years ago

@sabaatworld @thymoze works like a charm. Thanks !