Lines Matching defs:shader
51 /* for vertex shader, the inputs are loaded into registers before the shader
52 * is executed, so max_regs from the shader instructions might not properly
56 * Likewise, for fragment shader, we can have some regs which are passed
57 * input values but never touched by the resulting shader (ie. as result
68 * not written by gpu before shader starts (and in fact the
127 * shader state. Non-static since used by ir3_cmdline too.
253 "Native code%s for unnamed %s shader %s with sha1 %s:\n",
272 "Native code%s for unnamed %s shader %s with sha1 %s:\n",
291 compile_variant(struct ir3_shader *shader, struct ir3_shader_variant *v)
293 int ret = ir3_compile_shader_nir(shader->compiler, shader, v);
295 mesa_loge("compile failed! (%s:%s)", shader->nir->info.name,
296 shader->nir->info.label);
302 mesa_loge("assemble failed! (%s:%s)", shader->nir->info.name,
303 shader->nir->info.label);
311 * For creating normal shader variants, 'nonbinning' is NULL. For
312 * creating binning pass shader, it is link to corresponding normal
316 alloc_variant(struct ir3_shader *shader, const struct ir3_shader_key *key,
320 * of the shader, to simplify the error cleanup paths
329 v->id = ++shader->variant_count;
330 v->shader_id = shader->id;
334 v->type = shader->type;
335 v->compiler = shader->compiler;
336 v->mergedregs = shader->compiler->gen >= 6;
337 v->stream_output = shader->stream_output;
339 v->name = ralloc_strdup(v, shader->nir->info.name);
341 struct shader_info *info = &shader->nir->info;
366 v->cs.req_input_mem = shader->cs.req_input_mem;
367 v->cs.req_local_mem = shader->cs.req_local_mem;
376 v->num_reserved_user_consts = shader->num_reserved_user_consts;
377 v->api_wavesize = shader->api_wavesize;
378 v->real_wavesize = shader->real_wavesize;
382 v->const_state->shared_consts_enable = shader->shared_consts_enable;
397 create_variant(struct ir3_shader *shader, const struct ir3_shader_key *key,
400 struct ir3_shader_variant *v = alloc_variant(shader, key, NULL, mem_ctx);
408 v->binning = alloc_variant(shader, key, v, mem_ctx);
414 if (ir3_disk_cache_retrieve(shader, v))
417 if (!shader->nir_finalized) {
418 ir3_nir_post_finalize(shader);
421 mesa_logi("dump nir%d: type=%d", shader->id, shader->type);
422 nir_log_shaderi(shader->nir);
426 v->disasm_info.nir = nir_shader_as_str(shader->nir, v);
429 shader->nir_finalized = true;
432 if (!compile_variant(shader, v))
435 if (needs_binning_variant(v) && !compile_variant(shader, v->binning))
438 ir3_disk_cache_store(shader, v);
448 ir3_shader_create_variant(struct ir3_shader *shader,
452 return create_variant(shader, key, keep_ir, NULL);
456 shader_variant(struct ir3_shader *shader, const struct ir3_shader_key *key)
460 for (v = shader->variants; v; v = v->next)
468 ir3_shader_get_variant(struct ir3_shader *shader,
472 mtx_lock(&shader->variants_lock);
473 struct ir3_shader_variant *v = shader_variant(shader, key);
477 v = create_variant(shader, key, write_disasm, shader);
479 v->next = shader->variants;
480 shader->variants = v;
490 mtx_unlock(&shader->variants_lock);
496 ir3_shader_destroy(struct ir3_shader *shader)
498 ralloc_free(shader->nir);
499 mtx_destroy(&shader->variants_lock);
500 ralloc_free(shader);
504 * Creates a bitmask of the used bits of the shader key by this particular
505 * shader. Used by the gallium driver to skip state-dependent recompiles when
509 ir3_setup_used_key(struct ir3_shader *shader)
511 nir_shader *nir = shader->nir;
513 struct ir3_shader_key *key = &shader->key_mask;
526 if (info->stage != MESA_SHADER_COMPUTE && (info->stage != MESA_SHADER_FRAGMENT || !shader->compiler->has_clip_cull))
551 (shader->compiler->gen < 6 &&
665 struct ir3_shader *shader = rzalloc_size(NULL, sizeof(*shader));
667 mtx_init(&shader->variants_lock, mtx_plain);
668 shader->compiler = compiler;
669 shader->id = p_atomic_inc_return(&shader->compiler->shader_count);
670 shader->type = nir->info.stage;
672 memcpy(&shader->stream_output, stream_output,
673 sizeof(shader->stream_output));
674 shader->num_reserved_user_consts = options->reserved_user_consts;
675 shader->api_wavesize = options->api_wavesize;
676 shader->real_wavesize = options->real_wavesize;
677 shader->shared_consts_enable = options->shared_consts_enable;
678 shader->nir = nir;
680 ir3_disk_cache_init_shader_key(compiler, shader);
682 ir3_setup_used_key(shader);
684 return shader;
848 /* print generic shader info: */
876 /* print shader type specific info: */
923 * used by fragment shader will be stripped out.
933 * consumed by frag shader) need to be added:
962 * but frag shader doesn't consume all components: