Skip to content
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

Surfaceview ANativeWindow not valid #14250

Open
vautieri opened this issue May 6, 2021 · 2 comments
Open

Surfaceview ANativeWindow not valid #14250

vautieri opened this issue May 6, 2021 · 2 comments
Labels
p/Android s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects

Comments

@vautieri
Copy link

vautieri commented May 6, 2021

On android sdk V28, 4.x xamarin.

We need to get to the native window. Thus, in our SurfaceView, we have the holder call back into
public void SurfaceCreated(ISurfaceHolder holder).

In this SurfaceCreated callback:
aNativeWindow = NativeMethods.ANativeWindow_fromSurface(JNIEnv.Handle, holder.Surface.Handle)

If you have Use Fast Deployment (debug mode only) in visual studios enabled, this below works just fine.

            int h = NativeMethods.ANativeWindow_getHeight(aNativeWindow);
            int w = NativeMethods.ANativeWindow_getWidth(aNativeWindow);

and
ANativeWindow_setBuffersGeometry( native_window, 0, 0, format ); does not crash the app

However, if you have Use Fast Deployment (debug mode only) in visual studios disabled (or making a release build),

            int h = NativeMethods.ANativeWindow_getHeight(aNativeWindow);
            int w = NativeMethods.ANativeWindow_getWidth(aNativeWindow);

returns crazy values, and you cannot create an opengl surface
and
ANativeWindow_setBuffersGeometry( native_window, 0, 0, format ); DOES crash the app

I've spend days trying to narrow down a work around. We want to create the opengl context in our c++ sdk as we don't want to use the GLSurfaceView. NOTE that we validated aNativeWindow is wonky in the c# side.. so one cannot blame going into c++.

I don't see any errors indicating anything is wrong....as is simply acts like Xamarin didn;t really setup and android window yet, and we are getting a bad ANativeWindow

@vautieri vautieri added s/unverified New report that has yet to be verified t/bug 🐛 labels May 6, 2021
@jsuarezruiz jsuarezruiz added this to New in Triage via automation May 7, 2021
@jsuarezruiz
Copy link
Contributor

@Redth Could we transfer this issue to https://github.com/xamarin/xamarin-android?

@jsuarezruiz jsuarezruiz moved this from New to Needs Info in Triage May 7, 2021
@jsuarezruiz jsuarezruiz added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label May 7, 2021
@vautieri
Copy link
Author

I am kinda wondering if it has something to do with something not being binary compatible with their interface? Not sure what fast deployment might do/other shared lib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/Android s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
Needs Info
Development

No branches or pull requests

2 participants