Skip to content

Commit

Permalink
Use packed depth format on Nvidia
Browse files Browse the repository at this point in the history
  • Loading branch information
thr3343 committed Oct 6, 2024
1 parent b2da2b7 commit 1157f31
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/net/vulkanmod/vulkan/device/DeviceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ private static VkExtensionProperties.Buffer getAvailableExtension(MemoryStack st
// Use the optimal most performant depth format for the specific GPU
// Nvidia performs best with 24 bit depth, while AMD is most performant with 32-bit float
public static int findDepthFormat(boolean use24BitsDepthFormat) {
//Nvidia strongly recommends using packed depth formats: https://developer.nvidia.com/blog/vulkan-dos-donts/#h.806djmttkmkk
int[] formats = use24BitsDepthFormat ? new int[]
{VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT}
{VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT}
: new int[]{VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT};

return findSupportedFormat(
Expand Down

0 comments on commit 1157f31

Please sign in to comment.