Skip to content

Commit

Permalink
[Vk] use logMessage("Vulkan: some message" pattern, as column of spac…
Browse files Browse the repository at this point in the history
…es after "Vulkan: ' helps to visually skip or focus on messages from VK RS, rather on generic Ogre messages. Also, for consistency with D3D11 RS.
  • Loading branch information
eugenegff committed Nov 7, 2024
1 parent 87326b4 commit 01cadad
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
21 changes: 12 additions & 9 deletions RenderSystems/Vulkan/src/OgreVulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ namespace Ogre
mSupportedStages( 0xFFFFFFFF ),
mIsExternal( true )
{
LogManager::getSingleton().logMessage( "Creating Vulkan Device from External VkVulkan handle" );
LogManager::getSingleton().logMessage(
"Vulkan: Creating Vulkan Device from External VkVulkan handle" );

memset( &mDeviceMemoryProperties, 0, sizeof( mDeviceMemoryProperties ) );

Expand Down Expand Up @@ -123,7 +124,8 @@ namespace Ogre
for( size_t i = 0u; i < numExtensions; ++i )
{
const String extensionName = availableExtensions[i].extensionName;
LogManager::getSingleton().logMessage( "Found device extension: " + extensionName );
LogManager::getSingleton().logMessage( "Vulkan: Found device extension: " +
extensionName );
extensions.insert( extensionName );
}

Expand All @@ -136,7 +138,7 @@ namespace Ogre
if( extensions.find( itor->extensionName ) == extensions.end() )
{
LogManager::getSingleton().logMessage(
"[Vulkan][INFO] External Device claims extension " +
"Vulkan: [INFO] External Device claims extension " +
String( itor->extensionName ) +
" is present but it's not. This is normal. Ignoring." );
itor = efficientVectorRemove( deviceExtensionsCopy, itor );
Expand All @@ -152,8 +154,8 @@ namespace Ogre
itor = deviceExtensionsCopy.begin();
while( itor != endt )
{
LogManager::getSingleton().logMessage( "Externally requested Device Extension: " +
String( itor->extensionName ) );
LogManager::getSingleton().logMessage(
"Vulkan: Externally requested Device Extension: " + String( itor->extensionName ) );
mDeviceExtensions.push_back( itor->extensionName );
++itor;
}
Expand Down Expand Up @@ -362,7 +364,7 @@ namespace Ogre

while( itor != endt )
{
LogManager::getSingleton().logMessage( "Requesting Instance Extension: " +
LogManager::getSingleton().logMessage( "Vulkan: Requesting Instance Extension: " +
String( *itor ) );
msInstanceExtensions.push_back( *itor );
++itor;
Expand All @@ -388,7 +390,7 @@ namespace Ogre

while( itor != endt )
{
LogManager::getSingleton().logMessage( "Externally requested Instance Extension: " +
LogManager::getSingleton().logMessage( "Vulkan: Externally requested Instance Extension: " +
String( itor->extensionName ) );
msInstanceExtensions.push_back( itor->extensionName );
++itor;
Expand All @@ -408,7 +410,7 @@ namespace Ogre
break;
}

LogManager::getSingleton().logMessage( "[Vulkan] Requested \"" + deviceName + "\", selected \"" +
LogManager::getSingleton().logMessage( "Vulkan: Requested \"" + deviceName + "\", selected \"" +
devices[deviceIdx].title + "\"" );

mPhysicalDevice = devices[deviceIdx].physicalDevice;
Expand Down Expand Up @@ -557,7 +559,8 @@ namespace Ogre

while( itor != endt )
{
LogManager::getSingleton().logMessage( "Requesting Extension: " + String( *itor ) );
LogManager::getSingleton().logMessage( "Vulkan: Requesting Extension: " +
String( *itor ) );
mDeviceExtensions.push_back( *itor );
++itor;
}
Expand Down
49 changes: 26 additions & 23 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ namespace Ogre
}

if( result != VK_SUCCESS )
LogManager::getSingleton().logMessage( "[Vulkan] Pipeline cache outdated, not loaded." );
LogManager::getSingleton().logMessage( "Vulkan: Pipeline cache outdated, not loaded." );
else
{
VkPipelineCacheCreateInfo pipelineCacheCreateInfo;
Expand All @@ -516,14 +516,14 @@ namespace Ogre
if( VK_SUCCESS == result && pipelineCache != 0 )
{
std::swap( mDevice->mPipelineCache, pipelineCache );
LogManager::getSingleton().logMessage( "[Vulkan] Pipeline cache loaded, " +
LogManager::getSingleton().logMessage( "Vulkan: Pipeline cache loaded, " +
StringConverter::toString( buf.size() ) +
" bytes." );
}
else
{
LogManager::getSingleton().logMessage(
"[Vulkan] Pipeline cache loading failed. VkResult = " +
"Vulkan: Pipeline cache loading failed. VkResult = " +
vkResultToString( result ) );
}
if( pipelineCache != 0 )
Expand Down Expand Up @@ -571,13 +571,13 @@ namespace Ogre
hdr.dataHash = hashResult[0];

stream->write( buf.data(), buf.size() );
LogManager::getSingleton().logMessage( "[Vulkan] Pipeline cache saved, " +
LogManager::getSingleton().logMessage( "Vulkan: Pipeline cache saved, " +
StringConverter::toString( buf.size() ) +
" bytes." );
}
}
if( result != VK_SUCCESS )
LogManager::getSingleton().logMessage( "[Vulkan] Pipeline cache not saved. VkResult = " +
LogManager::getSingleton().logMessage( "Vulkan: Pipeline cache not saved. VkResult = " +
vkResultToString( result ) );
}
}
Expand All @@ -598,14 +598,14 @@ namespace Ogre
if( !CreateDebugReportCallback )
{
LogManager::getSingleton().logMessage(
"[Vulkan] GetProcAddr: Unable to find vkCreateDebugReportCallbackEXT. "
"Vulkan: GetProcAddr: Unable to find vkCreateDebugReportCallbackEXT. "
"Debug reporting won't be available" );
return;
}
if( !DestroyDebugReportCallback )
{
LogManager::getSingleton().logMessage(
"[Vulkan] GetProcAddr: Unable to find vkDestroyDebugReportCallbackEXT. "
"Vulkan: GetProcAddr: Unable to find vkDestroyDebugReportCallbackEXT. "
"Debug reporting won't be available" );
return;
}
Expand Down Expand Up @@ -653,19 +653,19 @@ namespace Ogre
VkPhysicalDeviceProperties &properties = mDevice->mDeviceProperties;

LogManager::getSingleton().logMessage(
"[Vulkan] API Version: " +
"Vulkan: API Version: " +
StringConverter::toString( VK_VERSION_MAJOR( properties.apiVersion ) ) + "." +
StringConverter::toString( VK_VERSION_MINOR( properties.apiVersion ) ) + "." +
StringConverter::toString( VK_VERSION_PATCH( properties.apiVersion ) ) + " (" +
StringConverter::toString( properties.apiVersion, 0, ' ', std::ios::hex ) + ")" );
LogManager::getSingleton().logMessage(
"[Vulkan] Driver Version (raw): " +
"Vulkan: Driver Version (raw): " +
StringConverter::toString( properties.driverVersion, 0, ' ', std::ios::hex ) );
LogManager::getSingleton().logMessage(
"[Vulkan] Vendor ID: " +
"Vulkan: Vendor ID: " +
StringConverter::toString( properties.vendorID, 0, ' ', std::ios::hex ) );
LogManager::getSingleton().logMessage(
"[Vulkan] Device ID: " +
"Vulkan: Device ID: " +
StringConverter::toString( properties.deviceID, 0, ' ', std::ios::hex ) );

rsc->setDeviceName( properties.deviceName );
Expand Down Expand Up @@ -1030,7 +1030,7 @@ namespace Ogre
//-------------------------------------------------------------------------
void VulkanRenderSystem::initializeExternalVkInstance( VulkanExternalInstance *externalInstance )
{
LogManager::getSingleton().logMessage( "[Vulkan] VkInstance is provided externally" );
LogManager::getSingleton().logMessage( "Vulkan: VkInstance is provided externally" );

OGRE_ASSERT_LOW( !mVkInstance );

Expand All @@ -1053,7 +1053,8 @@ namespace Ogre
for( size_t i = 0u; i < numExtensions; ++i )
{
const String extensionName = availableExtensions[i].extensionName;
LogManager::getSingleton().logMessage( "Found instance extension: " + extensionName );
LogManager::getSingleton().logMessage( "Vulkan: Found instance extension: " +
extensionName );
extensions.insert( extensionName );
}

Expand All @@ -1066,7 +1067,7 @@ namespace Ogre
if( extensions.find( itor->extensionName ) == extensions.end() )
{
LogManager::getSingleton().logMessage(
"[Vulkan][INFO] External Instance claims extension " +
"Vulkan: [INFO] External Instance claims extension " +
String( itor->extensionName ) +
" is present but it's not. This is normal. Ignoring." );
itor = efficientVectorRemove( externalInstance->instanceExtensions, itor );
Expand Down Expand Up @@ -1111,7 +1112,7 @@ namespace Ogre
for( size_t i = 0u; i < numInstanceLayers; ++i )
{
const String layerName = instanceLayerProps[i].layerName;
LogManager::getSingleton().logMessage( "Found instance layer: " + layerName );
LogManager::getSingleton().logMessage( "Vulkan: Found instance layer: " + layerName );
layers.insert( layerName );
}

Expand All @@ -1123,7 +1124,7 @@ namespace Ogre
if( layers.find( itor->layerName ) == layers.end() )
{
LogManager::getSingleton().logMessage(
"[Vulkan][INFO] External Instance claims layer " + String( itor->layerName ) +
"Vulkan: [INFO] External Instance claims layer " + String( itor->layerName ) +
" is present but it's not. This is normal. Ignoring." );
itor = efficientVectorRemove( externalInstance->instanceLayers, itor );
endt = externalInstance->instanceLayers.end();
Expand All @@ -1148,7 +1149,7 @@ namespace Ogre
if( mVkInstance )
return;

LogManager::getSingleton().logMessage( "[Vulkan] Initializing VkInstance" );
LogManager::getSingleton().logMessage( "Vulkan: Initializing VkInstance" );

#ifdef OGRE_VULKAN_WINDOW_NULL
mAvailableVulkanSupports["null"]->setSupported();
Expand All @@ -1169,7 +1170,8 @@ namespace Ogre
for( size_t i = 0u; i < numExtensions; ++i )
{
const String extensionName = availableExtensions[i].extensionName;
LogManager::getSingleton().logMessage( "Found instance extension: " + extensionName );
LogManager::getSingleton().logMessage( "Vulkan: Found instance extension: " +
extensionName );

#ifdef OGRE_VULKAN_WINDOW_WIN32
if( extensionName == VulkanWin32Window::getRequiredExtensionName() )
Expand Down Expand Up @@ -1251,7 +1253,7 @@ namespace Ogre
for( size_t i = 0u; i < numInstanceLayers; ++i )
{
const String layerName = instanceLayerProps[i].layerName;
LogManager::getSingleton().logMessage( "Found instance layer: " + layerName );
LogManager::getSingleton().logMessage( "Vulkan: Found instance layer: " + layerName );
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_HIGH
if( layerName == "VK_LAYER_KHRONOS_validation" )
{
Expand Down Expand Up @@ -1326,7 +1328,7 @@ namespace Ogre

if( refreshList || mVulkanPhysicalDeviceList.empty() )
{
LogManager::getSingleton().logMessage( "[Vulkan] Device detection starts" );
LogManager::getSingleton().logMessage( "Vulkan: Device detection starts" );

// enumerate
std::vector<VkPhysicalDevice> devices;
Expand Down Expand Up @@ -1365,11 +1367,11 @@ namespace Ogre
if( sameNameIndex != 0 )
name += " (" + Ogre::StringConverter::toString( sameNameIndex + 1 ) + ")";

LogManager::getSingleton().logMessage( "[Vulkan] \"" + name + "\"" );
LogManager::getSingleton().logMessage( "Vulkan: \"" + name + "\"" );
mVulkanPhysicalDeviceList.push_back( { device, name } );
}

LogManager::getSingleton().logMessage( "[Vulkan] Device detection ends" );
LogManager::getSingleton().logMessage( "Vulkan: Device detection ends" );
}
return mVulkanPhysicalDeviceList;
}
Expand Down Expand Up @@ -1499,7 +1501,8 @@ namespace Ogre
for( size_t i = 0u; i < numExtensions; ++i )
{
const String extensionName = availableExtensions[i].extensionName;
LogManager::getSingleton().logMessage( "Found device extension: " + extensionName );
LogManager::getSingleton().logMessage( "Vulkan: Found device extension: " +
extensionName );

if( extensionName == VK_KHR_MAINTENANCE2_EXTENSION_NAME )
{
Expand Down
20 changes: 10 additions & 10 deletions RenderSystems/Vulkan/src/Vao/OgreVulkanVaoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ namespace Ogre

char tmpBuffer[256];
LwString text( LwString::FromEmptyPointer( tmpBuffer, sizeof( tmpBuffer ) ) );
text.a( "[Vulkan] Flushing all mDelayedBlocks(", bytesToMegabytes( mDelayedBlocksSize ),
text.a( "Vulkan: Flushing all mDelayedBlocks(", bytesToMegabytes( mDelayedBlocksSize ),
" MB) because mDelayedBlocksFlushThreshold(",
bytesToMegabytes( mDelayedBlocksFlushThreshold ),
" MB) was exceeded. This prevents async operations (e.g. async compute)",
Expand Down Expand Up @@ -774,9 +774,9 @@ namespace Ogre
VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT );

LogManager &logManager = LogManager::getSingleton();
logManager.logMessage( "Supported memory types for general buffer usage: " +
logManager.logMessage( "Vulkan: Supported memory types for general buffer usage: " +
StringConverter::toString( supportedMemoryTypesBuffer ) );
logManager.logMessage( "Supported memory types for reading: " +
logManager.logMessage( "Vulkan: Supported memory types for reading: " +
StringConverter::toString( supportedMemoryTypesRead ) );

const VkPhysicalDeviceMemoryProperties &memProperties = mDevice->mDeviceMemoryProperties;
Expand Down Expand Up @@ -822,7 +822,7 @@ namespace Ogre
{
// This is BS. No heap is device-local. Sigh, just pick any and try to get the best score
logManager.logMessage(
"VkDevice: No heap found with DEVICE_LOCAL bit set. This should be impossible",
"Vulkan: No heap found with DEVICE_LOCAL bit set. This should be impossible",
LML_CRITICAL );
for( uint32 i = 0u; i < numMemoryTypes; ++i )
addMemoryType( CPU_INACCESSIBLE, memProperties, i );
Expand Down Expand Up @@ -868,17 +868,17 @@ namespace Ogre
}
}

logManager.logMessage( "VkDevice will use coherent memory buffers: " +
logManager.logMessage( "Vulkan: VkDevice will use coherent memory buffers: " +
StringConverter::toString( mSupportsCoherentMemory ) );
logManager.logMessage( "VkDevice will use non-coherent memory buffers: " +
logManager.logMessage( "Vulkan: VkDevice will use non-coherent memory buffers: " +
StringConverter::toString( mSupportsNonCoherentMemory ) );
logManager.logMessage( "VkDevice will prefer coherent memory buffers: " +
logManager.logMessage( "Vulkan: VkDevice will prefer coherent memory buffers: " +
StringConverter::toString( mPreferCoherentMemory ) );

if( mBestVkMemoryTypeIndex[CPU_READ_WRITE].empty() )
{
logManager.logMessage(
"VkDevice: could not find cached host-visible memory. GPU -> CPU transfers could be "
"Vulkan: could not find cached host-visible memory. GPU -> CPU transfers could be "
"slow",
LML_CRITICAL );

Expand Down Expand Up @@ -909,7 +909,7 @@ namespace Ogre
if( mDevice->mDeviceProperties.limits.bufferImageGranularity != 1u )
mBestVkMemoryTypeIndex[TEXTURES_OPTIMAL] = mBestVkMemoryTypeIndex[CPU_INACCESSIBLE];

logManager.logMessage( "VkDevice will use coherent memory for reading: " +
logManager.logMessage( "Vulkan: VkDevice will use coherent memory for reading: " +
StringConverter::toString( mReadMemoryIsCoherent ) );

// Fill mMemoryTypesInUse
Expand All @@ -927,7 +927,7 @@ namespace Ogre
}
}

logManager.logMessage( "VkDevice read memory is coherent: " +
logManager.logMessage( "Vulkan: VkDevice read memory is coherent: " +
StringConverter::toString( mReadMemoryIsCoherent ) );
}
//-----------------------------------------------------------------------------------
Expand Down

0 comments on commit 01cadad

Please sign in to comment.