mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
nvk: Expose a new nvk_compile_nir_shader() helper
This helper is intended for internal driver shaders. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30826>
This commit is contained in:
parent
cdef36c422
commit
db0c2aa796
2 changed files with 37 additions and 2 deletions
|
|
@ -590,7 +590,7 @@ nvk_compile_nir(struct nvk_device *dev, nir_shader *nir,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
static VkResult
|
||||
nvk_shader_upload(struct nvk_device *dev, struct nvk_shader *shader)
|
||||
{
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
|
|
@ -761,6 +761,39 @@ nvk_compile_shader(struct nvk_device *dev,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
nvk_compile_nir_shader(struct nvk_device *dev, nir_shader *nir,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct nvk_shader **shader_out)
|
||||
{
|
||||
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||
|
||||
const struct vk_pipeline_robustness_state rs_none = {
|
||||
.uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
|
||||
.storage_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
|
||||
.images = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_2_EXT,
|
||||
};
|
||||
|
||||
assert(nir->info.stage == MESA_SHADER_COMPUTE);
|
||||
if (nir->options == NULL)
|
||||
nir->options = nvk_get_nir_options(&pdev->vk, nir->info.stage, &rs_none);
|
||||
|
||||
struct vk_shader_compile_info info = {
|
||||
.stage = nir->info.stage,
|
||||
.nir = nir,
|
||||
.robustness = &rs_none,
|
||||
};
|
||||
|
||||
struct vk_shader *shader;
|
||||
VkResult result = nvk_compile_shader(dev, &info, NULL, alloc, &shader);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
*shader_out = container_of(shader, struct nvk_shader, vk);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
nvk_compile_shaders(struct vk_device *vk_dev,
|
||||
uint32_t shader_count,
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ nvk_lower_nir(struct nvk_device *dev, nir_shader *nir,
|
|||
struct nvk_cbuf_map *cbuf_map_out);
|
||||
|
||||
VkResult
|
||||
nvk_shader_upload(struct nvk_device *dev, struct nvk_shader *shader);
|
||||
nvk_compile_nir_shader(struct nvk_device *dev, nir_shader *nir,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct nvk_shader **shader_out);
|
||||
|
||||
/* Codegen wrappers.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue