Browse Source

Fix a depth related DX12 bug

Panagiotis Christopoulos Charitos 11 months ago
parent
commit
1f82a7f501

+ 2 - 1
AnKi/Gr/D3D/D3DGraphicsState.cpp

@@ -224,7 +224,8 @@ void GraphicsPipelineFactory::flushState(GraphicsStateTracker& state, D3D12Graph
 											 .FrontCounterClockwise = true,
 											 .DepthBias = staticState.m_rast.m_depthBias,
 											 .DepthBiasClamp = staticState.m_rast.m_depthBiasClamp,
-											 .SlopeScaledDepthBias = staticState.m_rast.m_slopeScaledDepthBias};
+											 .SlopeScaledDepthBias = staticState.m_rast.m_slopeScaledDepthBias,
+											 .DepthClipEnable = true};
 
 	// Misc
 	D3D12_RT_FORMAT_ARRAY rtFormats = {};

+ 1 - 1
AnKi/Util/SegregatedListsAllocatorBuilder.h

@@ -132,10 +132,10 @@ private:
 	U32 findClass(PtrSize size, PtrSize alignment) const;
 
 	/// Choose the best free block out of 2 given the allocation size and alignment.
+	/// @return True if the block returned is the best candidate overall.
 	static Bool chooseBestFit(PtrSize allocSize, PtrSize allocAlignment, FreeBlock* blockA, FreeBlock* blockB, FreeBlock*& bestBlock);
 
 	/// Place a free block in one of the lists.
-	/// @param[in,out] chunk The input chunk. If it's freed the pointer will become null.
 	void placeFreeBlock(PtrSize address, PtrSize size, ChunksIterator chunkIt);
 };
 /// @}

+ 2 - 2
AnKi/Util/SegregatedListsAllocatorBuilder.inl.h

@@ -185,6 +185,7 @@ void SegregatedListsAllocatorBuilder<TChunk, TInterface, TLock, TMemoryPool>::pl
 
 		if(leftBlock != kMaxU32 && rightBlock != kMaxU32)
 		{
+			// Best case, stop searching
 			break;
 		}
 	}
@@ -205,8 +206,7 @@ void SegregatedListsAllocatorBuilder<TChunk, TInterface, TLock, TMemoryPool>::pl
 
 		if(rightBlock != kMaxU32 && rightClass == leftClass)
 		{
-			// Both right and left blocks live in the same dynamic array. Due to the erase() above the rights's index
-			// is no longer valid, adjust it
+			// Both right and left blocks live in the same dynamic array. Due to the erase() above the rights's index is no longer valid, adjust it
 			ANKI_ASSERT(rightBlock > leftBlock);
 			--rightBlock;
 		}