@@ -288,9 +288,9 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
288288 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, buffer->getGraphicsAllocation ()->getAllocationType ());
289289}
290290
291- TEST (Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned ) {
291+ TEST (Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit ) {
292292 cl_mem_flags flags = 0 ;
293- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true );
293+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true , false );
294294 if (is32bit) {
295295 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
296296 } else {
@@ -300,51 +300,77 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
300300
301301TEST (Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
302302 cl_mem_flags flags = 0 ;
303- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, true , false );
303+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, true , false , false );
304304 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
305305}
306306
307307TEST (Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
308308 cl_mem_flags flags = 0 ;
309- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, true , true );
309+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, true , true , false );
310310 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
311311}
312312
313- TEST (Buffer, givenUseHostPtrFlagWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned ) {
313+ TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned ) {
314314 cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
315- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false );
315+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false , false );
316316 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
317317}
318318
319+ TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
320+ cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
321+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false , true );
322+ if (is64bit) {
323+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER, type);
324+ } else {
325+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
326+ }
327+ }
328+
319329TEST (Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
320330 cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
321- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false );
331+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false , false );
322332 if (is64bit) {
323333 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER, type);
324334 } else {
325335 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
326336 }
327337}
328338
329- TEST (Buffer, givenUseHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned ) {
339+ TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned ) {
330340 cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
331- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true );
341+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true , false );
342+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
343+ }
344+
345+ TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
346+ cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
347+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true , true );
348+ if (is64bit) {
349+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER, type);
350+ } else {
351+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
352+ }
353+ }
354+
355+ TEST (Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
356+ cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
357+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true , true );
332358 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
333359}
334360
335361TEST (Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
336362 cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
337- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true );
338- if (is32bit) {
339- EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
340- } else {
363+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , true , false );
364+ if (is64bit) {
341365 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
366+ } else {
367+ EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
342368 }
343369}
344370
345371TEST (Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
346372 cl_mem_flags flags = 0 ;
347- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false );
373+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (flags, false , false , false );
348374 if (is32bit) {
349375 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
350376 } else {
@@ -397,7 +423,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
397423
398424 void *cacheAlignedHostPtr = alignedMalloc (MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize);
399425
400- buffer.reset (Buffer::create (context.get (), CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
426+ buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
401427 EXPECT_EQ (cacheAlignedHostPtr, buffer->getGraphicsAllocation ()->getUnderlyingBuffer ());
402428 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
403429 EXPECT_EQ (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
@@ -415,7 +441,7 @@ TEST_F(RenderCompressedBuffersTests, givenBufferCompressedAllocationAndZeroCopyH
415441 }
416442
417443 localHwInfo.capabilityTable .ftrRenderCompressedBuffers = true ;
418- buffer.reset (Buffer::create (context.get (), CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
444+ buffer.reset (Buffer::create (context.get (), CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL | CL_MEM_USE_HOST_PTR, MemoryConstants::cacheLineSize, cacheAlignedHostPtr, retVal));
419445 EXPECT_EQ (cacheAlignedHostPtr, buffer->getGraphicsAllocation ()->getUnderlyingBuffer ());
420446 EXPECT_TRUE (buffer->isMemObjZeroCopy ());
421447 EXPECT_EQ (buffer->getGraphicsAllocation ()->getAllocationType (), GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
0 commit comments