Skip to content

Commit

Permalink
Fixed test not compiling shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrael1 committed Aug 27, 2024
1 parent 2683cfe commit e962c8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ foreach(SHADER ${SHADERS})
get_filename_component(FILE_NAME ${SHADER} NAME)

# Put the .spv files into the bin folder
set(SPIRV_BIN ${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.spv)

This comment has been minimized.

Copy link
@adam-sawicki-a

adam-sawicki-a Aug 27, 2024

Contributor

Why are those changes in the Cmake script needed? They seem unrelated to the subject of this pull request. Is there something wrong with your development environment that makes it not working for you?

This comment has been minimized.

Copy link
@Agrael1

Agrael1 Aug 27, 2024

Author Contributor

I couldn't launch the app without those changes. The App was compiled at standard path:
./out/build/debug-x64/src

and shaders are compiled to ./bin/
no wonder .exe couldn't pick them

set(SPIRV ${PROJECT_SOURCE_DIR}/bin/${FILE_NAME}.spv)


add_custom_command(
OUTPUT ${SPIRV}
# Use the same file name and append .spv to the compiled shader
COMMAND ${GLSL_VALIDATOR} -V ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER} -o ${SPIRV}
DEPENDS ${SHADER}
)
add_custom_command(
OUTPUT ${SPIRV_BIN}
# Use the same file name and append .spv to the compiled shader
COMMAND ${GLSL_VALIDATOR} -V ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER} -o ${SPIRV_BIN}
DEPENDS ${SHADER}
)

list(APPEND SPIRV_FILES ${SPIRV})
endforeach()
Expand Down
2 changes: 2 additions & 0 deletions src/Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8313,6 +8313,8 @@ static void TestWin32Handles()
vmaDestroyBuffer(g_hAllocator, buf, alloc);
TEST(CloseHandle(handle));
TEST(CloseHandle(handle2));

vmaDestroyPool(g_hAllocator, pool);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions src/VulkanSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#pragma comment(lib, "shlwapi.lib")

static const char* const SHADER_PATH1 = "./";
static const char* const SHADER_PATH1 = "./Shaders/";
static const char* const SHADER_PATH2 = "../bin/";
static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_KHRONOS_validation";
Expand Down Expand Up @@ -1884,7 +1884,7 @@ static void InitializeApplication()
else if(strcmp(physicalDeviceExtensionProperties[i].extensionName, VK_KHR_MAINTENANCE_5_EXTENSION_NAME) == 0)
VK_KHR_maintenance5_enabled = true;
else if (strcmp(physicalDeviceExtensionProperties[i].extensionName, VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME) == 0)
VK_KHR_external_memory_win32_enabled = true;
VK_KHR_external_memory_win32_enabled = VMA_DYNAMIC_VULKAN_FUNCTIONS;
}

if(GetVulkanApiVersion() >= VK_API_VERSION_1_2)
Expand Down

0 comments on commit e962c8c

Please sign in to comment.