gallium: Add pipe_shader_state_from_nir
and use it in nouveau Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22537>
This commit is contained in:
@@ -1067,9 +1067,8 @@ nv50_blitter_make_fp(struct pipe_context *pipe,
|
||||
/* return shader */
|
||||
NIR_PASS_V(b.shader, nir_lower_samplers);
|
||||
|
||||
struct pipe_shader_state state = {};
|
||||
state.type = PIPE_SHADER_IR_NIR;
|
||||
state.ir.nir = b.shader;
|
||||
struct pipe_shader_state state;
|
||||
pipe_shader_state_from_nir(&state, b.shader);
|
||||
return pipe->create_fs_state(pipe, &state);
|
||||
}
|
||||
|
||||
|
@@ -1025,8 +1025,7 @@ nvc0_program_init_tcp_empty(struct nvc0_context *nvc0)
|
||||
|
||||
nir_validate_shader(b.shader, "in nvc0_program_init_tcp_empty");
|
||||
|
||||
struct pipe_shader_state state = {0};
|
||||
state.type = PIPE_SHADER_IR_NIR;
|
||||
state.ir.nir = b.shader;
|
||||
struct pipe_shader_state state;
|
||||
pipe_shader_state_from_nir(&state, b.shader);
|
||||
nvc0->tcp_empty = nvc0->base.pipe.create_tcs_state(&nvc0->base.pipe, &state);
|
||||
}
|
||||
|
@@ -888,9 +888,8 @@ nvc0_blitter_make_vp(struct pipe_context *pipe)
|
||||
|
||||
NIR_PASS_V(b.shader, nir_lower_var_copies);
|
||||
|
||||
struct pipe_shader_state state = {};
|
||||
state.type = PIPE_SHADER_IR_NIR;
|
||||
state.ir.nir = b.shader;
|
||||
struct pipe_shader_state state;
|
||||
pipe_shader_state_from_nir(&state, b.shader);
|
||||
return pipe->create_vs_state(pipe, &state);
|
||||
}
|
||||
|
||||
|
@@ -318,6 +318,16 @@ pipe_shader_state_from_tgsi(struct pipe_shader_state *state,
|
||||
memset(&state->stream_output, 0, sizeof(state->stream_output));
|
||||
}
|
||||
|
||||
static inline void
|
||||
pipe_shader_state_from_nir(struct pipe_shader_state *state,
|
||||
void *nir)
|
||||
{
|
||||
state->type = PIPE_SHADER_IR_NIR;
|
||||
state->ir.nir = nir;
|
||||
state->tokens = NULL;
|
||||
memset(&state->stream_output, 0, sizeof(state->stream_output));
|
||||
}
|
||||
|
||||
|
||||
struct pipe_stencil_state
|
||||
{
|
||||
|
Reference in New Issue
Block a user