panfrost: Use nir_builder_init_simple_shader for blits
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 26 Aug 2020 20:48:13 +0000 (16:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Aug 2020 14:53:53 +0000 (14:53 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6476>

src/panfrost/lib/pan_blit.c

index 79a91200d8e60400bc62b12e41ec124d5486a5cf..9967e211d37c1d2c2de1d56362308e4f36e94868 100644 (file)
@@ -48,9 +48,10 @@ panfrost_build_blit_shader(panfrost_program *program, unsigned gpu_id, gl_frag_r
 {
         bool is_colour = loc >= FRAG_RESULT_DATA0;
 
-        nir_shader *shader = nir_shader_create(NULL, MESA_SHADER_FRAGMENT, &midgard_nir_options, NULL);
-        nir_function *fn = nir_function_create(shader, "main");
-        nir_function_impl *impl = nir_function_impl_create(fn);
+        nir_builder _b;
+        nir_builder_init_simple_shader(&_b, NULL, MESA_SHADER_FRAGMENT, &midgard_nir_options);
+        nir_builder *b = &_b;
+        nir_shader *shader = b->shader;
 
         nir_variable *c_src = nir_variable_create(shader, nir_var_shader_in, glsl_vector_type(GLSL_TYPE_FLOAT, 2), "coord");
         nir_variable *c_out = nir_variable_create(shader, nir_var_shader_out, glsl_vector_type(
@@ -59,11 +60,6 @@ panfrost_build_blit_shader(panfrost_program *program, unsigned gpu_id, gl_frag_r
         c_src->data.location = VARYING_SLOT_TEX0;
         c_out->data.location = loc;
 
-        nir_builder _b;
-        nir_builder *b = &_b;
-        nir_builder_init(b, impl);
-        b->cursor = nir_before_block(nir_start_block(impl));
-
         nir_ssa_def *coord = nir_load_var(b, c_src);
 
         nir_tex_instr *tex = nir_tex_instr_create(shader, ms ? 3 : 1);