diff --git a/README.md b/README.md index 66a2e0875..98a1a64f3 100644 --- a/README.md +++ b/README.md @@ -105,4 +105,5 @@ Any code change should be submitted as a pull request. The description should ex - [xHook](https://github.com/iqiyi/xHook) (Used for exit code trapping): [MIT and BSD-style licenses](https://github.com/iqiyi/xHook/blob/master/LICENSE). - [libepoxy](https://github.com/anholt/libepoxy): [MIT License](https://github.com/anholt/libepoxy/blob/master/COPYING). - [virglrenderer](https://github.com/PojavLauncherTeam/virglrenderer): [MIT License](https://gitlab.freedesktop.org/virgl/virglrenderer/-/blob/master/COPYING). +- [shaderc](https://github.com/google/shaderc) (used by mods that use Vulkan for rendering): [Apache 2.0 License](https://github.com/google/shaderc/blob/main/LICENSE). - Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars. diff --git a/app_pojavlauncher/src/main/assets/components/lwjgl3/lwjgl-glfw-classes.jar b/app_pojavlauncher/src/main/assets/components/lwjgl3/lwjgl-glfw-classes.jar index d58a61139..87cd80981 100644 Binary files a/app_pojavlauncher/src/main/assets/components/lwjgl3/lwjgl-glfw-classes.jar and b/app_pojavlauncher/src/main/assets/components/lwjgl3/lwjgl-glfw-classes.jar differ diff --git a/app_pojavlauncher/src/main/assets/components/lwjgl3/version b/app_pojavlauncher/src/main/assets/components/lwjgl3/version index 6bee63ec8..60556b0c0 100644 --- a/app_pojavlauncher/src/main/assets/components/lwjgl3/version +++ b/app_pojavlauncher/src/main/assets/components/lwjgl3/version @@ -1 +1 @@ -1654610266310 \ No newline at end of file +1654854646022 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index 687cf8550..1a78ef71f 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -21,6 +21,12 @@ #include #include #include "utils.h" + +#define GLFW_CLIENT_API 0x22001 +/* Consider GLFW_NO_API as Vulkan API */ +#define GLFW_NO_API 0 +#define GLFW_OPENGL_API 0x30001 + // region OSMESA internals struct pipe_screen; @@ -628,6 +634,7 @@ EGLSurface (*eglGetCurrentSurface_p) (EGLint readdraw); int (*vtest_main_p) (int argc, char** argv); void (*vtest_swap_buffers_p) (void); +#define RENDERER_VULKAN 0 #define RENDERER_GL4ES 1 #define RENDERER_VK_ZINK 2 #define RENDERER_VIRGL 3 @@ -801,6 +808,10 @@ int pojavInit() { savedHeight = ANativeWindow_getHeight(potatoBridge.androidWindow); ANativeWindow_setBuffersGeometry(potatoBridge.androidWindow,savedWidth,savedHeight,AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM); + return JNI_TRUE; +} + +jboolean pojavInit_OpenGL() { // NOTE: Override for now. const char *renderer = getenv("POJAV_RENDERER"); if (strncmp("opengles3_virgl", renderer, 15) == 0) { @@ -929,6 +940,24 @@ int pojavInit() { return 0; } + +void pojavSetWindowHint(int hint, int value) { + if (hint != GLFW_CLIENT_API) return; + switch (value) { + case GLFW_NO_API: + config_renderer = RENDERER_VULKAN; + /* Nothing to do: initialization is handled in Java-side */ + // pojavInit_Vulkan(); + break; + case GLFW_OPENGL_API: + pojavInit_OpenGL(); + break; + default: + printf("GLFW: Unimplemented API 0x%x\n", value); + abort(); + } +} + ANativeWindow_Buffer buf; int32_t stride; bool stopSwapBuffers; @@ -945,7 +974,7 @@ void pojavSwapBuffers() { } } } break; - + case RENDERER_VIRGL: { glFinish_p(); vtest_swap_buffers_p(); @@ -954,7 +983,7 @@ void pojavSwapBuffers() { case RENDERER_VK_ZINK: { OSMesaContext ctx = OSMesaGetCurrentContext_p(); if(ctx == NULL) { - printf("Zink: attempted to swap buffers without context!"); + printf("Zink: attempted to swap buffers without context!\n"); break; } OSMesaMakeCurrent_p(ctx,buf.bits,GL_UNSIGNED_BYTE,savedWidth,savedHeight); @@ -1077,6 +1106,10 @@ Java_org_lwjgl_glfw_GLFW_nativeEglDetachOnCurrentThread(JNIEnv *env, jclass claz */ void* pojavCreateContext(void* contextSrc) { + if (config_renderer == RENDERER_VULKAN) { + return (void *)potatoBridge.androidWindow; + } + if (config_renderer == RENDERER_GL4ES) { const EGLint ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, atoi(getenv("LIBGL_ES")), diff --git a/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libc++_shared.so b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libc++_shared.so new file mode 100644 index 000000000..f1ae47261 Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libc++_shared.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/arm64-v8a/liblwjgl_vma.so b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/liblwjgl_vma.so new file mode 100644 index 000000000..ccc9d27eb Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/liblwjgl_vma.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libshaderc.so b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libshaderc.so new file mode 100644 index 000000000..bdd98b041 Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libshaderc.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/libc++_shared.so b/app_pojavlauncher/src/main/jniLibs/x86_64/libc++_shared.so new file mode 100644 index 000000000..ee3c65acb Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/x86_64/libc++_shared.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/liblwjgl_vma.so b/app_pojavlauncher/src/main/jniLibs/x86_64/liblwjgl_vma.so new file mode 100644 index 000000000..fb8cf926e Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/x86_64/liblwjgl_vma.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/libshaderc.so b/app_pojavlauncher/src/main/jniLibs/x86_64/libshaderc.so new file mode 100644 index 000000000..3345f7d4c Binary files /dev/null and b/app_pojavlauncher/src/main/jniLibs/x86_64/libshaderc.so differ diff --git a/jre_lwjgl3glfw/libs/lwjgl-shaderc.jar b/jre_lwjgl3glfw/libs/lwjgl-shaderc.jar new file mode 100644 index 000000000..773724de5 Binary files /dev/null and b/jre_lwjgl3glfw/libs/lwjgl-shaderc.jar differ diff --git a/jre_lwjgl3glfw/libs/lwjgl-vma.jar b/jre_lwjgl3glfw/libs/lwjgl-vma.jar new file mode 100644 index 000000000..ac93a263e Binary files /dev/null and b/jre_lwjgl3glfw/libs/lwjgl-vma.jar differ diff --git a/jre_lwjgl3glfw/libs/lwjgl-vulkan.jar b/jre_lwjgl3glfw/libs/lwjgl-vulkan.jar new file mode 100644 index 000000000..d5fea3663 Binary files /dev/null and b/jre_lwjgl3glfw/libs/lwjgl-vulkan.jar differ diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java index 9ef855c36..ec2ad1610 100644 --- a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java @@ -611,6 +611,7 @@ public class GLFW //DetachOnCurrentThread = apiGetFunctionAddress(GLFW, "pojavDetachOnCurrentThread"), MakeContextCurrent = apiGetFunctionAddress(GLFW, "pojavMakeCurrent"), Terminate = apiGetFunctionAddress(GLFW, "pojavTerminate"), + SetWindowHint = apiGetFunctionAddress(GLFW, "pojavSetWindowHint"), SwapBuffers = apiGetFunctionAddress(GLFW, "pojavSwapBuffers"), SwapInterval = apiGetFunctionAddress(GLFW, "pojavSwapInterval"); } @@ -1039,7 +1040,12 @@ public class GLFW public static void glfwShowWindow(long window) { nglfwSetShowingWindow(window); } - public static void glfwWindowHint(int hint, int value) {} + + public static void glfwWindowHint(int hint, int value) { + long __functionAddress = Functions.SetWindowHint; + invokeV(hint, value, __functionAddress); + } + public static void glfwWindowHintString(int hint, @NativeType("const char *") ByteBuffer value) {} public static void glfwWindowHintString(int hint, @NativeType("const char *") CharSequence value) {} diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFWVulkan.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFWVulkan.java new file mode 100644 index 000000000..a1f01f38e --- /dev/null +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFWVulkan.java @@ -0,0 +1,279 @@ +/* + * Copyright LWJGL. All rights reserved. + * License terms: https://www.lwjgl.org/license + * MACHINE GENERATED FILE, DO NOT EDIT + */ +package org.lwjgl.glfw; + +import javax.annotation.*; + +import java.nio.*; + +import org.lwjgl.*; + +import org.lwjgl.system.*; + +import static org.lwjgl.system.APIUtil.*; +import static org.lwjgl.system.Checks.*; +import static org.lwjgl.system.JNI.*; +import static org.lwjgl.system.MemoryStack.*; +import static org.lwjgl.system.MemoryUtil.*; +import static org.lwjgl.vulkan.EXTMetalSurface.*; +import static org.lwjgl.vulkan.KHRAndroidSurface.*; + +import org.lwjgl.vulkan.*; + +/** Native bindings to the GLFW library's Vulkan functions. */ +public class GLFWVulkan { + + protected GLFWVulkan() { + throw new UnsupportedOperationException(); + } + + static { + //invokeV(Functions.Init); + + +/* + if (Platform.get() == Platform.MACOSX) { + // Force GLFW to initialize Vulkan using the same library used by LWJGL. + FunctionProvider fp = VK.getFunctionProvider(); + if (fp instanceof SharedLibrary) { + String path = ((SharedLibrary)fp).getPath(); + if (path != null) { + try (MemoryStack stack = stackPush()) { + long _glfw_vulkan_library = apiGetFunctionAddress(GLFW.getLibrary(), "_glfw_vulkan_library"); + + memPutAddress(_glfw_vulkan_library, memAddress(stack.UTF8(path))); + glfwVulkanSupported(); + memPutAddress(_glfw_vulkan_library, NULL); + } + } + } + } +*/ + } + + // --- [ glfwVulkanSupported ] --- + + /** + * Returns whether the Vulkan loader has been found. This check is performed by {@link GLFW#glfwInit Init}. + * + *

The availability of a Vulkan loader does not by itself guarantee that window surface creation or even device creation is possible. Call + * {@link #glfwGetRequiredInstanceExtensions GetRequiredInstanceExtensions} to check whether the extensions necessary for Vulkan surface creation are available and + * {@link #glfwGetPhysicalDevicePresentationSupport GetPhysicalDevicePresentationSupport} to check whether a queue family of a physical device supports image presentation.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED}.

+ * + *

This function may be called from any thread.

+ * + * @return {@link GLFW#GLFW_TRUE TRUE} if Vulkan is available, or {@link GLFW#GLFW_FALSE FALSE} otherwise + * + * @since version 3.2 + */ + @NativeType("int") + public static boolean glfwVulkanSupported() { + return true; + } + + // --- [ glfwGetRequiredInstanceExtensions ] --- + + /** + * Returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the list will + * always contain {@code VK_KHR_surface}, so if you don't require any additional extensions you can pass this list directly to the {@link VkInstanceCreateInfo} + * struct. + * + *

If Vulkan is not available on the machine, this function returns {@code NULL} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. Call {@link #glfwVulkanSupported VulkanSupported} to check whether + * Vulkan is available.

+ * + *

If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns {@code NULL}. You may still use Vulkan for + * off-screen rendering and compute work.

+ * + *

Additional extensions may be required by future versions of GLFW. You should check if any extensions you wish to enable are already in the returned + * array, as it is an error to specify an extension more than once in the {@code VkInstanceCreateInfo} struct.

+ * + *

The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.

+ * + *

This function may be called from any thread.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED} and {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE}.

+ * + * @return an array of ASCII encoded extension names, or {@code NULL} if an error occurred + * + * @since version 3.2 + */ + @Nullable + @NativeType("char const **") + public static PointerBuffer glfwGetRequiredInstanceExtensions() { + MemoryStack stack = MemoryStack.stackPush(); + String platformSurface; + if (Platform.get() == Platform.MACOSX) { + platformSurface = "VK_EXT_metal_surface"; + } else { + platformSurface = "VK_KHR_android_surface"; + } + return stack.pointers(stack.UTF8(KHRSurface.VK_KHR_SURFACE_EXTENSION_NAME), stack.UTF8(platformSurface)); + } + + // --- [ glfwGetInstanceProcAddress ] --- + + /** + * Returns the address of the specified Vulkan core or extension function for the specified instance. If instance is set to {@code NULL} it can return any + * function exported from the Vulkan loader, including at least the following functions: + * + * + * + *

If Vulkan is not available on the machine, this function returns {@code NULL} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. Call {@link #glfwVulkanSupported VulkanSupported} to check whether + * Vulkan is available.

+ * + *

This function is equivalent to calling {@link VK10#vkGetInstanceProcAddr} with a platform-specific query of the Vulkan loader as a fallback.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED} and {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE}.

+ * + *

The returned function pointer is valid until the library is terminated.

+ * + *

This function may be called from any thread.

+ * + * @param instance the Vulkan instance to query, or {@code NULL} to retrieve functions related to instance creation + * @param procname the ASCII encoded name of the function + * + * @return the address of the function, or {@code NULL} if an error occurred + * + * @since version 3.2 + */ + @NativeType("GLFWvkproc") + public static long glfwGetInstanceProcAddress(@Nullable VkInstance instance, @NativeType("char const *") ByteBuffer procname) { + return VK10.vkGetInstanceProcAddr(instance, procname); + } + + /** + * Returns the address of the specified Vulkan core or extension function for the specified instance. If instance is set to {@code NULL} it can return any + * function exported from the Vulkan loader, including at least the following functions: + * + * + * + *

If Vulkan is not available on the machine, this function returns {@code NULL} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. Call {@link #glfwVulkanSupported VulkanSupported} to check whether + * Vulkan is available.

+ * + *

This function is equivalent to calling {@link VK10#vkGetInstanceProcAddr} with a platform-specific query of the Vulkan loader as a fallback.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED} and {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE}.

+ * + *

The returned function pointer is valid until the library is terminated.

+ * + *

This function may be called from any thread.

+ * + * @param instance the Vulkan instance to query, or {@code NULL} to retrieve functions related to instance creation + * @param procname the ASCII encoded name of the function + * + * @return the address of the function, or {@code NULL} if an error occurred + * + * @since version 3.2 + */ + @NativeType("GLFWvkproc") + public static long glfwGetInstanceProcAddress(@Nullable VkInstance instance, @NativeType("char const *") CharSequence procname) { + return VK10.vkGetInstanceProcAddr(instance, procname); + } + + // --- [ glfwGetPhysicalDevicePresentationSupport ] --- + + /** + * Returns whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for. + * + *

If Vulkan or the required window surface creation instance extensions are not available on the machine, or if the specified instance was not created + * with the required extensions, this function returns {@link GLFW#GLFW_FALSE FALSE} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. Call {@link #glfwVulkanSupported VulkanSupported} to check whether Vulkan is + * available and {@link #glfwGetRequiredInstanceExtensions GetRequiredInstanceExtensions} to check what instance extensions are required.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED}, {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} and {@link GLFW#GLFW_PLATFORM_ERROR PLATFORM_ERROR}.

+ * + *

This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.

+ * + * @param instance the instance that the physical device belongs to + * @param device the physical device that the queue family belongs to + * @param queuefamily the index of the queue family to query + * + * @return {@link GLFW#GLFW_TRUE TRUE} if the queue family supports presentation, or {@link GLFW#GLFW_FALSE FALSE} otherwise + * + * @since version 3.2 + */ + @NativeType("int") + public static boolean glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, @NativeType("uint32_t") int queuefamily) { + return true; + } + + // --- [ glfwCreateWindowSurface ] --- + + /** + * Creates a Vulkan surface for the specified window. + * + *

If the Vulkan loader was not found at initialization, this function returns {@link VK10#VK_ERROR_INITIALIZATION_FAILED} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. + * Call {@link #glfwVulkanSupported VulkanSupported} to check whether the Vulkan loader was found.

+ * + *

If the required window surface creation instance extensions are not available or if the specified instance was not created with these extensions + * enabled, this function returns {@link VK10#VK_ERROR_EXTENSION_NOT_PRESENT} and generates a {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE} error. Call {@link #glfwGetRequiredInstanceExtensions GetRequiredInstanceExtensions} to + * check what instance extensions are required.

+ * + *

The window surface cannot be shared with another API so the window must have been created with the client api hint set to {@link GLFW#GLFW_NO_API NO_API} otherwise it + * generates a {@link GLFW#GLFW_INVALID_VALUE INVALID_VALUE} error and returns {@link KHRSurface#VK_ERROR_NATIVE_WINDOW_IN_USE_KHR}.

+ * + *

The window surface must be destroyed before the specified Vulkan instance. It is the responsibility of the caller to destroy the window surface. GLFW + * does not destroy it for you. Call {@link KHRSurface#vkDestroySurfaceKHR} to destroy the surface.

+ * + *

Possible errors include {@link GLFW#GLFW_NOT_INITIALIZED NOT_INITIALIZED}, {@link GLFW#GLFW_API_UNAVAILABLE API_UNAVAILABLE}, {@link GLFW#GLFW_PLATFORM_ERROR PLATFORM_ERROR} and {@link GLFW#GLFW_INVALID_VALUE INVALID_VALUE}.

+ * + *

If an error occurs before the creation call is made, GLFW returns the Vulkan error code most appropriate for the error. Appropriate use of + * {@link #glfwVulkanSupported VulkanSupported} and {@link #glfwGetRequiredInstanceExtensions GetRequiredInstanceExtensions} should eliminate almost all occurrences of these errors.

+ * + *

This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.

+ * + * @param instance the Vulkan instance to create the surface in + * @param window the window to create the surface for + * @param allocator the allocator to use, or {@code NULL} to use the default allocator. + * @param surface where to store the handle of the surface. This is set to {@link VK10#VK_NULL_HANDLE} if an error occurred. + * + * @return {@link VK10#VK_SUCCESS} if successful, or a Vulkan error code if an error occurred + * + * @since version 3.2 + */ + @NativeType("VkResult") + public static int glfwCreateWindowSurface(VkInstance instance, @NativeType("GLFWwindow *") long window, @Nullable @NativeType("VkAllocationCallbacks const *") VkAllocationCallbacks allocator, @NativeType("VkSurfaceKHR *") LongBuffer surface) { + if (CHECKS) { + check(surface, 1); + } + /* Since LWJGL didn't generate Android stuff, we have to lend Metal's one to call */ + if (Platform.get() == Platform.MACOSX) { + VkMetalSurfaceCreateInfoEXT pCreateInfo = VkMetalSurfaceCreateInfoEXT + .calloc() + .sType(VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT) + .pLayer(PointerBuffer.create(window, 1)); + return vkCreateMetalSurfaceEXT(instance, pCreateInfo, null, surface); + } else { + VkAndroidSurfaceCreateInfoKHR pCreateInfo = VkAndroidSurfaceCreateInfoKHR + .calloc() + .sType(VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR) + .pWindow(PointerBuffer.create(window, 1)); + return vkCreateAndroidSurfaceKHR(instance, pCreateInfo, null, surface); + } + } + + /** Array version of: {@link #glfwCreateWindowSurface CreateWindowSurface} */ + @NativeType("VkResult") + public static int glfwCreateWindowSurface(VkInstance instance, @NativeType("GLFWwindow *") long window, @Nullable @NativeType("VkAllocationCallbacks const *") VkAllocationCallbacks allocator, @NativeType("VkSurfaceKHR *") long[] surface) { + MemoryStack stack = stackGet(); + LongBuffer pSurface = stack.mallocLong(1); + int result = glfwCreateWindowSurface(instance, window, allocator, pSurface); + surface[0] = pSurface.get(0); + return result; + } + +} diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/KHRAndroidSurface.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/KHRAndroidSurface.java new file mode 100644 index 000000000..d2125f0d1 --- /dev/null +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/KHRAndroidSurface.java @@ -0,0 +1,167 @@ +/* + * Copyright LWJGL. All rights reserved. + * License terms: https://www.lwjgl.org/license + * MACHINE GENERATED FILE, DO NOT EDIT + */ +package org.lwjgl.vulkan; + +import javax.annotation.*; + +import java.nio.*; + +import org.lwjgl.system.*; + +import static org.lwjgl.system.Checks.*; +import static org.lwjgl.system.JNI.*; +import static org.lwjgl.system.MemoryUtil.*; + +/** + * The {@code VK_KHR_android_surface} extension is an instance extension. It provides a mechanism to create a {@code VkSurfaceKHR} object (defined by the {@code VK_KHR_surface} extension) that refers to an {@code ANativeWindow}, Android's native surface type. The {@code ANativeWindow} represents the producer endpoint of any buffer queue, regardless of consumer endpoint. Common consumer endpoints for {@code ANativeWindows} are the system window compositor, video encoders, and application-specific compositors importing the images through a SurfaceTexture. + *
+ *
Name String
+ *
VK_KHR_android_surface
+ *
Extension Type
+ *
Instance extension
+ *
Registered Extension Number
+ *
9
+ *
Last Modified Date
+ *
2016-01-14
+ *
Revision
+ *
6
+ *
IP Status
+ *
No known IP claims.
+ *
Dependencies
+ *
    + *
  • This extension is written against version 1.0 of the Vulkan API.
  • + *
  • Requires VK_KHR_surface.
  • + *
+ *
Contributors
+ *
    + *
  • Patrick Doane, Blizzard
  • + *
  • Jason Ekstrand, Intel
  • + *
  • Ian Elliott, LunarG
  • + *
  • Courtney Goeltzenleuchter, LunarG
  • + *
  • Jesse Hall, Google
  • + *
  • James Jones, NVIDIA
  • + *
  • Antoine Labour, Google
  • + *
  • Jon Leech, Khronos
  • + *
  • David Mao, AMD
  • + *
  • Norbert Nopper, Freescale
  • + *
  • Alon Or-bach, Samsung
  • + *
  • Daniel Rakos, AMD
  • + *
  • Graham Sellers, AMD
  • + *
  • Ray Smith, ARM
  • + *
  • Jeff Vigil, Qualcomm
  • + *
  • Chia-I Wu, LunarG
  • + *
+ *
Contacts
+ *
    + *
  • Jesse Hall, Google
  • + *
+ *
+ */ +public class KHRAndroidSurface { + + /** The extension specification version. */ + public static final int VK_KHR_ANDROID_SURFACE_SPEC_VERSION = 6; + + /** The extension name. */ + public static final String VK_KHR_ANDROID_SURFACE_EXTENSION_NAME = "VK_KHR_android_surface"; + + /** Extends {@code VkStructureType}. */ + public static final int VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000; + + protected KHRAndroidSurface() { + throw new UnsupportedOperationException(); + } + + static boolean checkCapsInstance(FunctionProvider provider, java.util.Map caps, java.util.Set ext) { + return ext.contains("VK_KHR_android_surface") && VK.checkExtension("VK_KHR_android_surface", + VK.isSupported(provider, "vkCreateAndroidSurfaceKHR", caps) + ); + } + + // --- [ vkCreateAndroidSurfaceKHR ] --- + + /** Unsafe version of: {@link #vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR} */ + public static int nvkCreateAndroidSurfaceKHR(VkInstance instance, long pCreateInfo, long pAllocator, long pSurface) { + long __functionAddress = VK10.vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR"); + //instance.getCapabilities().vkCreateAndroidSurfaceKHR; + if (CHECKS) { + check(__functionAddress); + VkAndroidSurfaceCreateInfoKHR.validate(pCreateInfo); + if (pAllocator != NULL) { VkAllocationCallbacks.validate(pAllocator); } + } + return callPPPPI(instance.address(), pCreateInfo, pAllocator, pSurface, __functionAddress); + } + + /** + * Create a VkSurfaceKHR object for ANativeWindow. + * + *
C Specification
+ * + *

To create a {@code VkSurfaceKHR} object for a dlink:ANativeWindow, call:

+ * + *

+     * VkResult vkCreateAndroidSurfaceKHR(
+     *     VkInstance                                  instance,
+     *     const VkAndroidSurfaceCreateInfoKHR*        pCreateInfo,
+     *     const VkAllocationCallbacks*                pAllocator,
+     *     VkSurfaceKHR*                               pSurface);
+ * + *
Valid Usage (Implicit)
+ * + *
    + *
  • {@code instance} must be a valid {@code VkInstance} handle
  • + *
  • {@code pCreateInfo} must be a valid pointer to a valid {@link VkAndroidSurfaceCreateInfoKHR} structure
  • + *
  • If {@code pAllocator} is not {@code NULL}, {@code pAllocator} must be a valid pointer to a valid {@link VkAllocationCallbacks} structure
  • + *
  • {@code pSurface} must be a valid pointer to a {@code VkSurfaceKHR} handle
  • + *
+ * + *
Return Codes
+ * + *
+ *
On success, this command returns
+ *
    + *
  • {@link VK10#VK_SUCCESS SUCCESS}
  • + *
+ *
On failure, this command returns
+ *
    + *
  • {@link VK10#VK_ERROR_OUT_OF_HOST_MEMORY ERROR_OUT_OF_HOST_MEMORY}
  • + *
  • {@link VK10#VK_ERROR_OUT_OF_DEVICE_MEMORY ERROR_OUT_OF_DEVICE_MEMORY}
  • + *
  • {@link KHRSurface#VK_ERROR_NATIVE_WINDOW_IN_USE_KHR ERROR_NATIVE_WINDOW_IN_USE_KHR}
  • + *
+ *
+ * + *
See Also
+ * + *

{@link VkAllocationCallbacks}, {@link VkAndroidSurfaceCreateInfoKHR}

+ * + * @param instance the instance with which to associate the surface. + * @param pCreateInfo a pointer to an instance of the {@link VkAndroidSurfaceCreateInfoKHR} structure containing the parameters affecting the creation of the surface object. + * @param pAllocator the allocator used for host memory allocated for the surface object when there is no more specific allocator available (see Memory Allocation). + * @param pSurface points to a {@code VkSurfaceKHR} handle in which the created surface object is returned. + */ + @NativeType("VkResult") + public static int vkCreateAndroidSurfaceKHR(VkInstance instance, @NativeType("VkAndroidSurfaceCreateInfoKHR const *") VkAndroidSurfaceCreateInfoKHR pCreateInfo, @Nullable @NativeType("VkAllocationCallbacks const *") VkAllocationCallbacks pAllocator, @NativeType("VkSurfaceKHR *") LongBuffer pSurface) { + if (CHECKS) { + check(pSurface, 1); + } + return nvkCreateAndroidSurfaceKHR(instance, pCreateInfo.address(), memAddressSafe(pAllocator), memAddress(pSurface)); + } + + /** Array version of: {@link #vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR} */ + @NativeType("VkResult") + public static int vkCreateAndroidSurfaceKHR(VkInstance instance, @NativeType("VkAndroidSurfaceCreateInfoKHR const *") VkAndroidSurfaceCreateInfoKHR pCreateInfo, @Nullable @NativeType("VkAllocationCallbacks const *") VkAllocationCallbacks pAllocator, @NativeType("VkSurfaceKHR *") long[] pSurface) { + long __functionAddress = VK10.vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR"); + //instance.getCapabilities().vkCreateAndroidSurfaceKHR; + if (CHECKS) { + check(__functionAddress); + check(pSurface, 1); + VkAndroidSurfaceCreateInfoKHR.validate(pCreateInfo.address()); + if (pAllocator != null) { VkAllocationCallbacks.validate(pAllocator.address()); } + } + return callPPPPI(instance.address(), pCreateInfo.address(), memAddressSafe(pAllocator), pSurface, __functionAddress); + } + +} diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/VkAndroidSurfaceCreateInfoKHR.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/VkAndroidSurfaceCreateInfoKHR.java new file mode 100644 index 000000000..b8718e0b5 --- /dev/null +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/vulkan/VkAndroidSurfaceCreateInfoKHR.java @@ -0,0 +1,401 @@ +/* + * Copyright LWJGL. All rights reserved. + * License terms: https://www.lwjgl.org/license + * MACHINE GENERATED FILE, DO NOT EDIT + */ +package org.lwjgl.vulkan; + +import javax.annotation.*; + +import java.nio.*; + +import org.lwjgl.*; +import org.lwjgl.system.*; + +import static org.lwjgl.system.Checks.*; +import static org.lwjgl.system.MemoryUtil.*; +import static org.lwjgl.system.MemoryStack.*; + +/** + * Structure specifying parameters of a newly created Android surface object. + * + *
Description
+ * + *
Valid Usage (Implicit)
+ * + *
    + *
  • {@code sType} must be {@link KHRAndroidSurface#VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR}
  • + *
  • {@code pNext} must be {@code NULL}
  • + *
  • {@code flags} must be 0
  • + *
+ * + *
See Also
+ * + *

{@link KHRAndroidSurface#vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR}

+ * + *

Member documentation

+ * + *
    + *
  • {@code sType} – the type of this structure.
  • + *
  • {@code pNext} – {@code NULL} or a pointer to an extension-specific structure.
  • + *
  • {@code flags} – reserved for future use.
  • + *
  • {@code pWindow} – a reference to a {@code ANativeWindow} object that represents a renderable surface.
  • + *
+ * + *

Layout

+ * + *

+ * struct VkAndroidSurfaceCreateInfoKHR {
+ *     VkStructureType sType;
+ *     void const * pNext;
+ *     VkAndroidSurfaceCreateFlagsKHR flags;
+ *     ANativeWindow const * pWindow;
+ * }
+ */ +public class VkAndroidSurfaceCreateInfoKHR extends Struct implements NativeResource { + + /** The struct size in bytes. */ + public static final int SIZEOF; + + /** The struct alignment in bytes. */ + public static final int ALIGNOF; + + /** The struct member offsets. */ + public static final int + STYPE, + PNEXT, + FLAGS, + PWINDOW; + + static { + Layout layout = __struct( + __member(4), + __member(POINTER_SIZE), + __member(4), + __member(POINTER_SIZE) + ); + + SIZEOF = layout.getSize(); + ALIGNOF = layout.getAlignment(); + + STYPE = layout.offsetof(0); + PNEXT = layout.offsetof(1); + FLAGS = layout.offsetof(2); + PWINDOW = layout.offsetof(3); + } + + /** + * Creates a {@code VkAndroidSurfaceCreateInfoKHR} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be + * visible to the struct instance and vice versa. + * + *

The created instance holds a strong reference to the container object.

+ */ + public VkAndroidSurfaceCreateInfoKHR(ByteBuffer container) { + super(memAddress(container), __checkContainer(container, SIZEOF)); + } + + @Override + public int sizeof() { return SIZEOF; } + + /** Returns the value of the {@code sType} field. */ + @NativeType("VkStructureType") + public int sType() { return nsType(address()); } + /** Returns the value of the {@code pNext} field. */ + @NativeType("void const *") + public long pNext() { return npNext(address()); } + /** Returns the value of the {@code flags} field. */ + @NativeType("VkAndroidSurfaceCreateFlagsKHR") + public int flags() { return nflags(address()); } + /** + * Returns a {@link PointerBuffer} view of the data pointed to by the {@code pWindow} field. + * + * @param capacity the number of elements in the returned buffer + */ + @NativeType("ANativeWindow const *") + public PointerBuffer pWindow(int capacity) { return npWindow(address(), capacity); } + + /** Sets the specified value to the {@code sType} field. */ + public VkAndroidSurfaceCreateInfoKHR sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; } + /** Sets the specified value to the {@code pNext} field. */ + public VkAndroidSurfaceCreateInfoKHR pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; } + /** Sets the specified value to the {@code flags} field. */ + public VkAndroidSurfaceCreateInfoKHR flags(@NativeType("VkAndroidSurfaceCreateFlagsKHR") int value) { nflags(address(), value); return this; } + /** Sets the address of the specified {@link PointerBuffer} to the {@code pWindow} field. */ + public VkAndroidSurfaceCreateInfoKHR pWindow(@NativeType("ANativeWindow const *") PointerBuffer value) { npWindow(address(), value); return this; } + + /** Initializes this struct with the specified values. */ + public VkAndroidSurfaceCreateInfoKHR set( + int sType, + long pNext, + int flags, + PointerBuffer pWindow + ) { + sType(sType); + pNext(pNext); + flags(flags); + pWindow(pWindow); + + return this; + } + + /** + * Copies the specified struct data to this struct. + * + * @param src the source struct + * + * @return this struct + */ + public VkAndroidSurfaceCreateInfoKHR set(VkAndroidSurfaceCreateInfoKHR src) { + memCopy(src.address(), address(), SIZEOF); + return this; + } + + // ----------------------------------- + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */ + public static VkAndroidSurfaceCreateInfoKHR malloc() { + return wrap(VkAndroidSurfaceCreateInfoKHR.class, nmemAllocChecked(SIZEOF)); + } + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */ + public static VkAndroidSurfaceCreateInfoKHR calloc() { + return wrap(VkAndroidSurfaceCreateInfoKHR.class, nmemCallocChecked(1, SIZEOF)); + } + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated with {@link BufferUtils}. */ + public static VkAndroidSurfaceCreateInfoKHR create() { + ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF); + return wrap(VkAndroidSurfaceCreateInfoKHR.class, memAddress(container), container); + } + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance for the specified memory address. */ + public static VkAndroidSurfaceCreateInfoKHR create(long address) { + return wrap(VkAndroidSurfaceCreateInfoKHR.class, address); + } + + /** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */ + @Nullable + public static VkAndroidSurfaceCreateInfoKHR createSafe(long address) { + return address == NULL ? null : wrap(VkAndroidSurfaceCreateInfoKHR.class, address); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. + * + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer malloc(int capacity) { + return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. + * + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer calloc(int capacity) { + return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated with {@link BufferUtils}. + * + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer create(int capacity) { + ByteBuffer container = __create(capacity, SIZEOF); + return wrap(Buffer.class, memAddress(container), capacity, container); + } + + /** + * Create a {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance at the specified memory. + * + * @param address the memory address + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer create(long address, int capacity) { + return wrap(Buffer.class, address, capacity); + } + + /** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */ + @Nullable + public static VkAndroidSurfaceCreateInfoKHR.Buffer createSafe(long address, int capacity) { + return address == NULL ? null : wrap(Buffer.class, address, capacity); + } + + // ----------------------------------- + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated on the thread-local {@link MemoryStack}. */ + public static VkAndroidSurfaceCreateInfoKHR mallocStack() { + return mallocStack(stackGet()); + } + + /** Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */ + public static VkAndroidSurfaceCreateInfoKHR callocStack() { + return callocStack(stackGet()); + } + + /** + * Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated on the specified {@link MemoryStack}. + * + * @param stack the stack from which to allocate + */ + public static VkAndroidSurfaceCreateInfoKHR mallocStack(MemoryStack stack) { + return wrap(VkAndroidSurfaceCreateInfoKHR.class, stack.nmalloc(ALIGNOF, SIZEOF)); + } + + /** + * Returns a new {@code VkAndroidSurfaceCreateInfoKHR} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. + * + * @param stack the stack from which to allocate + */ + public static VkAndroidSurfaceCreateInfoKHR callocStack(MemoryStack stack) { + return wrap(VkAndroidSurfaceCreateInfoKHR.class, stack.ncalloc(ALIGNOF, 1, SIZEOF)); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated on the thread-local {@link MemoryStack}. + * + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer mallocStack(int capacity) { + return mallocStack(capacity, stackGet()); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. + * + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer callocStack(int capacity) { + return callocStack(capacity, stackGet()); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack}. + * + * @param stack the stack from which to allocate + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer mallocStack(int capacity, MemoryStack stack) { + return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity); + } + + /** + * Returns a new {@link VkAndroidSurfaceCreateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero. + * + * @param stack the stack from which to allocate + * @param capacity the buffer capacity + */ + public static VkAndroidSurfaceCreateInfoKHR.Buffer callocStack(int capacity, MemoryStack stack) { + return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity); + } + + // ----------------------------------- + + /** Unsafe version of {@link #sType}. */ + public static int nsType(long struct) { return UNSAFE.getInt(null, struct + VkAndroidSurfaceCreateInfoKHR.STYPE); } + /** Unsafe version of {@link #pNext}. */ + public static long npNext(long struct) { return memGetAddress(struct + VkAndroidSurfaceCreateInfoKHR.PNEXT); } + /** Unsafe version of {@link #flags}. */ + public static int nflags(long struct) { return UNSAFE.getInt(null, struct + VkAndroidSurfaceCreateInfoKHR.FLAGS); } + /** Unsafe version of {@link #pWindow(int) pWindow}. */ + public static PointerBuffer npWindow(long struct, int capacity) { return memPointerBuffer(memGetAddress(struct + VkAndroidSurfaceCreateInfoKHR.PWINDOW), capacity); } + + /** Unsafe version of {@link #sType(int) sType}. */ + public static void nsType(long struct, int value) { UNSAFE.putInt(null, struct + VkAndroidSurfaceCreateInfoKHR.STYPE, value); } + /** Unsafe version of {@link #pNext(long) pNext}. */ + public static void npNext(long struct, long value) { memPutAddress(struct + VkAndroidSurfaceCreateInfoKHR.PNEXT, value); } + /** Unsafe version of {@link #flags(int) flags}. */ + public static void nflags(long struct, int value) { UNSAFE.putInt(null, struct + VkAndroidSurfaceCreateInfoKHR.FLAGS, value); } + /** Unsafe version of {@link #pWindow(PointerBuffer) pWindow}. */ + public static void npWindow(long struct, PointerBuffer value) { memPutAddress(struct + VkAndroidSurfaceCreateInfoKHR.PWINDOW, memAddress(value)); } + + /** + * Validates pointer members that should not be {@code NULL}. + * + * @param struct the struct to validate + */ + public static void validate(long struct) { + check(memGetAddress(struct + VkAndroidSurfaceCreateInfoKHR.PWINDOW)); + } + + /** + * Calls {@link #validate(long)} for each struct contained in the specified struct array. + * + * @param array the struct array to validate + * @param count the number of structs in {@code array} + */ + public static void validate(long array, int count) { + for (int i = 0; i < count; i++) { + validate(array + Integer.toUnsignedLong(i) * SIZEOF); + } + } + + // ----------------------------------- + + /** An array of {@link VkAndroidSurfaceCreateInfoKHR} structs. */ + public static class Buffer extends StructBuffer implements NativeResource { + + private static final VkAndroidSurfaceCreateInfoKHR ELEMENT_FACTORY = VkAndroidSurfaceCreateInfoKHR.create(-1L); + + /** + * Creates a new {@code VkAndroidSurfaceCreateInfoKHR.Buffer} instance backed by the specified container. + * + * Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values + * will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided + * by {@link VkAndroidSurfaceCreateInfoKHR#SIZEOF}, and its mark will be undefined. + * + *

The created buffer instance holds a strong reference to the container object.

+ */ + public Buffer(ByteBuffer container) { + super(container, container.remaining() / SIZEOF); + } + + public Buffer(long address, int cap) { + super(address, null, -1, 0, cap, cap); + } + + Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) { + super(address, container, mark, pos, lim, cap); + } + + @Override + protected Buffer self() { + return this; + } + + @Override + protected VkAndroidSurfaceCreateInfoKHR getElementFactory() { + return ELEMENT_FACTORY; + } + + /** Returns the value of the {@code sType} field. */ + @NativeType("VkStructureType") + public int sType() { return VkAndroidSurfaceCreateInfoKHR.nsType(address()); } + /** Returns the value of the {@code pNext} field. */ + @NativeType("void const *") + public long pNext() { return VkAndroidSurfaceCreateInfoKHR.npNext(address()); } + /** Returns the value of the {@code flags} field. */ + @NativeType("VkAndroidSurfaceCreateFlagsKHR") + public int flags() { return VkAndroidSurfaceCreateInfoKHR.nflags(address()); } + /** + * Returns a {@link PointerBuffer} view of the data pointed to by the {@code pWindow} field. + * + * @param capacity the number of elements in the returned buffer + */ + @NativeType("ANativeWindow const *") + public PointerBuffer pWindow(int capacity) { return VkAndroidSurfaceCreateInfoKHR.npWindow(address(), capacity); } + + /** Sets the specified value to the {@code sType} field. */ + public VkAndroidSurfaceCreateInfoKHR.Buffer sType(@NativeType("VkStructureType") int value) { VkAndroidSurfaceCreateInfoKHR.nsType(address(), value); return this; } + /** Sets the specified value to the {@code pNext} field. */ + public VkAndroidSurfaceCreateInfoKHR.Buffer pNext(@NativeType("void const *") long value) { VkAndroidSurfaceCreateInfoKHR.npNext(address(), value); return this; } + /** Sets the specified value to the {@code flags} field. */ + public VkAndroidSurfaceCreateInfoKHR.Buffer flags(@NativeType("VkAndroidSurfaceCreateFlagsKHR") int value) { VkAndroidSurfaceCreateInfoKHR.nflags(address(), value); return this; } + /** Sets the address of the specified {@link PointerBuffer} to the {@code pWindow} field. */ + public VkAndroidSurfaceCreateInfoKHR.Buffer pWindow(@NativeType("ANativeWindow const *") PointerBuffer value) { VkAndroidSurfaceCreateInfoKHR.npWindow(address(), value); return this; } + + } + +}