void nv50_gmtyprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *gp = nv50->gmtyprog; if (gp) { if (!nv50_program_validate(nv50, gp)) return; BEGIN_NV04(push, NV50_3D(GP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, gp->max_gpr); BEGIN_NV04(push, NV50_3D(GP_REG_ALLOC_RESULT), 1); PUSH_DATA (push, gp->max_out); BEGIN_NV04(push, NV50_3D(GP_OUTPUT_PRIMITIVE_TYPE), 1); PUSH_DATA (push, gp->gp.prim_type); BEGIN_NV04(push, NV50_3D(GP_VERTEX_OUTPUT_COUNT), 1); PUSH_DATA (push, gp->gp.vert_count); BEGIN_NV04(push, NV50_3D(GP_START_ID), 1); PUSH_DATA (push, gp->code_base); nv50->state.prim_size = gp->gp.prim_type; /* enum matches vertex count */ } nv50_program_update_context_state(nv50, gp, 2); /* GP_ENABLE is updated in linkage validation */ }
void nv50_fragprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *fp = nv50->fragprog; fp->fp.sample_interp = nv50->min_samples > 1; if (!nv50_program_validate(nv50, fp)) return; nv50_program_update_context_state(nv50, fp, 1); BEGIN_NV04(push, NV50_3D(FP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, fp->max_gpr); BEGIN_NV04(push, NV50_3D(FP_RESULT_COUNT), 1); PUSH_DATA (push, fp->max_out); BEGIN_NV04(push, NV50_3D(FP_CONTROL), 1); PUSH_DATA (push, fp->fp.flags[0]); BEGIN_NV04(push, NV50_3D(FP_CTRL_UNK196C), 1); PUSH_DATA (push, fp->fp.flags[1]); BEGIN_NV04(push, NV50_3D(FP_START_ID), 1); PUSH_DATA (push, fp->code_base); if (nv50->screen->tesla->oclass >= NVA3_3D_CLASS) { BEGIN_NV04(push, SUBC_3D(NVA3_3D_FP_MULTISAMPLE), 1); if (nv50->min_samples > 1 || fp->fp.has_samplemask) PUSH_DATA(push, NVA3_3D_FP_MULTISAMPLE_FORCE_PER_SAMPLE | (NVA3_3D_FP_MULTISAMPLE_EXPORT_SAMPLE_MASK * fp->fp.has_samplemask)); else PUSH_DATA(push, 0); } }
void nv50_vertprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *vp = nv50->vertprog; if (!nv50_program_validate(nv50, vp)) return; nv50_program_update_context_state(nv50, vp, 0); BEGIN_NV04(push, NV50_3D(VP_ATTR_EN(0)), 2); PUSH_DATA (push, vp->vp.attrs[0]); PUSH_DATA (push, vp->vp.attrs[1]); BEGIN_NV04(push, NV50_3D(VP_REG_ALLOC_RESULT), 1); PUSH_DATA (push, vp->max_out); BEGIN_NV04(push, NV50_3D(VP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, vp->max_gpr); BEGIN_NV04(push, NV50_3D(VP_START_ID), 1); PUSH_DATA (push, vp->code_base); if (unlikely(nv50->state.vport_bypass != vp->vp.vport_bypass)) { nv50->state.vport_bypass = vp->vp.vport_bypass; BEGIN_NV04(push, NV50_3D(VIEWPORT_TRANSFORM_EN), 1); PUSH_DATA (push, !vp->vp.vport_bypass); /* TODO: don't do these twice if the vport changed, too: */ nv50_validate_viewport(nv50); #ifdef NV50_SCISSORS_CLIPPING nv50_validate_scissor(nv50); #endif } }
void nv50_fragprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *fp = nv50->fragprog; struct pipe_rasterizer_state *rast = &nv50->rast->pipe; if (fp->fp.force_persample_interp != rast->force_persample_interp) { /* Force the program to be reuploaded, which will trigger interp fixups * to get applied */ if (fp->mem) nouveau_heap_free(&fp->mem); fp->fp.force_persample_interp = rast->force_persample_interp; } if (fp->mem && !(nv50->dirty_3d & (NV50_NEW_3D_FRAGPROG | NV50_NEW_3D_MIN_SAMPLES))) return; if (!nv50_program_validate(nv50, fp)) return; nv50_program_update_context_state(nv50, fp, 1); BEGIN_NV04(push, NV50_3D(FP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, fp->max_gpr); BEGIN_NV04(push, NV50_3D(FP_RESULT_COUNT), 1); PUSH_DATA (push, fp->max_out); BEGIN_NV04(push, NV50_3D(FP_CONTROL), 1); PUSH_DATA (push, fp->fp.flags[0]); BEGIN_NV04(push, NV50_3D(FP_CTRL_UNK196C), 1); PUSH_DATA (push, fp->fp.flags[1]); BEGIN_NV04(push, NV50_3D(FP_START_ID), 1); PUSH_DATA (push, fp->code_base); if (nv50->screen->tesla->oclass >= NVA3_3D_CLASS) { BEGIN_NV04(push, SUBC_3D(NVA3_3D_FP_MULTISAMPLE), 1); if (nv50->min_samples > 1 || fp->fp.has_samplemask) PUSH_DATA(push, NVA3_3D_FP_MULTISAMPLE_FORCE_PER_SAMPLE | (NVA3_3D_FP_MULTISAMPLE_EXPORT_SAMPLE_MASK * fp->fp.has_samplemask)); else PUSH_DATA(push, 0); } }
void nv50_vertprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *vp = nv50->vertprog; if (!nv50_program_validate(nv50, vp)) return; nv50_program_update_context_state(nv50, vp, 0); BEGIN_NV04(push, NV50_3D(VP_ATTR_EN(0)), 2); PUSH_DATA (push, vp->vp.attrs[0]); PUSH_DATA (push, vp->vp.attrs[1]); BEGIN_NV04(push, NV50_3D(VP_REG_ALLOC_RESULT), 1); PUSH_DATA (push, vp->max_out); BEGIN_NV04(push, NV50_3D(VP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, vp->max_gpr); BEGIN_NV04(push, NV50_3D(VP_START_ID), 1); PUSH_DATA (push, vp->code_base); }
void nv50_fragprog_validate(struct nv50_context *nv50) { struct nouveau_pushbuf *push = nv50->base.pushbuf; struct nv50_program *fp = nv50->fragprog; if (!nv50_program_validate(nv50, fp)) return; nv50_program_update_context_state(nv50, fp, 1); BEGIN_NV04(push, NV50_3D(FP_REG_ALLOC_TEMP), 1); PUSH_DATA (push, fp->max_gpr); BEGIN_NV04(push, NV50_3D(FP_RESULT_COUNT), 1); PUSH_DATA (push, fp->max_out); BEGIN_NV04(push, NV50_3D(FP_CONTROL), 1); PUSH_DATA (push, fp->fp.flags[0]); BEGIN_NV04(push, NV50_3D(FP_CTRL_UNK196C), 1); PUSH_DATA (push, fp->fp.flags[1]); BEGIN_NV04(push, NV50_3D(FP_START_ID), 1); PUSH_DATA (push, fp->code_base); }