From 4c5f1ef3cad5fe351bb8024d6733b22984d23a69 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Sun, 11 Apr 2021 14:11:43 -0700 Subject: [PATCH] microsoft/clc: Add a test for compiling a kernel with a read-write image Reviewed-by: Enrico Galli Part-of: --- src/microsoft/clc/clc_compiler_test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/microsoft/clc/clc_compiler_test.cpp b/src/microsoft/clc/clc_compiler_test.cpp index 2063e5e49ed..4d3182f17c3 100644 --- a/src/microsoft/clc/clc_compiler_test.cpp +++ b/src/microsoft/clc/clc_compiler_test.cpp @@ -1566,6 +1566,18 @@ TEST_F(ComputeTest, image_two_reads) validate(shader); } +TEST_F(ComputeTest, image_read_write) +{ + const char *kernel_source = + R"(__kernel void main_test(read_write image2d_t image) + { + int2 coords = (int2)(get_global_id(0), get_global_id(1)); + write_imagef(image, coords, read_imagef(image, coords) + (float4)(1.0f, 1.0f, 1.0f, 1.0f)); + })"; + Shader shader = compile(std::vector({ kernel_source }), { "-cl-std=cl3.0" }); + validate(shader); +} + TEST_F(ComputeTest, sampler) { const char* kernel_source =