Skip to content

Commit

Permalink
[Vk] add missing checkVkResult, but not in destroy()
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Golushkov committed Dec 23, 2024
1 parent f302ddc commit 6635ef9
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion OgreMain/src/Compositor/Pass/OgreCompositorPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ namespace Ogre
{
renderPassDesc->entriesModified( RenderPassDescriptor::All );
}
catch( Exception &e )
catch( Exception & )
{
LogManager::getSingleton().logMessage(
"The compositor pass '" + mDefinition->mProfilingId + "' from Node: '" +
Expand Down
3 changes: 2 additions & 1 deletion RenderSystems/Vulkan/src/OgreVulkanDescriptorPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ namespace Ogre

while( itor != endt )
{
vkResetDescriptorPool( device->mDevice, itor->pool, 0 );
VkResult result = vkResetDescriptorPool( device->mDevice, itor->pool, 0 );
checkVkResult( result, "vkResetDescriptorPool" );
itor->size = 0u;
++itor;
}
Expand Down
17 changes: 10 additions & 7 deletions RenderSystems/Vulkan/src/OgreVulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ namespace Ogre
{
if( mDevice )
{
vkDeviceWaitIdle( mDevice );
vkDeviceWaitIdle( mDevice ); // intentionally ignore result in destroy()

mGraphicsQueue.destroy();
destroyQueues( mComputeQueues );
Expand Down Expand Up @@ -714,12 +714,15 @@ namespace Ogre

// Obtain logical device
uint32 numExtensions = 0;
vkEnumerateDeviceExtensionProperties( mPhysicalDevice, 0, &numExtensions, 0 );
VkResult result = vkEnumerateDeviceExtensionProperties( mPhysicalDevice, 0, &numExtensions, 0 );
checkVkResult( result, "vkEnumerateDeviceExtensionProperties" );

FastArray<VkExtensionProperties> availableExtensions;
availableExtensions.resize( numExtensions );
vkEnumerateDeviceExtensionProperties( mPhysicalDevice, 0, &numExtensions,
availableExtensions.begin() );
result = vkEnumerateDeviceExtensionProperties( mPhysicalDevice, 0, &numExtensions,
availableExtensions.begin() );
checkVkResult( result, "vkEnumerateDeviceExtensionProperties" );

if( !externalDevice )
{
createDevice( availableExtensions, 0u, 0u );
Expand Down Expand Up @@ -776,8 +779,7 @@ namespace Ogre
// initial pipeline cache
VkPipelineCacheCreateInfo pipelineCacheCreateInfo;
makeVkStruct( pipelineCacheCreateInfo, VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO );
VkResult result =
vkCreatePipelineCache( mDevice, &pipelineCacheCreateInfo, nullptr, &mPipelineCache );
result = vkCreatePipelineCache( mDevice, &pipelineCacheCreateInfo, nullptr, &mPipelineCache );
checkVkResult( result, "vkCreatePipelineCache" );

// debug utils
Expand Down Expand Up @@ -1064,7 +1066,8 @@ namespace Ogre
commitAndNextCommandBuffer( SubmissionType::FlushOnly );
mRenderSystem->resetAllBindings();

vkDeviceWaitIdle( mDevice );
VkResult result = vkDeviceWaitIdle( mDevice );
checkVkResult( result, "vkDeviceWaitIdle" );

mRenderSystem->_notifyDeviceStalled();
}
Expand Down
28 changes: 21 additions & 7 deletions RenderSystems/Vulkan/src/OgreVulkanQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace Ogre
{
if( mDevice )
{
vkDeviceWaitIdle( mDevice );
vkDeviceWaitIdle( mDevice ); // intentionally ignore result in destroy()

mWindowsPendingSwap.clear();

Expand Down Expand Up @@ -160,7 +160,11 @@ namespace Ogre
// Reset the recycled fences so they can be used again
const uint32 numFencesToReset = (uint32)( mAvailableFences.size() - oldNumAvailableFences );
if( numFencesToReset > 0u )
vkResetFences( mDevice, numFencesToReset, &mAvailableFences[oldNumAvailableFences] );
{
VkResult result =
vkResetFences( mDevice, numFencesToReset, &mAvailableFences[oldNumAvailableFences] );
checkVkResult( result, "vkResetFences" );
}
}
//-------------------------------------------------------------------------
inline VkFence VulkanQueue::getCurrentFence()
Expand Down Expand Up @@ -192,7 +196,10 @@ namespace Ogre
frameData.mCommands.push_back( cmdBuffer );
}
else if( frameData.mCurrentCmdIdx == 0u )
vkResetCommandPool( mDevice, frameData.mCmdPool, 0 );
{
VkResult result = vkResetCommandPool( mDevice, frameData.mCmdPool, 0 );
checkVkResult( result, "vkResetCommandPool" );
}

return frameData.mCommands[frameData.mCurrentCmdIdx++];
}
Expand Down Expand Up @@ -280,7 +287,11 @@ namespace Ogre
cmdPoolCreateInfo.queueFamilyIndex = mFamilyIdx;

for( size_t i = 0; i < maxNumFrames; ++i )
vkCreateCommandPool( mDevice, &cmdPoolCreateInfo, 0, &mPerFrameData[i].mCmdPool );
{
VkResult result =
vkCreateCommandPool( mDevice, &cmdPoolCreateInfo, 0, &mPerFrameData[i].mCmdPool );
checkVkResult( result, "vkCreateCommandPool" );
}

newCommandBuffer();
}
Expand All @@ -293,7 +304,8 @@ namespace Ogre
VkCommandBufferBeginInfo beginInfo;
makeVkStruct( beginInfo, VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO );
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
vkBeginCommandBuffer( mCurrentCmdBuffer, &beginInfo );
VkResult result = vkBeginCommandBuffer( mCurrentCmdBuffer, &beginInfo );
checkVkResult( result, "vkBeginCommandBuffer" );
}
//-------------------------------------------------------------------------
void VulkanQueue::endCommandBuffer()
Expand Down Expand Up @@ -1117,7 +1129,8 @@ namespace Ogre
{
if( itor->second.recycleAfterRelease )
{
vkResetFences( mDevice, 1u, &itor->first );
VkResult result = vkResetFences( mDevice, 1u, &itor->first );
checkVkResult( result, "vkResetFences" );
mAvailableFences.push_back( itor->first );
}
mRefCountedFences.erase( itor );
Expand Down Expand Up @@ -1145,7 +1158,8 @@ namespace Ogre
if( !fences.empty() )
{
const uint32 numFences = static_cast<uint32>( fences.size() );
vkWaitForFences( mDevice, numFences, &fences[0], VK_TRUE, UINT64_MAX );
VkResult result = vkWaitForFences( mDevice, numFences, &fences[0], VK_TRUE, UINT64_MAX );
checkVkResult( result, "vkWaitForFences" );
recycleFences( fences );
}
}
Expand Down
3 changes: 2 additions & 1 deletion RenderSystems/Vulkan/src/OgreVulkanTextureGpuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ namespace Ogre

// We will be releasing the staging texture memory immediately. We must flush out manually
mDevice->commitAndNextCommandBuffer( SubmissionType::FlushOnly );
vkDeviceWaitIdle( mDevice->mDevice );
VkResult result = vkDeviceWaitIdle( mDevice->mDevice );
checkVkResult( result, "vkDeviceWaitIdle" );

vaoManager->destroyStagingTexture( stagingTex );
delete stagingTex;
Expand Down
11 changes: 7 additions & 4 deletions RenderSystems/Vulkan/src/OgreVulkanWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,15 @@ namespace Ogre
}

