diff options
Diffstat (limited to 'lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c index c0cd56969..c644fe992 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c @@ -28,40 +28,22 @@ #include "nvc0/nvc0_context.h" #include "nvc0/nvc0_query_hw.h" +#include "nvc0/nvc0_compute.xml.h" + static inline void nvc0_program_update_context_state(struct nvc0_context *nvc0, struct nvc0_program *prog, int stage) { - struct nouveau_pushbuf *push = nvc0->base.pushbuf; - if (prog && prog->need_tls) { const uint32_t flags = NV_VRAM_DOMAIN(&nvc0->screen->base) | NOUVEAU_BO_RDWR; if (!nvc0->state.tls_required) - BCTX_REFN_bo(nvc0->bufctx_3d, TLS, flags, nvc0->screen->tls); + BCTX_REFN_bo(nvc0->bufctx_3d, 3D_TLS, flags, nvc0->screen->tls); nvc0->state.tls_required |= 1 << stage; } else { if (nvc0->state.tls_required == (1 << stage)) - nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TLS); + nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TLS); nvc0->state.tls_required &= ~(1 << stage); } - - if (prog && prog->immd_size) { - BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3); - /* NOTE: may overlap code of a different shader */ - PUSH_DATA (push, align(prog->immd_size, 0x100)); - PUSH_DATAh(push, nvc0->screen->text->offset + prog->immd_base); - PUSH_DATA (push, nvc0->screen->text->offset + prog->immd_base); - BEGIN_NVC0(push, NVC0_3D(CB_BIND(stage)), 1); - PUSH_DATA (push, (14 << 4) | 1); - - nvc0->state.c14_bound |= 1 << stage; - } else - if (nvc0->state.c14_bound & (1 << stage)) { - BEGIN_NVC0(push, NVC0_3D(CB_BIND(stage)), 1); - PUSH_DATA (push, (14 << 4) | 0); - - nvc0->state.c14_bound &= ~(1 << stage); - } } static inline bool @@ -78,7 +60,7 @@ nvc0_program_validate(struct nvc0_context *nvc0, struct nvc0_program *prog) } if (likely(prog->code_size)) - return nvc0_program_upload_code(nvc0, prog); + return nvc0_program_upload(nvc0, prog); return true; /* stream output info only */ } @@ -152,7 +134,7 @@ nvc0_fragprog_validate(struct nvc0_context *nvc0) NVC0_3D_SHADE_MODEL_SMOOTH); } - if (fp->mem && !(nvc0->dirty & NVC0_NEW_FRAGPROG)) { + if (fp->mem && !(nvc0->dirty_3d & NVC0_NEW_3D_FRAGPROG)) { return; } @@ -257,6 +239,19 @@ nvc0_gmtyprog_validate(struct nvc0_context *nvc0) } void +nvc0_compprog_validate(struct nvc0_context *nvc0) +{ + struct nouveau_pushbuf *push = nvc0->base.pushbuf; + struct nvc0_program *cp = nvc0->compprog; + + if (cp && !nvc0_program_validate(nvc0, cp)) + return; + + BEGIN_NVC0(push, NVC0_CP(FLUSH), 1); + PUSH_DATA (push, NVC0_COMPUTE_FLUSH_CODE); +} + +void nvc0_tfb_validate(struct nvc0_context *nvc0) { struct nouveau_pushbuf *push = nvc0->base.pushbuf; @@ -292,7 +287,7 @@ nvc0_tfb_validate(struct nvc0_context *nvc0) } nvc0->state.tfb = tfb; - if (!(nvc0->dirty & NVC0_NEW_TFB_TARGETS)) + if (!(nvc0->dirty_3d & NVC0_NEW_3D_TFB_TARGETS)) return; for (b = 0; b < nvc0->num_tfbbufs; ++b) { @@ -309,7 +304,7 @@ nvc0_tfb_validate(struct nvc0_context *nvc0) buf = nv04_resource(targ->pipe.buffer); - BCTX_REFN(nvc0->bufctx_3d, TFB, buf, WR); + BCTX_REFN(nvc0->bufctx_3d, 3D_TFB, buf, WR); if (!(nvc0->tfbbuf_dirty & (1 << b))) continue; |