*/
#include "tgsi/tgsi_from_mesa.h"
-#include "st_glsl_types.h"
#include "st_nir.h"
-#include "nir_builder.h"
+
+#include "compiler/nir/nir_builder.h"
struct pipe_shader_state *
st_nir_finish_builtin_shader(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
- enum pipe_shader_type p_stage = pipe_shader_type_from_mesa(nir->info.stage);
- bool is_scalar =
- screen->get_shader_param(screen, p_stage, PIPE_SHADER_CAP_SCALAR_ISA);
nir->info.name = ralloc_strdup(nir, name);
nir->info.separate_shader = true;
NIR_PASS_V(nir, nir_lower_var_copies);
NIR_PASS_V(nir, nir_lower_system_values);
- if (is_scalar) {
+ if (nir->options->lower_to_scalar) {
nir_variable_mode mask =
(nir->info.stage > MESA_SHADER_VERTEX ? nir_var_shader_in : 0) |
(nir->info.stage < MESA_SHADER_FRAGMENT ? nir_var_shader_out : 0);
NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
}
- st_nir_opts(nir, is_scalar);
-
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
+ st_nir_assign_vs_in_locations(nir);
st_nir_assign_varying_locations(st, nir);
- if (st->ctx->Const.PackedDriverUniformStorage) {
- NIR_PASS_V(nir, nir_lower_io, nir_var_uniform, st_glsl_type_dword_size,
- (nir_lower_io_options)0);
- NIR_PASS_V(nir, st_nir_lower_uniforms_to_ubo);
- }
+ st_nir_lower_samplers(screen, nir, NULL, NULL);
+ st_nir_lower_uniforms(st, nir);
+
+ if (screen->finalize_nir)
+ screen->finalize_nir(screen, nir, true);
+ else
+ st_nir_opts(nir);
struct pipe_shader_state state = {
.type = PIPE_SHADER_IR_NIR,