-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphicsDevice.RenderTargetCount should be implemented on WebGL projects #2197
Comments
I realize that the problem is actually that XNA did not include a RenderTargetCount, but MonoGame has one. I understand now why it may not exist, but...what kind of performance implications does |
RenderTargetCount and GetRenderTargets(RenderTargetBinding[]) were added in MG as a zero-alloc alternative to GetRenderTargets(). In any real scenario you would need to keep a copy of the bindings. The first change was to combine the two methods by returning the number of bindings from GetRenderTargets(RenderTargetBinding[]). The second change was to return a preallocated zero-length array from GetRenderTargets() , making zero-allocs when there are no bound rendertargets. I propose two paths, b) use GetRenderTargets(RenderTargetBinding[]) . That is the only way to have zero-alloc in all cases. If you want something that would work with the current version, and doesn't need renderTargetCount, you could clear the array with Array.Clear(_previousRenderTargetBindings) before calling GetRenderTargets(RenderTargetBinding[]), then check (_previousRenderTargetBindings[0].RenderTarget == null) |
Kni web is missing GraphicsDevice.RenderTargetCount. This is important for FlatRedBall to detect if there is a current render target so that it can create an internal stack when drawing post processing.
As a workaround I can do:
Unfortunately this seems to allocate internally, so it's slightly more expensive than a potential Count property.
I am doing a workaround for now, but it would be nice to have something a little more efficient.
This is on WebGL, I haven't tested the other Kni platforms.
The text was updated successfully, but these errors were encountered: