-
Notifications
You must be signed in to change notification settings - Fork 422
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
Clean up for "ExtensionNotEnabled" with prerequisite framework fixes. #320
Changes from all commits
d46951c
3ecd90d
482a8b5
42f7372
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,6 +434,8 @@ class VkLayerTest : public VkRenderFramework { | |
|
||
protected: | ||
ErrorMonitor *m_errorMonitor; | ||
uint32_t m_instance_api_version = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "instance" version is what enumerates... (or by failing to enumerate informs us of being 1.0). The "target version" is what the framework will try to create. |
||
uint32_t m_target_api_version = 0; | ||
|
||
public: | ||
ErrorMonitor *Monitor() { return m_errorMonitor; } | ||
|
@@ -498,6 +500,31 @@ class VkLayerTest : public VkRenderFramework { | |
this->app_info.apiVersion = VK_API_VERSION_1_0; | ||
|
||
m_errorMonitor = new ErrorMonitor; | ||
|
||
// Find out what version the instance supports and record the default target instance | ||
auto enumerateInstanceVersion = | ||
(PFN_vkEnumerateInstanceVersion)vkGetInstanceProcAddr(nullptr, "vkEnumerateInstanceVersion"); | ||
if (enumerateInstanceVersion) { | ||
enumerateInstanceVersion(&m_instance_api_version); | ||
} else { | ||
m_instance_api_version = VK_API_VERSION_1_0; | ||
} | ||
m_target_api_version = app_info.apiVersion; | ||
} | ||
|
||
uint32_t SetTargetApiVersion(uint32_t target_api_version) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not binding on the framework, the return is what CreateInstance will request. |
||
if (target_api_version == 0) target_api_version = VK_API_VERSION_1_0; | ||
if (target_api_version <= m_instance_api_version) { | ||
m_target_api_version = target_api_version; | ||
app_info.apiVersion = m_target_api_version; | ||
} | ||
return m_target_api_version; | ||
} | ||
uint32_t DeviceValidationVersion() { | ||
// The validation layers, assume the version we are validating to is the apiVersion unless the device apiVersion is lower | ||
VkPhysicalDeviceProperties props; | ||
GetPhysicalDeviceProperties(&props); | ||
return std::min(m_target_api_version, props.apiVersion); | ||
} | ||
|
||
bool LoadDeviceProfileLayer( | ||
|
@@ -22053,7 +22080,7 @@ TEST_F(VkLayerTest, CopyImageTypeExtentMismatchMaintenance1) { | |
|
||
TEST_F(VkLayerTest, CopyImageCompressedBlockAlignment) { | ||
// Image copy tests on compressed images with block alignment errors | ||
|
||
SetTargetApiVersion(VK_API_VERSION_1_1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test really is 1.1 aware and thus should request 1.1. We don't care about what is request, as we test below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also the case for the other tests with this call added. |
||
ASSERT_NO_FATAL_FAILURE(Init()); | ||
|
||
// Select a compressed format and verify support | ||
|
@@ -22124,7 +22151,7 @@ TEST_F(VkLayerTest, CopyImageCompressedBlockAlignment) { | |
|
||
std::string vuid; | ||
bool ycbcr = (DeviceExtensionEnabled(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME) || | ||
(m_device->props.apiVersion >= VK_API_VERSION_1_1)); | ||
(DeviceValidationVersion() >= VK_API_VERSION_1_1)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The call hides the logic matching the logic the validation uses for "how we will validate" |
||
|
||
// Src, Dest offsets must be multiples of compressed block sizes {4, 4, 1} | ||
// Image transfer granularity gets set to compressed block size, so an ITG error is also (unavoidably) triggered. | ||
|
@@ -22849,6 +22876,7 @@ TEST_F(VkLayerTest, CopyImageSampleCountMismatch) { | |
|
||
TEST_F(VkLayerTest, CopyImageAspectMismatch) { | ||
TEST_DESCRIPTION("Image copies with aspect mask errors"); | ||
SetTargetApiVersion(VK_API_VERSION_1_1); | ||
ASSERT_NO_FATAL_FAILURE(Init()); | ||
auto ds_format = FindSupportedDepthStencilFormat(gpu()); | ||
if (!ds_format) { | ||
|
@@ -22897,7 +22925,7 @@ TEST_F(VkLayerTest, CopyImageAspectMismatch) { | |
// Src and dest aspect masks don't match | ||
copyRegion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT; | ||
bool ycbcr = (DeviceExtensionEnabled(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME) || | ||
(m_device->props.apiVersion >= VK_API_VERSION_1_1)); | ||
(DeviceValidationVersion() >= VK_API_VERSION_1_1)); | ||
std::string vuid = (ycbcr ? "VUID-VkImageCopy-srcImage-01551" : "VUID-VkImageCopy-aspectMask-00137"); | ||
m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, vuid); | ||
vkCmdCopyImage(m_commandBuffer->handle(), ds_image.handle(), VK_IMAGE_LAYOUT_GENERAL, ds_image.handle(), | ||
|
@@ -23795,16 +23823,26 @@ TEST_F(VkLayerTest, ExecuteSecondaryCBWithLayoutMismatch) { | |
TEST_F(VkLayerTest, ExtensionNotEnabled) { | ||
TEST_DESCRIPTION("Validate that using an API from an unenabled extension returns an error"); | ||
|
||
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); | ||
|
||
// Do NOT enable prerequesite extensions for YCBCR... | ||
// Do NOT enable VK_KHR_maintenance1 | ||
if (DeviceExtensionSupported(gpu(), nullptr, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME)) { | ||
m_device_extension_names.push_back(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME); | ||
if (InstanceExtensionSupported(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests is changed is to ensure that we get the same single error we expect on 1.0 and 1.1 drivers. |
||
m_instance_extension_names.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); | ||
} else { | ||
printf("%s test requires KHR YCBR conversion extension, not available. Skipping.\n", kSkipPrefix); | ||
printf("%s Did not find required instance extension %s; skipped.\n", kSkipPrefix, | ||
VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); | ||
return; | ||
} | ||
ASSERT_NO_FATAL_FAILURE(InitFramework(myDbgFunc, m_errorMonitor)); | ||
|
||
// Required extensions except VK_KHR_GET_MEMORY_REQUIREMENTS_2 -- to create the needed error | ||
std::vector<const char *> required_device_extensions = {VK_KHR_MAINTENANCE1_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, | ||
VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME}; | ||
for (auto dev_ext : required_device_extensions) { | ||
if (DeviceExtensionSupported(gpu(), nullptr, dev_ext)) { | ||
m_device_extension_names.push_back(dev_ext); | ||
} else { | ||
printf("%s Did not find required device extension %s; skipped.\n", kSkipPrefix, dev_ext); | ||
break; | ||
} | ||
} | ||
|
||
// Need to ignore this error to get to the one we're testing | ||
m_errorMonitor->SetUnexpectedError("VUID-vkCreateDevice-ppEnabledExtensionNames-01387"); | ||
|
@@ -23932,6 +23970,7 @@ TEST_F(VkLayerTest, InvalidCreateBufferSize) { | |
TEST_F(VkLayerTest, SetDynViewportParamTests) { | ||
TEST_DESCRIPTION("Test parameters of vkCmdSetViewport without multiViewport feature"); | ||
|
||
SetTargetApiVersion(VK_API_VERSION_1_1); | ||
VkPhysicalDeviceFeatures features{}; | ||
ASSERT_NO_FATAL_FAILURE(Init(&features)); | ||
|
||
|
@@ -24006,7 +24045,7 @@ TEST_F(VkLayerTest, SetDynViewportParamTests) { | |
{{0.0, 0.0, 64.0, 64.0, 0.0, NAN}, "VUID-VkViewport-maxDepth-01235"}, | ||
}; | ||
|
||
if (m_device->props.apiVersion < VK_API_VERSION_1_1) { | ||
if (DeviceValidationVersion() < VK_API_VERSION_1_1) { | ||
test_cases.push_back({{0.0, 0.0, 64.0, 0.0, 0.0, 1.0}, "VUID-VkViewport-height-01772"}); | ||
test_cases.push_back({{0.0, 0.0, 64.0, NAN, 0.0, 1.0}, "VUID-VkViewport-height-01772"}); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the driver version can be more or less than the instance version. For purposes of validation, if the application version is less than the driver version, we'll validate as if the driver was the lesser version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the instance supplied version is the lesser of the instances enumerated version and the apiVersion supplied to CreateInstance. (if the apiVersion is higher than the enumerated version, CreateInstance fails)