radeonsi: add code for creating, binding and destroying tessellation shaders
This doesn't do anything yet. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
@@ -57,6 +57,8 @@ static void si_blitter_begin(struct pipe_context *ctx, enum si_blitter_op op)
|
||||
util_blitter_save_rasterizer(sctx->blitter, sctx->queued.named.rasterizer);
|
||||
util_blitter_save_fragment_shader(sctx->blitter, sctx->ps_shader);
|
||||
util_blitter_save_geometry_shader(sctx->blitter, sctx->gs_shader);
|
||||
util_blitter_save_tessctrl_shader(sctx->blitter, sctx->tcs_shader);
|
||||
util_blitter_save_tesseval_shader(sctx->blitter, sctx->tes_shader);
|
||||
util_blitter_save_vertex_shader(sctx->blitter, sctx->vs_shader);
|
||||
util_blitter_save_vertex_elements(sctx->blitter, sctx->vertex_elements);
|
||||
if (sctx->queued.named.sample_mask) {
|
||||
|
||||
@@ -167,6 +167,8 @@ struct si_context {
|
||||
struct si_shader_selector *ps_shader;
|
||||
struct si_shader_selector *gs_shader;
|
||||
struct si_shader_selector *vs_shader;
|
||||
struct si_shader_selector *tcs_shader;
|
||||
struct si_shader_selector *tes_shader;
|
||||
struct si_cs_shader_state cs_shader_state;
|
||||
struct si_shader_data shader_userdata;
|
||||
/* shader information */
|
||||
|
||||
@@ -517,6 +517,18 @@ static void *si_create_vs_state(struct pipe_context *ctx,
|
||||
return si_create_shader_state(ctx, state, PIPE_SHADER_VERTEX);
|
||||
}
|
||||
|
||||
static void *si_create_tcs_state(struct pipe_context *ctx,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
return si_create_shader_state(ctx, state, PIPE_SHADER_TESS_CTRL);
|
||||
}
|
||||
|
||||
static void *si_create_tes_state(struct pipe_context *ctx,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
return si_create_shader_state(ctx, state, PIPE_SHADER_TESS_EVAL);
|
||||
}
|
||||
|
||||
static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
@@ -546,6 +558,34 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
|
||||
si_shader_change_notify(sctx);
|
||||
}
|
||||
|
||||
static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_shader_selector *sel = state;
|
||||
|
||||
if (sctx->tcs_shader == sel)
|
||||
return;
|
||||
|
||||
sctx->tcs_shader = sel;
|
||||
}
|
||||
|
||||
static void si_bind_tes_shader(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_shader_selector *sel = state;
|
||||
bool enable_changed = !!sctx->tes_shader != !!sel;
|
||||
|
||||
if (sctx->tes_shader == sel)
|
||||
return;
|
||||
|
||||
sctx->tes_shader = sel;
|
||||
sctx->clip_regs.dirty = true;
|
||||
sctx->last_rast_prim = -1; /* reset this so that it gets updated */
|
||||
|
||||
if (enable_changed)
|
||||
si_shader_change_notify(sctx);
|
||||
}
|
||||
|
||||
static void si_make_dummy_ps(struct si_context *sctx)
|
||||
{
|
||||
if (!sctx->dummy_pixel_shader) {
|
||||
@@ -643,6 +683,30 @@ static void si_delete_ps_shader(struct pipe_context *ctx, void *state)
|
||||
si_delete_shader_selector(ctx, sel);
|
||||
}
|
||||
|
||||
static void si_delete_tcs_shader(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_shader_selector *sel = (struct si_shader_selector *)state;
|
||||
|
||||
if (sctx->tcs_shader == sel) {
|
||||
sctx->tcs_shader = NULL;
|
||||
}
|
||||
|
||||
si_delete_shader_selector(ctx, sel);
|
||||
}
|
||||
|
||||
static void si_delete_tes_shader(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
struct si_shader_selector *sel = (struct si_shader_selector *)state;
|
||||
|
||||
if (sctx->tes_shader == sel) {
|
||||
sctx->tes_shader = NULL;
|
||||
}
|
||||
|
||||
si_delete_shader_selector(ctx, sel);
|
||||
}
|
||||
|
||||
static void si_update_spi_map(struct si_context *sctx)
|
||||
{
|
||||
struct si_shader *ps = sctx->ps_shader->current;
|
||||
@@ -956,14 +1020,20 @@ void si_update_shaders(struct si_context *sctx)
|
||||
void si_init_shader_functions(struct si_context *sctx)
|
||||
{
|
||||
sctx->b.b.create_vs_state = si_create_vs_state;
|
||||
sctx->b.b.create_tcs_state = si_create_tcs_state;
|
||||
sctx->b.b.create_tes_state = si_create_tes_state;
|
||||
sctx->b.b.create_gs_state = si_create_gs_state;
|
||||
sctx->b.b.create_fs_state = si_create_fs_state;
|
||||
|
||||
sctx->b.b.bind_vs_state = si_bind_vs_shader;
|
||||
sctx->b.b.bind_tcs_state = si_bind_tcs_shader;
|
||||
sctx->b.b.bind_tes_state = si_bind_tes_shader;
|
||||
sctx->b.b.bind_gs_state = si_bind_gs_shader;
|
||||
sctx->b.b.bind_fs_state = si_bind_ps_shader;
|
||||
|
||||
sctx->b.b.delete_vs_state = si_delete_vs_shader;
|
||||
sctx->b.b.delete_tcs_state = si_delete_tcs_shader;
|
||||
sctx->b.b.delete_tes_state = si_delete_tes_shader;
|
||||
sctx->b.b.delete_gs_state = si_delete_gs_shader;
|
||||
sctx->b.b.delete_fs_state = si_delete_ps_shader;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user