mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 21:30:23 +01:00
nvfx: move stuff around
This commit is contained in:
parent
ed99c28d12
commit
47537a4557
5 changed files with 95 additions and 84 deletions
|
|
@ -77,6 +77,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv)
|
|||
nvfx_init_state_functions(nvfx);
|
||||
nvfx_init_sampling_functions(nvfx);
|
||||
nvfx_init_vbo_functions(nvfx);
|
||||
nvfx_init_fragprog_functions(nvfx);
|
||||
nvfx_init_vertprog_functions(nvfx);
|
||||
nvfx_init_resource_functions(&nvfx->pipe);
|
||||
nvfx_init_transfer_functions(&nvfx->pipe);
|
||||
|
||||
|
|
|
|||
|
|
@ -244,8 +244,8 @@ nvfx_framebuffer_relocate(struct nvfx_context *nvfx);
|
|||
extern void nvfx_fragprog_destroy(struct nvfx_context *,
|
||||
struct nvfx_fragment_program *);
|
||||
extern void nvfx_fragprog_validate(struct nvfx_context *nvfx);
|
||||
extern void
|
||||
nvfx_fragprog_relocate(struct nvfx_context *nvfx);
|
||||
extern void nvfx_fragprog_relocate(struct nvfx_context *nvfx);
|
||||
extern void nvfx_init_fragprog_functions(struct nvfx_context *nvfx);
|
||||
|
||||
/* nvfx_fragtex.c */
|
||||
extern void nvfx_init_sampling_functions(struct nvfx_context *nvfx);
|
||||
|
|
@ -308,6 +308,7 @@ extern unsigned nvfx_vertex_formats[];
|
|||
extern boolean nvfx_vertprog_validate(struct nvfx_context *nvfx);
|
||||
extern void nvfx_vertprog_destroy(struct nvfx_context *,
|
||||
struct nvfx_vertex_program *);
|
||||
extern void nvfx_init_vertprog_functions(struct nvfx_context *nvfx);
|
||||
|
||||
/* nvfx_push.c */
|
||||
extern void nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info);
|
||||
|
|
|
|||
|
|
@ -1428,3 +1428,45 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx,
|
|||
if (fp->insn_len)
|
||||
FREE(fp->insn);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvfx_fp_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_shader_state *cso)
|
||||
{
|
||||
struct nvfx_fragment_program *fp;
|
||||
|
||||
fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
|
||||
fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
|
||||
|
||||
tgsi_scan_shader(fp->pipe.tokens, &fp->info);
|
||||
|
||||
return (void *)fp;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
|
||||
nvfx->fragprog = hwcso;
|
||||
nvfx->dirty |= NVFX_NEW_FRAGPROG;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_fragment_program *fp = hwcso;
|
||||
|
||||
nvfx_fragprog_destroy(nvfx, fp);
|
||||
FREE((void*)fp->pipe.tokens);
|
||||
FREE(fp);
|
||||
}
|
||||
|
||||
void
|
||||
nvfx_init_fragprog_functions(struct nvfx_context *nvfx)
|
||||
{
|
||||
nvfx->pipe.create_fs_state = nvfx_fp_state_create;
|
||||
nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
|
||||
nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,80 +260,6 @@ nvfx_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
|
|||
FREE(zsaso);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvfx_vp_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_shader_state *cso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_vertex_program *vp;
|
||||
|
||||
// TODO: use a 64-bit atomic here!
|
||||
static unsigned long long id = 0;
|
||||
|
||||
vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
|
||||
vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
|
||||
vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
|
||||
vp->id = ++id;
|
||||
|
||||
return (void *)vp;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
|
||||
nvfx->vertprog = hwcso;
|
||||
nvfx->dirty |= NVFX_NEW_VERTPROG;
|
||||
nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_vertex_program *vp = hwcso;
|
||||
|
||||
draw_delete_vertex_shader(nvfx->draw, vp->draw);
|
||||
nvfx_vertprog_destroy(nvfx, vp);
|
||||
FREE((void*)vp->pipe.tokens);
|
||||
FREE(vp);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvfx_fp_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_shader_state *cso)
|
||||
{
|
||||
struct nvfx_fragment_program *fp;
|
||||
|
||||
fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
|
||||
fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
|
||||
|
||||
tgsi_scan_shader(fp->pipe.tokens, &fp->info);
|
||||
|
||||
return (void *)fp;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
|
||||
nvfx->fragprog = hwcso;
|
||||
nvfx->dirty |= NVFX_NEW_FRAGPROG;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_fragment_program *fp = hwcso;
|
||||
|
||||
nvfx_fragprog_destroy(nvfx, fp);
|
||||
FREE((void*)fp->pipe.tokens);
|
||||
FREE(fp);
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_set_blend_color(struct pipe_context *pipe,
|
||||
const struct pipe_blend_color *bcol)
|
||||
|
|
@ -450,14 +376,6 @@ nvfx_init_state_functions(struct nvfx_context *nvfx)
|
|||
nvfx->pipe.delete_depth_stencil_alpha_state =
|
||||
nvfx_depth_stencil_alpha_state_delete;
|
||||
|
||||
nvfx->pipe.create_vs_state = nvfx_vp_state_create;
|
||||
nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
|
||||
nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
|
||||
|
||||
nvfx->pipe.create_fs_state = nvfx_fp_state_create;
|
||||
nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
|
||||
nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
|
||||
|
||||
nvfx->pipe.set_blend_color = nvfx_set_blend_color;
|
||||
nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
|
||||
nvfx->pipe.set_clip_state = nvfx_set_clip_state;
|
||||
|
|
|
|||
|
|
@ -1260,3 +1260,51 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
|
|||
util_dynarray_fini(&vp->branch_relocs);
|
||||
util_dynarray_fini(&vp->const_relocs);
|
||||
}
|
||||
|
||||
static void *
|
||||
nvfx_vp_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_shader_state *cso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_vertex_program *vp;
|
||||
|
||||
// TODO: use a 64-bit atomic here!
|
||||
static unsigned long long id = 0;
|
||||
|
||||
vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
|
||||
vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
|
||||
vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
|
||||
vp->id = ++id;
|
||||
|
||||
return (void *)vp;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
|
||||
nvfx->vertprog = hwcso;
|
||||
nvfx->dirty |= NVFX_NEW_VERTPROG;
|
||||
nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
|
||||
}
|
||||
|
||||
static void
|
||||
nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
|
||||
{
|
||||
struct nvfx_context *nvfx = nvfx_context(pipe);
|
||||
struct nvfx_vertex_program *vp = hwcso;
|
||||
|
||||
draw_delete_vertex_shader(nvfx->draw, vp->draw);
|
||||
nvfx_vertprog_destroy(nvfx, vp);
|
||||
FREE((void*)vp->pipe.tokens);
|
||||
FREE(vp);
|
||||
}
|
||||
|
||||
void
|
||||
nvfx_init_vertprog_functions(struct nvfx_context *nvfx)
|
||||
{
|
||||
nvfx->pipe.create_vs_state = nvfx_vp_state_create;
|
||||
nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
|
||||
nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue