Files
TheRock/rocm-systems/projects/clr/rocclr/device/pal/paldefs.hpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

520 lines
19 KiB
C++

/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "top.hpp"
#include "pal.h"
#include "palGpuMemory.h"
#include "palImage.h"
#include "palFormatInfo.h"
#include "util/palSysMemory.h"
#include <cstdlib>
#include <new>
#include <utility>
namespace amd {
//! Allocate `sizeof(T) + extSize` bytes via std::malloc and placement-construct T at the
//! start. The trailing `extSize` bytes are intended for caller-provided placement of
//! supplementary data (e.g. a PAL object whose size is reported by IDevice::Get*Size()).
//! Returns nullptr if allocation fails. If T's constructor throws, the storage is freed and
//! the exception is rethrown — preserving the cleanup guarantee that HeapObject's matching
//! placement-style operator delete used to provide.
template <class T, class... Args>
T* AllocWithTrailing(size_t extSize, Args&&... args) {
void* mem = std::malloc(sizeof(T) + extSize);
if (mem == nullptr) {
return nullptr;
}
try {
return new (mem) T(std::forward<Args>(args)...);
} catch (...) {
std::free(mem);
throw;
}
}
//! Counterpart to AllocWithTrailing: invokes T's destructor and frees the storage. Null-safe.
//! Must be paired with AllocWithTrailing — calling it on memory obtained from any other
//! allocator (including global ::operator new) is undefined behavior.
template <class T>
void DestroyWithTrailing(T* obj) {
if (obj == nullptr) {
return;
}
obj->~T();
std::free(obj);
}
} // namespace amd
//
/// Memory Object Type
//
enum PalGpuMemoryType {
PAL_DEPTH_BUFFER = 0, ///< Depth Buffer
PAL_BUFFER, ///< Pure buffer
PAL_TEXTURE_3D, ///< 3D texture
PAL_TEXTURE_2D, ///< 2D texture
PAL_TEXTURE_1D, ///< 1D texture
PAL_TEXTURE_1D_ARRAY, ///< 1D Array texture
PAL_TEXTURE_2D_ARRAY, ///< 2D Array texture
PAL_TEXTURE_BUFFER, ///< "buffer" texture inside VBO
};
//! Engine types
enum EngineType { MainEngine = 0, SdmaEngine, AllEngines };
struct GpuEvent {
static constexpr uint32_t InvalidID = ((1 << 30) - 1);
struct {
uint32_t id_ : 30; ///< Actual event id
uint32_t modified_ : 1; ///< Resource associated with the event was modified
uint32_t engineId_ : 1; ///< Type of the id
};
//! GPU event default constructor
GpuEvent() : id_(InvalidID), modified_(false), engineId_(MainEngine) {}
//! GPU event constructor
GpuEvent(uint evt) : id_(evt), modified_(false), engineId_(MainEngine) {}
//! Returns true if the current event is valid
bool isValid() const { return (id_ != InvalidID) ? true : false; }
//! Set invalid event id
void invalidate() { id_ = InvalidID; }
// Overwrite default assign operator to preserve modified_ field
GpuEvent& operator=(const GpuEvent& evt) {
id_ = evt.id_;
engineId_ = evt.engineId_;
return *this;
}
};
/*! \addtogroup PAL
* @{
*/
//! PAL Device Implementation
namespace amd::pal {
//! Maximum number of the supported global atomic counters
static constexpr uint MaxAtomicCounters = 8;
//! Maximum number of the supported samplers
static constexpr uint MaxSamplers = 16;
//! Maximum number of supported read images
static constexpr uint MaxReadImage = 128;
//! Maximum number of supported write images
static constexpr uint MaxWriteImage = 8;
//! Maximum number of supported read/write images for OCL20
static constexpr uint MaxReadWriteImage = 64;
//! Maximum number of supported constant arguments
static constexpr uint MaxConstArguments = 8;
//! Maximum number of supported kernel UAV arguments
static constexpr uint MaxUavArguments = 1024;
//! Maximum number of pixels for a 1D image created from a buffer
static constexpr size_t MaxImageBufferSize = (1ull << 32) - 1;
//! Maximum number of pixels for a 1D image created from a buffer
static constexpr size_t MaxImageArraySize = 2048;
//! Maximum number of supported constant buffers
static constexpr uint MaxConstBuffers = MaxConstArguments + 8;
//! Maximum number of constant buffers for arguments
static constexpr uint MaxConstBuffersArguments = 2;
//! Alignment restriction for the pinned memory
static constexpr size_t PinnedMemoryAlignment = 4 * Ki;
//! HSA path specific defines for images
static constexpr uint HsaImageObjectSize = 48;
static constexpr uint HsaImageObjectAlignment = 16;
static constexpr uint HsaSamplerObjectSize = 32;
static constexpr uint HsaSamplerObjectAlignment = 16;
//! HSA path specific defines for images
static constexpr uint DeviceQueueMaskSize = 32;
// Supported OpenCL versions
enum OclVersion {
OpenCL10 = 0x10,
OpenCL11 = 0x11,
OpenCL12 = 0x12,
OpenCL20 = 0x20,
OpenCL21 = 0x21,
OpenCL22 = 0x22,
};
struct MemoryFormat {
cl_image_format clFormat_; //!< CL image format
Pal::ChNumFormat palFormat_; //!< PAL image format
Pal::ChannelMapping palChannel_; //!< PAL channel mapping
};
static constexpr MemoryFormat MemoryFormatMap[] = {
// R
{{CL_R, CL_UNORM_INT8},
Pal::ChNumFormat::X8_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_UNORM_INT16},
Pal::ChNumFormat::X16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_SNORM_INT8},
Pal::ChNumFormat::X8_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_SNORM_INT16},
Pal::ChNumFormat::X16_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_SIGNED_INT8},
Pal::ChNumFormat::X8_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_SIGNED_INT16},
Pal::ChNumFormat::X16_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_SIGNED_INT32},
Pal::ChNumFormat::X32_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_UNSIGNED_INT16},
Pal::ChNumFormat::X16_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_UNSIGNED_INT32},
Pal::ChNumFormat::X32_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_HALF_FLOAT},
Pal::ChNumFormat::X16_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_R, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
// A
{{CL_A, CL_UNORM_INT8},
Pal::ChNumFormat::X8_Unorm,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_UNORM_INT16},
Pal::ChNumFormat::X16_Unorm,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_SNORM_INT8},
Pal::ChNumFormat::X8_Snorm,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_SNORM_INT16},
Pal::ChNumFormat::X16_Snorm,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_SIGNED_INT8},
Pal::ChNumFormat::X8_Sint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_SIGNED_INT16},
Pal::ChNumFormat::X16_Sint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_SIGNED_INT32},
Pal::ChNumFormat::X32_Sint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8_Uint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_UNSIGNED_INT16},
Pal::ChNumFormat::X16_Uint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_UNSIGNED_INT32},
Pal::ChNumFormat::X32_Uint,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_HALF_FLOAT},
Pal::ChNumFormat::X16_Float,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
{{CL_A, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::X}},
// RG
{{CL_RG, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_UNORM_INT16},
Pal::ChNumFormat::X16Y16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_SNORM_INT8},
Pal::ChNumFormat::X8Y8_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_SNORM_INT16},
Pal::ChNumFormat::X16Y16_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_SIGNED_INT8},
Pal::ChNumFormat::X8Y8_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_SIGNED_INT16},
Pal::ChNumFormat::X16Y16_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_SIGNED_INT32},
Pal::ChNumFormat::X32Y32_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8Y8_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_UNSIGNED_INT16},
Pal::ChNumFormat::X16Y16_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_UNSIGNED_INT32},
Pal::ChNumFormat::X32Y32_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_HALF_FLOAT},
Pal::ChNumFormat::X16Y16_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
{{CL_RG, CL_FLOAT},
Pal::ChNumFormat::X32Y32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Zero,
Pal::ChannelSwizzle::One}},
// RGB
{{CL_RGB, CL_UNORM_INT_101010},
Pal::ChNumFormat::X10Y10Z10W2_Unorm,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
// RGBA
// Note: special case for GL interops, OCL spec doesn't support 101010 format
// for GL interop and GL uses real RGB channel order
{{CL_RGBA, CL_UNORM_INT_101010},
Pal::ChNumFormat::X10Y10Z10W2_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::One}},
// RGBA
{{CL_RGBA, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_UNORM_INT16},
Pal::ChNumFormat::X16Y16Z16W16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_SNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_SNORM_INT16},
Pal::ChNumFormat::X16Y16Z16W16_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_SIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_SIGNED_INT16},
Pal::ChNumFormat::X16Y16Z16W16_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_SIGNED_INT32},
Pal::ChNumFormat::X32Y32Z32W32_Sint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_UNSIGNED_INT16},
Pal::ChNumFormat::X16Y16Z16W16_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_UNSIGNED_INT32},
Pal::ChNumFormat::X32Y32Z32W32_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_HALF_FLOAT},
Pal::ChNumFormat::X16Y16Z16W16_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
{{CL_RGBA, CL_FLOAT},
Pal::ChNumFormat::X32Y32Z32W32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
// ARGB
{{CL_ARGB, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Unorm,
{Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::W,
Pal::ChannelSwizzle::X}},
{{CL_ARGB, CL_SNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Snorm,
{Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::W,
Pal::ChannelSwizzle::X}},
{{CL_ARGB, CL_SIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Sint,
{Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::W,
Pal::ChannelSwizzle::X}},
{{CL_ARGB, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Uint,
{Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::W,
Pal::ChannelSwizzle::X}},
// BGRA
{{CL_BGRA, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Unorm,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::W}},
{{CL_BGRA, CL_SNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Snorm,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::W}},
{{CL_BGRA, CL_SIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Sint,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::W}},
{{CL_BGRA, CL_UNSIGNED_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Uint,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::W}},
// LUMINANCE
{{CL_LUMINANCE, CL_SNORM_INT8},
Pal::ChNumFormat::X8_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
{{CL_LUMINANCE, CL_SNORM_INT16},
Pal::ChNumFormat::X16_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
{{CL_LUMINANCE, CL_UNORM_INT8},
Pal::ChNumFormat::X8_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
{{CL_LUMINANCE, CL_UNORM_INT16},
Pal::ChNumFormat::X16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
{{CL_LUMINANCE, CL_HALF_FLOAT},
Pal::ChNumFormat::X16_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
{{CL_LUMINANCE, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::One}},
// INTENSITY
{{CL_INTENSITY, CL_SNORM_INT8},
Pal::ChNumFormat::X8_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_INTENSITY, CL_SNORM_INT16},
Pal::ChNumFormat::X16_Snorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_INTENSITY, CL_UNORM_INT8},
Pal::ChNumFormat::X8_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_INTENSITY, CL_UNORM_INT16},
Pal::ChNumFormat::X16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_INTENSITY, CL_HALF_FLOAT},
Pal::ChNumFormat::X16_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_INTENSITY, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
// sRBGA
{{CL_sRGBA, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Srgb,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::W}},
// sRBG
{{CL_sRGB, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Srgb,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::One}},
// sRBGx
{{CL_sRGBx, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Srgb,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::Z,
Pal::ChannelSwizzle::One}},
// sBGRA
{{CL_sBGRA, CL_UNORM_INT8},
Pal::ChNumFormat::X8Y8Z8W8_Srgb,
{Pal::ChannelSwizzle::Z, Pal::ChannelSwizzle::Y, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::W}},
// DEPTH
{{CL_DEPTH, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_DEPTH, CL_UNORM_INT16},
Pal::ChNumFormat::X16_Unorm,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_DEPTH_STENCIL, CL_UNORM_INT24},
Pal::ChNumFormat::X32_Uint,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}},
{{CL_DEPTH_STENCIL, CL_FLOAT},
Pal::ChNumFormat::X32_Float,
{Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X, Pal::ChannelSwizzle::X,
Pal::ChannelSwizzle::X}}};
} // namespace amd::pal