radv: compile fragment shader first.
authorDave Airlie <airlied@redhat.com>
Tue, 20 Jun 2017 02:50:04 +0000 (12:50 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 25 Jun 2017 22:45:26 +0000 (08:45 +1000)
This reorders things as we need something from the fs for the vs key.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_pipeline.c

index e77f9597bac362955771632bd25bc5e96601ca82..e58ada68cc9ee654c027bf79b3306fd1b64805b3 100644 (file)
@@ -1988,6 +1988,33 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
 
        radv_pipeline_init_blend_state(pipeline, pCreateInfo, extra);
 
+       if (!modules[MESA_SHADER_FRAGMENT]) {
+               nir_builder fs_b;
+               nir_builder_init_simple_shader(&fs_b, NULL, MESA_SHADER_FRAGMENT, NULL);
+               fs_b.shader->info.name = ralloc_strdup(fs_b.shader, "noop_fs");
+               fs_m.nir = fs_b.shader;
+               modules[MESA_SHADER_FRAGMENT] = &fs_m;
+       }
+
+       if (modules[MESA_SHADER_FRAGMENT]) {
+               union ac_shader_variant_key key;
+               key.fs.col_format = pipeline->graphics.blend.spi_shader_col_format;
+               key.fs.is_int8 = radv_pipeline_compute_is_int8(pCreateInfo);
+
+               const VkPipelineShaderStageCreateInfo *stage = pStages[MESA_SHADER_FRAGMENT];
+
+               pipeline->shaders[MESA_SHADER_FRAGMENT] =
+                        radv_pipeline_compile(pipeline, cache, modules[MESA_SHADER_FRAGMENT],
+                                              stage ? stage->pName : "main",
+                                              MESA_SHADER_FRAGMENT,
+                                              stage ? stage->pSpecializationInfo : NULL,
+                                              pipeline->layout, &key);
+               pipeline->active_stages |= mesa_to_vk_shader_stage(MESA_SHADER_FRAGMENT);
+       }
+
+       if (fs_m.nir)
+               ralloc_free(fs_m.nir);
+
        if (modules[MESA_SHADER_VERTEX]) {
                bool as_es = false;
                bool as_ls = false;
@@ -2040,33 +2067,6 @@ radv_pipeline_init(struct radv_pipeline *pipeline,
                        mesa_to_vk_shader_stage(MESA_SHADER_TESS_CTRL);
        }
 
-       if (!modules[MESA_SHADER_FRAGMENT]) {
-               nir_builder fs_b;
-               nir_builder_init_simple_shader(&fs_b, NULL, MESA_SHADER_FRAGMENT, NULL);
-               fs_b.shader->info.name = ralloc_strdup(fs_b.shader, "noop_fs");
-               fs_m.nir = fs_b.shader;
-               modules[MESA_SHADER_FRAGMENT] = &fs_m;
-       }
-
-       if (modules[MESA_SHADER_FRAGMENT]) {
-               union ac_shader_variant_key key;
-               key.fs.col_format = pipeline->graphics.blend.spi_shader_col_format;
-               key.fs.is_int8 = radv_pipeline_compute_is_int8(pCreateInfo);
-
-               const VkPipelineShaderStageCreateInfo *stage = pStages[MESA_SHADER_FRAGMENT];
-
-               pipeline->shaders[MESA_SHADER_FRAGMENT] =
-                        radv_pipeline_compile(pipeline, cache, modules[MESA_SHADER_FRAGMENT],
-                                              stage ? stage->pName : "main",
-                                              MESA_SHADER_FRAGMENT,
-                                              stage ? stage->pSpecializationInfo : NULL,
-                                              pipeline->layout, &key);
-               pipeline->active_stages |= mesa_to_vk_shader_stage(MESA_SHADER_FRAGMENT);
-       }
-
-       if (fs_m.nir)
-               ralloc_free(fs_m.nir);
-
        radv_pipeline_init_depth_stencil_state(pipeline, pCreateInfo, extra);
        radv_pipeline_init_raster_state(pipeline, pCreateInfo);
        radv_pipeline_init_multisample_state(pipeline, pCreateInfo);