@@ -130,16 +130,21 @@ namespace dxvk {
130130 const uint32_t geometryInstanceShaderBindingTableRecordOffset = instance->getVkInstance ().instanceShaderBindingTableRecordOffset ;
131131
132132 if (!geometries.empty ()) {
133- if (instanceMask != geometryInstanceMask)
133+ if (instanceMask != geometryInstanceMask) {
134134 return false ;
135- if (instanceShaderBindingTableRecordOffset != geometryInstanceShaderBindingTableRecordOffset)
135+ }
136+ if (instanceShaderBindingTableRecordOffset != geometryInstanceShaderBindingTableRecordOffset) {
136137 return false ;
137- if (customIndexFlags != geometryCustomIndexFlags)
138+ }
139+ if (customIndexFlags != geometryCustomIndexFlags) {
138140 return false ;
139- if (instanceFlags != geometryInstanceFlags)
141+ }
142+ if (instanceFlags != geometryInstanceFlags) {
140143 return false ;
141- if (usesUnorderedApproximations != geometryUsesUnorderedApproximations)
144+ }
145+ if (usesUnorderedApproximations != geometryUsesUnorderedApproximations) {
142146 return false ;
147+ }
143148 }
144149
145150 BlasEntry* blasEntry = instance->getBlas ();
@@ -205,8 +210,7 @@ namespace dxvk {
205210 instance.billboardIndices .push_back (billboardIndex);
206211 instance.indexOffsets .push_back (billboardIndex * kNumIndicesPerBillboardQuad );
207212 }
208- }
209- else {
213+ } else {
210214 VkAccelerationStructureGeometryKHR geometry = {};
211215
212216 geometry.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR;
@@ -251,8 +255,9 @@ namespace dxvk {
251255 }
252256
253257 void AccelManager::createAndBuildIntersectionBlas (Rc<DxvkContext> ctx, DxvkBarrierSet& execBarriers) {
254- if (m_intersectionBlas.ptr ())
258+ if (m_intersectionBlas.ptr ()) {
255259 return ;
260+ }
256261
257262 VkAccelerationStructureGeometryKHR geometry {};
258263 geometry.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR;
@@ -428,8 +433,9 @@ namespace dxvk {
428433 ONCE (Logger::err (" DxvkRaytrace: instances size is greater than max supported custom index value" ));
429434 }
430435
431- if (opacityMicromapManager)
436+ if (opacityMicromapManager) {
432437 opacityMicromapManager->onFrameStart (ctx);
438+ }
433439
434440 std::vector<std::unique_ptr<BlasBucket>> blasBuckets;
435441 blasBuckets.reserve (instances.size ());
@@ -676,8 +682,9 @@ namespace dxvk {
676682 }
677683
678684 // Copy the instance transform data to the device
679- if (instanceTransforms.size () > 0 )
685+ if (instanceTransforms.size () > 0 ) {
680686 ctx->writeToBuffer (m_transformBuffer, 0 , instanceTransforms.size () * sizeof (VkTransformMatrixKHR), instanceTransforms.data ());
687+ }
681688
682689 ctx->getCommandList ()->trackResource <DxvkAccess::Write>(m_transformBuffer);
683690 ctx->getCommandList ()->trackResource <DxvkAccess::Read>(m_transformBuffer);
@@ -793,8 +800,7 @@ namespace dxvk {
793800 uint32_t paddedLastTouched = blas->frameLastTouched + 1 + (RtxOptions::enablePreviousTLAS () ? 1u : 0u ); /* note: +2 because frameLastTouched is unsigned and init'd with UINT32_MAX, and keep the BLAS'es for one extra frame for previous TLAS access */
794801 if (bufferSize >= sizeInfo.accelerationStructureSize &&
795802 (!selectedBlas || bufferSize < selectedBlas->accelStructure ->info ().size ) &&
796- paddedLastTouched <= currentFrame)
797- {
803+ paddedLastTouched <= currentFrame) {
798804 selectedBlas = blas.ptr ();
799805 }
800806 }
@@ -818,7 +824,7 @@ namespace dxvk {
818824
819825 // Use the selected BLAS for the build
820826 buildInfo.dstAccelerationStructure = selectedBlas->accelStructure ->getAccelStructure ();
821-
827+
822828 if (buildInfo.mode == VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR) {
823829 // Set the src to the dst if we're updating
824830 buildInfo.srcAccelerationStructure = buildInfo.dstAccelerationStructure ;
@@ -853,15 +859,16 @@ namespace dxvk {
853859 instance.flags = bucket->instanceFlags ;
854860 instance.instanceShaderBindingTableRecordOffset = bucket->instanceShaderBindingTableRecordOffset ;
855861 instance.mask = bucket->instanceMask ;
856- instance.instanceCustomIndex =
862+ instance.instanceCustomIndex =
857863 (bucket->customIndexFlags & ~uint32_t (CUSTOM_INDEX_SURFACE_MASK)) |
858864 (bucket->reorderedSurfacesOffset & uint32_t (CUSTOM_INDEX_SURFACE_MASK));
859865 memcpy (static_cast <void *>(&instance.transform .matrix [0 ][0 ]), &identityTransform[0 ][0 ], sizeof (VkTransformMatrixKHR));
860866
861- if (bucket->usesUnorderedApproximations && RtxOptions::enableSeparateUnorderedApproximations ())
867+ if (bucket->usesUnorderedApproximations && RtxOptions::enableSeparateUnorderedApproximations ()) {
862868 m_mergedInstances[Tlas::Unordered].push_back (instance);
863- else
869+ } else {
864870 m_mergedInstances[Tlas::Opaque].push_back (instance);
871+ }
865872 }
866873 }
867874
@@ -875,8 +882,9 @@ namespace dxvk {
875882 }
876883 }
877884
878- if (!haveInstances && instanceManager.getBillboards ().empty ())
885+ if (!haveInstances && instanceManager.getBillboards ().empty ()) {
879886 return ;
887+ }
880888
881889 createAndBuildIntersectionBlas (ctx, execBarriers);
882890
@@ -890,8 +898,9 @@ namespace dxvk {
890898 uint32_t index = 0 ;
891899
892900 for (const auto & billboard : instanceManager.getBillboards ()) {
893- if (billboard.instanceMask == 0 || !billboard.allowAsIntersectionPrimitive )
901+ if (billboard.instanceMask == 0 || !billboard.allowAsIntersectionPrimitive ) {
894902 continue ;
903+ }
895904
896905 // Shader data
897906 MemoryBillboard& memory = memoryBillboards[index];
@@ -907,10 +916,12 @@ namespace dxvk {
907916 memory.centerUV = billboard.centerUV ;
908917 memory.vertexColor = billboard.vertexColor ;
909918 memory.flags = 0 ;
910- if (billboard.isBeam )
919+ if (billboard.isBeam ) {
911920 memory.flags |= billboardFlagIsBeam;
912- if (billboard.isCameraFacing )
921+ }
922+ if (billboard.isCameraFacing ) {
913923 memory.flags |= billboardFlagIsCameraFacing;
924+ }
914925
915926 // TLAS instance
916927 VkAccelerationStructureInstanceKHR instance {};
@@ -1262,8 +1273,9 @@ namespace dxvk {
12621273 }
12631274
12641275 void AccelManager::buildTlas (Rc<DxvkContext> ctx) {
1265- if (m_vkInstanceBuffer == nullptr )
1276+ if (m_vkInstanceBuffer == nullptr ) {
12661277 return ;
1278+ }
12671279
12681280 ScopedGpuProfileZone (ctx, " buildTLAS" );
12691281
@@ -1339,8 +1351,9 @@ namespace dxvk {
13391351 // Create TLAS
13401352 Tlas& tlas = m_device->getCommon ()->getResources ().getTLAS (type);
13411353
1342- if (type == Tlas::Opaque)
1354+ if (type == Tlas::Opaque) {
13431355 std::swap (tlas.accelStructure , tlas.previousAccelStructure );
1356+ }
13441357
13451358 if (tlas.accelStructure == nullptr || sizeInfo.accelerationStructureSize > tlas.accelStructure ->info ().size ) {
13461359 ScopedGpuProfileZone (ctx, " buildTLAS_createAccelStructure" );
0 commit comments