From 82dc9c5d23d2fc36c5a8a80eebeb6cd5fd3306e7 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 21 Jul 2014 14:27:24 -0400
Subject: [PATCH] P4 to Git Change 1057445 by rili@rili_opencl_stg on
2014/07/21 14:11:34
EPR #399808 - Add CL_RGB, CL_UNORM_INT_101010 support
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#105 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudefs.hpp#111 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#186 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#106 edit
[ROCm/clr commit: 1b9e65b27b4d134e09cb8e9ec123c68c69a2b385]
---
projects/clr/rocclr/runtime/device/gpu/gpublit.cpp | 2 ++
projects/clr/rocclr/runtime/device/gpu/gpudefs.hpp | 7 +++++++
projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp | 6 ++++++
projects/clr/rocclr/runtime/platform/memory.cpp | 9 +++++++--
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpublit.cpp b/projects/clr/rocclr/runtime/device/gpu/gpublit.cpp
index 544dc25bc1..cd5fd38ca7 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpublit.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpublit.cpp
@@ -917,6 +917,7 @@ static const FormatConvertion RejectedData[] =
{ CL_FLOAT, CL_UNSIGNED_INT32 },
{ CL_SIGNED_INT8, CL_UNSIGNED_INT8 },
{ CL_SIGNED_INT16, CL_UNSIGNED_INT16 },
+ { CL_UNORM_INT_101010, CL_UNSIGNED_INT8 },
{ CL_SIGNED_INT32, CL_UNSIGNED_INT32 }
};
@@ -927,6 +928,7 @@ static const FormatConvertion RejectedOrder[] =
{ CL_RA, CL_RG },
{ CL_LUMINANCE, CL_R },
{ CL_INTENSITY, CL_R },
+ { CL_RGB, CL_RGBA },
{ CL_BGRA, CL_RGBA },
{ CL_ARGB, CL_RGBA },
{ CL_sRGB, CL_RGBA },
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudefs.hpp b/projects/clr/rocclr/runtime/device/gpu/gpudefs.hpp
index 9bfd9ca103..d215747a85 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudefs.hpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudefs.hpp
@@ -259,6 +259,12 @@ MemoryFormatMap[] = {
{ { CL_RA, CL_FLOAT },
{ GSL_CHANNEL_ORDER_RA, CM_SURF_FMT_RG32F } },
+ // RGB
+ { { CL_RGB, CL_UNORM_INT_101010 },
+ { GSL_CHANNEL_ORDER_RGB, CM_SURF_FMT_BGR10_X2 } },
+ { { CL_RGB, CL_UNSIGNED_INT8 }, // This is used only by blit kernel
+ { GSL_CHANNEL_ORDER_RGBA, CM_SURF_FMT_RGBA8UI } },
+
// RGBA
{ { CL_RGBA, CL_UNORM_INT8 },
{ GSL_CHANNEL_ORDER_RGBA, CM_SURF_FMT_RGBA8 } },
@@ -427,6 +433,7 @@ MemoryFormatSize[] = {
{ CM_SURF_FMT_RG16F, 4, 2 }, /**< A 2 component, 16-bit float value per component */
{ CM_SURF_FMT_RGBA16F, 8, 4 }, /**< A 4 component, 16-bit float value per component */
+ { CM_SURF_FMT_BGR10_X2, 4, 4 }, /**< 4 component, unnormalized signed 10-bit integer value per component packed as (@c XXRRRRRRRRRRGGGGGGGGGGBBBBBBBBBB)*/
{ CM_SURF_FMT_DEPTH32F, 4, 1 }, /**< A one component, 32 float value per component */
{ CM_SURF_FMT_DEPTH16 , 2, 1 }, /**< A one component, 16 unsigned int value per component */
{ CM_SURF_FMT_DEPTH24_STEN8 , 4 ,1}, /**< A one component, 32 float value per component */
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
index 3cca0ba309..6be2231341 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp
@@ -197,6 +197,9 @@ static uint32_t GetHSAILImageFormatType(cmSurfFmt format)
formatType = 6;
break;
*/
+ case CM_SURF_FMT_BGR10_X2:
+ formatType = 7;
+ break;
case CM_SURF_FMT_sR8:
case CM_SURF_FMT_sRG8:
case CM_SURF_FMT_sRGBA8:
@@ -285,6 +288,9 @@ static uint32_t GetHSAILImageOrderType(gslChannelOrder chOrder)
case HSA_IMAGE_FMT_R10G10B10_UNORM:
orderType = 6;
break;*/
+ case GSL_CHANNEL_ORDER_RGB:
+ orderType = 7;
+ break;
case GSL_CHANNEL_ORDER_RGBA:
orderType = 8;
break;
diff --git a/projects/clr/rocclr/runtime/platform/memory.cpp b/projects/clr/rocclr/runtime/platform/memory.cpp
index ac5db8069d..161c051f50 100644
--- a/projects/clr/rocclr/runtime/platform/memory.cpp
+++ b/projects/clr/rocclr/runtime/platform/memory.cpp
@@ -760,6 +760,8 @@ Image::Format::getElementSize() const
break;
case CL_UNORM_INT_101010:
+ bytesPerPixel = 4;
+ break;
case CL_SIGNED_INT32:
case CL_UNSIGNED_INT32:
case CL_FLOAT:
@@ -916,6 +918,9 @@ Image::supportedFormats[] = {
{CL_RG, CL_HALF_FLOAT}, {CL_RG, CL_FLOAT},
+ // RGB
+ {CL_RGB, CL_UNORM_INT_101010},
+
// RGBA
{CL_RGBA, CL_SNORM_INT8}, {CL_RGBA, CL_SNORM_INT16},
{CL_RGBA, CL_UNORM_INT8}, {CL_RGBA, CL_UNORM_INT16},
@@ -1334,9 +1339,9 @@ Image::Format::formatColor(const void* colorRGBA, void* colorFormat) const
union t101010 {
struct {
- uint32_t r_: 10;
- uint32_t g_: 10;
uint32_t b_: 10;
+ uint32_t g_: 10;
+ uint32_t r_: 10;
uint32_t a_: 2;
};
uint32_t rgba_;