Skip to content

Commit 92451f0

Browse files
committed
[OpenCL] Add MSAA sharing extension builtin functions
Add the MSAA sharing builtin functions from the OpenCL Extension Specification. Patch by Pierre Gondois and Sven van Haastregt.
1 parent 35787e3 commit 92451f0

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

clang/lib/Sema/OpenCLBuiltins.td

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def FuncExtKhrLocalInt32ExtendedAtomics : FunctionExtension<"cl_khr_local_int32
6060
def FuncExtKhrInt64BaseAtomics : FunctionExtension<"cl_khr_int64_base_atomics">;
6161
def FuncExtKhrInt64ExtendedAtomics : FunctionExtension<"cl_khr_int64_extended_atomics">;
6262
def FuncExtKhrMipmapImage : FunctionExtension<"cl_khr_mipmap_image">;
63+
def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sharing">;
6364

6465
// Multiple extensions
6566
def FuncExtKhrMipmapAndWrite3d : FunctionExtension<"cl_khr_mipmap_image cl_khr_3d_image_writes">;
@@ -1312,3 +1313,39 @@ let Extension = FuncExtKhrMipmapImage in {
13121313
}
13131314
}
13141315
}
1316+
1317+
1318+
//--------------------------------------------------------------------
1319+
// OpenCL Extension v2.0 s18.3 - Creating OpenCL Memory Objects from OpenGL MSAA Textures
1320+
let Extension = FuncExtKhrGlMsaaSharing in {
1321+
// --- Table 6.13.14.3 ---
1322+
foreach aQual = ["RO", "RW"] in {
1323+
foreach imgTy = [Image2dMsaa] in {
1324+
def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>, Int], Attr.Pure>;
1325+
def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>, Int], Attr.Pure>;
1326+
def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>, Int], Attr.Pure>;
1327+
}
1328+
foreach imgTy = [Image2dArrayMsaa] in {
1329+
def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>, Int], Attr.Pure>;
1330+
def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>, Int], Attr.Pure>;
1331+
def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>, Int], Attr.Pure>;
1332+
}
1333+
foreach name = ["read_imagef"] in {
1334+
def : Builtin<name, [Float, ImageType<Image2dMsaaDepth, aQual>, VectorType<Int, 2>, Int], Attr.Pure>;
1335+
def : Builtin<name, [Float, ImageType<Image2dArrayMsaaDepth, aQual>, VectorType<Int, 4>, Int], Attr.Pure>;
1336+
}
1337+
}
1338+
1339+
// --- Table 6.13.14.5 ---
1340+
foreach aQual = ["RO", "WO", "RW"] in {
1341+
foreach imgTy = [Image2dMsaa, Image2dArrayMsaa, Image2dMsaaDepth, Image2dArrayMsaaDepth] in {
1342+
foreach name = ["get_image_width", "get_image_height",
1343+
"get_image_channel_data_type", "get_image_channel_order",
1344+
"get_image_num_samples"] in {
1345+
def : Builtin<name, [Int, ImageType<imgTy, aQual>], Attr.Const>;
1346+
}
1347+
def : Builtin<"get_image_dim", [VectorType<Int, 2>, ImageType<imgTy, aQual>], Attr.Const>;
1348+
}
1349+
def : Builtin<"get_image_array_size", [Size, ImageType<Image2dArrayMsaaDepth, aQual>], Attr.Const>;
1350+
}
1351+
}

0 commit comments

Comments
 (0)