Skip to content

Commit

Permalink
detect RSC_UMA on Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Sep 14, 2023
1 parent 07fb831 commit b5417b3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,17 @@ namespace Ogre
rsc->setCapability( RSC_EXPLICIT_API );
rsc->setMaxPointSize( 256 );

const VkPhysicalDeviceMemoryProperties &memoryProperties = mDevice->mDeviceMemoryProperties;
for( uint32_t typeIndex = 0; typeIndex < memoryProperties.memoryTypeCount; ++typeIndex )
{
const VkMemoryType &memoryType = memoryProperties.memoryTypes[typeIndex];
if( ( memoryType.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT ) != 0 &&
( memoryType.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT ) != 0 &&
( memoryType.propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT ) != 0 )
{
rsc->setCapability( RSC_UMA );
}
}

rsc->setVertexProgramConstantFloatCount( 256u );
rsc->setVertexProgramConstantIntCount( 256u );
Expand Down
15 changes: 15 additions & 0 deletions RenderSystems/Vulkan/src/Vao/OgreVulkanBufferInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ namespace Ogre
//-----------------------------------------------------------------------------------
size_t VulkanBufferInterface::advanceFrame( bool bAdvanceFrame )
{
if( mBuffer->mBufferType == BT_DEFAULT_SHARED )
{
if( bAdvanceFrame )
{
mBuffer->mFinalBufferStart = mBuffer->mInternalBufferStart;
}
return 0;
}

VulkanVaoManager *vaoManager = static_cast<VulkanVaoManager *>( mBuffer->mVaoManager );
size_t dynamicCurrentFrame = mBuffer->mFinalBufferStart - mBuffer->mInternalBufferStart;
dynamicCurrentFrame /= mBuffer->_getInternalNumElements();
Expand All @@ -159,6 +168,12 @@ namespace Ogre
//-----------------------------------------------------------------------------------
void VulkanBufferInterface::regressFrame()
{
if( mBuffer->mBufferType == BT_DEFAULT_SHARED )
{
mBuffer->mFinalBufferStart = mBuffer->mInternalBufferStart;
return;
}

VulkanVaoManager *vaoManager = static_cast<VulkanVaoManager *>( mBuffer->mVaoManager );
size_t dynamicCurrentFrame = mBuffer->mFinalBufferStart - mBuffer->mInternalBufferStart;
dynamicCurrentFrame /= mBuffer->_getInternalNumElements();
Expand Down

0 comments on commit b5417b3

Please sign in to comment.