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

Android, does CreateAndroidSurface work? #55

Open
BradChase2011 opened this issue Aug 27, 2019 · 7 comments
Open

Android, does CreateAndroidSurface work? #55

BradChase2011 opened this issue Aug 27, 2019 · 7 comments

Comments

@BradChase2011
Copy link

BradChase2011 commented Aug 27, 2019

I am trying to create an android example app but I keep failing when trying to call CreateAndroidSurface from the Instance:

at <0xffffffff>
at System.Object:wrapper_native_0x7820814f5c <0x00007>
at :invoke_Result_Instance_AndroidSurfaceCreateInfo*_AllocationCallbacks*_Surface* <0x0018b>
at SharpVk.Khronos.InstanceExtensions:CreateAndroidSurface <0x003eb>

I cant seem to find any SharpVk examples that have a Droid target so I was hoping either, this was a known problem, there are some running examples somewhere I can parse through to find some differences, or maybe I missed a flag somewhere. These are the three extensions I have named:

_Instance = Instance.Create(enabledLayers.ToArray(), new string[] { "VK_KHR_surface", "VK_KHR_android_surface", "VK_EXT_debug_report" }, applicationInfo: applicationInfo);

Thanks much!
Brad

EDIT: To add, all the VulkanSharp and VulkanCore samples run...

@FacticiusVir
Copy link
Owner

I've not directly tested the Android extension methods, so it's likely a bug in the bindings; if you have an example app I can test against I'll get it fixed.

@BradChase2011
Copy link
Author

I can build a test app tonight for ya. In the meantime I also want to check if I switch out all our code for another Vulkan wrapper and see if that works. If so then maybe it'll help narrow it down.

@BradChase2011
Copy link
Author

A little update, I am close to having everything moved over to another wrapper. The big thing though is, the surface creation does work. So I want to spend a little time next week finishing that up but I will put some time into taking their (Xamarin's) sample over to SharpVk so there is atleast a way to use SharpVk on Droid so we can look at it.

@BradChase2011
Copy link
Author

To update on this, Windows works but Droid is still broken.

Switching all the code over to VulkanSharp works on all devices. The code crashes here:

Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);

under InstanceExtensions.gen.cs.

@BradChase2011
Copy link
Author

BradChase2011 commented Mar 17, 2020

in the meantime so I can test things out (which works as a temporary solution for droid right now is to change the AndroidSurfaceCreateInfo.gen.cs to:
`

    /// <summary>
    /// The type of this structure.
    /// </summary>
    public SharpVk.StructureType SType; 
    
    /// <summary>
    /// Null or an extension-specific structure.
    /// </summary>
    public IntPtr Next; 
    
    /// <summary>
    /// Reserved for future use.
    /// </summary>
    public UInt32 Flags; 
    
    /// <summary>
    /// A pointer to the ANativeWindow to associate the surface with.
    /// </summary>
    public IntPtr Window;

`

@FacticiusVir
Copy link
Owner

Did you change the MarshalTo method to match?

@BradChase2011
Copy link
Author

Yea I did. Its not a permanent answer, I was hoping it would give you a little more light into the situation.

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

No branches or pull requests

2 participants