static bool nv50_compute_validate_program(struct nv50_context *nv50) { struct nv50_program *prog = nv50->compprog; if (prog->mem) return true; if (!prog->translated) { prog->translated = nv50_program_translate( prog, nv50->screen->base.device->chipset, &nv50->base.debug); if (!prog->translated) return false; } if (unlikely(!prog->code_size)) return false; if (likely(prog->code_size)) { if (nv50_program_upload_code(nv50, prog)) { struct nouveau_pushbuf *push = nv50->base.pushbuf; BEGIN_NV04(push, NV50_COMPUTE(CODE_CB_FLUSH), 1); PUSH_DATA (push, 0); return true; } } return false; }
static bool nv50_program_validate(struct nv50_context *nv50, struct nv50_program *prog) { if (!prog->translated) { prog->translated = nv50_program_translate( prog, nv50->screen->base.device->chipset); if (!prog->translated) return false; } else if (prog->mem) return true; return nv50_program_upload_code(nv50, prog); }
static boolean nv50_program_validate(struct nv50_context *nv50, struct nv50_program *prog) { struct nouveau_resource *heap; int ret; unsigned size; if (!prog->translated) { prog->translated = nv50_program_translate(prog); if (!prog->translated) return FALSE; } else if (prog->res) return TRUE; if (prog->type == PIPE_SHADER_FRAGMENT) heap = nv50->screen->fp_code_heap; else if (prog->type == PIPE_SHADER_GEOMETRY) heap = nv50->screen->gp_code_heap; else heap = nv50->screen->vp_code_heap; size = align(prog->code_size, 0x100); ret = nouveau_resource_alloc(heap, size, prog, &prog->res); if (ret) { NOUVEAU_ERR("out of code space for shader type %i\n", prog->type); return FALSE; } prog->code_base = prog->res->start; nv50_relocate_program(prog, prog->code_base, 0); nv50_sifc_linear_u8(&nv50->base, nv50->screen->code, (prog->type << NV50_CODE_BO_SIZE_LOG2) + prog->code_base, NOUVEAU_BO_VRAM, prog->code_size, prog->code); BEGIN_RING(nv50->screen->base.channel, RING_3D(CODE_CB_FLUSH), 1); OUT_RING (nv50->screen->base.channel, 0); return TRUE; }
static void * nv50_sp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso, unsigned type) { struct nv50_program *prog; prog = CALLOC_STRUCT(nv50_program); if (!prog) return NULL; prog->type = type; prog->pipe.tokens = tgsi_dup_tokens(cso->tokens); if (cso->stream_output.num_outputs) prog->pipe.stream_output = cso->stream_output; prog->translated = nv50_program_translate( prog, nv50_context(pipe)->screen->base.device->chipset, &nouveau_context(pipe)->debug); return (void *)prog; }