diff options
author | Kristian Høgsberg Kristensen <[email protected]> | 2015-09-03 12:27:28 -0700 |
---|---|---|
committer | Kristian Høgsberg Kristensen <[email protected]> | 2015-09-03 12:27:28 -0700 |
commit | 316c8ac53bd1cf654d77057a0fb4b35e4994d523 (patch) | |
tree | 8c6ba3e613d7e9a7e24252db4b74b11c9461fdb2 /src/vulkan/anv_compiler.cpp | |
parent | 6e35a1f166e677a55f465ec420d9d546e10f3fd7 (diff) |
vk: Assert that the SPIR-V module has the magic number
Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
Diffstat (limited to 'src/vulkan/anv_compiler.cpp')
-rw-r--r-- | src/vulkan/anv_compiler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vulkan/anv_compiler.cpp b/src/vulkan/anv_compiler.cpp index 1f961eb043b..070fd1e1121 100644 --- a/src/vulkan/anv_compiler.cpp +++ b/src/vulkan/anv_compiler.cpp @@ -974,6 +974,7 @@ anv_compile_shader_spirv(struct anv_compiler *compiler, struct anv_shader *shader = pipeline->shaders[stage]; struct gl_shader *mesa_shader; int name = 0; + uint32_t *spirv; mesa_shader = brw_new_shader(&brw->ctx, name, stage_info[stage].token); fail_if(mesa_shader == NULL, @@ -1012,13 +1013,15 @@ anv_compile_shader_spirv(struct anv_compiler *compiler, mesa_shader->Type = stage_info[stage].token; mesa_shader->Stage = stage_info[stage].stage; - assert(shader->module->size % 4 == 0); - struct gl_shader_compiler_options *glsl_options = &compiler->screen->compiler->glsl_compiler_options[stage_info[stage].stage]; + spirv = (uint32_t *) shader->module->data; + assert(spirv[0] == SPIR_V_MAGIC_NUMBER); + assert(shader->module->size % 4 == 0); + mesa_shader->Program->nir = - spirv_to_nir((uint32_t *)shader->module->data, shader->module->size / 4, + spirv_to_nir(spirv, shader->module->size / 4, stage_info[stage].stage, glsl_options->NirOptions); nir_validate_shader(mesa_shader->Program->nir); |