#include "util/u_prim.h"
#include "tgsi/tgsi_parse.h"
+#include "nir/nir_to_tgsi_info.h"
#include "draw_fs.h"
#include "draw_private.h"
dfs = CALLOC_STRUCT(draw_fragment_shader);
if (dfs) {
dfs->base = *shader;
- tgsi_scan_shader(shader->tokens, &dfs->info);
+ if (shader->type == PIPE_SHADER_IR_TGSI)
+ tgsi_scan_shader(shader->tokens, &dfs->info);
+ else
+ nir_tgsi_scan_shader(shader->ir.nir, &dfs->info, false);
}
return dfs;
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_exec.h"
-
+#include "nir/nir_to_tgsi_info.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_math.h"
gs->draw = draw;
gs->state = *state;
- gs->state.tokens = tgsi_dup_tokens(state->tokens);
- if (!gs->state.tokens) {
- FREE(gs);
- return NULL;
- }
- tgsi_scan_shader(state->tokens, &gs->info);
+ if (state->type == PIPE_SHADER_IR_TGSI) {
+ gs->state.tokens = tgsi_dup_tokens(state->tokens);
+ if (!gs->state.tokens) {
+ FREE(gs);
+ return NULL;
+ }
+
+ tgsi_scan_shader(state->tokens, &gs->info);
+ } else
+ nir_tgsi_scan_shader(state->ir.nir, &gs->info, false);
/* setup the defaults */
gs->max_out_prims = 0;
#include "gallivm/lp_bld_flow.h"
#include "gallivm/lp_bld_debug.h"
#include "gallivm/lp_bld_tgsi.h"
+#include "gallivm/lp_bld_nir.h"
#include "gallivm/lp_bld_printf.h"
#include "gallivm/lp_bld_intr.h"
#include "gallivm/lp_bld_init.h"
memcpy(&variant->key, key, shader->variant_key_size);
if (gallivm_debug & (GALLIVM_DEBUG_TGSI | GALLIVM_DEBUG_IR)) {
- tgsi_dump(llvm->draw->vs.vertex_shader->state.tokens, 0);
+ if (llvm->draw->vs.vertex_shader->state.type == PIPE_SHADER_IR_TGSI)
+ tgsi_dump(llvm->draw->vs.vertex_shader->state.tokens, 0);
+ else
+ nir_print_shader(llvm->draw->vs.vertex_shader->state.ir.nir, stderr);
draw_llvm_dump_variant_key(&variant->key);
}
params.ssbo_sizes_ptr = num_ssbos_ptr;
params.image = draw_image;
- lp_build_tgsi_soa(variant->gallivm,
- tokens,
- ¶ms,
- outputs);
+ if (llvm->draw->vs.vertex_shader->state.ir.nir &&
+ llvm->draw->vs.vertex_shader->state.type == PIPE_SHADER_IR_NIR)
+ lp_build_nir_soa(variant->gallivm,
+ llvm->draw->vs.vertex_shader->state.ir.nir,
+ ¶ms,
+ outputs);
+ else
+ lp_build_tgsi_soa(variant->gallivm,
+ tokens,
+ ¶ms,
+ outputs);
{
LLVMValueRef out;
}
if (gallivm_debug & (GALLIVM_DEBUG_TGSI | GALLIVM_DEBUG_IR)) {
- tgsi_dump(tokens, 0);
+ if (llvm->draw->gs.geometry_shader->state.type == PIPE_SHADER_IR_TGSI)
+ tgsi_dump(tokens, 0);
+ else
+ nir_print_shader(llvm->draw->gs.geometry_shader->state.ir.nir, stderr);
draw_gs_llvm_dump_variant_key(&variant->key);
}
params.ssbo_sizes_ptr = num_ssbos_ptr;
params.image = image;
- lp_build_tgsi_soa(variant->gallivm,
- tokens,
- ¶ms,
- outputs);
+ if (llvm->draw->gs.geometry_shader->state.type == PIPE_SHADER_IR_TGSI)
+ lp_build_tgsi_soa(variant->gallivm,
+ tokens,
+ ¶ms,
+ outputs);
+ else
+ lp_build_nir_soa(variant->gallivm,
+ llvm->draw->gs.geometry_shader->state.ir.nir,
+ ¶ms,
+ outputs);
sampler->destroy(sampler);
image->destroy(image);
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;
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_scan.h"
-
+#include "nir/nir_to_tgsi_info.h"
static void
vs_llvm_prepare(struct draw_vertex_shader *shader,
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;
+ /* due to some bugs in the feedback state tracker we have to check
+ for ir.nir & PIPE_SHADER_IR_NIR here. */
+ if (state->ir.nir && state->type == PIPE_SHADER_IR_NIR)
+ nir_tgsi_scan_shader(state->ir.nir, &vs->base.info, false);
+ else {
+ /* 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;
+ }
+
+ tgsi_scan_shader(state->tokens, &vs->base.info);
}
- tgsi_scan_shader(state->tokens, &vs->base.info);
-
vs->variant_key_size =
draw_llvm_variant_key_size(
vs->base.info.file_max[TGSI_FILE_INPUT]+1,
vs->base.info.file_max[TGSI_FILE_SAMPLER_VIEW]+1),
vs->base.info.file_max[TGSI_FILE_IMAGE]+1);
+ vs->base.state.type = state->type;
+ vs->base.state.ir.nir = state->ir.nir;
vs->base.state.stream_output = state->stream_output;
vs->base.draw = draw;
vs->base.prepare = vs_llvm_prepare;