iris: refactor program CSO stuff
This commit is contained in:
@@ -79,16 +79,13 @@ struct iris_uncompiled_shader {
|
||||
* Actual shader compilation to assembly happens later, at first use.
|
||||
*/
|
||||
static void *
|
||||
iris_create_shader_state(struct pipe_context *ctx,
|
||||
const struct pipe_shader_state *state)
|
||||
iris_create_uncompiled_shader(struct pipe_context *ctx,
|
||||
nir_shader *nir,
|
||||
const struct pipe_stream_output_info *so_info)
|
||||
{
|
||||
//struct iris_context *ice = (struct iris_context *)ctx;
|
||||
struct iris_screen *screen = (struct iris_screen *)ctx->screen;
|
||||
|
||||
assert(state->type == PIPE_SHADER_IR_NIR);
|
||||
|
||||
nir_shader *nir = state->ir.nir;
|
||||
|
||||
struct iris_uncompiled_shader *ish =
|
||||
calloc(1, sizeof(struct iris_uncompiled_shader));
|
||||
if (!ish)
|
||||
@@ -98,8 +95,8 @@ iris_create_shader_state(struct pipe_context *ctx,
|
||||
|
||||
ish->program_id = get_new_program_id(screen);
|
||||
ish->nir = nir;
|
||||
memcpy(&ish->stream_output, &state->stream_output,
|
||||
sizeof(struct pipe_stream_output_info));
|
||||
if (so_info)
|
||||
memcpy(&ish->stream_output, so_info, sizeof(*so_info));
|
||||
|
||||
switch (nir->info.stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
@@ -143,6 +140,25 @@ iris_create_shader_state(struct pipe_context *ctx,
|
||||
*
|
||||
* Frees the iris_uncompiled_shader.
|
||||
*/
|
||||
static void *
|
||||
iris_create_shader_state(struct pipe_context *ctx,
|
||||
const struct pipe_shader_state *state)
|
||||
{
|
||||
assert(state->type == PIPE_SHADER_IR_NIR);
|
||||
|
||||
return iris_create_uncompiled_shader(ctx, state->ir.nir,
|
||||
&state->stream_output);
|
||||
}
|
||||
|
||||
static void *
|
||||
iris_create_compute_state(struct pipe_context *ctx,
|
||||
const struct pipe_compute_state *state)
|
||||
{
|
||||
assert(state->ir_type == PIPE_SHADER_IR_NIR);
|
||||
|
||||
return iris_create_uncompiled_shader(ctx, state->prog, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
iris_delete_shader_state(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
@@ -222,6 +238,12 @@ iris_bind_fs_state(struct pipe_context *ctx, void *state)
|
||||
bind_state((void *) ctx, state, MESA_SHADER_FRAGMENT);
|
||||
}
|
||||
|
||||
static void
|
||||
iris_bind_cs_state(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
bind_state((void *) ctx, state, MESA_SHADER_COMPUTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the starting offsets for the groups of binding table entries
|
||||
* common to all pipeline stages.
|
||||
@@ -881,16 +903,19 @@ iris_init_program_functions(struct pipe_context *ctx)
|
||||
ctx->create_tes_state = iris_create_shader_state;
|
||||
ctx->create_gs_state = iris_create_shader_state;
|
||||
ctx->create_fs_state = iris_create_shader_state;
|
||||
ctx->create_compute_state = iris_create_compute_state;
|
||||
|
||||
ctx->delete_vs_state = iris_delete_shader_state;
|
||||
ctx->delete_tcs_state = iris_delete_shader_state;
|
||||
ctx->delete_tes_state = iris_delete_shader_state;
|
||||
ctx->delete_gs_state = iris_delete_shader_state;
|
||||
ctx->delete_fs_state = iris_delete_shader_state;
|
||||
ctx->delete_compute_state = iris_delete_shader_state;
|
||||
|
||||
ctx->bind_vs_state = iris_bind_vs_state;
|
||||
ctx->bind_tcs_state = iris_bind_tcs_state;
|
||||
ctx->bind_tes_state = iris_bind_tes_state;
|
||||
ctx->bind_gs_state = iris_bind_gs_state;
|
||||
ctx->bind_fs_state = iris_bind_fs_state;
|
||||
ctx->bind_compute_state = iris_bind_cs_state;
|
||||
}
|
||||
|
@@ -2133,14 +2133,6 @@ iris_bind_vertex_elements_state(struct pipe_context *ctx, void *state)
|
||||
ice->state.dirty |= IRIS_DIRTY_VERTEX_ELEMENTS;
|
||||
}
|
||||
|
||||
static void *
|
||||
iris_create_compute_state(struct pipe_context *ctx,
|
||||
const struct pipe_compute_state *state)
|
||||
{
|
||||
// XXX: actually do something
|
||||
return malloc(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gallium CSO for stream output (transform feedback) targets.
|
||||
*/
|
||||
@@ -2627,12 +2619,6 @@ iris_emit_sbe(struct iris_batch *batch, const struct iris_context *ice)
|
||||
iris_emit_sbe_swiz(batch, ice, urb_read_offset, sprite_coord_overrides);
|
||||
}
|
||||
|
||||
static void
|
||||
iris_bind_compute_state(struct pipe_context *ctx, void *state)
|
||||
{
|
||||
// XXX: do something
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
@@ -4398,20 +4384,17 @@ genX(init_state)(struct iris_context *ice)
|
||||
ctx->create_sampler_view = iris_create_sampler_view;
|
||||
ctx->create_surface = iris_create_surface;
|
||||
ctx->create_vertex_elements_state = iris_create_vertex_elements;
|
||||
ctx->create_compute_state = iris_create_compute_state;
|
||||
ctx->bind_blend_state = iris_bind_blend_state;
|
||||
ctx->bind_depth_stencil_alpha_state = iris_bind_zsa_state;
|
||||
ctx->bind_sampler_states = iris_bind_sampler_states;
|
||||
ctx->bind_rasterizer_state = iris_bind_rasterizer_state;
|
||||
ctx->bind_vertex_elements_state = iris_bind_vertex_elements_state;
|
||||
ctx->bind_compute_state = iris_bind_compute_state;
|
||||
ctx->delete_blend_state = iris_delete_state;
|
||||
ctx->delete_depth_stencil_alpha_state = iris_delete_state;
|
||||
ctx->delete_fs_state = iris_delete_state;
|
||||
ctx->delete_rasterizer_state = iris_delete_state;
|
||||
ctx->delete_sampler_state = iris_delete_state;
|
||||
ctx->delete_vertex_elements_state = iris_delete_state;
|
||||
ctx->delete_compute_state = iris_delete_state;
|
||||
ctx->delete_tcs_state = iris_delete_state;
|
||||
ctx->delete_tes_state = iris_delete_state;
|
||||
ctx->delete_gs_state = iris_delete_state;
|
||||
|
Reference in New Issue
Block a user