Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@

# Release Notes

## [Vulkan Profiles Tools 1.4.3XX](https://github.com/KhronosGroup/Vulkan-Profiles/tree/main) - July 2026
## [Vulkan Profiles Tools 1.4.3XX](https://github.com/KhronosGroup/Vulkan-Profiles/tree/main) - September 2026

### Features:
- Implement `VK_NO_PROTOTYPES` support #734

### Deprecation:
- Require Vulkan 1.1

## [Vulkan Profiles Tools 1.4.356](https://github.com/KhronosGroup/Vulkan-Profiles/tree/sdk-1.4.356.0) - July 2026

### Features:
- Add `profiles.py` python script, to pull dependent extensions into a source profiles file (ALPHA)
Expand Down
257 changes: 186 additions & 71 deletions library/TUTORIAL.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions library/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,22 @@ add_unit_test_simple(test_mocked_api_create_device)
if (NOT ANDROID)
add_unit_test_simple(test_mocked_api_generated_library)
endif()

function(add_unit_test_no_prototypes NAME)
set(TEST_FILE ./${NAME}.cpp)
set(TEST_NAME VpLibrary_${NAME})

add_executable(${TEST_NAME} ${TEST_FILE})
if(MSVC)
target_compile_options(${TEST_NAME} PRIVATE /bigobj)
endif()
target_compile_definitions(${TEST_NAME} PUBLIC "VK_NO_PROTOTYPES=1")
target_compile_definitions(${TEST_NAME} PUBLIC "VK_ENABLE_BETA_EXTENSIONS=1")
target_include_directories(${TEST_NAME} PUBLIC "${vulkan-headers_SOURCE_DIR}/include")
target_link_libraries(${TEST_NAME} PRIVATE GTest::gtest GTest::gtest_main Vulkan::Headers Vulkan::Profiles Vulkan::CompilerConfiguration Vulkan::CompilerConfigurationExtra)
add_dependencies(${TEST_NAME} VpGenerated VpLibrary_test_generated_library)
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} --gtest_catch_exceptions=0)
set_target_properties(${TEST_NAME} PROPERTIES FOLDER "Profiles API library")
endfunction()

add_unit_test_no_prototypes(test_api_no_prototypes_loading)
24 changes: 24 additions & 0 deletions library/test/mock_vulkan_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <unordered_map>
#include <algorithm>

#ifndef VP_USE_OBJECT
#define VP_USE_OBJECT 1
#endif

struct VulkanStructData {
VkStructureType sType;
std::vector<uint8_t> contents;
Expand Down Expand Up @@ -177,6 +181,7 @@ class MockVulkanAPI final
VkPhysicalDevice vkPhysicalDevice;
VkDevice vkDevice;
VkAllocationCallbacks vkAllocator;
VpFunctions functions;

MockVulkanAPI()
: m_instanceProcAddr{}
Expand All @@ -198,10 +203,27 @@ class MockVulkanAPI final
, vkAllocator{}
{
sInstance = this;

VpFunctionsCreateInfo functionsCreateInfo{};
functionsCreateInfo.GetInstanceProcAddr = MockVulkanAPI::vkGetInstanceProcAddr;
functionsCreateInfo.EnumerateInstanceVersion = MockVulkanAPI::vkEnumerateInstanceVersion;
functionsCreateInfo.EnumerateInstanceExtensionProperties = MockVulkanAPI::vkEnumerateInstanceExtensionProperties;
functionsCreateInfo.EnumerateDeviceExtensionProperties = MockVulkanAPI::vkEnumerateDeviceExtensionProperties;
functionsCreateInfo.CreateInstance = MockVulkanAPI::vkCreateInstance;
functionsCreateInfo.CreateDevice = MockVulkanAPI::vkCreateDevice;
functionsCreateInfo.GetPhysicalDeviceFeatures2 = MockVulkanAPI::vkGetPhysicalDeviceFeatures2;
functionsCreateInfo.GetPhysicalDeviceFormatProperties2 = MockVulkanAPI::vkGetPhysicalDeviceFormatProperties2;
functionsCreateInfo.GetPhysicalDeviceProperties2 = MockVulkanAPI::vkGetPhysicalDeviceProperties2;
functionsCreateInfo.GetPhysicalDeviceQueueFamilyProperties2 = MockVulkanAPI::vkGetPhysicalDeviceQueueFamilyProperties2;

VkResult result = vpCreateFunctions(&functionsCreateInfo, nullptr, &this->functions);
assert(result == VK_SUCCESS);
}

~MockVulkanAPI()
{
vpDestroyFunctions(this->functions, nullptr);

sInstance = nullptr;
}

Expand Down Expand Up @@ -255,6 +277,7 @@ class MockVulkanAPI final

void SetInstanceAPIVersion(uint32_t version)
{
VpInstanceFunctionsLoadFlags loadInstanceFlags{};
m_instanceAPIVersion = version;
if (version >= VK_API_VERSION_1_1) {
AddInstanceProc(nullptr, "vkEnumerateInstanceVersion", &vkEnumerateInstanceVersion);
Expand All @@ -275,6 +298,7 @@ class MockVulkanAPI final
RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceProperties2");
RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceFormatProperties2");
RemoveInstanceProc(vkInstance, "vkGetPhysicalDeviceQueueFamilyProperties2");
loadInstanceFlags = VP_INSTANCE_FUNCTIONS_LOAD_KHR_GET_PHYSICAL_DEVICE_PROPERTIES2_BIT;
}
}

Expand Down
80 changes: 80 additions & 0 deletions library/test/test_api_no_prototypes_loading.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2021-2026 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef VP_USE_OBJECT
#define VP_USE_OBJECT 1
#endif

#ifndef VK_NO_PROTOTYPES
#define VK_NO_PROTOTYPES 1
#endif

#ifndef VP_DISABLE_STATIC_LINKING
#define VP_DISABLE_STATIC_LINKING 1
#endif

#ifndef VULKAN_PROFILES_HEADER_ONLY
#include <vulkan/vulkan_profiles.hpp>
#else
#include <vulkan/debug/vulkan_profiles.h>
#endif

#include <gtest/gtest.h>
#include <vulkan/vulkan.hpp>

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);

int result = RUN_ALL_TESTS();

return result;
}

TEST(no_prototypes, create_instance_with_dynamic_pointers) {
vk::detail::DispatchLoaderDynamic dl;
dl.init();

VpFunctionsCreateInfo functionsCreateInfo{};

VpFunctions functions;
vpCreateFunctions(&functionsCreateInfo, nullptr, &functions);

EXPECT_TRUE(vpInitializeGlobalFunctions(functions, dl.vkGetInstanceProcAddr) == VK_SUCCESS);

VkApplicationInfo ai{};
ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
ai.pApplicationName = "Testing scaffold";
ai.applicationVersion = VK_MAKE_VERSION(1, 2, 0);
ai.pEngineName = "No Engine";
ai.engineVersion = VK_MAKE_VERSION(1, 2, 0);
ai.apiVersion = VK_API_VERSION_1_2;

VkInstanceCreateInfo ici{};
ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
ici.pApplicationInfo = &ai;

#if defined(__APPLE__)
const char* extensions[] = { VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME };
ici.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
ici.enabledExtensionCount = 1;
ici.ppEnabledExtensionNames = extensions;
#endif

VpInstanceCreateInfo createInfo{ &ici, 0, 0, nullptr };

VkInstance instance = VK_NULL_HANDLE;
EXPECT_TRUE(vpCreateInstance(functions, &createInfo, nullptr, &instance) == VK_SUCCESS);
}
Loading
Loading