From 91b3083aecdcb7beb33d497a94f4467f110b4f6d Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Wed, 5 Feb 2020 16:05:20 +0000 Subject: [PATCH] [OpenCL] Fix tblgen support for cl_khr_mipmap_image_writes Apply the fix of f780e15caf1 ("[OpenCL] Fix support for cl_khr_mipmap_image_writes", 2020-01-27) also to the TableGen OpenCL builtin function definitions. --- clang/lib/Sema/OpenCLBuiltins.td | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td index 0cbdc05..888978d 100644 --- a/clang/lib/Sema/OpenCLBuiltins.td +++ b/clang/lib/Sema/OpenCLBuiltins.td @@ -60,10 +60,11 @@ def FuncExtKhrLocalInt32ExtendedAtomics : FunctionExtension<"cl_khr_local_int32 def FuncExtKhrInt64BaseAtomics : FunctionExtension<"cl_khr_int64_base_atomics">; def FuncExtKhrInt64ExtendedAtomics : FunctionExtension<"cl_khr_int64_extended_atomics">; def FuncExtKhrMipmapImage : FunctionExtension<"cl_khr_mipmap_image">; +def FuncExtKhrMipmapImageWrites : FunctionExtension<"cl_khr_mipmap_image_writes">; def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sharing">; // Multiple extensions -def FuncExtKhrMipmapAndWrite3d : FunctionExtension<"cl_khr_mipmap_image cl_khr_3d_image_writes">; +def FuncExtKhrMipmapWritesAndWrite3d : FunctionExtension<"cl_khr_mipmap_image_writes cl_khr_3d_image_writes">; // Qualified Type. These map to ASTContext::QualType. class QualType { @@ -1271,6 +1272,16 @@ let Extension = FuncExtKhrMipmapImage in { } } } + // Added to section 6.13.14.5 + foreach aQual = ["RO", "WO", "RW"] in { + foreach imgTy = [Image1d, Image2d, Image3d, Image1dArray, Image2dArray, Image2dDepth, Image2dArrayDepth] in { + def : Builtin<"get_image_num_mip_levels", [Int, ImageType]>; + } + } +} + +// Write functions are enabled using a separate extension. +let Extension = FuncExtKhrMipmapImageWrites in { // Added to section 6.13.14.4. foreach aQual = ["WO"] in { foreach imgTy = [Image2d] in { @@ -1295,7 +1306,7 @@ let Extension = FuncExtKhrMipmapImage in { def : Builtin<"write_imageui", [Void, ImageType, VectorType, Int, VectorType]>; } def : Builtin<"write_imagef", [Void, ImageType, VectorType, Int, Float]>; - let Extension = FuncExtKhrMipmapAndWrite3d in { + let Extension = FuncExtKhrMipmapWritesAndWrite3d in { foreach imgTy = [Image3d] in { def : Builtin<"write_imagef", [Void, ImageType, VectorType, Int, VectorType]>; def : Builtin<"write_imagei", [Void, ImageType, VectorType, Int, VectorType]>; @@ -1303,15 +1314,8 @@ let Extension = FuncExtKhrMipmapImage in { } } } - // Added to section 6.13.14.5 - foreach aQual = ["RO", "WO", "RW"] in { - foreach imgTy = [Image1d, Image2d, Image3d, Image1dArray, Image2dArray, Image2dDepth, Image2dArrayDepth] in { - def : Builtin<"get_image_num_mip_levels", [Int, ImageType]>; - } - } } - //-------------------------------------------------------------------- // OpenCL Extension v2.0 s18.3 - Creating OpenCL Memory Objects from OpenGL MSAA Textures let Extension = FuncExtKhrGlMsaaSharing in { -- 2.7.4