Panagiotis Christopoulos Charitos 2 lat temu
rodzic
commit
671bc10e21

+ 3 - 3
AnKi/Core/App.cpp

@@ -515,9 +515,9 @@ Error App::mainLoop()
 			{
 				MaliHwCountersOut out;
 				MaliHwCounters::getSingleton().sample(out);
-				g_maliGpuActive.set(out.m_gpuActive);
-				g_maliGpuReadBandwidth.set(out.m_readBandwidth);
-				g_maliGpuWriteBandwidth.set(out.m_writeBandwidth);
+				g_maliGpuActiveStatVar.set(out.m_gpuActive);
+				g_maliGpuReadBandwidthStatVar.set(out.m_readBandwidth);
+				g_maliGpuWriteBandwidthStatVar.set(out.m_writeBandwidth);
 			}
 #endif
 

+ 1 - 1
AnKi/Core/StatsSet.h

@@ -85,7 +85,7 @@ public:
 #if ANKI_STATS_ENABLED
 		ANKI_ASSERT(!!(m_flags & StatFlag::kFloat));
 		checkThread();
-		const F64 orig;
+		F64 orig;
 		if(!!(m_flags & StatFlag::kMainThreadUpdates))
 		{
 			orig = m_f;

+ 2 - 1
AnKi/Gr/Vulkan/CommandBufferFactory.cpp

@@ -68,7 +68,8 @@ Error CommandBufferThreadAllocator::init()
 			continue;
 		}
 
-		VkCommandPoolCreateInfo ci = {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO};
+		VkCommandPoolCreateInfo ci = {};
+		ci.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
 		ci.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
 		ci.queueFamilyIndex = m_factory->m_queueFamilies[qtype];
 

+ 4 - 3
AnKi/Renderer/ClusterBinning2.cpp

@@ -42,7 +42,7 @@ Error ClusterBinning2::init()
 		m_binningGrProgs[type].reset(&variant->getProgram());
 
 		ANKI_CHECK(loadShaderProgram("ShaderBinaries/ClusterBinning2PackVisibles.ankiprogbin",
-									 Array<SubMutation, 1>{{"OBJECT_TYPE", MutatorValue(type)}}, m_packingProg, m_packingGrProgs[type]));
+									 Array<SubMutation, 1>{{{"OBJECT_TYPE", MutatorValue(type)}}}, m_packingProg, m_packingGrProgs[type]));
 	}
 
 	return Error::kNone;
@@ -225,7 +225,7 @@ void ClusterBinning2::populateRenderGraph(RenderingContext& ctx)
 			rpass.newBufferDependency(m_runCtx.m_packedObjectsHandles[type], BufferUsageBit::kStorageComputeWrite);
 		}
 
