dotnet / Silk.NET

The high-speed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.
https://dotnet.github.io/Silk.NET
MIT License
3.89k stars 378 forks source link

Error when trying to use TextureStorage3D on Android #2163

Closed davidtme closed 2 months ago

davidtme commented 2 months ago

Summary

when trying to call TextureStorage3D on Android I get the following exception:

Silk.NET.SDL.SdlException: 'Failed loading _glTextureStorage3D: undefined symbol: __glTextureStorage3D'

image

Steps to reproduce

Minimal code example

using System.Diagnostics;
using Android.App;
using Silk.NET.OpenGL;
using Silk.NET.Windowing;
using Silk.NET.Windowing.Sdl.Android;

namespace AndroidDemo
{
    [Activity(Label = "@string/app_name", MainLauncher = true)]
    public class MainActivity : SilkActivity
    {
        protected override void OnRun()
        {
            var options = ViewOptions.Default;
            options.API = new GraphicsAPI(ContextAPI.OpenGLES, ContextProfile.Compatability, ContextFlags.Default, new APIVersion(3, 2));

            var view = Silk.NET.Windowing.Window.GetView(options);

            view.Load += () => { 
                var gl = GL.GetApi(view);
                var texture = gl.GenTexture();
                gl.ActiveTexture(TextureUnit.Texture0);
                gl.BindTexture(TextureTarget.Texture2DArray, texture);
                gl.TextureStorage3D(texture, 1u, SizedInternalFormat.Rgba8, 1024, 1024, 1);
            };

            view.Run();
            view.Dispose();
        }
    }
}
Perksey commented 2 months ago

Yes, direct state access functions such as this one is only available in OpenGL 4.5+ and is not present in any OpenGLES version. Not a bug, user error.

davidtme commented 2 months ago

@Perksey I'm a bit confused, on https://registry.khronos.org/OpenGL-Refpages/es3/html/glTexStorage3D.xhtml it is OpenGL ES 3+ has glTexStorage3D

image

Microsoft also seems to think it should be in es3

https://learn.microsoft.com/en-us/dotnet/api/android.opengl.gles30.gltexstorage3d?view=net-android-34.0#android-opengl-gles30-gltexstorage3d(system-int32-system-int32-system-int32-system-int32-system-int32-system-int32)

(sorry if I've misunderstood what you mean by direct state access function).

Perksey commented 2 months ago

glTexStorage3D is different to glTextureStorage3D

davidtme commented 2 months ago

@Perksey sorry for wasting your time 🤦🏻‍♂️

Perksey commented 2 months ago

No worries! Easy mistake to make :)