-
-
Notifications
You must be signed in to change notification settings - Fork 397
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
DrawElements does not work in a safe context #1350
Comments
BufferData seems to have a similar problem when trying to reserve buffer space for BufferSubData but instead it crashes with an access exception, requiring you to provide a throw away buffer that open gl would not normally require. |
By passing zero you are asking the library to pass a pointer to zero, rather than a zero pointer. We had tried to remove these overloads, but guess it’s not working. I’ll have another look at it. However, we most likely won’t be adding a safe overload for this. |
Thats very interesting, is that what that nint stuff is? Is it not possible to add a marshal for IntPtr.Zero? Thanks for checking, it certainly threw me off, and if it wasn't for someone else mentioning it, I would have been really stuck trying to figure out what wasn't drawing. |
What would be the use of an IntPtr overload when there is a void* one? |
You can use IntPtr without needing the unsafe keyword.
…On Tue, Mar 21, 2023 at 2:05 PM Beyley Thomas ***@***.***> wrote:
Thats very interesting, is that what that nint stuff is? Is it not
possible to add a marshal for IntPtr.Zero? Thanks for checking, it
certainly threw me off, and if it wasn't for someone else mentioning it, I
would have been really stuck trying to figure out what wasn't drawing.
What would be the use of an IntPtr overload when there is a void* one?
—
Reply to this email directly, view it on GitHub
<#1350 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4KCBSPJHKTEQGUEXKOAYLW5IJ3DANCNFSM6AAAAAAWB7YOLM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Why avoid unsafe? that would just bloat overload counts |
Ya, I guess I've just enjoyed OpenTK's ability to leave the Unsafe options off yet still can do all the things I need to do to render things. But if being an safe compatible API is not a goal (which does not appear to be the case), then just removing the errant behavior would be good. |
I have experimented with fixing this and unfortunately I cannot implement a fix that is acceptable to the team. Please note: even if you're not using unsafe language features, everything you do with Silk.NET (or even OpenTK or any native interop library) is inherently unsafe and avoiding those language features doesn't change that. Please use Thanks. |
Summary
Using a 0 with draw elements results in nothing drawing, no warnings, no errors. But putting an unsafe void* fixes the problem.
Steps to reproduce
Setup a VAO with EBO and ABO bound correctly
Call Draw elements with 0
Note that it doesn't work.
Call Draw Elements with unsafe null.
Note that it starts working fine.
Comments
This has been noted by multiple people in discord
If you know how to fix this issue, please submit a pull request instead!
I assume its something in the marshal process?
The text was updated successfully, but these errors were encountered: