diff --git a/CMakeLists.txt b/CMakeLists.txt index 068fd20..573fed1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -515,9 +515,10 @@ layer_test(thread_2 thread_2) layer_test(thread_3 thread_3) layer_test(compute_bda_sc compute_bda_sc) layer_test(compute_bda_pushconstant compute_bda_pushconstant) -layer_test(compute_bda_ubo compute_bda_ubo) -layer_test(compute_bda_ubo_ssbo compute_bda_ubo --ssbo) -layer_test(compute_bda_ubo_fb compute_bda_ubo --frame-boundary) +# These three tests crash on Nvidia and freeze the GPU +#layer_test(compute_bda_ubo compute_bda_ubo) +#layer_test(compute_bda_ubo_ssbo compute_bda_ubo --ssbo) +#layer_test(compute_bda_ubo_fb compute_bda_ubo --frame-boundary) add_test(NAME layer_test_thread_3_replay_blackhole_stress_1 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/lava-replay -V -B vulkan_thread_3.vk) set_tests_properties(layer_test_thread_3_replay_blackhole_stress_1 PROPERTIES FIXTURES_REQUIRED thread_3) add_test(NAME layer_test_thread_3_replay_blackhole_stress_2 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/lava-replay -D -B vulkan_thread_3.vk) @@ -552,6 +553,6 @@ layer_test(compute_2_2 compute_2 -j 1 -s 2) layer_test(compute_3 compute_3) layer_test(feature_1 feature_1) layer_test(tool_1 tool_1) +layer_test(as_1 as_1) #layer_test(multidevice_1 multidevice_1) # assert failure on memory type -#layer_test(as_1) #layer_test(mesh_1) diff --git a/include/feature_detect.h b/include/feature_detect.h index 2479ce3..2667b16 100644 --- a/include/feature_detect.h +++ b/include/feature_detect.h @@ -245,6 +245,24 @@ struct feature_detection void check_VkPipelineColorBlendStateCreateInfo(const VkPipelineColorBlendStateCreateInfo* info) { if (info->logicOpEnable == VK_TRUE) core10.logicOp = true; + + if (info->attachmentCount > 1) + { + for (uint32_t i = 1; i < info->attachmentCount; i++) + { + if (info->pAttachments[i].blendEnable != info->pAttachments[i - 1].blendEnable || + info->pAttachments[i].srcColorBlendFactor != info->pAttachments[i - 1].srcColorBlendFactor || + info->pAttachments[i].dstColorBlendFactor != info->pAttachments[i - 1].dstColorBlendFactor || + info->pAttachments[i].colorBlendOp != info->pAttachments[i - 1].colorBlendOp || + info->pAttachments[i].srcAlphaBlendFactor != info->pAttachments[i - 1].srcAlphaBlendFactor || + info->pAttachments[i].dstAlphaBlendFactor != info->pAttachments[i - 1].dstAlphaBlendFactor || + info->pAttachments[i].alphaBlendOp != info->pAttachments[i - 1].alphaBlendOp || + info->pAttachments[i].colorWriteMask != info->pAttachments[i - 1].colorWriteMask) + { + core10.independentBlend = true; + } + } + } } void check_VkPipelineMultisampleStateCreateInfo(const VkPipelineMultisampleStateCreateInfo* info) @@ -294,6 +312,35 @@ struct feature_detection if (info->depthBoundsTestEnable == VK_TRUE) core10.depthBounds = true; } + void check_VkImageViewCreateInfo(const VkImageViewCreateInfo* info) + { + if (info->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) core10.imageCubeArray = true; + } + + void check_VkCommandBufferInheritanceInfo(const VkCommandBufferInheritanceInfo* info) + { + if (info->occlusionQueryEnable != VK_FALSE || ((info->queryFlags & ~(VK_QUERY_CONTROL_PRECISE_BIT)) == 0)) + { + core10.inheritedQueries = true; + } + } + + void check_VkPipelineViewportStateCreateInfo(const VkPipelineViewportStateCreateInfo* info) + { + if (info->viewportCount > 1 || info->scissorCount > 1) + { + core10.multiViewport = true; + } + } + + void check_VkPipelineViewportExclusiveScissorStateCreateInfoNV(const VkPipelineViewportExclusiveScissorStateCreateInfoNV* info) + { + if (info->exclusiveScissorCount != 0 && info->exclusiveScissorCount != 1) + { + core10.multiViewport = true; + } + } + // --- Checking functions. Call these for all these Vulkan commands after they are successfully called, before returning. --- void check_vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) @@ -331,6 +378,30 @@ struct feature_detection core13.dynamicRendering = true; } + void check_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) + { + if (firstViewport != 0 || viewportCount != 1) + { + core10.multiViewport = true; + } + } + + void check_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) + { + if (firstScissor != 0 || scissorCount != 1) + { + core10.multiViewport = true; + } + } + + void check_vkCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors) + { + if (firstExclusiveScissor != 0 || exclusiveScissorCount != 1) + { + core10.multiViewport = true; + } + } + // --- Remove unused feature bits from these structures --- void adjust_device_extensions(std::unordered_set& exts) @@ -370,6 +441,10 @@ struct feature_detection CHECK_FEATURE10(sparseResidency8Samples); CHECK_FEATURE10(sparseResidency16Samples); CHECK_FEATURE10(sparseResidencyAliased); + CHECK_FEATURE10(independentBlend); + CHECK_FEATURE10(inheritedQueries); + CHECK_FEATURE10(multiViewport); + CHECK_FEATURE10(imageCubeArray); #undef CHECK_FEATURE10 } diff --git a/src/suballocator.cpp b/src/suballocator.cpp index 96bc836..bb04159 100644 --- a/src/suballocator.cpp +++ b/src/suballocator.cpp @@ -335,15 +335,13 @@ suballoc_location suballoc_add_image(uint16_t tid, VkDevice device, VkImage imag return r; } -void suballoc_virtualswap_images(VkDevice device, const std::vector& images) +void suballoc_virtualswap_images(VkDevice device, const std::vector& images, VkMemoryPropertyFlags flags) { assert(run); VkMemoryRequirements2 req = {}; const bool dedicated = fill_image_memreq(device, images.at(0), req, 0); - VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; const uint32_t memoryTypeIndex = get_device_memory_type(req.memoryRequirements.memoryTypeBits, flags); - VkMemoryAllocateInfo info = {}; - info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + VkMemoryAllocateInfo info = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr }; VkDeviceSize image_size = aligned_size(req.memoryRequirements.size, req.memoryRequirements.alignment); info.memoryTypeIndex = memoryTypeIndex; VkDeviceMemory mem = VK_NULL_HANDLE; diff --git a/src/suballocator.h b/src/suballocator.h index 201112b..4d35aae 100644 --- a/src/suballocator.h +++ b/src/suballocator.h @@ -48,4 +48,4 @@ suballoc_location suballoc_find_buffer_memory(uint32_t buffer_index); int suballoc_internal_test(); /// Special handling of virtual swapchain images -void suballoc_virtualswap_images(VkDevice device, const std::vector& images); +void suballoc_virtualswap_images(VkDevice device, const std::vector& images, VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); diff --git a/src/util.cpp b/src/util.cpp index 8e1666c..99566c4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -358,7 +358,11 @@ bool shader_has_buffer_devices_addresses(const uint32_t* code, uint32_t code_siz do { opcode = uint16_t(insn[0]); word_count = uint16_t(insn[0] >> 16); - if (opcode == SpvOpExtension && strcmp((char*)&insn[2], "KHR_physical_storage_buffer") == 0) return true; + if (opcode == SpvOpExtension) + { + if (strcmp((char*)&insn[2], "KHR_physical_storage_buffer") == 0) return true; + else if (strcmp((char*)&insn[2], "EXT_physical_storage_buffer") == 0) return true; + } insn += word_count; } while (insn != code + code_size && opcode != SpvOpMemoryModel);