From 997831868fea1f56223b5fbf59526d0b538527c0 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 8 Jul 2015 21:48:57 -0400 Subject: [PATCH] vk/compiler: create the right kind of program struct This fixes Valgrind errors and gets all the tests to pass with --use-spir-v. --- src/vulkan/compiler.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vulkan/compiler.cpp b/src/vulkan/compiler.cpp index 0a8ec87415f..216da89c697 100644 --- a/src/vulkan/compiler.cpp +++ b/src/vulkan/compiler.cpp @@ -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; -- 2.30.2