mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 03:50:13 +01:00
draw: add NIR support to draw_create_vertex_shader
Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7826>
This commit is contained in:
parent
8bb4a76add
commit
df11ceaaaf
1 changed files with 17 additions and 6 deletions
|
|
@ -33,7 +33,10 @@
|
|||
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "nir/nir_to_tgsi.h"
|
||||
|
||||
#include "draw_private.h"
|
||||
#include "draw_context.h"
|
||||
|
|
@ -221,16 +224,24 @@ draw_create_vs_exec(struct draw_context *draw,
|
|||
if (!vs)
|
||||
return NULL;
|
||||
|
||||
/* we make a private copy of the tokens */
|
||||
vs->base.state.tokens = tgsi_dup_tokens(state->tokens);
|
||||
if (!vs->base.state.tokens) {
|
||||
FREE(vs);
|
||||
return NULL;
|
||||
if (state->type == PIPE_SHADER_IR_NIR) {
|
||||
vs->base.state.type = PIPE_SHADER_IR_TGSI;
|
||||
vs->base.state.tokens = nir_to_tgsi(state->ir.nir, draw->pipe->screen);
|
||||
ralloc_free(state->ir.nir);
|
||||
} else {
|
||||
assert(state->type == PIPE_SHADER_IR_TGSI);
|
||||
vs->base.state.type = state->type;
|
||||
|
||||
/* we need to keep a local copy of the tokens */
|
||||
vs->base.state.tokens = tgsi_dup_tokens(state->tokens);
|
||||
if (!vs->base.state.tokens) {
|
||||
FREE(vs);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
tgsi_scan_shader(state->tokens, &vs->base.info);
|
||||
|
||||
vs->base.state.type = state->type;
|
||||
vs->base.state.stream_output = state->stream_output;
|
||||
vs->base.draw = draw;
|
||||
vs->base.prepare = vs_exec_prepare;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue