diff --git a/projects/clr/rocclr/runtime/device/pal/paldevice.hpp b/projects/clr/rocclr/runtime/device/pal/paldevice.hpp index 667bd01840..b22ed66230 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevice.hpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevice.hpp @@ -482,7 +482,7 @@ class Device : public NullDevice { bool initGLInteropPrivateExt(void* GLplatformContext, void* GLdeviceContext) const; bool glCanInterop(void* GLplatformContext, void* GLdeviceContext) const; bool resGLAssociate(void* GLContext, uint name, uint type, void** handle, void** mbResHandle, - size_t* offset + size_t* offset, uint& glFormat #ifdef ATI_OS_WIN , Pal::DoppDesktopInfo& doppDesktopInfo diff --git a/projects/clr/rocclr/runtime/device/pal/paldevicegl.cpp b/projects/clr/rocclr/runtime/device/pal/paldevicegl.cpp index e9d61ed826..e3ed052f72 100644 --- a/projects/clr/rocclr/runtime/device/pal/paldevicegl.cpp +++ b/projects/clr/rocclr/runtime/device/pal/paldevicegl.cpp @@ -178,7 +178,7 @@ bool Device::glDissociate(void* GLplatformContext, void* GLdeviceContext) const } bool Device::resGLAssociate(void* GLContext, uint name, uint type, void** handle, - void** mbResHandle, size_t* offset + void** mbResHandle, size_t* offset, uint& glFormat #ifdef ATI_OS_WIN , Pal::DoppDesktopInfo& doppDesktopInfo @@ -225,6 +225,8 @@ bool Device::resGLAssociate(void* GLContext, uint name, uint type, void** handle } #endif + glFormat = static_cast(hData.format); + return status; } diff --git a/projects/clr/rocclr/runtime/device/pal/palresource.cpp b/projects/clr/rocclr/runtime/device/pal/palresource.cpp index 6c5e85fa83..e44f511960 100644 --- a/projects/clr/rocclr/runtime/device/pal/palresource.cpp +++ b/projects/clr/rocclr/runtime/device/pal/palresource.cpp @@ -483,13 +483,20 @@ bool Resource::create(MemoryType memType, CreateParams* params) { layer = oglRes->layer_; type = oglRes->type_; mipLevel = oglRes->mipLevel_; + uint glFormat = 0; if (!dev().resGLAssociate(oglRes->glPlatformContext_, oglRes->handle_, glType_, - &openInfo.hExternalResource, &glInteropMbRes_, &offset_, + &openInfo.hExternalResource, &glInteropMbRes_, &offset_, glFormat, openInfo.doppDesktopInfo)) { return false; } desc_.isDoppTexture_ = (openInfo.doppDesktopInfo.gpuVirtAddr != 0); + // This is a temporary workaround for SWDEV-130722 + // 0x22 = CM_SURF_FMT_BGRA8 defined in cm_enum.h in gsl + if (glFormat == 0x22) { + desc_.format_.image_channel_order = CL_BGRA; + format = dev().getPalFormat(desc().format_, &channels); + } } else { D3DInteropParams* d3dRes = reinterpret_cast(params); openInfo.hExternalResource = d3dRes->handle_;