Skip to content

Commit

Permalink
tests: Use AddRequiredFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
arno-lunarg committed May 13, 2024
1 parent f20bed5 commit 5b41904
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
23 changes: 7 additions & 16 deletions tests/unit/gpu_av_indirect_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,9 @@ TEST_F(NegativeGpuAVIndirectBuffer, DrawCountDeviceLimitSubmit2) {
props.limits.maxDrawIndirectCount = 1;
fpvkSetPhysicalDeviceLimitsEXT(gpu(), &props.limits);

VkPhysicalDeviceVulkan13Features features_13 = vku::InitStructHelper();
VkPhysicalDeviceVulkan12Features features_12 = vku::InitStructHelper(&features_13);
VkPhysicalDeviceFeatures2 features2 = vku::InitStructHelper(&features_12);
GetPhysicalDeviceFeatures2(features2);
if (!features_12.drawIndirectCount) {
GTEST_SKIP() << "drawIndirectCount not supported";
}
RETURN_IF_SKIP(InitState(nullptr, &features2));
AddRequiredFeature(vkt::Feature::drawIndirectCount);
AddRequiredFeature(vkt::Feature::synchronization2);
RETURN_IF_SKIP(InitState());
InitRenderTarget();

vkt::Buffer draw_buffer(*m_device, 2 * sizeof(VkDrawIndexedIndirectCommand), VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT,
Expand Down Expand Up @@ -546,11 +541,8 @@ TEST_F(NegativeGpuAVIndirectBuffer, FirstInstance) {
AddRequiredExtensions(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
RETURN_IF_SKIP(InitGpuAvFramework());

VkPhysicalDeviceFeatures2 features2 = vku::InitStructHelper();
GetPhysicalDeviceFeatures2(features2);
features2.features.drawIndirectFirstInstance = VK_FALSE;

RETURN_IF_SKIP(InitState(nullptr, &features2));
AddDisabledFeature(vkt::Feature::drawIndirectFirstInstance);
RETURN_IF_SKIP(InitState(nullptr));
InitRenderTarget();

vkt::Buffer draw_buffer(*m_device, 4 * sizeof(VkDrawIndirectCommand), VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT,
Expand Down Expand Up @@ -724,9 +716,8 @@ TEST_F(NegativeGpuAVIndirectBuffer, DispatchWorkgroupSizeShaderObjects) {
props.limits.maxComputeWorkGroupCount[2] = 2;
fpvkSetPhysicalDeviceLimitsEXT(gpu(), &props.limits);

VkPhysicalDeviceShaderObjectFeaturesEXT shaderObjectFeatures = vku::InitStructHelper();
auto features2 = GetPhysicalDeviceFeatures2(shaderObjectFeatures);
RETURN_IF_SKIP(InitState(nullptr, &features2));
AddRequiredFeature(vkt::Feature::shaderObject);
RETURN_IF_SKIP(InitState());

vkt::Buffer indirect_buffer(*m_device, 5 * sizeof(VkDispatchIndirectCommand), VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
Expand Down
22 changes: 7 additions & 15 deletions tests/unit/gpu_av_oob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ TEST_F(NegativeGpuAVOOB, RobustBuffer) {
AddRequiredExtensions(VK_EXT_PIPELINE_ROBUSTNESS_EXTENSION_NAME);
RETURN_IF_SKIP(InitGpuAvFramework());

VkPhysicalDevicePipelineRobustnessFeaturesEXT pipeline_robustness_features = vku::InitStructHelper();
auto features2 = GetPhysicalDeviceFeatures2(pipeline_robustness_features);
features2.features.robustBufferAccess = VK_FALSE;
if (!pipeline_robustness_features.pipelineRobustness) {
GTEST_SKIP() << "pipelineRobustness feature not supported";
}
RETURN_IF_SKIP(InitState(nullptr, &features2));
AddRequiredFeature(vkt::Feature::pipelineRobustness);
RETURN_IF_SKIP(InitState());
InitRenderTarget();
VkMemoryPropertyFlags reqs = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
vkt::Buffer uniform_buffer(*m_device, 4, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, reqs);
Expand Down Expand Up @@ -161,15 +156,12 @@ void NegativeGpuAVOOB::ShaderBufferSizeTest(VkDeviceSize buffer_size, VkDeviceSi
}
RETURN_IF_SKIP(InitGpuAvFramework());

VkPhysicalDeviceDynamicRenderingFeatures dynamic_rendering_features = vku::InitStructHelper();
dynamic_rendering_features.dynamicRendering = VK_TRUE;
VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = vku::InitStructHelper(&dynamic_rendering_features);
shader_object_features.shaderObject = VK_TRUE;
VkPhysicalDeviceFeatures2 features = vku::InitStructHelper(); // Make sure robust buffer access is not enabled
AddDisabledFeature(vkt::Feature::robustBufferAccess);
if (shader_objects) {
features.pNext = &shader_object_features;
AddRequiredFeature(vkt::Feature::dynamicRendering);
AddRequiredFeature(vkt::Feature::shaderObject);
}
RETURN_IF_SKIP(InitState(nullptr, &features));
RETURN_IF_SKIP(InitState());
if (shader_objects) {
InitDynamicRenderTarget();
} else {
Expand Down Expand Up @@ -1489,4 +1481,4 @@ TEST_F(NegativeGpuAVOOB, VertexFragmentMultiEntrypoint) {
m_default_queue->Submit(*m_commandBuffer);
m_default_queue->Wait();
m_errorMonitor->VerifyFound();
}
}

0 comments on commit 5b41904

Please sign in to comment.