Skip to content

Commit

Permalink
Added tests for Vulkan compatibility mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Feb 8, 2025
1 parent 8099c3e commit 4cf93c9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
19 changes: 10 additions & 9 deletions SampleBase/include/SampleApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,16 @@ class SampleApp : public NativeAppBase
Uint32 m_AdapterId = DEFAULT_ADAPTER_ID;
ADAPTER_TYPE m_AdapterType = ADAPTER_TYPE_UNKNOWN;
std::string m_AdapterDetailsString;
int m_SelectedDisplayMode = 0;
bool m_bVSync = false;
bool m_bFullScreenMode = false;
bool m_bShowAdaptersDialog = true;
bool m_bShowUI = true;
bool m_bForceNonSeprblProgs = false;
bool m_bBreakOnError = true;
double m_CurrentTime = 0;
Uint32 m_MaxFrameLatency = SwapChainDesc{}.BufferCount;
int m_SelectedDisplayMode = 0;
bool m_bVSync = false;
bool m_bFullScreenMode = false;
bool m_bShowAdaptersDialog = true;
bool m_bShowUI = true;
bool m_bForceNonSeprblProgs = false;
bool m_bVulkanCompatibilityMode = false;
bool m_bBreakOnError = true;
double m_CurrentTime = 0;
Uint32 m_MaxFrameLatency = SwapChainDesc{}.BufferCount;

// We will need this when we have to recreate the swap chain (on Android)
SwapChainDesc m_SwapChainInitDesc;
Expand Down
7 changes: 7 additions & 0 deletions SampleBase/src/SampleApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,12 @@ void SampleApp::InitializeDiligentEngine(const NativeWindow* pWindow)
EngineCI.AdapterId = FindAdapter(pFactoryVk, EngineCI.GraphicsAPIVersion, m_AdapterAttribs);
m_TheSample->ModifyEngineInitInfo({pFactoryVk, m_DeviceType, EngineCI, m_SwapChainInitDesc});

if (m_bVulkanCompatibilityMode)
{
LOG_INFO_MESSAGE(TextColorCode::Magenta, "Using Vulkan compatibility mode");
EngineCI.FeaturesVk = DeviceFeaturesVk{DEVICE_FEATURE_STATE_DISABLED};
}

NumImmediateContexts = std::max(1u, EngineCI.NumImmediateContexts);
ppContexts.resize(NumImmediateContexts + EngineCI.NumDeferredContexts);
pFactoryVk->CreateDeviceAndContextsVk(EngineCI, &m_pDevice, ppContexts.data());
Expand Down Expand Up @@ -832,6 +838,7 @@ SampleApp::CommandLineStatus SampleApp::ProcessCommandLine(int argc, const char*
ArgsParser.Parse("golden_image_tolerance", m_GoldenImgPixelTolerance);
ArgsParser.Parse("vsync", m_bVSync);
ArgsParser.Parse("non_separable_progs", m_bForceNonSeprblProgs);
ArgsParser.Parse("vk_compatibility", m_bVulkanCompatibilityMode);
ArgsParser.Parse("break_on_error", m_bBreakOnError);


Expand Down
38 changes: 30 additions & 8 deletions Tests/ProcessGoldenImages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,15 @@ declare -a TestApps=(
"Tutorials/Tutorial10_DataStreaming"
"Tutorials/Tutorial11_ResourceUpdates"
"Tutorials/Tutorial12_RenderTarget"
"Tutorials/Tutorial12_RenderTarget --vk_compatibility 1"
"Tutorials/Tutorial13_ShadowMap"
"Tutorials/Tutorial13_ShadowMap --vk_compatibility 1"
"Tutorials/Tutorial14_ComputeShader"
# "Tutorials/Tutorial16_BindlessResources" does not work properly on llvmpipe
"Tutorials/Tutorial17_MSAA"
"Tutorials/Tutorial18_Queries --show_ui 0"
"Tutorials/Tutorial19_RenderPasses"
"Tutorials/Tutorial19_RenderPasses --vk_compatibility 1"
"Tutorials/Tutorial20_MeshShader --show_ui 0"
"Tutorials/Tutorial21_RayTracing --show_ui 0"
"Tutorials/Tutorial23_CommandQueues --show_ui 0"
Expand All @@ -106,8 +109,11 @@ declare -a TestApps=(
# On the second run the states should be loaded from the cache
"Tutorials/Tutorial26_StateCache --show_ui 0"
"Tutorials/Tutorial29_OIT --show_ui 0"
"Tutorials/Tutorial29_OIT --show_ui 0 --vk_compatibility 1"
"Samples/Atmosphere --show_ui 0"
"Samples/Atmosphere --show_ui 0 --vk_compatibility 1"
"Samples/GLTFViewer --show_ui 0 --use_cache 1"
"Samples/GLTFViewer --show_ui 0 --use_cache 1 --vk_compatibility 1"
"Samples/NuklearDemo --show_ui 0"
"Samples/Shadows --show_ui 0"
# "Samples/ImguiDemo" has fps counter in the UI, so we have to skip it
Expand All @@ -118,6 +124,22 @@ tests_passed=0
tests_skipped=0
overall_status=""

function get_argument_value {
local arg_name=$1
local default_value=$2
shift 2
local args=("$@")

for i in "${!args[@]}"; do
if [[ "${args[$i]}" == "$arg_name" ]]; then
let j=i+1
echo "${args[$j]}"
return
fi
done
echo "$default_value"
}

function process_golden_img
{
IFS='/ ' read -r -a inputs <<< "$1"
Expand Down Expand Up @@ -156,17 +178,17 @@ function process_golden_img
skip_test=0
if [[ "$backend_name" == "gl" ]]; then
if [[ "$app_name" == "Tutorial07_GeometryShader" || "$app_name" == "Tutorial08_Tessellation" ]]; then
for i in "${!args[@]}"; do
if [[ "${args[$i]}" == "--non_separable_progs" ]]; then
let j=i+1
if [[ "${args[$j]}" != "0" ]]; then
skip_test=1
fi
fi
done
local non_separable_progs=$(get_argument_value "--non_separable_progs" "0" "${args[@]}")
if [[ "$non_separable_progs" != "0" ]]; then
skip_test=1
fi
elif [[ "$app_name" == "Tutorial20_MeshShader" || "$app_name" == "Tutorial21_RayTracing" ]]; then
skip_test=1
fi
local vk_compatibility=$(get_argument_value "--vk_compatibility" "0" "${extra_args[@]}")
if [[ "$vk_compatibility" != "0" ]]; then
skip_test=1
fi
fi

if [[ "$skip_test" == "0" ]]; then
Expand Down

0 comments on commit 4cf93c9

Please sign in to comment.