layers: Make passing a non-SPIRV shader to CreateShaderModule an error

Various real drivers are not tolerant of the wrapped-GLSL-blob hack that
was used early in Vulkan development. Rather than simply bypassing most
of the validation when one of these blobs is seen, make it an error.

Structurally, move the validation out of the shader_module ctor in
preparation for the callback being able to signal whether to bail out.

V2: Adjustment for descriptor validation landing

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Tobin Ehlis <tobin@lunarg.com>
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index ab4e3d2..112b05e 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -2388,7 +2388,7 @@
 
     msgFlags = m_errorMonitor->GetState(&msgString);
 
-    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_WARN_BIT);
+    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_ERROR_BIT);
     if (!strstr(msgString.c_str(),"Shader is not SPIR-V")) {
         FAIL() << "Incorrect warning: " << msgString;
     }
@@ -2420,7 +2420,7 @@
 
     msgFlags = m_errorMonitor->GetState(&msgString);
 
-    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_WARN_BIT);
+    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_ERROR_BIT);
     if (!strstr(msgString.c_str(),"Shader is not SPIR-V")) {
         FAIL() << "Incorrect warning: " << msgString;
     }
@@ -2453,7 +2453,7 @@
 
     msgFlags = m_errorMonitor->GetState(&msgString);
 
-    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_WARN_BIT);
+    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_ERROR_BIT);
     if (!strstr(msgString.c_str(),"Shader is not SPIR-V")) {
         FAIL() << "Incorrect warning: " << msgString;
     }
@@ -2999,63 +2999,6 @@
     }
 }
 
-TEST_F(VkLayerTest, CreatePipelineNonSpirvShader)
-{
-    VkFlags msgFlags;
-    std::string msgString;
-    ASSERT_NO_FATAL_FAILURE(InitState());
-    /* Intentionally provided GLSL rather than compiling to SPIRV first */
-    ScopedUseGlsl useGlsl(true);
-
-    char const *vsSource =
-        "#version 140\n"
-        "#extension GL_ARB_separate_shader_objects: require\n"
-        "#extension GL_ARB_shading_language_420pack: require\n"
-        "\n"
-        "void main(){\n"
-        "   gl_Position = vec4(1);\n"
-        "}\n";
-    char const *fsSource =
-        "#version 140\n"
-        "#extension GL_ARB_separate_shader_objects: require\n"
-        "#extension GL_ARB_shading_language_420pack: require\n"
-        "\n"
-        "layout(location=0) out vec4 x;\n"
-        "void main(){\n"
-        "   x = vec4(1);\n"
-        "}\n";
-
-    m_errorMonitor->ClearState();
-
-    VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX, this);
-    VkShaderObj fs(m_device, fsSource, VK_SHADER_STAGE_FRAGMENT, this);
-
-
-    VkPipelineObj pipe(m_device);
-    pipe.AddShader(&vs);
-    pipe.AddShader(&fs);
-
-    /* set up CB 0; type is UNORM by default */
-    pipe.AddColorAttachment();
-    ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
-
-    VkDescriptorSetObj descriptorSet(m_device);
-    descriptorSet.AppendDummy();
-    descriptorSet.CreateVKDescriptorSet(m_cmdBuffer);
-
-    VkResult res = pipe.CreateVKPipeline(descriptorSet.GetPipelineLayout(), renderPass());
-    /* pipeline creation should have succeeded */
-    ASSERT_EQ(VK_SUCCESS, res);
-
-    /* should have emitted a warning: the shader is not SPIRV, so we're
-     * not going to be able to analyze it */
-    msgFlags = m_errorMonitor->GetState(&msgString);
-    ASSERT_NE(0, msgFlags & VK_DBG_REPORT_WARN_BIT);
-    if (!strstr(msgString.c_str(),"is not SPIR-V")) {
-        FAIL() << "Incorrect warning: " << msgString;
-    }
-}
-
 TEST_F(VkLayerTest, CreatePipelineUniformBlockNotProvided)
 {
     VkFlags msgFlags;