static void delete_shader(struct fd3_shader_stateobj *so) { ir3_shader_destroy(so->ir); fd_bo_del(so->bo); free(so); }
int fd_program_attach_asm(struct fd_program *program, enum fd_shader_type type, const char *src) { struct fd_shader *shader = get_shader(program, type); int sizedwords; if (shader->ir) ir3_shader_destroy(shader->ir); memset(shader, 0, sizeof(*shader)); shader->ir = fd_asm_parse(src); if (!shader->ir) { ERROR_MSG("parse failed"); return -1; } sizedwords = ir3_shader_assemble(shader->ir, shader->bin, ARRAY_SIZE(shader->bin), &shader->info); if (sizedwords <= 0) { ERROR_MSG("assembler failed"); return -1; } shader->sizedwords = sizedwords; return 0; }
/* once the compiler is good enough, we should construct TGSI in the * core freedreno driver, and then let the a2xx/a3xx parts compile * the internal shaders from TGSI the same as regular shaders. This * would be the first step towards handling most of clear (and the * gmem<->mem blits) from the core via normal state changes and shader * state objects. * * (Well, there would still be some special bits, because there are * some registers that don't get set for normal draw, but this should * be relatively small and could be handled via callbacks from core * into a2xx/a3xx..) */ static struct fd3_shader_stateobj * create_internal_shader(struct pipe_context *pctx, enum shader_t type, struct ir3_shader *ir) { struct fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_shader_stateobj); if (!so) { ir3_shader_destroy(ir); return NULL; } so->type = type; so->ir = ir; assemble_shader(pctx, so); assert(so->bo); return so; }
static void delete_shader_stateobj(struct fd5_shader_stateobj *so) { ir3_shader_destroy(so->shader); free(so); }
static void fd3_vp_state_delete(struct pipe_context *pctx, void *hwcso) { struct ir3_shader *so = hwcso; ir3_shader_destroy(so); }