Return buffer compressed when render buffer compressed is enable

Change-Id: I62fde1573849139ca16ff9d7e5d5672eab7ccd2b
This commit is contained in:
Daria Hinz
2019-02-19 09:20:15 +01:00
committed by sys_ocldev
parent 802eb37394
commit 82613a0750
2 changed files with 13 additions and 6 deletions

View File

@@ -340,11 +340,8 @@ GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const Memor
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
if (isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL) || !isLocalMemoryEnabled) {
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}
return GraphicsAllocation::AllocationType::BUFFER;
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR) && (isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL) || !isLocalMemoryEnabled)) {
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}
if (MemObjHelper::isSuitableForRenderCompression(renderCompressedBuffers, properties, contextType)) {

View File

@@ -300,6 +300,16 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
}
}
TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
MemoryProperties properties;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, true);
if (is32bit) {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
}
}
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
MemoryProperties properties;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, true, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false);
@@ -353,7 +363,7 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
properties.flags = CL_MEM_USE_HOST_PTR;
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, true);
if (is64bit) {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
} else {
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
}