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,
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);
+ if (shader->module->nir) {
+ /* Some things such as our meta clear/blit code will give us a NIR
+ * shader directly. In that case, we just ignore the SPIR-V entirely
+ * and just use the NIR shader */
+ mesa_shader->Program->nir = shader->module->nir;
+ mesa_shader->Program->nir->options = glsl_options->NirOptions;
+ } else {
+ uint32_t *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(spirv, shader->module->size / 4,
- stage_info[stage].stage, glsl_options->NirOptions);
+ mesa_shader->Program->nir =
+ spirv_to_nir(spirv, shader->module->size / 4,
+ stage_info[stage].stage, glsl_options->NirOptions);
+ }
nir_validate_shader(mesa_shader->Program->nir);
brw_process_nir(mesa_shader->Program->nir,