85beaf8888
SWDEV-130722 - Channel order in an interop buffer from OpenCL to OpenGL is flipped on Vega
OCL calls glGetTexLevelParameteriv_ function to get the internal GL format but this format is the one chosen by app in OGL API such as glTexImage2D.
The issue is that OGL sometimes selects a different format than defined in the glTexImage2D and this causes some issues in cl_gl interop. One example is shown below
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA/**internal format**/, width, height, 0, GL_BGRA/**external format**/, GL_UNSIGNED_BYTES, NULL);
in this case GL_RGBA is selected by app as the internal format but OGL switches to BGRA8 internally and causes an issue later in cl_gl interop (i.e., R and B channels are swapped) because OCL gets GL_RGBA as the internal format in the glGetTexLevelParameteriv_ call.
To avoid this issue, OCL needs to query the real internal gl format in wglResourceAttachAMD and adjusts the CL format accordingly.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/13408/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevicegl.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#35 edit
[ROCm/clr commit: e8395888c5]