Skip to content

Commit

Permalink
Fix clang format CI not applying to Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Nov 21, 2024
1 parent b718ca1 commit 9e823a6
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/run_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
'RenderSystems/GL3Plus',
'RenderSystems/Metal',
'RenderSystems/NULL',
'RenderSystems/Vulkan',
'PlugIns/ParticleFX',
'PlugIns/ParticleFX2',
'Samples/2.0',
Expand All @@ -53,6 +54,7 @@
'OgreMetalPixelFormatToShaderType.inl',
'OgreD3D11PixelFormatToShaderType.cpp',
'OgreD3D11PixelFormatToShaderType.inl',
'spirv.h', 'spirv_reflect.h',
'LocalCubemapScene.h', 'LocalCubemapsManualProbesScene.h',
'OgreScriptTranslator.cpp'}

Expand Down
4 changes: 2 additions & 2 deletions RenderSystems/Vulkan/src/OgreVulkanDescriptorSets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ namespace Ogre
{
#if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64
sampler = static_cast<VkSampler>( samplerblock->mRsData );
#else // VK handles are always 64bit, even on 32bit systems
sampler = *static_cast<VkSampler*>( samplerblock->mRsData );
#else // VK handles are always 64bit, even on 32bit systems
sampler = *static_cast<VkSampler *>( samplerblock->mRsData );
#endif
}
VkDescriptorImageInfo imageInfo;
Expand Down
39 changes: 17 additions & 22 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ namespace Ogre
pipelineCacheCreateInfo.pInitialData = buf.data() + sizeof( PipelineCachePrefixHeader );

VkPipelineCache pipelineCache{};
result = vkCreatePipelineCache( mDevice->mDevice, &pipelineCacheCreateInfo,
nullptr, &pipelineCache );
result = vkCreatePipelineCache( mDevice->mDevice, &pipelineCacheCreateInfo, nullptr,
&pipelineCache );
if( VK_SUCCESS == result && pipelineCache != 0 )
{
std::swap( mDevice->mPipelineCache, pipelineCache );
Expand All @@ -538,8 +538,8 @@ namespace Ogre
if( mDevice->mPipelineCache )
{
size_t size{};
VkResult result = vkGetPipelineCacheData( mDevice->mDevice, mDevice->mPipelineCache, &size,
nullptr );
VkResult result =
vkGetPipelineCacheData( mDevice->mDevice, mDevice->mPipelineCache, &size, nullptr );
if( result == VK_SUCCESS && size > 0 && size <= 0x7FFFFFFF )
{
std::vector<unsigned char> buf; // PipelineCachePrefixHeader + payload
Expand Down Expand Up @@ -807,7 +807,7 @@ namespace Ogre
rsc->setCapability( RSC_VBO );
// VK_INDEX_TYPE_UINT32 is always supported with range at least 2^24-1
// and even 2^32-1 if mDevice->mDeviceFeatures.fullDrawIndexUint32
rsc->setCapability( RSC_32BIT_INDEX );
rsc->setCapability( RSC_32BIT_INDEX );
rsc->setCapability( RSC_TWO_SIDED_STENCIL );
rsc->setCapability( RSC_STENCIL_WRAP );
if( mDevice->mDeviceFeatures.shaderClipDistance )
Expand Down Expand Up @@ -1325,7 +1325,6 @@ namespace Ogre
//-------------------------------------------------------------------------
const VulkanPhysicalDeviceList &VulkanRenderSystem::getVulkanPhysicalDevices( bool refreshList )
{

if( refreshList || mVulkanPhysicalDeviceList.empty() )
{
LogManager::getSingleton().logMessage( "Vulkan: Device detection starts" );
Expand Down Expand Up @@ -3016,8 +3015,7 @@ namespace Ogre
#endif
}

vkCmdSetViewport( mDevice->mGraphicsQueue.getCurrentCmdBuffer(), 0u, numViewports,
vkVp );
vkCmdSetViewport( mDevice->mGraphicsQueue.getCurrentCmdBuffer(), 0u, numViewports, vkVp );
}

if( mVpChanged || numViewports > 1u )
Expand Down Expand Up @@ -3366,16 +3364,14 @@ namespace Ogre
//
// This cannot catch all use cases, but if you fall into something this
// doesn't catch, then you should probably be using explicit resolves
bool useNewLayoutForMsaa =
itor->newLayout == ResourceLayout::RenderTarget ||
itor->newLayout == ResourceLayout::ResolveDest ||
itor->newLayout == ResourceLayout::CopySrc ||
itor->newLayout == ResourceLayout::CopyDst;
bool useOldLayoutForMsaa =
itor->oldLayout == ResourceLayout::RenderTarget ||
itor->oldLayout == ResourceLayout::ResolveDest ||
itor->oldLayout == ResourceLayout::CopySrc ||
itor->oldLayout == ResourceLayout::CopyDst;
bool useNewLayoutForMsaa = itor->newLayout == ResourceLayout::RenderTarget ||
itor->newLayout == ResourceLayout::ResolveDest ||
itor->newLayout == ResourceLayout::CopySrc ||
itor->newLayout == ResourceLayout::CopyDst;
bool useOldLayoutForMsaa = itor->oldLayout == ResourceLayout::RenderTarget ||
itor->oldLayout == ResourceLayout::ResolveDest ||
itor->oldLayout == ResourceLayout::CopySrc ||
itor->oldLayout == ResourceLayout::CopyDst;
if( !useNewLayoutForMsaa )
imageBarrier.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
if( !useOldLayoutForMsaa )
Expand Down Expand Up @@ -3415,10 +3411,9 @@ namespace Ogre
dstStage = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;

vkCmdPipelineBarrier( mDevice->mGraphicsQueue.getCurrentCmdBuffer(),
srcStage & mDevice->mSupportedStages,
dstStage & mDevice->mSupportedStages, 0, numMemBarriers, &memBarrier,
0u, 0, static_cast<uint32>( mImageBarriers.size() ),
mImageBarriers.begin() );
srcStage & mDevice->mSupportedStages, dstStage & mDevice->mSupportedStages,
0, numMemBarriers, &memBarrier, 0u, 0,
static_cast<uint32>( mImageBarriers.size() ), mImageBarriers.begin() );
mImageBarriers.clear();
}
//-------------------------------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions RenderSystems/Vulkan/src/OgreVulkanTextureGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ namespace Ogre
_setToDisplayDummyTexture();
}
//-----------------------------------------------------------------------------------
VulkanTextureGpu::~VulkanTextureGpu()
{
destroyInternalResourcesImpl();
}
VulkanTextureGpu::~VulkanTextureGpu() { destroyInternalResourcesImpl(); }
//-----------------------------------------------------------------------------------
PixelFormatGpu VulkanTextureGpu::getWorkaroundedPixelFormat( const PixelFormatGpu pixelFormat ) const
{
Expand Down
6 changes: 4 additions & 2 deletions RenderSystems/Vulkan/src/Vao/OgreVulkanStagingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ namespace Ogre
OGRE_ASSERT_HIGH( !Workarounds::mPowerVRAlignment ||
( region.dstOffset % Workarounds::mPowerVRAlignment ) == 0u );
#endif
vkCmdCopyBuffer( device->mGraphicsQueue.getCurrentCmdBuffer(), mVboName, dstBuffer, 1u, &region );
vkCmdCopyBuffer( device->mGraphicsQueue.getCurrentCmdBuffer(), mVboName, dstBuffer, 1u,
&region );

if( mUploadOnly )
{
Expand Down Expand Up @@ -417,7 +418,8 @@ namespace Ogre
OGRE_ASSERT_HIGH( !Workarounds::mPowerVRAlignment ||
( region.dstOffset % Workarounds::mPowerVRAlignment ) == 0u );
#endif
vkCmdCopyBuffer( device->mGraphicsQueue.getCurrentCmdBuffer(), srcBuffer, mVboName, 1u, &region );
vkCmdCopyBuffer( device->mGraphicsQueue.getCurrentCmdBuffer(), srcBuffer, mVboName, 1u,
&region );

return freeRegionOffset + extraOffset;
}
Expand Down
2 changes: 1 addition & 1 deletion RenderSystems/Vulkan/src/Vao/OgreVulkanVaoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ namespace Ogre
}
//-----------------------------------------------------------------------------------
void VulkanVaoManager::getAvailableSemaphores( VkSemaphoreArray &semaphoreArray,
size_t numSemaphores )
size_t numSemaphores )
{
semaphoreArray.reserve( semaphoreArray.size() + numSemaphores );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace Ogre
}
}
//-------------------------------------------------------------------------
IdString VulkanAndroidSupport::getInterfaceName() const { return "android"; }
IdString VulkanAndroidSupport::getInterfaceName() const { return "android"; }
//-------------------------------------------------------------------------
String VulkanAndroidSupport::getInterfaceNameStr() const { return "android"; }
String VulkanAndroidSupport::getInterfaceNameStr() const { return "android"; }
} // namespace Ogre
10 changes: 4 additions & 6 deletions RenderSystems/Vulkan/src/Windowing/X11/OgreVulkanXcbWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ namespace Ogre
VulkanTextureGpuManager *textureManager =
static_cast<VulkanTextureGpuManager *>( textureGpuManager );


