| 1 | /* |
| 2 | * Copyright (C) 2018-2025 Intel Corporation |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "shared/source/os_interface/product_helper.h" |
| 9 | #include "shared/test/common/mocks/mock_device.h" |
| 10 | #include "shared/test/common/mocks/mock_gmm.h" |
| 11 | #include "shared/test/common/mocks/mock_gmm_resource_info.h" |
| 12 | #include "shared/test/common/mocks/mock_memory_manager.h" |
| 13 | |
| 14 | #include "opencl/source/helpers/gmm_types_converter.h" |
| 15 | #include "opencl/source/mem_obj/image.h" |
| 16 | #include "opencl/source/platform/platform.h" |
| 17 | #include "opencl/source/sharings/gl/gl_texture.h" |
| 18 | #include "opencl/test/unit_test/mocks/gl/windows/mock_gl_sharing_windows.h" |
| 19 | #include "opencl/test/unit_test/mocks/mock_cl_device.h" |
| 20 | #include "opencl/test/unit_test/mocks/mock_context.h" |
| 21 | #include "opencl/test/unit_test/mocks/mock_platform.h" |
| 22 | |
| 23 | #include "gtest/gtest.h" |
| 24 | |
| 25 | using namespace NEO; |
| 26 | |
| 27 | class GlSharingTextureTests : public ::testing::Test { |
| 28 | public: |
| 29 | // temp solution - we need to query size from GMM: |
| 30 | class TempMM : public MockMemoryManager { |
| 31 | public: |
| 32 | using MockMemoryManager::MockMemoryManager; |
| 33 | GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override { |
| 34 | auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(osHandleData, properties, requireSpecificBitness, isHostIpcAllocation, reuseSharedAllocation, mapPointer); |
| 35 | if (useForcedGmm) { |
| 36 | alloc->setDefaultGmm(forceGmm.get()); |
| 37 | } |
| 38 | return alloc; |
| 39 | } |
| 40 | void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override { |
| 41 | if (useForcedGmm) { |
| 42 | forceGmm.release(); |
| 43 | } |
| 44 | OsAgnosticMemoryManager::freeGraphicsMemoryImpl(gfxAllocation); |
| 45 | } |
| 46 | bool mapAuxGpuVA(GraphicsAllocation *graphicsAllocation) override { |
| 47 | mapAuxGpuVACalled++; |
| 48 | return false; |
| 49 | } |
| 50 | uint32_t mapAuxGpuVACalled = 0u; |
| 51 | size_t forceAllocationSize; |
| 52 | std::unique_ptr<Gmm> forceGmm; |
| 53 | bool useForcedGmm = true; |
| 54 | }; |
| 55 | |
| 56 | void SetUp() override { |
| 57 | executionEnvironment = platform()->peekExecutionEnvironment(); |
| 58 | imgDesc = {}; |
| 59 | imgDesc.imageType = ImageType::image1D; |
| 60 | imgDesc.imageWidth = 10; |
| 61 | auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); |
| 62 | |
| 63 | tempMM = new TempMM(*executionEnvironment); |
| 64 | executionEnvironment->memoryManager.reset(tempMM); |
| 65 | device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0)); |
| 66 | clContext = std::make_unique<MockContext>(device.get()); |
| 67 | |
| 68 | mockGlSharingFunctions = glSharing->sharingFunctions.release(); |
| 69 | clContext->setSharingFunctions(mockGlSharingFunctions); |
| 70 | |
| 71 | tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmHelper(), imgInfo, false); |
| 72 | tempMM->forceAllocationSize = textureSize; |
| 73 | textureSize = imgInfo.size; |
| 74 | textureId = 1; |
| 75 | } |
| 76 | |
| 77 | void setUnifiedAuxSurf() { |
| 78 | tempMM->useForcedGmm = true; |
| 79 | auto mockGmmResInfo = static_cast<MockGmmResourceInfo *>(tempMM->forceGmm->gmmResourceInfo.get()); |
| 80 | mockGmmResInfo->setUnifiedAuxTranslationCapable(); |
| 81 | } |
| 82 | void setMcsSurf() { |
| 83 | tempMM->useForcedGmm = true; |
| 84 | auto mockGmmResInfo = static_cast<MockGmmResourceInfo *>(tempMM->forceGmm->gmmResourceInfo.get()); |
| 85 | mockGmmResInfo->setMultisampleControlSurface(); |
| 86 | } |
| 87 | |
| 88 | ExecutionEnvironment *executionEnvironment; |
| 89 | ImageDescriptor imgDesc; |
| 90 | TempMM *tempMM; |
| 91 | std::unique_ptr<MockClDevice> device; |
| 92 | std::unique_ptr<MockContext> clContext; |
| 93 | std::unique_ptr<MockGlSharing> glSharing = std::make_unique<MockGlSharing>(); |
| 94 | GlSharingFunctionsMock *mockGlSharingFunctions; |
| 95 | size_t textureSize; |
| 96 | unsigned int textureId; |
| 97 | }; |
| 98 | |
| 99 | TEST_F(GlSharingTextureTests, givenMockGlWhen1dGlTextureIsCreatedThenMemObjectHasGlHandler) { |
| 100 | cl_int retVal = CL_INVALID_VALUE; |
| 101 | |
| 102 | glSharing->uploadDataToTextureInfo(textureId); |
| 103 | |
| 104 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 105 | ASSERT_NE(nullptr, glTexture); |
| 106 | auto graphicsAllocation = glTexture->getGraphicsAllocation(device->getRootDeviceIndex()); |
| 107 | EXPECT_NE(nullptr, graphicsAllocation); |
| 108 | EXPECT_EQ(textureSize, graphicsAllocation->getUnderlyingBufferSize()); |
| 109 | EXPECT_EQ(1, glSharing->dllParam->getParam("glAcquireSharedTextureCalled")); |
| 110 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 111 | |
| 112 | EXPECT_EQ(textureId, glSharing->dllParam->getTextureInfo().name); // input |
| 113 | |
| 114 | auto handler = glTexture->peekSharingHandler(); |
| 115 | ASSERT_NE(nullptr, handler); |
| 116 | auto glHandler = static_cast<GlSharing *>(handler); |
| 117 | |
| 118 | EXPECT_EQ(glHandler->peekFunctionsHandler(), mockGlSharingFunctions); |
| 119 | |
| 120 | delete glTexture; |
| 121 | } |
| 122 | |
| 123 | class FailingMemoryManager : public MockMemoryManager { |
| 124 | public: |
| 125 | GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override { |
| 126 | return nullptr; |
| 127 | } |
| 128 | }; |
| 129 | |
| 130 | TEST_F(GlSharingTextureTests, givenMockGlWhenGlTextureIsCreatedFromWrongHandleThenErrorAndNoTextureIsReturned) { |
| 131 | auto tempMemoryManager = clContext->getMemoryManager(); |
| 132 | tempMM->useForcedGmm = false; |
| 133 | auto memoryManager = std::unique_ptr<FailingMemoryManager>(new FailingMemoryManager()); |
| 134 | clContext->memoryManager = memoryManager.get(); |
| 135 | |
| 136 | auto retVal = CL_SUCCESS; |
| 137 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 138 | |
| 139 | EXPECT_EQ(nullptr, glTexture); |
| 140 | EXPECT_EQ(CL_INVALID_GL_OBJECT, retVal); |
| 141 | |
| 142 | clContext->memoryManager = tempMemoryManager; |
| 143 | } |
| 144 | |
| 145 | GLboolean OSAPI mockGLAcquireSharedTexture(GLDisplay, GLContext, GLContext, GLvoid *pResourceInfo) { |
| 146 | auto pTextureInfo = (CL_GL_RESOURCE_INFO *)pResourceInfo; |
| 147 | GlDllHelper dllParam; |
| 148 | pTextureInfo->globalShareHandle = dllParam.getTextureInfo().globalShareHandle; |
| 149 | pTextureInfo->globalShareHandleMCS = dllParam.getTextureInfo().globalShareHandleMCS; |
| 150 | |
| 151 | if (pTextureInfo->target == GL_TEXTURE_BUFFER) { |
| 152 | // size and width for texture buffer are queried from textureInfo - not from gmm |
| 153 | pTextureInfo->textureBufferSize = dllParam.getTextureInfo().textureBufferSize; |
| 154 | pTextureInfo->textureBufferWidth = dllParam.getTextureInfo().textureBufferWidth; |
| 155 | } |
| 156 | pTextureInfo->pGmmResInfo = dllParam.getTextureInfo().pGmmResInfo; |
| 157 | pTextureInfo->glInternalFormat = 99999; |
| 158 | pTextureInfo->glHWFormat = dllParam.getTextureInfo().glHWFormat; |
| 159 | pTextureInfo->textureBufferOffset = dllParam.getTextureInfo().textureBufferOffset; |
| 160 | dllParam.loadTexture(*pTextureInfo); |
| 161 | return (GLboolean)1; |
| 162 | }; |
| 163 | |
| 164 | TEST_F(GlSharingTextureTests, givenMockGlWhenGlTextureIsCreatedFromIncorrectFormatThenErrorAndNoTextureIsReturned) { |
| 165 | mockGlSharingFunctions->setGLAcquireSharedTextureMock(mockGLAcquireSharedTexture); |
| 166 | |
| 167 | auto retVal = CL_SUCCESS; |
| 168 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 169 | |
| 170 | EXPECT_EQ(nullptr, glTexture); |
| 171 | EXPECT_EQ(CL_INVALID_GL_OBJECT, retVal); |
| 172 | } |
| 173 | |
| 174 | TEST_F(GlSharingTextureTests, givenMockGlWhenRenderBufferTextureIsCreatedThenMemObjectHasGlHandler) { |
| 175 | cl_int retVal = CL_INVALID_VALUE; |
| 176 | |
| 177 | glSharing->uploadDataToTextureInfo(textureId); |
| 178 | |
| 179 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_RENDERBUFFER_EXT, 0, textureId, &retVal); |
| 180 | ASSERT_NE(nullptr, glTexture); |
| 181 | auto graphicsAllocation = glTexture->getGraphicsAllocation(device->getRootDeviceIndex()); |
| 182 | EXPECT_NE(nullptr, graphicsAllocation); |
| 183 | EXPECT_EQ(textureSize, graphicsAllocation->getUnderlyingBufferSize()); |
| 184 | EXPECT_EQ(1, glSharing->dllParam->getParam("glAcquireSharedRenderBufferCalled")); |
| 185 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 186 | |
| 187 | EXPECT_EQ(textureId, glSharing->dllParam->getTextureInfo().name); |
| 188 | |
| 189 | auto handler = glTexture->peekSharingHandler(); |
| 190 | ASSERT_NE(nullptr, handler); |
| 191 | auto glHandler = static_cast<GlSharing *>(handler); |
| 192 | |
| 193 | EXPECT_EQ(glHandler->peekFunctionsHandler(), mockGlSharingFunctions); |
| 194 | |
| 195 | delete glTexture; |
| 196 | } |
| 197 | |
| 198 | TEST_F(GlSharingTextureTests, givenGmmResourceAsInputWhenTextureIsCreatedThenItHasGmmSet) { |
| 199 | cl_int retVal = CL_INVALID_VALUE; |
| 200 | |
| 201 | glSharing->textureInfoOutput.globalShareHandle = textureId; |
| 202 | glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo(); |
| 203 | this->tempMM->useForcedGmm = false; |
| 204 | glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo(); |
| 205 | |
| 206 | glSharing->uploadDataToTextureInfo(); |
| 207 | |
| 208 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 209 | ASSERT_NE(nullptr, glTexture); |
| 210 | auto graphicsAllocation = glTexture->getGraphicsAllocation(device->getRootDeviceIndex()); |
| 211 | EXPECT_NE(nullptr, graphicsAllocation); |
| 212 | |
| 213 | ASSERT_NE(nullptr, graphicsAllocation->getDefaultGmm()); |
| 214 | ASSERT_NE(nullptr, graphicsAllocation->getDefaultGmm()->gmmResourceInfo->peekHandle()); |
| 215 | |
| 216 | delete glTexture; |
| 217 | } |
| 218 | |
| 219 | TEST_F(GlSharingTextureTests, givenGmmResourceInfoWithMcsWhenMcsHandleIsNullAndMultisampleCountIsGreaterThanOneThenImageHasUnifiedMcs) { |
| 220 | cl_int retVal = CL_INVALID_VALUE; |
| 221 | |
| 222 | setMcsSurf(); |
| 223 | glSharing->textureInfoOutput.globalShareHandleMCS = NULL; |
| 224 | glSharing->textureInfoOutput.numberOfSamples = 16; |
| 225 | glSharing->textureInfoOutput.globalShareHandle = textureId; |
| 226 | glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo(); |
| 227 | this->tempMM->useForcedGmm = false; |
| 228 | glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo(); |
| 229 | |
| 230 | glSharing->uploadDataToTextureInfo(); |
| 231 | |
| 232 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 233 | EXPECT_TRUE(glTexture->getIsUnifiedMcsSurface()); |
| 234 | delete glTexture; |
| 235 | } |
| 236 | |
| 237 | TEST_F(GlSharingTextureTests, givenDifferentHwFormatWhenSurfaceFormatInfoIsSetThenOverwrite) { |
| 238 | cl_int retVal = CL_INVALID_VALUE; |
| 239 | cl_image_format imageFormat = {}; |
| 240 | GlTexture::setClImageFormat(GL_DEPTH32F_STENCIL8, imageFormat); |
| 241 | auto format = Image::getSurfaceFormatFromTable(CL_MEM_READ_ONLY, &imageFormat); |
| 242 | ASSERT_NE(format, nullptr); |
| 243 | auto newHwFormat = 217u; |
| 244 | |
| 245 | EXPECT_TRUE(format->surfaceFormat.genxSurfaceFormat != newHwFormat); |
| 246 | |
| 247 | glSharing->textureInfoOutput.glHWFormat = newHwFormat; |
| 248 | glSharing->textureInfoOutput.glInternalFormat = GL_DEPTH32F_STENCIL8; |
| 249 | |
| 250 | glSharing->uploadDataToTextureInfo(); |
| 251 | |
| 252 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, textureId, &retVal); |
| 253 | ASSERT_NE(nullptr, glTexture); |
| 254 | EXPECT_TRUE(newHwFormat == glTexture->getSurfaceFormatInfo().surfaceFormat.genxSurfaceFormat); |
| 255 | |
| 256 | delete glTexture; |
| 257 | } |
| 258 | |
| 259 | TEST_F(GlSharingTextureTests, givenGLRGB10FormatWhenSharedGlTextureIsCreatedThenItHasCorrectGenxSurfaceFormatAssigned) { |
| 260 | cl_int retVal = CL_INVALID_VALUE; |
| 261 | glSharing->textureInfoOutput.glInternalFormat = GL_RGB10; |
| 262 | glSharing->textureInfoOutput.glHWFormat = GFX3DSTATE_SURFACEFORMAT_R16G16B16X16_UNORM; |
| 263 | glSharing->uploadDataToTextureInfo(); |
| 264 | |
| 265 | std::unique_ptr<Image> glTexture(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, textureId, &retVal)); |
| 266 | ASSERT_NE(nullptr, glTexture); |
| 267 | EXPECT_EQ(glTexture->getSurfaceFormatInfo().surfaceFormat.genxSurfaceFormat, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UNORM); |
| 268 | } |
| 269 | |
| 270 | TEST_F(GlSharingTextureTests, givenContextAnd1dTextureWhenClCreateFromGlTextureIsCalledThenImageIsReturned) { |
| 271 | cl_int retVal = CL_INVALID_GL_OBJECT; |
| 272 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 273 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 274 | ASSERT_NE(nullptr, glImage); |
| 275 | |
| 276 | retVal = clReleaseMemObject(glImage); |
| 277 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 278 | } |
| 279 | |
| 280 | TEST_F(GlSharingTextureTests, givenContextWithoutSharingAnd1dTextureWhenClCreateFromGlTextureIsCalledThenErrorIsReturned) { |
| 281 | tempMM->useForcedGmm = false; |
| 282 | clContext->resetSharingFunctions(CLGL_SHARING); |
| 283 | cl_int retVal = CL_INVALID_GL_OBJECT; |
| 284 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 285 | ASSERT_EQ(CL_INVALID_CONTEXT, retVal); |
| 286 | ASSERT_EQ(nullptr, glImage); |
| 287 | } |
| 288 | |
| 289 | TEST_F(GlSharingTextureTests, givenContextAndRenderBufferTextureWhenClCreateFromGlTextureIsCalledThenImageIsReturned) { |
| 290 | cl_int retVal = CL_INVALID_GL_OBJECT; |
| 291 | auto glImage = clCreateFromGLRenderbuffer(clContext.get(), 0, textureId, &retVal); |
| 292 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 293 | ASSERT_NE(nullptr, glImage); |
| 294 | |
| 295 | retVal = clReleaseMemObject(glImage); |
| 296 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 297 | } |
| 298 | |
| 299 | TEST_F(GlSharingTextureTests, givenContextWithoutSharingAndRenderBufferTextureWhenClCreateFromGlTextureIsCalledThenErrorIsReturned) { |
| 300 | tempMM->useForcedGmm = false; |
| 301 | clContext->resetSharingFunctions(CLGL_SHARING); |
| 302 | cl_int retVal = CL_INVALID_GL_OBJECT; |
| 303 | auto glImage = clCreateFromGLRenderbuffer(clContext.get(), 0, textureId, &retVal); |
| 304 | ASSERT_EQ(CL_INVALID_CONTEXT, retVal); |
| 305 | ASSERT_EQ(nullptr, glImage); |
| 306 | } |
| 307 | |
| 308 | TEST_F(GlSharingTextureTests, givenGlCl1dTextureWhenAskedForCLGLGetInfoThenIdAndTypeIsReturned) { |
| 309 | auto retVal = CL_SUCCESS; |
| 310 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 311 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 312 | ASSERT_NE(nullptr, glImage); |
| 313 | |
| 314 | cl_gl_object_type objectType = 0u; |
| 315 | cl_GLuint objectId = 0u; |
| 316 | |
| 317 | retVal = clGetGLObjectInfo(glImage, &objectType, &objectId); |
| 318 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 319 | EXPECT_EQ(objectType, (cl_gl_object_type)CL_GL_OBJECT_TEXTURE1D); |
| 320 | EXPECT_EQ(objectId, textureId); |
| 321 | |
| 322 | retVal = clReleaseMemObject(glImage); |
| 323 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 324 | } |
| 325 | |
| 326 | TEST_F(GlSharingTextureTests, givenHwCommandQueueAndGlTextureWhenItIsCreatedWithClCreateFromGlTexture2dThenImageObjectIsReturned) { |
| 327 | auto retVal = CL_SUCCESS; |
| 328 | auto glImage = clCreateFromGLTexture2D(clContext.get(), 0, GL_TEXTURE_2D, 0, textureId, &retVal); |
| 329 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 330 | ASSERT_NE(nullptr, glImage); |
| 331 | |
| 332 | cl_gl_object_type objectType = 0u; |
| 333 | cl_GLuint objectId = 0u; |
| 334 | |
| 335 | retVal = clGetGLObjectInfo(glImage, &objectType, &objectId); |
| 336 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 337 | EXPECT_EQ(objectType, (cl_gl_object_type)CL_GL_OBJECT_TEXTURE2D); |
| 338 | EXPECT_EQ(objectId, textureId); |
| 339 | |
| 340 | retVal = clReleaseMemObject(glImage); |
| 341 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 342 | } |
| 343 | |
| 344 | TEST_F(GlSharingTextureTests, givenContextWithoutSharingAndGlTextureWhenItIsCreatedWithClCreateFromGlTexture2dThenErrorIsReturned) { |
| 345 | tempMM->useForcedGmm = false; |
| 346 | clContext->resetSharingFunctions(CLGL_SHARING); |
| 347 | auto retVal = CL_SUCCESS; |
| 348 | auto glImage = clCreateFromGLTexture2D(clContext.get(), 0, GL_TEXTURE_2D, 0, textureId, &retVal); |
| 349 | ASSERT_EQ(CL_INVALID_CONTEXT, retVal); |
| 350 | ASSERT_EQ(nullptr, glImage); |
| 351 | } |
| 352 | |
| 353 | TEST_F(GlSharingTextureTests, givenHwCommandQueueAndGlTextureWhenItIsCreatedWithClCreateFromGlTexture3dThenImageObjectIsReturned) { |
| 354 | auto retVal = CL_SUCCESS; |
| 355 | auto glImage = clCreateFromGLTexture3D(clContext.get(), 0, GL_TEXTURE_3D, 0, textureId, &retVal); |
| 356 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 357 | ASSERT_NE(nullptr, glImage); |
| 358 | |
| 359 | cl_gl_object_type objectType = 0u; |
| 360 | cl_GLuint objectId = 0u; |
| 361 | |
| 362 | retVal = clGetGLObjectInfo(glImage, &objectType, &objectId); |
| 363 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 364 | EXPECT_EQ(objectType, (cl_gl_object_type)CL_GL_OBJECT_TEXTURE3D); |
| 365 | EXPECT_EQ(objectId, textureId); |
| 366 | |
| 367 | retVal = clReleaseMemObject(glImage); |
| 368 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 369 | } |
| 370 | |
| 371 | TEST_F(GlSharingTextureTests, givenContextWithoutSharingAndGlTextureWhenItIsCreatedWithClCreateFromGlTexture3dThenErrorIsReturned) { |
| 372 | tempMM->useForcedGmm = false; |
| 373 | clContext->resetSharingFunctions(CLGL_SHARING); |
| 374 | auto retVal = CL_SUCCESS; |
| 375 | auto glImage = clCreateFromGLTexture3D(clContext.get(), 0, GL_TEXTURE_3D, 0, textureId, &retVal); |
| 376 | ASSERT_EQ(CL_INVALID_CONTEXT, retVal); |
| 377 | ASSERT_EQ(nullptr, glImage); |
| 378 | } |
| 379 | |
| 380 | TEST_F(GlSharingTextureTests, givenHwCommandQueueAndGlTextureWhenAcquireIsCalledThenAcquireCountIsIncremented) { |
| 381 | glSharing->uploadDataToTextureInfo(textureId); |
| 382 | |
| 383 | auto retVal = CL_SUCCESS; |
| 384 | auto commandQueue = clCreateCommandQueue(clContext.get(), clContext->getDevice(0), 0, &retVal); |
| 385 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 386 | |
| 387 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 388 | |
| 389 | EXPECT_EQ(1, glSharing->dllParam->getParam("glAcquireSharedTextureCalled")); |
| 390 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 391 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 392 | EXPECT_EQ(2, glSharing->dllParam->getParam("glAcquireSharedTextureCalled")); |
| 393 | |
| 394 | retVal = clEnqueueReleaseGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 395 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 396 | |
| 397 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 398 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 399 | EXPECT_EQ(3, glSharing->dllParam->getParam("glAcquireSharedTextureCalled")); |
| 400 | |
| 401 | retVal = clReleaseCommandQueue(commandQueue); |
| 402 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 403 | retVal = clReleaseMemObject(glImage); |
| 404 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 405 | } |
| 406 | |
| 407 | TEST_F(GlSharingTextureTests, GivenGlTextureThenBufferOffsetIsCorrect) { |
| 408 | glSharing->uploadDataToTextureInfo(textureId); |
| 409 | |
| 410 | auto rootDeviceIndex = clContext->getDevice(0)->getRootDeviceIndex(); |
| 411 | |
| 412 | auto retVal = CL_SUCCESS; |
| 413 | auto commandQueue = clCreateCommandQueue(clContext.get(), clContext->getDevice(0), 0, &retVal); |
| 414 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 415 | |
| 416 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, GL_TEXTURE_1D, 0, textureId, &retVal); |
| 417 | EXPECT_NE(glImage, nullptr); |
| 418 | |
| 419 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 420 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 421 | auto memObj = castToObject<MemObj>(glImage); |
| 422 | EXPECT_NE(memObj, nullptr); |
| 423 | EXPECT_EQ(memObj->getGraphicsAllocation(rootDeviceIndex)->getAllocationOffset(), 0u); |
| 424 | |
| 425 | retVal = clEnqueueReleaseGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 426 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 427 | |
| 428 | glSharing->uploadTextureBufferOffsetToTextureInfo(0x660); |
| 429 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 430 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 431 | memObj = castToObject<MemObj>(glImage); |
| 432 | EXPECT_NE(memObj, nullptr); |
| 433 | EXPECT_EQ(memObj->getGraphicsAllocation(rootDeviceIndex)->getAllocationOffset(), 0x660u); |
| 434 | |
| 435 | retVal = clEnqueueReleaseGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 436 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 437 | |
| 438 | retVal = clReleaseCommandQueue(commandQueue); |
| 439 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 440 | |
| 441 | retVal = clReleaseMemObject(glImage); |
| 442 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 443 | } |
| 444 | |
| 445 | TEST_F(GlSharingTextureTests, givenHwCommandQueueAndGlRenderBufferWhenAcquireIsCalledThenAcquireCountIsIncremented) { |
| 446 | glSharing->uploadDataToTextureInfo(textureId); |
| 447 | |
| 448 | auto retVal = CL_SUCCESS; |
| 449 | auto commandQueue = clCreateCommandQueue(clContext.get(), clContext->getDevice(0), 0, &retVal); |
| 450 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 451 | |
| 452 | auto glImage = clCreateFromGLRenderbuffer(clContext.get(), 0, textureId, &retVal); |
| 453 | |
| 454 | EXPECT_EQ(1, glSharing->dllParam->getParam("glAcquireSharedRenderBufferCalled")); |
| 455 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 456 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 457 | EXPECT_EQ(2, glSharing->dllParam->getParam("glAcquireSharedRenderBufferCalled")); |
| 458 | |
| 459 | retVal = clEnqueueReleaseGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 460 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 461 | |
| 462 | retVal = clEnqueueAcquireGLObjects(commandQueue, 1, &glImage, 0, nullptr, nullptr); |
| 463 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 464 | EXPECT_EQ(3, glSharing->dllParam->getParam("glAcquireSharedRenderBufferCalled")); |
| 465 | |
| 466 | retVal = clReleaseCommandQueue(commandQueue); |
| 467 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 468 | retVal = clReleaseMemObject(glImage); |
| 469 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 470 | } |
| 471 | |
| 472 | TEST_F(GlSharingTextureTests, givenSharedGlTextureWhenItIsAcquireCountIsDecrementedToZeroThenCallReleaseFunction) { |
| 473 | std::unique_ptr<Image> image(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, textureId, nullptr)); |
| 474 | auto sharingHandler = image->peekSharingHandler(); |
| 475 | |
| 476 | sharingHandler->acquire(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 477 | sharingHandler->acquire(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 478 | |
| 479 | sharingHandler->release(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 480 | EXPECT_EQ(0, glSharing->dllParam->getParam("glReleaseSharedTextureCalled")); |
| 481 | |
| 482 | sharingHandler->release(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 483 | EXPECT_EQ(1, glSharing->dllParam->getParam("glReleaseSharedTextureCalled")); |
| 484 | EXPECT_EQ(0, glSharing->dllParam->getParam("glReleaseSharedRenderBufferCalled")); |
| 485 | EXPECT_EQ(textureId, glSharing->dllParam->getTextureInfo().name); |
| 486 | } |
| 487 | |
| 488 | TEST_F(GlSharingTextureTests, givenSharedRenderBufferWhenItIsAcquireCountIsDecrementedToZeroThenCallReleaseFunction) { |
| 489 | std::unique_ptr<Image> image(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_WRITE, GL_RENDERBUFFER_EXT, 0, textureId, nullptr)); |
| 490 | auto sharingHandler = image->peekSharingHandler(); |
| 491 | |
| 492 | sharingHandler->acquire(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 493 | sharingHandler->acquire(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 494 | |
| 495 | sharingHandler->release(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 496 | EXPECT_EQ(0, glSharing->dllParam->getParam("glReleaseSharedRenderBufferCalled")); |
| 497 | |
| 498 | sharingHandler->release(image.get(), clContext->getDevice(0)->getRootDeviceIndex()); |
| 499 | EXPECT_EQ(1, glSharing->dllParam->getParam("glReleaseSharedRenderBufferCalled")); |
| 500 | EXPECT_EQ(0, glSharing->dllParam->getParam("glReleaseSharedTextureCalled")); |
| 501 | EXPECT_EQ(textureId, glSharing->dllParam->getTextureInfo().name); |
| 502 | } |
| 503 | |
| 504 | TEST_F(GlSharingTextureTests, givenMultisampleTextureWithMoreThanOneSampleWhenAskedForNumSamplesThenReturnCorrectValue) { |
| 505 | GLsizei expectedNumSamples = 2; |
| 506 | glSharing->textureInfoOutput.numberOfSamples = expectedNumSamples; |
| 507 | glSharing->uploadDataToTextureInfo(); |
| 508 | std::unique_ptr<Image> image(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_WRITE, GL_TEXTURE_2D_MULTISAMPLE, 0, textureId, nullptr)); |
| 509 | |
| 510 | GLsizei numSamples = 0; |
| 511 | size_t retSize = 0; |
| 512 | |
| 513 | auto retVal = clGetGLTextureInfo(image.get(), CL_GL_NUM_SAMPLES, sizeof(GLsizei), &numSamples, &retSize); |
| 514 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 515 | EXPECT_EQ(expectedNumSamples, numSamples); |
| 516 | EXPECT_EQ(sizeof(GLsizei), retSize); |
| 517 | } |
| 518 | |
| 519 | TEST_F(GlSharingTextureTests, givenTextureWithOneSampleWhenAskedForNumSamplesThenReturnZero) { |
| 520 | glSharing->textureInfoOutput.numberOfSamples = 1; |
| 521 | glSharing->uploadDataToTextureInfo(); |
| 522 | std::unique_ptr<Image> image(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_WRITE, GL_TEXTURE_2D_MULTISAMPLE, 0, textureId, nullptr)); |
| 523 | |
| 524 | GLenum numSamples = 0; |
| 525 | size_t retSize = 0; |
| 526 | |
| 527 | auto retVal = clGetGLTextureInfo(image.get(), CL_GL_NUM_SAMPLES, sizeof(GLsizei), &numSamples, &retSize); |
| 528 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 529 | EXPECT_EQ(0u, numSamples); |
| 530 | EXPECT_EQ(sizeof(GLsizei), retSize); |
| 531 | } |
| 532 | |
| 533 | TEST_F(GlSharingTextureTests, givenTextureWithZeroSamplesWhenAskedForNumSamplesThenReturnZero) { |
| 534 | glSharing->textureInfoOutput.numberOfSamples = 0; |
| 535 | glSharing->uploadDataToTextureInfo(); |
| 536 | std::unique_ptr<Image> image(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_READ_WRITE, GL_TEXTURE_2D_MULTISAMPLE, 0, textureId, nullptr)); |
| 537 | |
| 538 | GLenum numSamples = 0; |
| 539 | size_t retSize = 0; |
| 540 | |
| 541 | auto retVal = clGetGLTextureInfo(image.get(), CL_GL_NUM_SAMPLES, sizeof(GLsizei), &numSamples, &retSize); |
| 542 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 543 | EXPECT_EQ(0u, numSamples); |
| 544 | EXPECT_EQ(sizeof(GLsizei), retSize); |
| 545 | } |
| 546 | |
| 547 | TEST_F(GlSharingTextureTests, givenMockGlWhenGlTextureIsCreatedFromFormatNotIncludedInSurfaceFormatsThenErrorAndNoTextureIsReturned) { |
| 548 | cl_int retVal = CL_SUCCESS; |
| 549 | auto textureInfoOutput = std::make_unique<CL_GL_RESOURCE_INFO>(); |
| 550 | textureInfoOutput->glInternalFormat = GL_SRGB8_ALPHA8; |
| 551 | glSharing->dllParam->loadTexture(*textureInfoOutput); |
| 552 | |
| 553 | auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_WRITE_ONLY, GL_SRGB8_ALPHA8, 0, textureId, &retVal); |
| 554 | |
| 555 | EXPECT_EQ(nullptr, glTexture); |
| 556 | EXPECT_EQ(CL_INVALID_GL_OBJECT, retVal); |
| 557 | } |
| 558 | |
| 559 | TEST_F(GlSharingTextureTests, givenMockGlWhenGlTextureIsCreatedWithUnifiedAuxSurfThenMapAuxGpuVaIsCalled) { |
| 560 | CL_GL_RESOURCE_INFO textureInfoToReturn = {}; |
| 561 | textureInfoToReturn.isAuxEnabled = GL_TRUE; |
| 562 | glSharing->dllParam->loadTexture(textureInfoToReturn); |
| 563 | |
| 564 | cl_int retVal = CL_SUCCESS; |
| 565 | setUnifiedAuxSurf(); |
| 566 | EXPECT_EQ(0u, tempMM->mapAuxGpuVACalled); |
| 567 | |
| 568 | auto glTexture = std::unique_ptr<Image>(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_WRITE_ONLY, GL_SRGB8_ALPHA8, 0, textureId, &retVal)); |
| 569 | |
| 570 | const auto &hwInfo = clContext->getDevice(0)->getHardwareInfo(); |
| 571 | const auto &productHelper = clContext->getDevice(0)->getProductHelper(); |
| 572 | uint32_t expectedMapAuxGpuVaCalls = productHelper.isPageTableManagerSupported(hwInfo) ? 1 : 0; |
| 573 | |
| 574 | EXPECT_EQ(expectedMapAuxGpuVaCalls, tempMM->mapAuxGpuVACalled); |
| 575 | } |
| 576 | |
| 577 | TEST_F(GlSharingTextureTests, givenAuxDisabledAndUnifiedAuxCapableWhenGlTextureIsCreatedThenAllocationIsTreatedAsUncompressed) { |
| 578 | CL_GL_RESOURCE_INFO textureInfoToReturn = {}; |
| 579 | textureInfoToReturn.isAuxEnabled = GL_FALSE; |
| 580 | glSharing->dllParam->loadTexture(textureInfoToReturn); |
| 581 | |
| 582 | cl_int retVal = CL_SUCCESS; |
| 583 | setUnifiedAuxSurf(); |
| 584 | ASSERT_EQ(0u, tempMM->mapAuxGpuVACalled); |
| 585 | |
| 586 | auto glTexture = std::unique_ptr<Image>(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_WRITE_ONLY, GL_SRGB8_ALPHA8, 0, textureId, &retVal)); |
| 587 | EXPECT_EQ(0u, tempMM->mapAuxGpuVACalled); |
| 588 | auto graphicsAllocation = glTexture->getGraphicsAllocation(device->getRootDeviceIndex()); |
| 589 | EXPECT_FALSE(graphicsAllocation->getDefaultGmm()->isCompressionEnabled()); |
| 590 | } |
| 591 | |
| 592 | TEST_F(GlSharingTextureTests, givenGmmInfoIsDisplayableWhenGlTextureIsCreatedThenImageHasDisplayableSet) { |
| 593 | auto mockGmmResInfo = static_cast<MockGmmResourceInfo *>(tempMM->forceGmm->gmmResourceInfo.get()); |
| 594 | mockGmmResInfo->isDisplayableValue = true; |
| 595 | cl_int retVal = CL_SUCCESS; |
| 596 | auto glTexture = std::unique_ptr<Image>(GlTexture::createSharedGlTexture(clContext.get(), CL_MEM_WRITE_ONLY, GL_SRGB8_ALPHA8, 0, textureId, &retVal)); |
| 597 | EXPECT_TRUE(glTexture->getIsDisplayable()); |
| 598 | } |
| 599 | |
| 600 | class GetGlTextureInfoTests : public GlSharingTextureTests, |
| 601 | public ::testing::WithParamInterface<unsigned int /*cl_GLenum*/> { |
| 602 | }; |
| 603 | |
| 604 | INSTANTIATE_TEST_SUITE_P( |
| 605 | GetGlTextureInfoTests, |
| 606 | GetGlTextureInfoTests, |
| 607 | testing::ValuesIn(glTextureTargets::supportedTargets)); |
| 608 | |
| 609 | TEST_P(GetGlTextureInfoTests, givenGlTextureWhenAskedForCLGetGLTextureInfoThenReturnValidInfo) { |
| 610 | auto retVal = CL_SUCCESS; |
| 611 | GLenum expectedTarget = GetParam(); |
| 612 | GLint mipLevel = 1u; |
| 613 | auto glImage = clCreateFromGLTexture(clContext.get(), 0, expectedTarget, mipLevel, textureId, &retVal); |
| 614 | ASSERT_EQ(CL_SUCCESS, retVal); |
| 615 | ASSERT_NE(nullptr, glImage); |
| 616 | |
| 617 | auto pMemObj = castToObject<MemObj>(glImage); |
| 618 | auto glTextureObj = (GlTexture *)pMemObj->peekSharingHandler(); |
| 619 | |
| 620 | GLenum textureTarget = 0u; |
| 621 | |
| 622 | size_t retSize = 0; |
| 623 | |
| 624 | retVal = clGetGLTextureInfo(glImage, CL_GL_TEXTURE_TARGET, sizeof(GLenum), &textureTarget, &retSize); |
| 625 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 626 | EXPECT_EQ(expectedTarget, textureTarget); |
| 627 | EXPECT_EQ(sizeof(GLenum), retSize); |
| 628 | |
| 629 | retVal = clGetGLTextureInfo(glImage, CL_GL_MIPMAP_LEVEL, sizeof(GLenum), &mipLevel, &retSize); |
| 630 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 631 | EXPECT_EQ(glTextureObj->getMiplevel(), mipLevel); |
| 632 | EXPECT_EQ(sizeof(GLint), retSize); |
| 633 | |
| 634 | retVal = clGetGLTextureInfo(glImage, CL_INVALID_VALUE, 0, nullptr, nullptr); |
| 635 | EXPECT_EQ(CL_INVALID_VALUE, retVal); |
| 636 | |
| 637 | auto image = castToObject<Image>(glImage); |
| 638 | EXPECT_EQ(mipLevel, image->peekBaseMipLevel()); |
| 639 | |
| 640 | retVal = clReleaseMemObject(glImage); |
| 641 | EXPECT_EQ(CL_SUCCESS, retVal); |
| 642 | } |
| 643 | |
| 644 | TEST_P(GetGlTextureInfoTests, givenApiTargetTypeWhenAskedForBaseTypeThenConvertOnlyCubeMaps) { |
| 645 | tempMM->useForcedGmm = false; |
| 646 | auto apiTarget = GetParam(); |
| 647 | unsigned int expectedBaseType; |
| 648 | |
| 649 | switch (apiTarget) { |
| 650 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 651 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 652 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 653 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 654 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 655 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 656 | expectedBaseType = GL_TEXTURE_CUBE_MAP_ARB; |
| 657 | break; |
| 658 | default: |
| 659 | expectedBaseType = apiTarget; |
| 660 | break; |
| 661 | } |
| 662 | |
| 663 | EXPECT_EQ(GlTexture::getBaseTargetType(apiTarget), expectedBaseType); |
| 664 | } |
| 665 | |
| 666 | TEST_P(GetGlTextureInfoTests, givenApiTargetTypeWhenAskedForGmmCubeFaceIndexThenReturnValidOnlyForCubeType) { |
| 667 | tempMM->useForcedGmm = false; |
| 668 | auto apiTarget = GetParam(); |
| 669 | auto gmmCubeFaceIndex = static_cast<unsigned int>(GmmTypesConverter::getCubeFaceIndex(apiTarget)); |
| 670 | |
| 671 | switch (apiTarget) { |
| 672 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 673 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_NEG_X)); |
| 674 | break; |
| 675 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 676 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_POS_X)); |
| 677 | break; |
| 678 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 679 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_NEG_Y)); |
| 680 | break; |
| 681 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 682 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_POS_Y)); |
| 683 | break; |
| 684 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 685 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_NEG_Z)); |
| 686 | break; |
| 687 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 688 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_CUBE_FACE_POS_Z)); |
| 689 | break; |
| 690 | default: |
| 691 | EXPECT_EQ(gmmCubeFaceIndex, static_cast<unsigned int>(__GMM_NO_CUBE_MAP)); |
| 692 | break; |
| 693 | } |
| 694 | } |