v154: Bug 14417 - Added VkShaderStage to VkShaderCreateInfo
diff --git a/icd/intel/compiler/shader/compiler_interface.cpp b/icd/intel/compiler/shader/compiler_interface.cpp
index db0731a..21eba97 100644
--- a/icd/intel/compiler/shader/compiler_interface.cpp
+++ b/icd/intel/compiler/shader/compiler_interface.cpp
@@ -343,7 +343,8 @@
 // invoke front end compiler to generate an independently linked
 // program object that contains Mesa HIR
 struct intel_ir *shader_create_ir(const struct intel_gpu *gpu,
-                                  const void *code, size_t size)
+                                  const void *code, size_t size,
+                                  VkShaderStage stage)
 {
     // Wrap this path in a mutex until we can clean up initialization
     static mtx_t mutex = _MTX_INITIALIZER_NP;
@@ -399,32 +400,14 @@
         shader->Source = (const GLchar*)code;
         shader->Size   = size / sizeof(unsigned);  // size in SPV words
 
-        spv::ExecutionModel executionModel = spv::ExecutionModelVertex;
-
-        unsigned spvWord = 5;
-
-        while (spvWord < size) {
-            const unsigned    opWord = ((unsigned int*)code)[spvWord];
-            const spv::Op op     = spv::Op((opWord & 0xffff));
-
-            if (op == spv::OpEntryPoint) {
-                executionModel = spv::ExecutionModel(((unsigned int*)code)[spvWord+1]);
-                break;
-            }
-
-            spvWord += (opWord & 0xffff0000) >> 16;
-        }
-
-        // We should parse the glsl text out of spv right now, but
-        // instead we are just plopping down our glsl
-        switch(executionModel) {
-        case spv::ExecutionModelVertex:
+        switch (stage) {
+        case VK_SHADER_STAGE_VERTEX:
             shader->Type = GL_VERTEX_SHADER;
             break;
-        case spv::ExecutionModelGeometry:
+        case VK_SHADER_STAGE_GEOMETRY:
             shader->Type = GL_GEOMETRY_SHADER;
             break;
-        case spv::ExecutionModelFragment:
+        case VK_SHADER_STAGE_FRAGMENT:
             shader->Type = GL_FRAGMENT_SHADER;
             break;
         default:
diff --git a/icd/intel/compiler/shader/compiler_interface.h b/icd/intel/compiler/shader/compiler_interface.h
index f318639..6d337f7 100644
--- a/icd/intel/compiler/shader/compiler_interface.h
+++ b/icd/intel/compiler/shader/compiler_interface.h
@@ -39,7 +39,8 @@
 void initialize_mesa_context_to_defaults(struct gl_context *ctx);
 
 struct intel_ir *shader_create_ir(const struct intel_gpu *gpu,
-                                  const void *code, size_t size);
+                                  const void *code, size_t size,
+                                  VkShaderStage stage);
 
 void shader_destroy_ir(struct intel_ir *ir);
 
diff --git a/icd/intel/compiler/shader/main.cpp b/icd/intel/compiler/shader/main.cpp
index cba3de5..53d3629 100644
--- a/icd/intel/compiler/shader/main.cpp
+++ b/icd/intel/compiler/shader/main.cpp
@@ -144,22 +144,24 @@
 
            void *shaderCode;
            size_t size;
+           VkShaderStage stage = VK_SHADER_STAGE_VERTEX;
 
            if (checkFileExt(argv[1], ".spv")) {
                shaderCode = load_spv_file(argv[1], &size);
            } else if (checkFileExt(argv[1], ".vert")) {
-               shaderCode = load_glsl_file(argv[1], &size, VK_SHADER_STAGE_VERTEX);
+               stage = VK_SHADER_STAGE_VERTEX;
            } else if (checkFileExt(argv[1], ".geom")) {
-               shaderCode = load_glsl_file(argv[1], &size, VK_SHADER_STAGE_GEOMETRY);
+               stage = VK_SHADER_STAGE_GEOMETRY;
            } else if (checkFileExt(argv[1], ".frag")) {
-               shaderCode = load_glsl_file(argv[1], &size, VK_SHADER_STAGE_FRAGMENT);
+               stage = VK_SHADER_STAGE_FRAGMENT;
            } else {
                return EXIT_FAILURE;
            }
 
+           shaderCode = load_glsl_file(argv[1], &size, stage);
            assert(shaderCode);
 
-           struct intel_ir *shader_program = shader_create_ir(NULL, shaderCode, size);
+           struct intel_ir *shader_program = shader_create_ir(NULL, shaderCode, size, stage);
            assert(shader_program);
 
            // Set up only the fields needed for backend compile
@@ -212,14 +214,14 @@
        shaderCode[0] = load_spv_file(argv[1], &size[0]);
        assert(shaderCode[0]);
        printf("Compiling %s\n", argv[1]);
-       result[0] = shader_create_ir(NULL, shaderCode[0], size[0]);
+       result[0] = shader_create_ir(NULL, shaderCode[0], size[0], VK_SHADER_STAGE_VERTEX);
        assert(result[0]);
 
        // Compile second shader
        shaderCode[1] = load_spv_file(argv[2], &size[1]);
        assert(shaderCode[1]);
        printf("Compiling %s\n", argv[2]);
-       result[1] = shader_create_ir(NULL, shaderCode[1], size[1]);
+       result[1] = shader_create_ir(NULL, shaderCode[1], size[1], VK_SHADER_STAGE_FRAGMENT);
        assert(result[1]);
 
 
diff --git a/icd/intel/shader.c b/icd/intel/shader.c
index a131a52..29dd2ee 100644
--- a/icd/intel/shader.c
+++ b/icd/intel/shader.c
@@ -116,7 +116,7 @@
 
     struct intel_shader_module *sm = intel_shader_module(info->module);
 
-    sh->ir = shader_create_ir(dev->gpu, sm->code, sm->code_size);
+    sh->ir = shader_create_ir(dev->gpu, sm->code, sm->code_size, info->stage);
     if (!sh->ir) {
         shader_destroy(&sh->obj);
         return VK_ERROR_BAD_SHADER_CODE;