-		rpass.setWork([this, &ctx, indirectArgsBuff](RenderPassWorkContext& rgraphCtx) {
+		rpass.setWork([this, indirectArgsBuff](RenderPassWorkContext& rgraphCtx) {
 			CommandBuffer& cmdb = *rgraphCtx.m_commandBuffer;
 
 			PtrSize indirectArgsBuffOffset = indirectArgsBuff.m_offset + sizeof(DispatchIndirectArgs) * U32(GpuSceneNonRenderableObjectType::kCount);
@@ -325,7 +325,8 @@ void ClusterBinning2::writeClusterUniformsInternal()
 		out.m_shadowCascadeCount = cam.getShadowCascadeCount();
 		out.m_direction = dirLight->getDirection();
 		out.m_active = 1;
-		for(U32 i = 0; i < kMaxShadowCascades; ++i)
+		out.m_shadowCascadeDistances = Vec4(0.0f);
+		for(U32 i = 0; i < cam.getShadowCascadeCount(); ++i)
 		{
 			out.m_shadowCascadeDistances[i] = cam.getShadowCascadeDistance(i);
 		}

+ 3 - 3
AnKi/Renderer/DepthDownscale.cpp

@@ -55,7 +55,7 @@ Error DepthDownscale::initInternal()
 	if(preferCompute)
 	{
 		ANKI_CHECK(
-			loadShaderProgram("ShaderBinaries/DepthDownscaleCompute.ankiprogbin", Array<SubMutation, 1>{{"WAVE_OPERATIONS", 0}}, m_prog, m_grProg));
+			loadShaderProgram("ShaderBinaries/DepthDownscaleCompute.ankiprogbin", Array<SubMutation, 1>{{{"WAVE_OPERATIONS", 0}}}, m_prog, m_grProg));
 	}
 	else
 	{
@@ -113,12 +113,12 @@ void DepthDownscale::populateRenderGraph(RenderingContext& ctx)
 {
 	RenderGraphDescription& rgraph = ctx.m_renderGraphDescr;
 
+	m_runCtx.m_rt = rgraph.newRenderTarget(m_rtDescr);
+
 	if(g_preferComputeCVar.get())
 	{
 		// Do it with compute
 
-		m_runCtx.m_rt = rgraph.newRenderTarget(m_rtDescr);
-
 		ComputeRenderPassDescription& pass = rgraph.newComputeRenderPass("Depth downscale");
 
 		pass.newTextureDependency(getRenderer().getGBuffer().getDepthRt(), TextureUsageBit::kSampledCompute,

+ 11 - 10
AnKi/Renderer/ShadowMapping.cpp

@@ -28,16 +28,17 @@ static StatCounter g_tilesAllocatedStatVar(StatCategory::kRenderer, "Shadow tile
 class LightHash
 {
 public:
-	union
+	class Unpacked
 	{
-		class
-		{
-		public:
-			U64 m_uuid : 31;
-			U64 m_componentIndex : 30;
-			U64 m_faceIdx : 3;
-		} m_unpacked;
+	public:
+		U64 m_uuid : 31;
+		U64 m_componentIndex : 30;
+		U64 m_faceIdx : 3;
+	};
 
+	union
+	{
+		Unpacked m_unpacked;
 		U64 m_packed;
 	};
 };
@@ -256,7 +257,7 @@ TileAllocatorResult2 ShadowMapping::allocateAtlasTiles(U32 lightUuid, U32 compon
 
 	TileAllocatorResult2 goodResult = TileAllocatorResult2::kAllocationSucceded | TileAllocatorResult2::kTileCached;
 
-	for(U i = 0; i < faceCount; ++i)
+	for(U32 i = 0; i < faceCount; ++i)
 	{
 		TileAllocator2::ArrayOfLightUuids kickedOutLights(&getRenderer().getFrameMemoryPool());
 
@@ -284,7 +285,7 @@ TileAllocatorResult2 ShadowMapping::allocateAtlasTiles(U32 lightUuid, U32 compon
 						g_shadowMappingTileCountPerRowOrColumnCVar.getFullName().cstr());
 
 			// Invalidate cache entries for what we already allocated
-			for(U j = 0; j < i; ++j)
+			for(U32 j = 0; j < i; ++j)
 			{
 				m_tileAlloc.invalidateCache(encodeTileHash(lightUuid, componentIndex, j));
 			}

+ 3 - 3
AnKi/Renderer/Utils/Drawer.cpp

@@ -18,8 +18,8 @@
 
 namespace anki {
 
-static StatCounter g_executedDrawcallsStatVar(StatCategory::kRenderer, "Visible objects", StatFlag::kZeroEveryFrame);
-static StatCounter g_maxDrawcallsStatVar(StatCategory::kRenderer, "Objects tested for visibility", StatFlag::kZeroEveryFrame);
+static StatCounter g_executedDrawcallsStatVar(StatCategory::kRenderer, "Drawcalls executed", StatFlag::kZeroEveryFrame);
+static StatCounter g_maxDrawcallsStatVar(StatCategory::kRenderer, "Drawcalls possible", StatFlag::kZeroEveryFrame);
 
 RenderableDrawer::~RenderableDrawer()
 {
@@ -83,7 +83,7 @@ void RenderableDrawer::setState(const RenderableDrawerArguments& args, CommandBu
 void RenderableDrawer::drawMdi(const RenderableDrawerArguments& args, CommandBuffer& cmdb)
 {
 #if ANKI_STATS_ENABLED
-	U32 variant;
+	U32 variant = 0;
 	switch(args.m_renderingTechinuqe)
 	{
 	case RenderingTechnique::kGBuffer:

+ 2 - 2
AnKi/Scene/Components/CameraComponent.cpp

@@ -15,8 +15,8 @@ static NumericCVar<U8> g_shadowCascadeCountCVar(CVarSubsystem::kScene, "ShadowCa
 												kMaxShadowCascades, "Max number of shadow cascades for directional lights");
 static NumericCVar<F32> g_shadowCascade0DistanceCVar(CVarSubsystem::kScene, "ShadowCascade0Distance", 18.0, 1.0, kMaxF32,
 													 "The distance of the 1st cascade");
-static NumericCVar<F32> g_shadowCascade1DistanceCVar(CVarSubsystem::kScene, "ShadowCascade1Distance", 40.0, 1.0, kMaxF32,
-													 "The distance of the 2nd cascade");
+static NumericCVar<F32> g_shadowCascade1DistanceCVar(CVarSubsystem::kScene, "ShadowCascade1Distance", (ANKI_PLATFORM_MOBILE) ? 100.0f : 40.0, 1.0,
+													 kMaxF32, "The distance of the 2nd cascade");
 static NumericCVar<F32> g_shadowCascade2DistanceCVar(CVarSubsystem::kScene, "ShadowCascade2Distance", 80.0, 1.0, kMaxF32,
 													 "The distance of the 3rd cascade");
 static NumericCVar<F32> g_shadowCascade3DistanceCVar(CVarSubsystem::kScene, "ShadowCascade3Distance", 200.0, 1.0, kMaxF32,

+ 1 - 1
AnKi/Scene/Components/LightComponent.cpp

@@ -318,7 +318,7 @@ void LightComponent::setShadowAtlasUvViewports(ConstWeakArray<Vec4> viewports)
 
 	if(dirty)
 	{
-		m_shadowAtlasUvViewportCount = viewports.getSize();
+		m_shadowAtlasUvViewportCount = U8(viewports.getSize());
 		for(U32 i = 0; i < viewports.getSize(); ++i)
 		{
 			m_shadowAtlasUvViewports[i] = viewports[i];

+ 0 - 6
AnKi/Scene/Components/LightComponent.h

@@ -168,14 +168,8 @@ private:
 		F32 m_innerAngle = toRad(15.0f);
 	};
 
-	class Dir
-	{
-	public:
-	};
-
 	Point m_point;
 	Spot m_spot;
-	Dir m_dir;
 
 	GpuSceneArrays::Light::Allocation m_gpuSceneLight;
 

+ 0 - 1
AnKi/Scene/Components/ModelComponent.cpp

@@ -16,7 +16,6 @@ namespace anki {
 
 ModelComponent::ModelComponent(SceneNode* node)
 	: SceneComponent(node, kClassType)
-	, m_node(node)
 {
 	m_gpuSceneTransforms.allocate();
 }

+ 0 - 1
AnKi/Scene/Components/ModelComponent.h

@@ -61,7 +61,6 @@ private:
 		RenderingTechniqueBit m_techniques;
 	};
 
-	SceneNode* m_node = nullptr;
 	SkinComponent* m_skinComponent = nullptr;
 
 	ModelResourcePtr m_model;

+ 2 - 0
AnKi/Scene/Components/SceneComponent.h

@@ -79,6 +79,8 @@ public:
 	{
 	}
 
+	virtual ~SceneComponent() = default;
+
 	SceneComponentType getType() const
 	{
 		return m_type;

+ 2 - 0
AnKi/Scene/SceneNode.cpp

@@ -66,6 +66,8 @@ SceneNode::~SceneNode()
 		SceneGraph::getSingleton().getComponentArrays().get##name##s().erase(comp->getArrayIndex()); \
 		break;
 #include <AnKi/Scene/Components/SceneComponentClasses.def.h>
+		default:
+			ANKI_ASSERT(0);
 		}
 	}
 }

+ 1 - 1
AnKi/Util/BlockArray.inl.h

@@ -195,7 +195,7 @@ void BlockArray<T, TMemoryPool, TConfig>::validate() const
 {
 	ANKI_ASSERT(m_blockStorages.getSize() == m_blockMetadatas.getSize());
 
-	U32 count = 0;
+	[[maybe_unused]] U32 count = 0;
 	U32 first = 0;
 	U32 end = 0;
 	for(U32 i = 0; i < m_blockStorages.getSize(); ++i)