vk/compiler: create the right kind of program struct
authorConnor Abbott <connor.w.abbott@intel.com>
Thu, 9 Jul 2015 01:48:57 +0000 (21:48 -0400)
committerConnor Abbott <connor.w.abbott@intel.com>
Thu, 9 Jul 2015 02:03:30 +0000 (22:03 -0400)
This fixes Valgrind errors and gets all the tests to pass with
--use-spir-v.

src/vulkan/compiler.cpp

index 0a8ec87415fa07f98dc98bc0efd980d4a02a9415..216da89c69711a1d6c5cf3a6bbb6a96c97bda366 100644 (file)
@@ -981,7 +981,21 @@ anv_compile_shader_spirv(struct anv_compiler *compiler,
    fail_if(mesa_shader == NULL,
            "failed to create %s shader\n", stage_info[stage].name);
 
-   mesa_shader->Program = rzalloc(mesa_shader, struct gl_program);
+   switch (stage) {
+   case VK_SHADER_STAGE_VERTEX:
+      mesa_shader->Program = &rzalloc(mesa_shader, struct brw_vertex_program)->program.Base;
+      break;
+   case VK_SHADER_STAGE_GEOMETRY:
+      mesa_shader->Program = &rzalloc(mesa_shader, struct brw_geometry_program)->program.Base;
+      break;
+   case VK_SHADER_STAGE_FRAGMENT:
+      mesa_shader->Program = &rzalloc(mesa_shader, struct brw_fragment_program)->program.Base;
+      break;
+   case VK_SHADER_STAGE_COMPUTE:
+      mesa_shader->Program = &rzalloc(mesa_shader, struct brw_compute_program)->program.Base;
+      break;
+   }
+
    mesa_shader->Type = stage_info[stage].token;
    mesa_shader->Stage = stage_info[stage].stage;