uint32 numPresentModes = 0u;
vkGetPhysicalDeviceSurfacePresentModesKHR( mDevice->mPhysicalDevice, mSurfaceKHR,
&numPresentModes, 0 );
result = vkGetPhysicalDeviceSurfacePresentModesKHR( mDevice->mPhysicalDevice, mSurfaceKHR,
&numPresentModes, 0 );
checkVkResult( result, "vkGetPhysicalDeviceSurfacePresentModesKHR" );

FastArray<VkPresentModeKHR> presentModes;
presentModes.resize( numPresentModes );
vkGetPhysicalDeviceSurfacePresentModesKHR( mDevice->mPhysicalDevice, mSurfaceKHR,
&numPresentModes, presentModes.begin() );
result = vkGetPhysicalDeviceSurfacePresentModesKHR( mDevice->mPhysicalDevice, mSurfaceKHR,
&numPresentModes, presentModes.begin() );
checkVkResult( result, "vkGetPhysicalDeviceSurfacePresentModesKHR" );

// targetPresentModes[0] is the target, targetPresentModes[1] is the fallback
bool presentModesFound[2] = { false, false };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,16 @@ static void createVulkanDevice( const Ogre::VulkanExternalInstance &externalInst
FastArray<const char *> deviceExtensions;
{
uint32_t numExtensions = 0;
vkEnumerateDeviceExtensionProperties( outExternalDevice.physicalDevice, 0, &numExtensions, 0 );
VkResult result = vkEnumerateDeviceExtensionProperties( outExternalDevice.physicalDevice, 0,
&numExtensions, 0 );
myCheckVkResult( result, "vkCreateInstance" );

FastArray<VkExtensionProperties> availableExtensions;
availableExtensions.resize( numExtensions );
vkEnumerateDeviceExtensionProperties( outExternalDevice.physicalDevice, 0, &numExtensions,
availableExtensions.begin() );
result = vkEnumerateDeviceExtensionProperties( outExternalDevice.physicalDevice, 0,
&numExtensions, availableExtensions.begin() );
myCheckVkResult( result, "vkCreateInstance" );

for( size_t i = 0u; i < numExtensions; ++i )
{
const String extensionName = availableExtensions[i].extensionName;
Expand Down

0 comments on commit 6635ef9

Please sign in to comment.