Skip to content

Commit

Permalink
Add a comment about why 3-channel images aren't supported.
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Quill <robert.quill@imgtec.com>
  • Loading branch information
robquill committed Sep 2, 2024
1 parent b792ed5 commit 4417e0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Image::init(void* data,
}

if (numChannels > 4 || numChannels == 3) {
// We don't support 3-channel images because they are not supported by Metal or Mesa (llvmpipe)
// See comment here: https://github.com/KomputeProject/kompute/pull/388#discussion_r1720959531
throw std::runtime_error(
"Kompute Images can only have up to 1, 2 or 4 channels");
}
Expand Down
3 changes: 3 additions & 0 deletions test/TestImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ TEST(TestImage, DataTypes)

// 3-channel images are not supported and should throw an exception.
// This is tested by a different test.

// We don't support 3-channel images because they are not supported by Metal or Mesa (llvmpipe)
// See comment here: https://github.com/KomputeProject/kompute/pull/388#discussion_r1720959531
if (numChannels == 3)
{
continue;
Expand Down

0 comments on commit 4417e0d

Please sign in to comment.