1- From 1ed55ebdc8181c67b9cf1cfa3a977f069413dd89 Mon Sep 17 00:00:00 2001
1+ From 9625ef3fea5f587558965a2a40dd51f8fee9eb05 Mon Sep 17 00:00:00 2001
22From: Ilya Mashkov <
[email protected] >
33Date: Thu, 12 Dec 2019 14:33:41 +0300
44Subject: [PATCH] Add support for cl_khr_mipmap_image_writes
55
6+ This is backporting of https://reviews.llvm.org/D71460
7+
8+ Signed-off-by: haonanya <
[email protected] >
69---
710 clang/include/clang/Basic/OpenCLExtensions.def | 1 +
8- clang/lib/Headers/opencl-c.h | 22 ++++ ++++++++++--------
11+ clang/lib/Headers/opencl-c.h | 18 ++++++++++--------
912 clang/test/SemaOpenCL/extension-version.cl | 12 ++++++++++++
10- 3 files changed, 27 insertions(+), 8 deletions(-)
13+ 3 files changed, 23 insertions(+), 8 deletions(-)
1114
1215diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
13- index 5536a6e..5174815 100644
16+ index 5536a6e8e4df..517481584313 100644
1417--- a/clang/include/clang/Basic/OpenCLExtensions.def
1518+++ b/clang/include/clang/Basic/OpenCLExtensions.def
1619@@ -70,6 +70,7 @@ OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
@@ -22,20 +25,19 @@ index 5536a6e..5174815 100644
2225 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
2326 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
2427diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
25- index 06c5ab6..d3ae0dd 100644
28+ index 06c5ab6a72f0..1985a361168b 100644
2629--- a/clang/lib/Headers/opencl-c.h
2730+++ b/clang/lib/Headers/opencl-c.h
28- @@ -14682,7 +14682,8 @@ void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, flo
31+ @@ -14682,7 +14682,7 @@ void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, flo
2932
3033 // OpenCL Extension v2.0 s9.18 - Mipmaps
3134 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3235- #ifdef cl_khr_mipmap_image
3336+ #if defined(cl_khr_mipmap_image_writes)
34- + #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : begin
3537 void __ovld write_imagef(write_only image1d_t image, int coord, int lod, float4 color);
3638 void __ovld write_imagei(write_only image1d_t image, int coord, int lod, int4 color);
3739 void __ovld write_imageui(write_only image1d_t image, int coord, int lod, uint4 color);
38- @@ -14699,15 +14700,17 @@ void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, int
40+ @@ -14699,15 +14699,16 @@ void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, int
3941 void __ovld write_imagei(write_only image2d_array_t image_array, int4 coord, int lod, int4 color);
4042 void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, int lod, uint4 color);
4143
@@ -52,42 +54,40 @@ index 06c5ab6..d3ae0dd 100644
5254- #endif //cl_khr_mipmap_image
5355+ #endif //cl_khr_3d_image_writes
5456+
55- + #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : end
5657+ #endif //defined(cl_khr_mipmap_image_writes)
5758 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
5859
5960 // Image write functions for half4 type
60- @@ -14756,7 +14759,8 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, flo
61+ @@ -14756,7 +14757,7 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, flo
6162 #endif //cl_khr_depth_images
6263
6364 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6465- #ifdef cl_khr_mipmap_image
6566+ #ifdef cl_khr_mipmap_image_writes
66- + #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : begin
6767 void __ovld write_imagef(read_write image1d_t image, int coord, int lod, float4 color);
6868 void __ovld write_imagei(read_write image1d_t image, int coord, int lod, int4 color);
6969 void __ovld write_imageui(read_write image1d_t image, int coord, int lod, uint4 color);
70- @@ -14780,8 +14784,10 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int
70+ @@ -14780,8 +14781,9 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int
7171 void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
7272 void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
7373 void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
7474- #endif
7575- #endif //cl_khr_mipmap_image
7676+ #endif //cl_khr_3d_image_writes
7777+
78- + #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : end
7978+ #endif //cl_khr_mipmap_image_writes
8079 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
8180
8281 // Image write functions for half4 type
8382diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl
84- index 19d0884..0e6bbb7 100644
83+ index 19d088495350..0e6bbb7d3bcd 100644
8584--- a/clang/test/SemaOpenCL/extension-version.cl
8685+++ b/clang/test/SemaOpenCL/extension-version.cl
87- @@ -243,6 +243,18 @@
86+ @@ -242,6 +242,18 @@
87+ #endif
8888 #pragma OPENCL EXTENSION cl_khr_mipmap_image : enable
8989
90- #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
90+ + #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
9191+ #ifndef cl_khr_mipmap_image_writes
9292+ #error "Missing cl_khr_mipmap_image_writes define"
9393+ #endif
@@ -99,10 +99,9 @@ index 19d0884..0e6bbb7 100644
9999+ #endif
100100+ #pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable
101101+
102- + #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
102+ #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
103103 #ifndef cl_khr_srgb_image_writes
104104 #error "Missing cl_khr_srgb_image_writes define"
105- #endif
106105- -
107- 2.7.4
106+ 2.17.1
108107
0 commit comments