Skip to content

support stencil buffer on GLES, and fix 64bit GL/GLES targets#71

Merged
smoogipoo merged 1 commit intoppy:masterfrom
jeske:GLES_stencil_init_bug
Mar 17, 2026
Merged

support stencil buffer on GLES, and fix 64bit GL/GLES targets#71
smoogipoo merged 1 commit intoppy:masterfrom
jeske:GLES_stencil_init_bug

Conversation

@jeske
Copy link
Copy Markdown

@jeske jeske commented Mar 14, 2026

This code

  • adds GLES stencil buffer init (curiously missing entirely), so I can get my SilkyNvg 2d vector draw Veldrid backend running on Android / GLES.
  • fixes GL/GLES device setup on 64bit, as eglGetDisplay(int) needs to be eglGetDisplay(IntPtr) - eglGetDisplay(NativeDisplayType*)

On GL2/GLES2 where packed stencil (D24UNormS8UInt) is not supported, i decided to automatically fallback (with log message) to D32FloatS8UInt, as Veldrid currently isn't setup to be able to query valid formats before opening, nor does it handle graphics device failure-retry well on EGL.

In the future i think Veldrid would fit well with more of a WebGPU style capability init, since it's trying to abstract these details... where consumers could start with a profile (Universal - incl GLES/GL2, Standard - DX11/vulkan/metal1+, Extended - raytracing, mesh shaders, etc) and ask for features and preferences with some softness as to how they are satisfiied.

- support stencil buffer on GLES
- extend the fix to GL and GLES3
- fix int that should be IntPtr in eglGetDisplay()
- support packed stencil where it is available
- Merge branch 'an_main' into GLES_stencil_init_bug
@jeske jeske force-pushed the GLES_stencil_init_bug branch from 04274d2 to b69e94d Compare March 15, 2026 05:00
jeske added a commit to jeske/SilkyNvg that referenced this pull request Mar 15, 2026
- skip compiling up to date shaders
- support GLES startup in Android Example
- both android and vulkan backends working and showing the backend in a label

requires patched ppy.Veldrid backend
  - see [Pull #71](ppy/veldrid#71)
@jeske jeske changed the title support stencil buffer on GLES support stencil buffer on GLES (and fix 64bit GL/GLES targets) Mar 15, 2026
@jeske jeske changed the title support stencil buffer on GLES (and fix 64bit GL/GLES targets) support stencil buffer on GLES, and fix 64bit GL/GLES targets Mar 15, 2026
@smoogipoo
Copy link
Copy Markdown

Are you able to retarget this PR to upstream (the veldrid/veldrid fork), and then we'll pull it into here?

@smoogipoo smoogipoo mentioned this pull request Mar 16, 2026
@jeske jeske force-pushed the GLES_stencil_init_bug branch from 9833efc to c7d7a45 Compare March 16, 2026 21:16
@jeske
Copy link
Copy Markdown
Author

jeske commented Mar 16, 2026

I realized some of my local build tweaks accidentally made it in here. I will pull them out (done)

@jeske jeske force-pushed the GLES_stencil_init_bug branch from c7d7a45 to 5e775a5 Compare March 16, 2026 22:26
@jeske
Copy link
Copy Markdown
Author

jeske commented Mar 16, 2026

Are you able to retarget this PR to upstream (the veldrid/veldrid fork), and then we'll pull it into here?

yes, i can do that in a few hours... though its pretty annoying to track veldrid/veldrid and ppy/veldrid because the symbol changes ppy/veldrid made mean my test programs need #defines to swap between tyem, and the fact that ppy/veldrid dropped a bunch of modules which i am using.

i have a symbol compatibility addition that would make it much simpler for clients to cross target, but seeing as veldrid/veldrid is dead, im considering making my own AN.veldrid branch and package that has ppy fixes and the utility packages from veldrid/veldrid that all work together, because that's what im presently using myself

@jeske jeske force-pushed the GLES_stencil_init_bug branch from 5e775a5 to b69e94d Compare March 16, 2026 22:35
@jeske
Copy link
Copy Markdown
Author

jeske commented Mar 16, 2026

Are you able to retarget this PR to upstream (the veldrid/veldrid fork), and then we'll pull it into here?

I have a question, im rebasing this on upstream, and it's a bunch of stylistic changes that would have to be refixed to get it onto ppy/veldrid and veldrid/veldrid is unmaintained, so nobody is going to merge it. (thats why I did a pull-request against ppy/veldrid)

I'm going to finish this rebase, but can you explain why you are asking for this? and where is "here" that you plan to merge it to?

@jeske
Copy link
Copy Markdown
Author

jeske commented Mar 17, 2026

rebased against upstream - veldrid#550

@smoogipoo
Copy link
Copy Markdown

Yeah this fork is quite annoying. Probably need to push any remaining unmerged changes upstream and continue on from there.

Thanks for rebasing though, have merged.

@smoogipoo smoogipoo merged commit 1dd1183 into ppy:master Mar 17, 2026
3 checks passed
@smoogipoo
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants