#include "tgsi/tgsi_dump.h"
#include "nv30_context.h"
-#include "nv30_state.h"
+#include "nvfx_state.h"
/* TODO (at least...):
* 1. Indexed consts + ARL
#define abs(s) nv30_sr_abs((s))
struct nv30_vpc {
- struct nv30_vertex_program *vp;
+ struct nvfx_vertex_program *vp;
- struct nv30_vertex_program_exec *vpi;
+ struct nvfx_vertex_program_exec *vpi;
unsigned output_map[PIPE_MAX_SHADER_OUTPUTS];
static struct nv30_sreg
constant(struct nv30_vpc *vpc, int pipe, float x, float y, float z, float w)
{
- struct nv30_vertex_program *vp = vpc->vp;
- struct nv30_vertex_program_data *vpd;
+ struct nvfx_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program_data *vpd;
int idx;
if (pipe >= 0) {
static void
emit_src(struct nv30_vpc *vpc, uint32_t *hw, int pos, struct nv30_sreg src)
{
- struct nv30_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
uint32_t sr = 0;
switch (src.type) {
static void
emit_dst(struct nv30_vpc *vpc, uint32_t *hw, int slot, struct nv30_sreg dst)
{
- struct nv30_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
switch (dst.type) {
case NV30SR_TEMP:
struct nv30_sreg s0, struct nv30_sreg s1,
struct nv30_sreg s2)
{
- struct nv30_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
uint32_t *hw;
vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi));
}
static void
-nv30_vertprog_translate(struct nv30_context *nv30,
- struct nv30_vertex_program *vp)
+nv30_vertprog_translate(struct nvfx_context *nvfx,
+ struct nvfx_vertex_program *vp)
{
struct tgsi_parse_context parse;
struct nv30_vpc *vpc = NULL;
}
static boolean
-nv30_vertprog_validate(struct nv30_context *nv30)
+nv30_vertprog_validate(struct nvfx_context *nvfx)
{
- struct pipe_screen *pscreen = nv30->pipe.screen;
- struct nv30_screen *screen = nv30->screen;
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
- struct nv30_vertex_program *vp;
+ struct nvfx_vertex_program *vp;
struct pipe_buffer *constbuf;
boolean upload_code = FALSE, upload_data = FALSE;
int i;
- vp = nv30->vertprog;
- constbuf = nv30->constbuf[PIPE_SHADER_VERTEX];
+ vp = nvfx->vertprog;
+ constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX];
/* Translate TGSI shader into hw bytecode */
if (!vp->translated) {
- nv30_vertprog_translate(nv30, vp);
+ nv30_vertprog_translate(nvfx, vp);
if (!vp->translated)
return FALSE;
}
/* Allocate hw vtxprog exec slots */
if (!vp->exec) {
- struct nouveau_resource *heap = nv30->screen->vp_exec_heap;
+ struct nouveau_resource *heap = nvfx->screen->vp_exec_heap;
struct nouveau_stateobj *so;
uint vplen = vp->nr_insns;
if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
while (heap->next && heap->size < vplen) {
- struct nv30_vertex_program *evict;
+ struct nvfx_vertex_program *evict;
evict = heap->next->priv;
nouveau_resource_free(&evict->exec);
/* Allocate hw vtxprog const slots */
if (vp->nr_consts && !vp->data) {
- struct nouveau_resource *heap = nv30->screen->vp_data_heap;
+ struct nouveau_resource *heap = nvfx->screen->vp_data_heap;
if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
while (heap->next && heap->size < vp->nr_consts) {
- struct nv30_vertex_program *evict;
+ struct nvfx_vertex_program *evict;
evict = heap->next->priv;
nouveau_resource_free(&evict->data);
*/
if (vp->exec_start != vp->exec->start) {
for (i = 0; i < vp->nr_insns; i++) {
- struct nv30_vertex_program_exec *vpi = &vp->insns[i];
+ struct nvfx_vertex_program_exec *vpi = &vp->insns[i];
if (vpi->has_branch_offset) {
assert(0);
if (vp->nr_consts && vp->data_start != vp->data->start) {
for (i = 0; i < vp->nr_insns; i++) {
- struct nv30_vertex_program_exec *vpi = &vp->insns[i];
+ struct nvfx_vertex_program_exec *vpi = &vp->insns[i];
if (vpi->const_index >= 0) {
vpi->data[1] &= ~NV30_VP_INST_CONST_SRC_MASK;
}
for (i = 0; i < vp->nr_consts; i++) {
- struct nv30_vertex_program_data *vpd = &vp->consts[i];
+ struct nvfx_vertex_program_data *vpd = &vp->consts[i];
if (vpd->index >= 0) {
if (!upload_data &&
}
}
- if (vp->so != nv30->state.hw[NV30_STATE_VERTPROG]) {
- so_ref(vp->so, &nv30->state.hw[NV30_STATE_VERTPROG]);
+ if (vp->so != nvfx->state.hw[NVFX_STATE_VERTPROG]) {
+ so_ref(vp->so, &nvfx->state.hw[NVFX_STATE_VERTPROG]);
return TRUE;
}
}
void
-nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
+nv30_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
{
vp->translated = FALSE;
so_ref(NULL, &vp->so);
}
-struct nv30_state_entry nv30_state_vertprog = {
+struct nvfx_state_entry nv30_state_vertprog = {
.validate = nv30_vertprog_validate,
.dirty = {
- .pipe = NV30_NEW_VERTPROG /*| NV30_NEW_UCP*/,
- .hw = NV30_STATE_VERTPROG,
+ .pipe = NVFX_NEW_VERTPROG /*| NVFX_NEW_UCP*/,
+ .hw = NVFX_STATE_VERTPROG,
}
};