Browse Source

Fix more bugs

Panagiotis Christopoulos Charitos 2 years ago
parent
commit
8585039ae1
3 changed files with 10 additions and 10 deletions
  1. 1 1
      AnKi/Renderer/LightShading.cpp
  2. 2 2
      AnKi/Scene/GpuSceneArray.h
  3. 7 7
      AnKi/Scene/GpuSceneArray.inl.h

+ 1 - 1
AnKi/Renderer/LightShading.cpp

@@ -204,7 +204,7 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 
 
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 
 
-		const Bool isSolidColor = (sky) ? sky->getSkyboxType() == SkyboxType::kSolidColor : false;
+		const Bool isSolidColor = (sky) ? sky->getSkyboxType() == SkyboxType::kSolidColor : true;
 
 
 		if(isSolidColor)
 		if(isSolidColor)
 		{
 		{

+ 2 - 2
AnKi/Scene/GpuSceneArray.h

@@ -112,7 +112,7 @@ public:
 	U32 getElementCount() const
 	U32 getElementCount() const
 	{
 	{
 		LockGuard lock(m_mtx);
 		LockGuard lock(m_mtx);
-		return (m_inuUseIndicesCount) ? m_maxInUseIndex + 1 : 0;
+		return (m_inUseIndicesCount) ? m_maxInUseIndex + 1 : 0;
 	}
 	}
 
 
 	constexpr static U32 getElementSize()
 	constexpr static U32 getElementSize()
@@ -140,7 +140,7 @@ private:
 
 
 	SceneDynamicArray<SubMask> m_inUseIndicesMask;
 	SceneDynamicArray<SubMask> m_inUseIndicesMask;
 
 
-	U32 m_inuUseIndicesCount = 0; ///< Doesn't count null elements.
+	U32 m_inUseIndicesCount = 0; ///< Doesn't count null elements.
 	U32 m_maxInUseIndex = 0; ///< Counts null elements.
 	U32 m_maxInUseIndex = 0; ///< Counts null elements.
 
 
 	SceneDynamicArray<U32> m_freedAllocations;
 	SceneDynamicArray<U32> m_freedAllocations;

+ 7 - 7
AnKi/Scene/GpuSceneArray.inl.h

@@ -17,7 +17,7 @@ GpuSceneArray<TGpuSceneObject, kId>::GpuSceneArray(U32 maxArraySize)
 	m_gpuSceneAllocation = GpuSceneBuffer::getSingleton().allocate(sizeof(TGpuSceneObject) * maxArraySize, alignment);
 	m_gpuSceneAllocation = GpuSceneBuffer::getSingleton().allocate(sizeof(TGpuSceneObject) * maxArraySize, alignment);
 
 
 	m_inUseIndicesMask.resize(maxArraySize / sizeof(SubMask), false);
 	m_inUseIndicesMask.resize(maxArraySize / sizeof(SubMask), false);
-	ANKI_ASSERT(m_inuUseIndicesCount == 0);
+	ANKI_ASSERT(m_inUseIndicesCount == 0);
 	m_maxInUseIndex = 0;
 	m_maxInUseIndex = 0;
 }
 }
 
 
@@ -26,7 +26,7 @@ GpuSceneArray<TGpuSceneObject, kId>::~GpuSceneArray()
 {
 {
 	flushInternal(false);
 	flushInternal(false);
 	validate();
 	validate();
-	ANKI_ASSERT(m_inuUseIndicesCount == 0 && "Forgot to free");
+	ANKI_ASSERT(m_inUseIndicesCount == 0 && "Forgot to free");
 }
 }
 
 
 template<typename TGpuSceneObject, U32 kId>
 template<typename TGpuSceneObject, U32 kId>
@@ -66,7 +66,7 @@ GpuSceneArrayAllocation<TGpuSceneObject, kId> GpuSceneArray<TGpuSceneObject, kId
 	m_inUseIndicesMask[idx / 64].set(idx % 64);
 	m_inUseIndicesMask[idx / 64].set(idx % 64);
 
 
 	m_maxInUseIndex = max(m_maxInUseIndex, idx);
 	m_maxInUseIndex = max(m_maxInUseIndex, idx);
-	++m_inuUseIndicesCount;
+	++m_inUseIndicesCount;
 
 
 	Allocation out;
 	Allocation out;
 	out.m_index = idx;
 	out.m_index = idx;
@@ -90,8 +90,8 @@ void GpuSceneArray<TGpuSceneObject, kId>::free(Allocation& alloc)
 	ANKI_ASSERT(m_inUseIndicesMask[idx / 64].get(idx % 64) == true);
 	ANKI_ASSERT(m_inUseIndicesMask[idx / 64].get(idx % 64) == true);
 	m_inUseIndicesMask[idx / 64].unset(idx % 64);
 	m_inUseIndicesMask[idx / 64].unset(idx % 64);
 
 
-	ANKI_ASSERT(m_inuUseIndicesCount > 0);
-	--m_inuUseIndicesCount;
+	ANKI_ASSERT(m_inUseIndicesCount > 0);
+	--m_inUseIndicesCount;
 
 
 	// Sort because allocations later on should preferably grab the lowest index possible
 	// Sort because allocations later on should preferably grab the lowest index possible
 	std::sort(m_freedAllocations.getBegin(), m_freedAllocations.getEnd());
 	std::sort(m_freedAllocations.getBegin(), m_freedAllocations.getEnd());
@@ -116,7 +116,7 @@ void GpuSceneArray<TGpuSceneObject, kId>::flushInternal(Bool nullifyElements)
 		}
 		}
 
 
 		// Update the the last index
 		// Update the the last index
-		U32 maskGroup = m_maxInUseIndex / 64;
+		U32 maskGroup = m_maxInUseIndex / 64 + 1;
 		m_maxInUseIndex = 0;
 		m_maxInUseIndex = 0;
 		while(maskGroup--)
 		while(maskGroup--)
 		{
 		{
@@ -148,7 +148,7 @@ void GpuSceneArray<TGpuSceneObject, kId>::validate() const
 		++maskGroupCount;
 		++maskGroupCount;
 	}
 	}
 
 
-	ANKI_ASSERT(count == m_inuUseIndicesCount);
+	ANKI_ASSERT(count == m_inUseIndicesCount);
 	ANKI_ASSERT(maxIdx == m_maxInUseIndex);
 	ANKI_ASSERT(maxIdx == m_maxInUseIndex);
 #endif
 #endif
 }
 }