public void setWaitSemaphores(LongBuffer waitSemaphore){ IntBuffer pWaitDstStageMask = memAllocInt(1); pWaitDstStageMask.put(0, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); submitInfo.setWaitDstStageMask(pWaitDstStageMask); submitInfo.setWaitSemaphores(waitSemaphore); }
public void setDynamicState(){ pDynamicStates = memAllocInt(2); pDynamicStates.put(VK_DYNAMIC_STATE_VIEWPORT); pDynamicStates.put(VK_DYNAMIC_STATE_SCISSOR); pDynamicStates.flip(); dynamicState = VkPipelineDynamicStateCreateInfo.calloc() .sType(VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO) .pDynamicStates(pDynamicStates); }
public static List<String> getPhysicalDeviceExtensionNamesSupport(VkPhysicalDevice physicalDevice){ IntBuffer extensionCount = memAllocInt(1); int err = vkEnumerateDeviceExtensionProperties(physicalDevice, "", extensionCount, null); if (err != VK_SUCCESS) { throw new AssertionError(VkUtil.translateVulkanResult(err)); } VkExtensionProperties.Buffer extensions = VkExtensionProperties.calloc(extensionCount.get(0)); err = vkEnumerateDeviceExtensionProperties(physicalDevice, "", extensionCount, extensions); if (err != VK_SUCCESS) { throw new AssertionError(VkUtil.translateVulkanResult(err)); } List<String> extensionNames = new ArrayList<>(); for (VkExtensionProperties extension : extensions){ extensionNames.add(extension.extensionNameString()); } return extensionNames; }
public void createImages(){ IntBuffer pImageCount = memAllocInt(1); int err = vkGetSwapchainImagesKHR(device, handle, pImageCount, null); int imageCount = pImageCount.get(0); if (err != VK_SUCCESS) { throw new AssertionError("Failed to get number of swapchain images: " + VkUtil.translateVulkanResult(err)); } LongBuffer pSwapchainImages = memAllocLong(imageCount); err = vkGetSwapchainImagesKHR(device, handle, pImageCount, pSwapchainImages); if (err != VK_SUCCESS) { throw new AssertionError("Failed to get swapchain images: " + VkUtil.translateVulkanResult(err)); } swapChainImages = new ArrayList<>(imageCount); for (int i = 0; i < imageCount; i++) { swapChainImages.add(pSwapchainImages.get(i)); } memFree(pImageCount); memFree(pSwapchainImages); }
IntBuffer pFormatCount = memAllocInt(1); err = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pFormatCount, null); int formatCount = pFormatCount.get(0); IntBuffer pPresentModeCount = memAllocInt(1); err = vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, null); int presentModeCount = pPresentModeCount.get(0); presentModes = memAllocInt(presentModeCount); err = vkGetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, presentModes); if (err != VK_SUCCESS) {
public static void checkInstanceExtensionSupport(PointerBuffer ppEnabledExtensionNames){ IntBuffer extensionCount = memAllocInt(1);
IntBuffer pQueueFamilyPropertyCount = memAllocInt(1); vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, null); int queueCount = pQueueFamilyPropertyCount.get(0); IntBuffer supportsPresent = memAllocInt(queueCount);
public static void checkValidationLayerSupport(PointerBuffer ppEnabledLayerNames){ IntBuffer layerCount = memAllocInt(1);
public void draw(VkQueue queue, VkSemaphore waitSemaphore){ int err = vkAcquireNextImageKHR(device, handle, UINT64_MAX, imageAcquiredSemaphore.getHandle(), VK_NULL_HANDLE, pAcquiredImageIndex); if (err != VK_SUCCESS) { throw new AssertionError("Failed to acquire next swapchain image: " + VkUtil.translateVulkanResult(err)); } CommandBuffer currentRenderCommandBuffer = renderCommandBuffers.get(pAcquiredImageIndex.get(0)); IntBuffer pWaitDstStageMask = memAllocInt(2); pWaitDstStageMask.put(0, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT); pWaitDstStageMask.put(1, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); LongBuffer pWaitSemaphores = memAllocLong(2); pWaitSemaphores.put(0, imageAcquiredSemaphore.getHandle()); pWaitSemaphores.put(1, waitSemaphore.getHandle()); submitInfo.setCommandBuffers(currentRenderCommandBuffer.getHandlePointer()); submitInfo.setWaitDstStageMask(pWaitDstStageMask); submitInfo.setWaitSemaphores(pWaitSemaphores); submitInfo.submit(queue); VkUtil.vkCheckResult(vkQueuePresentKHR(queue, presentInfo)); }
public PhysicalDevice(VkInstance vkInstance, long surface) { IntBuffer pPhysicalDeviceCount = memAllocInt(1); int err = vkEnumeratePhysicalDevices(vkInstance, pPhysicalDeviceCount, null); if (err != VK_SUCCESS) {
IntBuffer memoryTypeIndex = memAllocInt(1);
IntBuffer memoryTypeIndex = memAllocInt(1);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);
indicesBuffer = MemoryUtil.memAllocInt(indices.length); indicesBuffer.put(indices).flip(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idxVboId);