diff options
Diffstat (limited to 'src/gallium/drivers/nv40/nv40_state.c')
-rw-r--r-- | src/gallium/drivers/nv40/nv40_state.c | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index e8076e059b..a205342ac5 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -7,15 +7,15 @@ #include "tgsi/tgsi_parse.h" #include "nv40_context.h" -#include "nv40_state.h" +#include "nvfx_state.h" static void * nv40_blend_state_create(struct pipe_context *pipe, const struct pipe_blend_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nouveau_grobj *eng3d = nv40->screen->eng3d; - struct nv40_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) { @@ -60,16 +60,16 @@ nv40_blend_state_create(struct pipe_context *pipe, static void nv40_blend_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->blend = hwcso; - nv40->dirty |= NV40_NEW_BLEND; + nvfx->blend = hwcso; + nvfx->dirty |= NVFX_NEW_BLEND; } static void nv40_blend_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_blend_state *bso = hwcso; + struct nvfx_blend_state *bso = hwcso; so_ref(NULL, &bso->so); FREE(bso); @@ -118,10 +118,10 @@ static void * nv40_sampler_state_create(struct pipe_context *pipe, const struct pipe_sampler_state *cso) { - struct nv40_sampler_state *ps; + struct nvfx_sampler_state *ps; uint32_t filter = 0; - ps = MALLOC(sizeof(struct nv40_sampler_state)); + ps = MALLOC(sizeof(struct nvfx_sampler_state)); ps->fmt = 0; if (!cso->normalized_coords) @@ -258,21 +258,21 @@ nv40_sampler_state_create(struct pipe_context *pipe, static void nv40_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { - nv40->tex_sampler[unit] = sampler[unit]; - nv40->dirty_samplers |= (1 << unit); + nvfx->tex_sampler[unit] = sampler[unit]; + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv40->nr_samplers; unit++) { - nv40->tex_sampler[unit] = NULL; - nv40->dirty_samplers |= (1 << unit); + for (unit = nr; unit < nvfx->nr_samplers; unit++) { + nvfx->tex_sampler[unit] = NULL; + nvfx->dirty_samplers |= (1 << unit); } - nv40->nr_samplers = nr; - nv40->dirty |= NV40_NEW_SAMPLER; + nvfx->nr_samplers = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void @@ -285,33 +285,33 @@ static void nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr, struct pipe_texture **miptree) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); unsigned unit; for (unit = 0; unit < nr; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv40->tex_miptree[unit], miptree[unit]); - nv40->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], miptree[unit]); + nvfx->dirty_samplers |= (1 << unit); } - for (unit = nr; unit < nv40->nr_textures; unit++) { + for (unit = nr; unit < nvfx->nr_textures; unit++) { pipe_texture_reference((struct pipe_texture **) - &nv40->tex_miptree[unit], NULL); - nv40->dirty_samplers |= (1 << unit); + &nvfx->tex_miptree[unit], NULL); + nvfx->dirty_samplers |= (1 << unit); } - nv40->nr_textures = nr; - nv40->dirty |= NV40_NEW_SAMPLER; + nvfx->nr_textures = nr; + nvfx->dirty |= NVFX_NEW_SAMPLER; } static void * nv40_rasterizer_state_create(struct pipe_context *pipe, const struct pipe_rasterizer_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_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 = nv40->screen->eng3d; + struct nouveau_grobj *eng3d = nvfx->screen->eng3d; /*XXX: ignored: * light_twoside @@ -423,17 +423,17 @@ nv40_rasterizer_state_create(struct pipe_context *pipe, static void nv40_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->rasterizer = hwcso; - nv40->dirty |= NV40_NEW_RAST; - nv40->draw_dirty |= NV40_NEW_RAST; + nvfx->rasterizer = hwcso; + nvfx->dirty |= NVFX_NEW_RAST; + nvfx->draw_dirty |= NVFX_NEW_RAST; } static void nv40_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_rasterizer_state *rsso = hwcso; + struct nvfx_rasterizer_state *rsso = hwcso; so_ref(NULL, &rsso->so); FREE(rsso); @@ -443,10 +443,10 @@ static void * nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, const struct pipe_depth_stencil_alpha_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_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 = nv40->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)); @@ -497,16 +497,16 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe, static void nv40_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->zsa = hwcso; - nv40->dirty |= NV40_NEW_ZSA; + nvfx->zsa = hwcso; + nvfx->dirty |= NVFX_NEW_ZSA; } static void nv40_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_zsa_state *zsaso = hwcso; + struct nvfx_zsa_state *zsaso = hwcso; so_ref(NULL, &zsaso->so); FREE(zsaso); @@ -516,12 +516,12 @@ static void * nv40_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_vertex_program *vp; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp; - vp = CALLOC(1, sizeof(struct nv40_vertex_program)); + vp = CALLOC(1, sizeof(struct nvfx_vertex_program)); vp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - vp->draw = draw_create_vertex_shader(nv40->draw, &vp->pipe); + vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe); return (void *)vp; } @@ -529,21 +529,21 @@ nv40_vp_state_create(struct pipe_context *pipe, static void nv40_vp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->vertprog = hwcso; - nv40->dirty |= NV40_NEW_VERTPROG; - nv40->draw_dirty |= NV40_NEW_VERTPROG; + nvfx->vertprog = hwcso; + nvfx->dirty |= NVFX_NEW_VERTPROG; + nvfx->draw_dirty |= NVFX_NEW_VERTPROG; } static void nv40_vp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_vertex_program *vp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_vertex_program *vp = hwcso; - draw_delete_vertex_shader(nv40->draw, vp->draw); - nv40_vertprog_destroy(nv40, vp); + draw_delete_vertex_shader(nvfx->draw, vp->draw); + nv40_vertprog_destroy(nvfx, vp); FREE((void*)vp->pipe.tokens); FREE(vp); } @@ -552,9 +552,9 @@ static void * nv40_fp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso) { - struct nv40_fragment_program *fp; + struct nvfx_fragment_program *fp; - fp = CALLOC(1, sizeof(struct nv40_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); @@ -565,19 +565,19 @@ nv40_fp_state_create(struct pipe_context *pipe, static void nv40_fp_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->fragprog = hwcso; - nv40->dirty |= NV40_NEW_FRAGPROG; + nvfx->fragprog = hwcso; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } static void nv40_fp_state_delete(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); - struct nv40_fragment_program *fp = hwcso; + struct nvfx_context *nvfx = nvfx_context(pipe); + struct nvfx_fragment_program *fp = hwcso; - nv40_fragprog_destroy(nv40, fp); + nv40_fragprog_destroy(nvfx, fp); FREE((void*)fp->pipe.tokens); FREE(fp); } @@ -586,47 +586,47 @@ static void nv40_set_blend_color(struct pipe_context *pipe, const struct pipe_blend_color *bcol) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->blend_colour = *bcol; - nv40->dirty |= NV40_NEW_BCOL; + nvfx->blend_colour = *bcol; + nvfx->dirty |= NVFX_NEW_BCOL; } static void nv40_set_stencil_ref(struct pipe_context *pipe, const struct pipe_stencil_ref *sr) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->stencil_ref = *sr; - nv40->dirty |= NV40_NEW_SR; + nvfx->stencil_ref = *sr; + nvfx->dirty |= NVFX_NEW_SR; } static void nv40_set_clip_state(struct pipe_context *pipe, const struct pipe_clip_state *clip) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->clip = *clip; - nv40->dirty |= NV40_NEW_UCP; - nv40->draw_dirty |= NV40_NEW_UCP; + nvfx->clip = *clip; + nvfx->dirty |= NVFX_NEW_UCP; + nvfx->draw_dirty |= NVFX_NEW_UCP; } static void nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, struct pipe_buffer *buf ) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->constbuf[shader] = buf; - nv40->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) { - nv40->dirty |= NV40_NEW_VERTPROG; + nvfx->dirty |= NVFX_NEW_VERTPROG; } else if (shader == PIPE_SHADER_FRAGMENT) { - nv40->dirty |= NV40_NEW_FRAGPROG; + nvfx->dirty |= NVFX_NEW_FRAGPROG; } } @@ -634,54 +634,54 @@ static void nv40_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->framebuffer = *fb; - nv40->dirty |= NV40_NEW_FB; + nvfx->framebuffer = *fb; + nvfx->dirty |= NVFX_NEW_FB; } static void nv40_set_polygon_stipple(struct pipe_context *pipe, const struct pipe_poly_stipple *stipple) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv40->stipple, stipple->stipple, 4 * 32); - nv40->dirty |= NV40_NEW_STIPPLE; + memcpy(nvfx->stipple, stipple->stipple, 4 * 32); + nvfx->dirty |= NVFX_NEW_STIPPLE; } static void nv40_set_scissor_state(struct pipe_context *pipe, const struct pipe_scissor_state *s) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->scissor = *s; - nv40->dirty |= NV40_NEW_SCISSOR; + nvfx->scissor = *s; + nvfx->dirty |= NVFX_NEW_SCISSOR; } static void nv40_set_viewport_state(struct pipe_context *pipe, const struct pipe_viewport_state *vpt) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->viewport = *vpt; - nv40->dirty |= NV40_NEW_VIEWPORT; - nv40->draw_dirty |= NV40_NEW_VIEWPORT; + nvfx->viewport = *vpt; + nvfx->dirty |= NVFX_NEW_VIEWPORT; + nvfx->draw_dirty |= NVFX_NEW_VIEWPORT; } static void nv40_set_vertex_buffers(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_buffer *vb) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - memcpy(nv40->vtxbuf, vb, sizeof(*vb) * count); - nv40->vtxbuf_nr = count; + memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count); + nvfx->vtxbuf_nr = count; - nv40->dirty |= NV40_NEW_ARRAYS; - nv40->draw_dirty |= NV40_NEW_ARRAYS; + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } static void * @@ -689,7 +689,7 @@ nv40_vtxelts_state_create(struct pipe_context *pipe, unsigned num_elements, const struct pipe_vertex_element *elements) { - struct nv40_vtxelt_state *cso = CALLOC_STRUCT(nv40_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; @@ -709,57 +709,57 @@ nv40_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso) static void nv40_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso) { - struct nv40_context *nv40 = nv40_context(pipe); + struct nvfx_context *nvfx = nvfx_context(pipe); - nv40->vtxelt = hwcso; - nv40->dirty |= NV40_NEW_ARRAYS; - nv40->draw_dirty |= NV40_NEW_ARRAYS; + nvfx->vtxelt = hwcso; + nvfx->dirty |= NVFX_NEW_ARRAYS; + nvfx->draw_dirty |= NVFX_NEW_ARRAYS; } void -nv40_init_state_functions(struct nv40_context *nv40) +nv40_init_state_functions(struct nvfx_context *nvfx) { - nv40->pipe.create_blend_state = nv40_blend_state_create; - nv40->pipe.bind_blend_state = nv40_blend_state_bind; - nv40->pipe.delete_blend_state = nv40_blend_state_delete; + nvfx->pipe.create_blend_state = nv40_blend_state_create; + nvfx->pipe.bind_blend_state = nv40_blend_state_bind; + nvfx->pipe.delete_blend_state = nv40_blend_state_delete; - nv40->pipe.create_sampler_state = nv40_sampler_state_create; - nv40->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; - nv40->pipe.delete_sampler_state = nv40_sampler_state_delete; - nv40->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; + nvfx->pipe.create_sampler_state = nv40_sampler_state_create; + nvfx->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; + nvfx->pipe.delete_sampler_state = nv40_sampler_state_delete; + nvfx->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; - nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create; - nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; - nv40->pipe.delete_rasterizer_state = nv40_rasterizer_state_delete; + nvfx->pipe.create_rasterizer_state = nv40_rasterizer_state_create; + nvfx->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; + nvfx->pipe.delete_rasterizer_state = nv40_rasterizer_state_delete; - nv40->pipe.create_depth_stencil_alpha_state = + nvfx->pipe.create_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_create; - nv40->pipe.bind_depth_stencil_alpha_state = + nvfx->pipe.bind_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_bind; - nv40->pipe.delete_depth_stencil_alpha_state = + nvfx->pipe.delete_depth_stencil_alpha_state = nv40_depth_stencil_alpha_state_delete; - nv40->pipe.create_vs_state = nv40_vp_state_create; - nv40->pipe.bind_vs_state = nv40_vp_state_bind; - nv40->pipe.delete_vs_state = nv40_vp_state_delete; + nvfx->pipe.create_vs_state = nv40_vp_state_create; + nvfx->pipe.bind_vs_state = nv40_vp_state_bind; + nvfx->pipe.delete_vs_state = nv40_vp_state_delete; - nv40->pipe.create_fs_state = nv40_fp_state_create; - nv40->pipe.bind_fs_state = nv40_fp_state_bind; - nv40->pipe.delete_fs_state = nv40_fp_state_delete; + nvfx->pipe.create_fs_state = nv40_fp_state_create; + nvfx->pipe.bind_fs_state = nv40_fp_state_bind; + nvfx->pipe.delete_fs_state = nv40_fp_state_delete; - nv40->pipe.set_blend_color = nv40_set_blend_color; - nv40->pipe.set_stencil_ref = nv40_set_stencil_ref; - nv40->pipe.set_clip_state = nv40_set_clip_state; - nv40->pipe.set_constant_buffer = nv40_set_constant_buffer; - nv40->pipe.set_framebuffer_state = nv40_set_framebuffer_state; - nv40->pipe.set_polygon_stipple = nv40_set_polygon_stipple; - nv40->pipe.set_scissor_state = nv40_set_scissor_state; - nv40->pipe.set_viewport_state = nv40_set_viewport_state; + nvfx->pipe.set_blend_color = nv40_set_blend_color; + nvfx->pipe.set_stencil_ref = nv40_set_stencil_ref; + nvfx->pipe.set_clip_state = nv40_set_clip_state; + nvfx->pipe.set_constant_buffer = nv40_set_constant_buffer; + nvfx->pipe.set_framebuffer_state = nv40_set_framebuffer_state; + nvfx->pipe.set_polygon_stipple = nv40_set_polygon_stipple; + nvfx->pipe.set_scissor_state = nv40_set_scissor_state; + nvfx->pipe.set_viewport_state = nv40_set_viewport_state; - nv40->pipe.create_vertex_elements_state = nv40_vtxelts_state_create; - nv40->pipe.delete_vertex_elements_state = nv40_vtxelts_state_delete; - nv40->pipe.bind_vertex_elements_state = nv40_vtxelts_state_bind; + nvfx->pipe.create_vertex_elements_state = nv40_vtxelts_state_create; + nvfx->pipe.delete_vertex_elements_state = nv40_vtxelts_state_delete; + nvfx->pipe.bind_vertex_elements_state = nv40_vtxelts_state_bind; - nv40->pipe.set_vertex_buffers = nv40_set_vertex_buffers; + nvfx->pipe.set_vertex_buffers = nv40_set_vertex_buffers; } |