diff options
author | Karol Herbst <git@karolherbst.de> | 2023-05-15 16:02:45 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-05-16 21:07:08 +0000 |
commit | cdc2e2fece231b0793e052161d8d2ba28a6d296b (patch) | |
tree | 2d953020048c9c2337c15fa4146245abf1845eac | |
parent | 2041c36e70d061a1efd1f9f297d6b83bc7068c77 (diff) | |
download | mesa-cdc2e2fece231b0793e052161d8d2ba28a6d296b.tar.gz |
rusticl/device: split add_ext in fill_extensions
The initial hope was that we'd get extension and feature pairs more often.
Reality isn't as nice so just split it up.
Signed-off-by: Karol Herbst <git@karolherbst.de>
Reviewed-by: Nora Allen <blackcatgames@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23031>
-rw-r--r-- | src/gallium/frontends/rusticl/core/device.rs | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index b2224880567..c82dabfd8a3 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -474,61 +474,56 @@ impl Device { let mut exts_str: Vec<String> = Vec::new(); let mut exts = PLATFORM_EXTENSIONS.to_vec(); let mut feats = Vec::new(); - let mut add_ext = |major, minor, patch, ext: &str, feat: &str| { - if !ext.is_empty() { - exts.push(mk_cl_version_ext(major, minor, patch, ext)); - exts_str.push(ext.to_owned()); - } - - if !feat.is_empty() { - feats.push(mk_cl_version_ext(major, minor, patch, feat)); - } + let mut add_ext = |major, minor, patch, ext: &str| { + exts.push(mk_cl_version_ext(major, minor, patch, ext)); + exts_str.push(ext.to_owned()); + }; + let mut add_feat = |major, minor, patch, feat: &str| { + feats.push(mk_cl_version_ext(major, minor, patch, feat)); }; // add extensions all drivers support for now - add_ext(1, 0, 0, "cl_khr_global_int32_base_atomics", ""); - add_ext(1, 0, 0, "cl_khr_global_int32_extended_atomics", ""); - add_ext(1, 0, 0, "cl_khr_local_int32_base_atomics", ""); - add_ext(1, 0, 0, "cl_khr_local_int32_extended_atomics", ""); + add_ext(1, 0, 0, "cl_khr_global_int32_base_atomics"); + add_ext(1, 0, 0, "cl_khr_global_int32_extended_atomics"); + add_ext(1, 0, 0, "cl_khr_local_int32_base_atomics"); + add_ext(1, 0, 0, "cl_khr_local_int32_extended_atomics"); if self.doubles_supported() { - add_ext(1, 0, 0, "cl_khr_fp64", "__opencl_c_fp64"); + add_ext(1, 0, 0, "cl_khr_fp64"); + add_feat(1, 0, 0, "__opencl_c_fp64"); } if self.long_supported() { - let ext = if self.embedded { "cles_khr_int64" } else { "" }; + if self.embedded { + add_ext(1, 0, 0, "cles_khr_int64"); + }; - add_ext(1, 0, 0, ext, "__opencl_c_int64"); + add_feat(1, 0, 0, "__opencl_c_int64"); } if self.image_supported() { - add_ext(1, 0, 0, "", "__opencl_c_images"); + add_feat(1, 0, 0, "__opencl_c_images"); if self.image2d_from_buffer_supported() { - add_ext(1, 0, 0, "cl_khr_image2d_from_buffer", ""); + add_ext(1, 0, 0, "cl_khr_image2d_from_buffer"); } if self.image_read_write_supported() { - add_ext(1, 0, 0, "", "__opencl_c_read_write_images"); + add_feat(1, 0, 0, "__opencl_c_read_write_images"); } if self.image_3d_write_supported() { - add_ext( - 1, - 0, - 0, - "cl_khr_3d_image_writes", - "__opencl_c_3d_image_writes", - ); + add_ext(1, 0, 0, "cl_khr_3d_image_writes"); + add_feat(1, 0, 0, "__opencl_c_3d_image_writes"); } } if self.pci_info().is_some() { - add_ext(1, 0, 0, "cl_khr_pci_bus_info", ""); + add_ext(1, 0, 0, "cl_khr_pci_bus_info"); } if self.svm_supported() { - add_ext(1, 0, 0, "cl_arm_shared_virtual_memory", ""); + add_ext(1, 0, 0, "cl_arm_shared_virtual_memory"); } self.extensions = exts; |