aboutsummaryrefslogtreecommitdiff
path: root/tests/vklayertests_pipeline_shader.cpp
diff options
context:
space:
mode:
authorJohn Zulauf <jzulauf@lunarg.com>2019-06-29 08:01:49 -0600
committerJohn Zulauf <32470354+jzulauf-lunarg@users.noreply.github.com>2019-07-01 09:20:35 -0600
commit29b2041fed94f3730a8385c79bcd4105b8161e01 (patch)
tree62f3a2101c2b83618e5ad4c438c583c50543ab9d /tests/vklayertests_pipeline_shader.cpp
parent5e3bf3d651e08cb7464f6c7270a9637239fc13bb (diff)
downloadvulkan-validation-layers-29b2041fed94f3730a8385c79bcd4105b8161e01.tar.gz
tests: Fix two platform specific test issues
1) Extension availabilty was not being tested before use 2) Invalid content was being rejected at an earlier point by some platforms than others, and the failure not handled. Quick fix layer crash from invalid handles, but indicates (Note added) a need for validation to check the invalid content (a shader) earlier with matching changes to unit test needed. Change-Id: I344d493f4ba0ec2bc49ff8e1d393211c98c1eaf1
Diffstat (limited to 'tests/vklayertests_pipeline_shader.cpp')
-rw-r--r--tests/vklayertests_pipeline_shader.cpp89
1 files changed, 52 insertions, 37 deletions
diff --git a/tests/vklayertests_pipeline_shader.cpp b/tests/vklayertests_pipeline_shader.cpp
index 26214c701..5c11baa2e 100644
--- a/tests/vklayertests_pipeline_shader.cpp
+++ b/tests/vklayertests_pipeline_shader.cpp
@@ -5089,7 +5089,13 @@ TEST_F(VkLayerTest, SubgroupSupportedOperations) {
module_create_info.codeSize = spv.size() * sizeof(unsigned int);
module_create_info.flags = 0;
- vkCreateShaderModule(m_device->handle(), &module_create_info, NULL, &shader_module[i]);
+ VkResult result = vkCreateShaderModule(m_device->handle(), &module_create_info, NULL, &shader_module[i]);
+
+ // NOTE: It appears that for the case of invalid capabilities some drivers (recent AMD) fail at CreateShaderModule time.
+ // Likely the capability test should be moved up to CSM time, implementing ShaderModuleCreateInfo-pCode-01090
+ // Note(2) -- yes I truncated the above VUID s.t. the VUID checking tools would not catch it.
+ if (result != VK_SUCCESS) shader_module[i] = VK_NULL_HANDLE;
+
stage[i].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
stage[i].pNext = nullptr;
stage[i].flags = 0;
@@ -5110,48 +5116,52 @@ TEST_F(VkLayerTest, SubgroupSupportedOperations) {
pipeline_info.stage = stage[0];
pipeline_info.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT;
- if (!(subgroup_prop.supportedOperations & capability.second)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedOperations");
- }
- if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedStages");
- }
+ if (pipeline_info.stage.module != VK_NULL_HANDLE) {
+ if (!(subgroup_prop.supportedOperations & capability.second)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedOperations");
+ }
+ if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedStages");
+ }
- VkPipeline cs_pipeline;
- vkCreateComputePipelines(device(), VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &cs_pipeline);
- vkDestroyPipeline(device(), cs_pipeline, nullptr);
+ VkPipeline cs_pipeline;
+ vkCreateComputePipelines(device(), VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &cs_pipeline);
+ vkDestroyPipeline(device(), cs_pipeline, nullptr);
- m_errorMonitor->VerifyFound();
+ m_errorMonitor->VerifyFound();
+ }
- stage[1].stage = VK_SHADER_STAGE_VERTEX_BIT;
- stage[2].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
+ if ((stage[1].module != VK_NULL_HANDLE) && (stage[2].module != VK_NULL_HANDLE)) {
+ stage[1].stage = VK_SHADER_STAGE_VERTEX_BIT;
+ stage[2].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
- VkPipelineObj pipe(m_device);
- pipe.AddShader(stage[1]);
- pipe.AddShader(stage[2]);
- pipe.AddDefaultColorAttachment();
+ VkPipelineObj pipe(m_device);
+ pipe.AddShader(stage[1]);
+ pipe.AddShader(stage[2]);
+ pipe.AddDefaultColorAttachment();
- if (!(subgroup_prop.supportedOperations & capability.second)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedOperations");
- }
- if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_VERTEX_BIT)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedStages");
- }
- if (!(subgroup_prop.supportedOperations & capability.second)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedOperations");
- }
- if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)) {
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
- "VkPhysicalDeviceSubgroupProperties::supportedStages");
- }
- pipe.CreateVKPipeline(pipeline_layout, renderPass());
+ if (!(subgroup_prop.supportedOperations & capability.second)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedOperations");
+ }
+ if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_VERTEX_BIT)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedStages");
+ }
+ if (!(subgroup_prop.supportedOperations & capability.second)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedOperations");
+ }
+ if (!(subgroup_prop.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)) {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VkPhysicalDeviceSubgroupProperties::supportedStages");
+ }
+ pipe.CreateVKPipeline(pipeline_layout, renderPass());
- m_errorMonitor->VerifyFound();
+ m_errorMonitor->VerifyFound();
+ }
vkDestroyShaderModule(device(), shader_module[0], nullptr);
vkDestroyShaderModule(device(), shader_module[1], nullptr);
@@ -5312,6 +5322,11 @@ TEST_F(VkLayerTest, CreatePipelineCheckShaderImageFootprintEnabled) {
ASSERT_NO_FATAL_FAILURE(Init());
+ if (!DeviceExtensionSupported(gpu(), nullptr, VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME)) {
+ printf("%s Extension %s is not supported.\n", kSkipPrefix, VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME);
+ return;
+ }
+
std::vector<const char *> device_extension_names;
auto features = m_device->phy().features();