diff options
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_state.c')
-rw-r--r-- | src/gallium/drivers/nv30/nv30_state.c | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index 3304480..5263f89 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -5,15 +5,15 @@ #include "tgsi/tgsi_parse.h" #include "nv30_context.h" -#include "nv30_state.h" +#include "nvfx_state.h" static void * nv30_blend_state_create(struct pipe_context *pipe, const struct pipe_blend_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nouveau_grobj *eng3d = nv30->screen->eng3d; - struct nv30_blend_state *bso = CALLOC(1, sizeof(*bso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; + struct nvfx_blend_state *bso = CALLOC(1, sizeof(*bso)); struct nouveau_stateobj *so = so_new(5, 8, 0); if (cso->rt[0].blend_enable) { @@ -59,16 +59,16 @@ nv30_blend_state_create(struct pipe_context *pipe, static void nv30_blend_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->blend = hwcso; - nv30->dirty |= NV30_NEW_BLEND; + nvfx->blend = hwcso; + nvfx->dirty |= NVFX_NEW_BLEND; } static void nv30_blend_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_blend_state *bso = hwcso; + struct nvfx_blend_state *bso = hwcso; so_ref(NULL, &bso->so); FREE(bso); @@ -117,10 +117,10 @@ static void * nv30_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { - struct nv30_sampler_state *ps; + struct nvfx_sampler_state *ps; uint32_t filter = 0; - ps = MALLOC(sizeof(struct nv30_sampler_state)); + ps = MALLOC(sizeof(struct nvfx_sampler_state)); ps->fmt = 0; /* TODO: Not all RECTs formats have this bit set, bits 15-8 of format @@ -248,21 +248,21 @@ nv30_sampler_state_create(struct pipe_context *pipe, static void nv30_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { - nv30->tex_sampler[unit] = sampler[unit]; - nv30->dirty_samplers |= (1 << unit); + nvfx->tex_sampler[unit] = sampler[unit]; + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv30->nr_samplers; unit++) { - nv30->tex_sampler[unit] = NULL; - nv30->dirty_samplers |= (1 << unit); + for (unit = nr; unit < nvfx->nr_samplers; unit++) { + nvfx->tex_sampler[unit] = NULL; + nvfx->dirty_samplers |= (1 << unit); } - nv30->nr_samplers = nr; - nv30->dirty |= NV30_NEW_SAMPLER; + nvfx->nr_samplers = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void @@ -275,33 +275,33 @@ static void nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr, struct pipe_texture **miptree) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv30->tex_miptree[unit], miptree[unit]); - nv30->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], miptree[unit]); + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv30->nr_textures; unit++) { + for (unit = nr; unit < nvfx->nr_textures; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv30->tex_miptree[unit], NULL); - nv30->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], NULL); + nvfx->dirty_samplers |= (1 << unit); } - nv30->nr_textures = nr; - nv30->dirty |= NV30_NEW_SAMPLER; + nvfx->nr_textures = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void * nv30_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso)); struct nouveau_stateobj *so = so_new(9, 19, 0); - struct nouveau_grobj *eng3d = nv30->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; /*XXX: ignored: * light_twoside @@ -413,17 +413,17 @@ nv30_rasterizer_state_create(struct pipe_context *pipe, static void nv30_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->rasterizer = hwcso; - nv30->dirty |= NV30_NEW_RAST; - /*nv30->draw_dirty |= NV30_NEW_RAST;*/ + nvfx->rasterizer = hwcso; + nvfx->dirty |= NVFX_NEW_RAST; + /*nvfx->draw_dirty |= NVFX_NEW_RAST;*/ } static void nv30_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_rasterizer_state *rsso = hwcso; + struct nvfx_rasterizer_state *rsso = hwcso; so_ref(NULL, &rsso->so); FREE(rsso); @@ -433,10 +433,10 @@ static void * nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe, const struct pipe_depth_stencil_alpha_state *cso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso)); struct nouveau_stateobj *so = so_new(6, 20, 0); - struct nouveau_grobj *eng3d = nv30->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; so_method(so, eng3d, NV34TCL_DEPTH_FUNC, 3); so_data (so, nvgl_comparison_op(cso->depth.func)); @@ -487,16 +487,16 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe, static void nv30_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->zsa = hwcso; - nv30->dirty |= NV30_NEW_ZSA; + nvfx->zsa = hwcso; + nvfx->dirty |= NVFX_NEW_ZSA; } static void nv30_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_zsa_state *zsaso = hwcso; + struct nvfx_zsa_state *zsaso = hwcso; so_ref(NULL, &zsaso->so); FREE(zsaso); @@ -506,12 +506,12 @@ static void * nv30_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - /*struct nv30_context *nv30 = nv30_context(pipe);*/ - struct nv30_vertex_program *vp; + /*struct nvfx_context *nvfx = nvfx_context(pipe);*/ + struct nvfx_vertex_program *vp; - vp = CALLOC(1, sizeof(struct nv30_vertex_program)); + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - /*vp->draw = draw_create_vertex_shader(nv30->draw, &vp->pipe);*/ + /*vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);*/ return (void *)vp; } @@ -519,21 +519,21 @@ nv30_vp_state_create(struct pipe_context *pipe, static void nv30_vp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->vertprog = hwcso; - nv30->dirty |= NV30_NEW_VERTPROG; - /*nv30->draw_dirty |= NV30_NEW_VERTPROG;*/ + nvfx->vertprog = hwcso; + nvfx->dirty |= NVFX_NEW_VERTPROG; + /*nvfx->draw_dirty |= NVFX_NEW_VERTPROG;*/ } static void nv30_vp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_vertex_program *vp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp = hwcso; - /*draw_delete_vertex_shader(nv30->draw, vp->draw);*/ - nv30_vertprog_destroy(nv30, vp); + /*draw_delete_vertex_shader(nvfx->draw, vp->draw);*/ + nv30_vertprog_destroy(nvfx, vp); FREE((void*)vp->pipe.tokens); FREE(vp); } @@ -542,9 +542,9 @@ static void * nv30_fp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv30_fragment_program *fp; + struct nvfx_fragment_program *fp; - fp = CALLOC(1, sizeof(struct nv30_fragment_program)); + fp = CALLOC(1, sizeof(struct nvfx_fragment_program)); fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); tgsi_scan_shader(fp->pipe.tokens, &fp->info); @@ -555,19 +555,19 @@ nv30_fp_state_create(struct pipe_context *pipe, static void nv30_fp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->fragprog = hwcso; - nv30->dirty |= NV30_NEW_FRAGPROG; + nvfx->fragprog = hwcso; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } static void nv30_fp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); - struct nv30_fragment_program *fp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_fragment_program *fp = hwcso; - nv30_fragprog_destroy(nv30, fp); + nv30_fragprog_destroy(nvfx, fp); FREE((void*)fp->pipe.tokens); FREE(fp); } @@ -576,20 +576,20 @@ static void nv30_set_blend_color(struct pipe_context *pipe, const struct pipe_blend_color *bcol) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->blend_colour = *bcol; - nv30->dirty |= NV30_NEW_BCOL; + nvfx->blend_colour = *bcol; + nvfx->dirty |= NVFX_NEW_BCOL; } static void nv30_set_stencil_ref(struct pipe_context *pipe, const struct pipe_stencil_ref *sr) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->stencil_ref = *sr; - nv30->dirty |= NV30_NEW_SR; + nvfx->stencil_ref = *sr; + nvfx->dirty |= NVFX_NEW_SR; } static void @@ -602,16 +602,16 @@ static void nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct pipe_buffer *buf ) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->constbuf[shader] = buf; - nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float)); + nvfx->constbuf[shader] = buf; + nvfx->constbuf_nr[shader] = buf->size / (4 * sizeof(float)); if (shader == PIPE_SHADER_VERTEX) { - nv30->dirty |= NV30_NEW_VERTPROG; + nvfx->dirty |= NVFX_NEW_VERTPROG; } else if (shader == PIPE_SHADER_FRAGMENT) { - nv30->dirty |= NV30_NEW_FRAGPROG; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } } @@ -619,54 +619,54 @@ static void nv30_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->framebuffer = *fb; - nv30->dirty |= NV30_NEW_FB; + nvfx->framebuffer = *fb; + nvfx->dirty |= NVFX_NEW_FB; } static void nv30_set_polygon_stipple(struct pipe_context *pipe, const struct pipe_poly_stipple *stipple) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv30->stipple, stipple->stipple, 4 * 32); - nv30->dirty |= NV30_NEW_STIPPLE; + memcpy(nvfx->stipple, stipple->stipple, 4 * 32); + nvfx->dirty |= NVFX_NEW_STIPPLE; } static void nv30_set_scissor_state(struct pipe_context *pipe, const struct pipe_scissor_state *s) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->scissor = *s; - nv30->dirty |= NV30_NEW_SCISSOR; + nvfx->scissor = *s; + nvfx->dirty |= NVFX_NEW_SCISSOR; } static void nv30_set_viewport_state(struct pipe_context *pipe, const struct pipe_viewport_state *vpt) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->viewport = *vpt; - nv30->dirty |= NV30_NEW_VIEWPORT; - /*nv30->draw_dirty |= NV30_NEW_VIEWPORT;*/ + nvfx->viewport = *vpt; + nvfx->dirty |= NVFX_NEW_VIEWPORT; + /*nvfx->draw_dirty |= NVFX_NEW_VIEWPORT;*/ } static void nv30_set_vertex_buffers(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_buffer *vb) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv30->vtxbuf, vb, sizeof(*vb) * count); - nv30->vtxbuf_nr = count; + memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count); + nvfx->vtxbuf_nr = count; - nv30->dirty |= NV30_NEW_ARRAYS; - /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/ + nvfx->dirty |= NVFX_NEW_ARRAYS; + /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/ } static void * @@ -674,7 +674,7 @@ nv30_vtxelts_state_create(struct pipe_context *pipe, unsigned num_elements, const struct pipe_vertex_element *elements) { - struct nv30_vtxelt_state *cso = CALLOC_STRUCT(nv30_vtxelt_state); + struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state); assert(num_elements < 16); /* not doing fallbacks yet */ cso->num_elements = num_elements; @@ -694,57 +694,57 @@ nv30_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) static void nv30_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv30_context *nv30 = nv30_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv30->vtxelt = hwcso; - nv30->dirty |= NV30_NEW_ARRAYS; - /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/ + nvfx->vtxelt = hwcso; + nvfx->dirty |= NVFX_NEW_ARRAYS; + /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/ } void -nv30_init_state_functions(struct nv30_context *nv30) +nv30_init_state_functions(struct nvfx_context *nvfx) { - nv30->pipe.create_blend_state = nv30_blend_state_create; - nv30->pipe.bind_blend_state = nv30_blend_state_bind; - nv30->pipe.delete_blend_state = nv30_blend_state_delete; + nvfx->pipe.create_blend_state = nv30_blend_state_create; + nvfx->pipe.bind_blend_state = nv30_blend_state_bind; + nvfx->pipe.delete_blend_state = nv30_blend_state_delete; - nv30->pipe.create_sampler_state = nv30_sampler_state_create; - nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; - nv30->pipe.delete_sampler_state = nv30_sampler_state_delete; - nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; + nvfx->pipe.create_sampler_state = nv30_sampler_state_create; + nvfx->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; + nvfx->pipe.delete_sampler_state = nv30_sampler_state_delete; + nvfx->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; - nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create; - nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; - nv30->pipe.delete_rasterizer_state = nv30_rasterizer_state_delete; + nvfx->pipe.create_rasterizer_state = nv30_rasterizer_state_create; + nvfx->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; + nvfx->pipe.delete_rasterizer_state = nv30_rasterizer_state_delete; - nv30->pipe.create_depth_stencil_alpha_state = + nvfx->pipe.create_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_create; - nv30->pipe.bind_depth_stencil_alpha_state = + nvfx->pipe.bind_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_bind; - nv30->pipe.delete_depth_stencil_alpha_state = + nvfx->pipe.delete_depth_stencil_alpha_state = nv30_depth_stencil_alpha_state_delete; - nv30->pipe.create_vs_state = nv30_vp_state_create; - nv30->pipe.bind_vs_state = nv30_vp_state_bind; - nv30->pipe.delete_vs_state = nv30_vp_state_delete; + nvfx->pipe.create_vs_state = nv30_vp_state_create; + nvfx->pipe.bind_vs_state = nv30_vp_state_bind; + nvfx->pipe.delete_vs_state = nv30_vp_state_delete; - nv30->pipe.create_fs_state = nv30_fp_state_create; - nv30->pipe.bind_fs_state = nv30_fp_state_bind; - nv30->pipe.delete_fs_state = nv30_fp_state_delete; + nvfx->pipe.create_fs_state = nv30_fp_state_create; + nvfx->pipe.bind_fs_state = nv30_fp_state_bind; + nvfx->pipe.delete_fs_state = nv30_fp_state_delete; - nv30->pipe.set_blend_color = nv30_set_blend_color; - nv30->pipe.set_stencil_ref = nv30_set_stencil_ref; - nv30->pipe.set_clip_state = nv30_set_clip_state; - nv30->pipe.set_constant_buffer = nv30_set_constant_buffer; - nv30->pipe.set_framebuffer_state = nv30_set_framebuffer_state; - nv30->pipe.set_polygon_stipple = nv30_set_polygon_stipple; - nv30->pipe.set_scissor_state = nv30_set_scissor_state; - nv30->pipe.set_viewport_state = nv30_set_viewport_state; + nvfx->pipe.set_blend_color = nv30_set_blend_color; + nvfx->pipe.set_stencil_ref = nv30_set_stencil_ref; + nvfx->pipe.set_clip_state = nv30_set_clip_state; + nvfx->pipe.set_constant_buffer = nv30_set_constant_buffer; + nvfx->pipe.set_framebuffer_state = nv30_set_framebuffer_state; + nvfx->pipe.set_polygon_stipple = nv30_set_polygon_stipple; + nvfx->pipe.set_scissor_state = nv30_set_scissor_state; + nvfx->pipe.set_viewport_state = nv30_set_viewport_state; - nv30->pipe.create_vertex_elements_state = nv30_vtxelts_state_create; - nv30->pipe.delete_vertex_elements_state = nv30_vtxelts_state_delete; - nv30->pipe.bind_vertex_elements_state = nv30_vtxelts_state_bind; + nvfx->pipe.create_vertex_elements_state = nv30_vtxelts_state_create; + nvfx->pipe.delete_vertex_elements_state = nv30_vtxelts_state_delete; + nvfx->pipe.bind_vertex_elements_state = nv30_vtxelts_state_bind; - nv30->pipe.set_vertex_buffers = nv30_set_vertex_buffers; + nvfx->pipe.set_vertex_buffers = nv30_set_vertex_buffers; } |