-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Support base index for draw instancing in OpenGL #7016
Conversation
@nkast Modified to retain original APIs and added overloaded versions. |
We're getting there @YTN0! Great work so far! 2 more things
|
…hen base index instancing is used but < OpenGL 4.2
@Jjagg Made the changes you suggested. Removed the obsolete override, and also changed the code to throw a PlatformNotSupportedException if trying to use base index instancing when < OpenGL 4.2 / the API is not supported. |
Awesome, thanks @YTN0! Gonna merge this one :) I'm thinking it would be good if we had a single page in the docs that listed all graphics capabilities and what platform native caps they match with for the DX and GL backend. And we should also add the graphics capabilities requirements to the xml docs for the specific methods IMO. But for now this is great! |
The pattern we use throughout the API is that |
* Fix for 6732 * Making baseInstance optional in one of the modified methods * Updating default parameter * Updating GraphicsDevice.Web with default parameter for base index instancing * Maintained original APIs and added overloaded versions * Removing obsolete instancing method override and throwing exception when base index instancing is used but < OpenGL 4.2 * Changing exception verbiage slightly to match API and parameter name
Per #6732 ... This change exposes the option to set the instance base index for instancing. This works perfectly on DirectX, and somewhat works on OpenGL. On OpenGL, this is still impacted by the instancing bug #6293.
Note: For OpenGL, if not setting the base instance index (which is the default behavior), it will continue using the original OpenGL API. If setting the base, this will use the OpenGL API glDrawElementsInstancedBaseInstance which is only available in OpenGL 4.2 and higher.
Also added a capabilities check to GraphicsCapabilities.cs. If the glDrawElementsInstancedBaseInstance is not available (i.e. < OpenGL 4.2), this defaults to the default behavior and calls the original method without attempting to set the base index.
FYI @Jjagg Let me know if this looks good.