mTexture = textureManager->createTextureGpuWindow( this );
if( DepthBuffer::DefaultDepthBufferFormat != PFG_NULL )
{
Expand All @@ -250,11 +249,10 @@ namespace Ogre

if( mDepthBuffer )
{
mTexture->_setDepthBufferDefaults(
mDepthBuffer->isTilerMemoryless()
? DepthBuffer::POOL_MEMORYLESS
: DepthBuffer::NO_POOL_EXPLICIT_RTV, false,
mDepthBuffer->getPixelFormat() );
mTexture->_setDepthBufferDefaults( mDepthBuffer->isTilerMemoryless()
? DepthBuffer::POOL_MEMORYLESS
: DepthBuffer::NO_POOL_EXPLICIT_RTV,
false, mDepthBuffer->getPixelFormat() );
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@ namespace Ogre
VulkanTextureGpuManager *textureManager =
static_cast<VulkanTextureGpuManager *>( textureGpuManager );


mTexture = textureManager->createTextureGpuWindow( this );
if( DepthBuffer::DefaultDepthBufferFormat != PFG_NULL )
{
Expand Down Expand Up @@ -565,11 +564,10 @@ namespace Ogre

if( mDepthBuffer )
{
mTexture->_setDepthBufferDefaults(
mDepthBuffer->isTilerMemoryless()
? DepthBuffer::POOL_MEMORYLESS
: DepthBuffer::NO_POOL_EXPLICIT_RTV, false,
mDepthBuffer->getPixelFormat() );
mTexture->_setDepthBufferDefaults( mDepthBuffer->isTilerMemoryless()
? DepthBuffer::POOL_MEMORYLESS
: DepthBuffer::NO_POOL_EXPLICIT_RTV,
false, mDepthBuffer->getPixelFormat() );
}
else
{
Expand Down

0 comments on commit 9e823a6

Please sign in to comment.