rusticl/device: implement cl_khr_3d_image_writes
authorKarol Herbst <kherbst@redhat.com>
Thu, 31 Mar 2022 14:24:37 +0000 (16:24 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Sep 2022 05:58:13 +0000 (05:58 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>

src/gallium/frontends/rusticl/core/device.rs
src/gallium/frontends/rusticl/core/format.rs

index c1bfdc0..13f6d98 100644 (file)
@@ -403,6 +403,16 @@ impl Device {
             add_ext(1, 0, 0, "cl_khr_fp64");
         }
 
+        if !FORMATS
+            .iter()
+            .filter(|f| f.req_for_3d_image_write_ext)
+            .map(|f| self.formats.get(&f.cl_image_format).unwrap())
+            .map(|f| f.get(&CL_MEM_OBJECT_IMAGE3D).unwrap())
+            .any(|f| *f & cl_mem_flags::from(CL_MEM_WRITE_ONLY) == 0)
+        {
+            add_ext(1, 0, 0, "cl_khr_3d_image_writes");
+        }
+
         if self.embedded {
             if self.long_supported() {
                 add_ext(1, 0, 0, "cles_khr_int64");
index f8502ac..cec72f5 100644 (file)
@@ -11,6 +11,7 @@ pub struct RusticlImageFormat {
     pub req_for_full_read_or_write: bool,
     pub req_for_embeded_read_or_write: bool,
     pub req_for_full_read_and_write: bool,
+    pub req_for_3d_image_write_ext: bool,
     pub pipe: pipe_format,
 }
 
@@ -19,6 +20,7 @@ pub const fn rusticl_image_format(
     req_for_full_read_or_write: bool,
     req_for_embeded_read_or_write: bool,
     req_for_full_read_and_write: bool,
+    req_for_3d_image_write_ext: bool,
     pipe: pipe_format,
 ) -> RusticlImageFormat {
     RusticlImageFormat {
@@ -26,6 +28,7 @@ pub const fn rusticl_image_format(
         req_for_full_read_or_write: req_for_full_read_or_write,
         req_for_embeded_read_or_write: req_for_embeded_read_or_write,
         req_for_full_read_and_write: req_for_full_read_and_write,
+        req_for_3d_image_write_ext: req_for_3d_image_write_ext,
         pipe: pipe,
     }
 }
@@ -36,6 +39,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R16_FLOAT,
     ),
     rusticl_image_format(
@@ -43,6 +47,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R32_FLOAT,
     ),
     rusticl_image_format(
@@ -50,6 +55,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R8_SINT,
     ),
     rusticl_image_format(
@@ -57,6 +63,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R16_SINT,
     ),
     rusticl_image_format(
@@ -64,6 +71,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R32_SINT,
     ),
     rusticl_image_format(
@@ -71,6 +79,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R8_UNORM,
     ),
     rusticl_image_format(
@@ -78,6 +87,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         false,
+        false,
         pipe_format::PIPE_FORMAT_R16_UNORM,
     ),
     rusticl_image_format(
@@ -85,6 +95,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R8_UINT,
     ),
     rusticl_image_format(
@@ -92,6 +103,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R16_UINT,
     ),
     rusticl_image_format(
@@ -99,6 +111,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         false,
         false,
         true,
+        false,
         pipe_format::PIPE_FORMAT_R32_UINT,
     ),
     rusticl_image_format(
@@ -106,6 +119,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R16G16B16A16_FLOAT,
     ),
     rusticl_image_format(
@@ -113,6 +127,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R32G32B32A32_FLOAT,
     ),
     rusticl_image_format(
@@ -120,6 +135,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R8G8B8A8_SINT,
     ),
     rusticl_image_format(
@@ -127,6 +143,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R16G16B16A16_SINT,
     ),
     rusticl_image_format(
@@ -134,6 +151,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R32G32B32A32_SINT,
     ),
     rusticl_image_format(
@@ -141,6 +159,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R8G8B8A8_UNORM,
     ),
     rusticl_image_format(
@@ -148,6 +167,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         false,
+        true,
         pipe_format::PIPE_FORMAT_R16G16B16A16_UNORM,
     ),
     rusticl_image_format(
@@ -155,6 +175,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R8G8B8A8_UINT,
     ),
     rusticl_image_format(
@@ -162,6 +183,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R16G16B16A16_UINT,
     ),
     rusticl_image_format(
@@ -169,6 +191,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         true,
         true,
+        true,
         pipe_format::PIPE_FORMAT_R32G32B32A32_UINT,
     ),
     rusticl_image_format(
@@ -176,6 +199,7 @@ pub const FORMATS: &[RusticlImageFormat] = &[
         true,
         false,
         false,
+        true,
         pipe_format::PIPE_FORMAT_B8G8R8A8_UNORM,
     ),
 ];