diff options
author | Dave Airlie <[email protected]> | 2017-06-20 12:50:04 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-06-26 08:45:26 +1000 |
commit | 2a87ddbdcb3129606f237d4eedf9cad588b5b4d9 (patch) | |
tree | de1a5b217d32a5deb834a8683f5dcb5928da94ec /src/amd/vulkan/radv_pipeline.c | |
parent | a563f611c3d3cdb2ca8a60d5eb4086cab5fa0f31 (diff) |
radv: compile fragment shader first.
This reorders things as we need something from the fs for the vs key.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_pipeline.c')
-rw-r--r-- | src/amd/vulkan/radv_pipeline.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index e77f9597bac..e58ada68cc9 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -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); |