Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: External memory FD #1930

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions test/test_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ add_subdirectory(multisample-depth)
add_subdirectory(pipeline-binaries)
add_subdirectory(host-image-copy)
add_subdirectory(shader-objects)
add_subdirectory(external-memory-fd)
32 changes: 18 additions & 14 deletions test/test_apps/common/test_app_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,18 +2819,20 @@ std::exception sdl_exception()
return std::runtime_error(SDL_GetError());
}

void device_initialization_phase_1(const std::string& window_name, InitInfo& init)
void device_initialization_phase_2(const std::string& window_name, InitInfo& init)
{
init.window = create_window_sdl(window_name.data(), true, 1024, 1024);
if (!init.instance.headless) {

init.window = create_window_sdl(window_name.data(), true, 1024, 1024);
init.surface = create_surface_sdl(init.instance, init.window);
}
}

void device_initialization_phase_2(InstanceBuilder const& instance_builder, InitInfo& init)
void device_initialization_phase_1(InstanceBuilder const& instance_builder, InitInfo& init)
{
init.instance = instance_builder.build();

init.inst_disp = init.instance.make_table();

init.surface = create_surface_sdl(init.instance, init.window);
}

PhysicalDevice device_initialization_phase_3(PhysicalDeviceSelector& phys_device_selector, InitInfo& init)
Expand All @@ -2857,10 +2859,10 @@ InitInfo device_initialization(const std::string& window_name)
{
InitInfo init;

device_initialization_phase_1(window_name, init);

InstanceBuilder instance_builder;
device_initialization_phase_2(instance_builder, init);
device_initialization_phase_1(instance_builder, init);

device_initialization_phase_2(window_name, init);

PhysicalDeviceSelector phys_device_selector(init.instance);
init.physical_device = device_initialization_phase_3(phys_device_selector, init);
Expand Down Expand Up @@ -2900,11 +2902,11 @@ void recreate_init_swapchain(SwapchainBuilder& swapchain_builder, InitInfo& init

void TestAppBase::run(const std::string& window_name)
{
device_initialization_phase_1(window_name, init);

InstanceBuilder instance_builder;
configure_instance_builder(instance_builder);
device_initialization_phase_2(instance_builder, init);
device_initialization_phase_1(instance_builder, init);

device_initialization_phase_2(window_name, init);

PhysicalDeviceSelector phys_device_selector(init.instance);
configure_physical_device_selector(phys_device_selector);
Expand All @@ -2914,9 +2916,11 @@ void TestAppBase::run(const std::string& window_name)
configure_device_builder(device_builder, init.physical_device);
device_initialization_phase_4(device_builder, init);

SwapchainBuilder swapchain_builder{ init.device };
configure_swapchain_builder(swapchain_builder);
device_initialization_phase_5(swapchain_builder, init);
if (!init.instance.headless) {
SwapchainBuilder swapchain_builder{ init.device };
configure_swapchain_builder(swapchain_builder);
device_initialization_phase_5(swapchain_builder, init);
}

setup();

Expand Down
2 changes: 1 addition & 1 deletion test/test_apps/common/test_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ struct Instance
// Return a loaded instance dispatch table
vkb::InstanceDispatchTable make_table() const;

private:
bool headless = false;
private:
bool properties2_ext_enabled = false;
uint32_t instance_version = VKB_VK_API_VERSION_1_0;
uint32_t api_version = VKB_VK_API_VERSION_1_0;
Expand Down
28 changes: 28 additions & 0 deletions test/test_apps/external-memory-fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
###############################################################################
# Copyright (c) 2024 LunarG, Inc.
# All rights reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Author: LunarG Team
# Description: CMake script for VK_KHR_external_memory_fd tests
###############################################################################

add_subdirectory(export)
add_subdirectory(import)
71 changes: 71 additions & 0 deletions test/test_apps/external-memory-fd/export/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
###############################################################################
# Copyright (c) 2024 LunarG, Inc.
# All rights reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Author: LunarG Team
# Description: CMake script for VK_KHR_external_memory_fd export test app
###############################################################################

add_executable(gfxrecon-external-memory-fd-export "")

target_sources(gfxrecon-external-memory-fd-export
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/app.cpp
${CMAKE_CURRENT_LIST_DIR}/../../common/test_app_base.cpp)

target_include_directories(gfxrecon-external-memory-fd-export PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}/../../common)

target_link_libraries(gfxrecon-external-memory-fd-export
gfxrecon_application
gfxrecon_decode
gfxrecon_graphics
gfxrecon_format
gfxrecon_util
SDL3::SDL3
platform_specific)

if (MSVC)
# Force inclusion of "gfxrecon_disable_popup_result" variable in linking.
# On 32-bit windows, MSVC prefixes symbols with "_" but on 64-bit windows it doesn't.
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_options(gfxrecon-replay PUBLIC "LINKER:/Include:_gfxrecon_disable_popup_result")
else()
target_link_options(gfxrecon-replay PUBLIC "LINKER:/Include:gfxrecon_disable_popup_result")
endif()
endif()

common_build_directives(gfxrecon-external-memory-fd-export)

add_custom_command(
TARGET gfxrecon-external-memory-fd-export
POST_BUILD
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
if (WIN32)
add_custom_command(TARGET gfxrecon-external-memory-fd-export POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:gfxrecon-external-memory-fd-export> $<TARGET_FILE_DIR:gfxrecon-external-memory-fd-export>
COMMAND_EXPAND_LISTS)
endif ()

install(TARGETS gfxrecon-external-memory-fd-export RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

add_dependencies(gfxrecon-testapps gfxrecon-external-memory-fd-export)
Loading
Loading