nvk: Re-structure early shader compilation a bit
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25443>
This commit is contained in:
committed by
Marge Bot
parent
a4f8fd9dd5
commit
abe52a6d03
@@ -181,15 +181,9 @@ nvk_compute_pipeline_create(struct nvk_device *dev,
|
||||
pCreateInfo->pNext,
|
||||
pCreateInfo->stage.pNext);
|
||||
|
||||
const nir_shader_compiler_options *nir_options =
|
||||
nvk_physical_device_nir_options(pdev, MESA_SHADER_COMPUTE);
|
||||
const struct spirv_to_nir_options spirv_options =
|
||||
nvk_physical_device_spirv_options(pdev, &robustness);
|
||||
|
||||
nir_shader *nir;
|
||||
result = vk_pipeline_shader_stage_to_nir(&dev->vk, &pCreateInfo->stage,
|
||||
&spirv_options, nir_options,
|
||||
NULL, &nir);
|
||||
result = nvk_shader_stage_to_nir(dev, &pCreateInfo->stage, &robustness,
|
||||
NULL, &nir);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
|
||||
@@ -309,14 +309,8 @@ nvk_graphics_pipeline_create(struct nvk_device *dev,
|
||||
vk_pipeline_robustness_state_fill(&dev->vk, &robustness[stage],
|
||||
pCreateInfo->pNext, sinfo->pNext);
|
||||
|
||||
const nir_shader_compiler_options *nir_options =
|
||||
nvk_physical_device_nir_options(pdev, stage);
|
||||
const struct spirv_to_nir_options spirv_options =
|
||||
nvk_physical_device_spirv_options(pdev, &robustness[stage]);
|
||||
|
||||
result = vk_pipeline_shader_stage_to_nir(&dev->vk, sinfo,
|
||||
&spirv_options, nir_options,
|
||||
NULL, &nir[stage]);
|
||||
result = nvk_shader_stage_to_nir(dev, sinfo, &robustness[stage],
|
||||
NULL, &nir[stage]);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -417,6 +417,32 @@ nvk_optimize_nir(nir_shader *nir)
|
||||
nir_var_function_temp | nir_var_shader_in | nir_var_shader_out, NULL);
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_shader_stage_to_nir(struct nvk_device *dev,
|
||||
const VkPipelineShaderStageCreateInfo *sinfo,
|
||||
const struct vk_pipeline_robustness_state *rstate,
|
||||
void *mem_ctx, struct nir_shader **nir_out)
|
||||
{
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
const gl_shader_stage stage = vk_to_mesa_shader_stage(sinfo->stage);
|
||||
const nir_shader_compiler_options *nir_options =
|
||||
nvk_physical_device_nir_options(pdev, stage);
|
||||
const struct spirv_to_nir_options spirv_options =
|
||||
nvk_physical_device_spirv_options(pdev, rstate);
|
||||
|
||||
nir_shader *nir;
|
||||
VkResult result = vk_pipeline_shader_stage_to_nir(&dev->vk, sinfo,
|
||||
&spirv_options,
|
||||
nir_options,
|
||||
mem_ctx, &nir);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
*nir_out = nir;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
|
||||
const struct vk_pipeline_robustness_state *rs,
|
||||
|
||||
@@ -125,6 +125,12 @@ nvk_nir_lower_descriptors(nir_shader *nir,
|
||||
const struct vk_pipeline_robustness_state *rs,
|
||||
const struct vk_pipeline_layout *layout);
|
||||
|
||||
VkResult
|
||||
nvk_shader_stage_to_nir(struct nvk_device *dev,
|
||||
const VkPipelineShaderStageCreateInfo *sinfo,
|
||||
const struct vk_pipeline_robustness_state *rstate,
|
||||
void *mem_ctx, struct nir_shader **nir_out);
|
||||
|
||||
void
|
||||
nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
|
||||
const struct vk_pipeline_robustness_state *rs,
|
||||
|
||||
Reference in New Issue
Block a user