瀏覽代碼

Make DynamicArray and WeakArray more compact

Panagiotis Christopoulos Charitos 6 年之前
父節點
當前提交
7bfd677555
共有 72 個文件被更改,包括 466 次插入478 次删除
  1. 1 1
      samples/physics_playground/Main.cpp
  2. 3 3
      src/anki/core/App.cpp
  3. 20 20
      src/anki/gr/RenderGraph.cpp
  4. 4 4
      src/anki/gr/RenderGraph.inl.h
  5. 3 3
      src/anki/gr/ShaderCompiler.cpp
  6. 16 16
      src/anki/gr/vulkan/CommandBufferImpl.cpp
  7. 4 4
      src/anki/gr/vulkan/CommandBufferImpl.inl.h
  8. 7 7
      src/anki/gr/vulkan/DescriptorSet.cpp
  9. 4 4
      src/anki/gr/vulkan/FenceFactory.cpp
  10. 4 4
      src/anki/gr/vulkan/GpuMemoryManager.cpp
  11. 7 7
      src/anki/gr/vulkan/GrManagerImpl.cpp
  12. 5 5
      src/anki/gr/vulkan/MicroObjectRecycler.inl.h
  13. 2 2
      src/anki/gr/vulkan/PipelineCache.cpp
  14. 2 2
      src/anki/gr/vulkan/ShaderImpl.cpp
  15. 6 6
      src/anki/gr/vulkan/ShaderProgramImpl.cpp
  16. 9 9
      src/anki/importer/GltfImporter.cpp
  17. 35 35
      src/anki/importer/GltfImporterMesh.cpp
  18. 5 5
      src/anki/misc/Xml.cpp
  19. 2 2
      src/anki/misc/Xml.h
  20. 1 1
      src/anki/physics/PhysicsCollisionShape.cpp
  21. 37 37
      src/anki/renderer/ClusterBin.cpp
  22. 4 4
      src/anki/renderer/Dbg.cpp
  23. 1 1
      src/anki/renderer/ForwardShading.cpp
  24. 3 3
      src/anki/renderer/GBuffer.cpp
  25. 10 11
      src/anki/renderer/GlobalIllumination.cpp
  26. 6 6
      src/anki/renderer/LensFlare.cpp
  27. 2 2
      src/anki/renderer/LightShading.cpp
  28. 6 6
      src/anki/renderer/ProbeReflections.cpp
  29. 6 6
      src/anki/renderer/ShadowMapping.cpp
  30. 1 1
      src/anki/renderer/VolumetricFog.cpp
  31. 3 3
      src/anki/resource/AnimationResource.cpp
  32. 1 1
      src/anki/resource/AnimationResource.h
  33. 1 1
      src/anki/resource/GenericResource.cpp
  34. 12 12
      src/anki/resource/ImageLoader.cpp
  35. 12 11
      src/anki/resource/MaterialResource.cpp
  36. 4 4
      src/anki/resource/MeshLoader.cpp
  37. 2 2
      src/anki/resource/MeshResource.cpp
  38. 3 3
      src/anki/resource/MeshResource.h
  39. 3 3
      src/anki/resource/ModelResource.cpp
  40. 4 4
      src/anki/resource/ShaderProgramPreProcessor.cpp
  41. 6 6
      src/anki/resource/ShaderProgramResource.cpp
  42. 6 6
      src/anki/resource/ShaderProgramResource.h
  43. 2 2
      src/anki/resource/SkeletonResource.cpp
  44. 3 3
      src/anki/resource/TextureAtlasResource.cpp
  45. 4 4
      src/anki/scene/DebugDrawer.cpp
  46. 1 1
      src/anki/scene/DecalNode.cpp
  47. 1 1
      src/anki/scene/GlobalIlluminationProbeNode.cpp
  48. 2 2
      src/anki/scene/LightNode.cpp
  49. 3 3
      src/anki/scene/ModelNode.cpp
  50. 4 4
      src/anki/scene/OccluderNode.cpp
  51. 2 2
      src/anki/scene/ParticleEmitterNode.cpp
  52. 1 1
      src/anki/scene/ReflectionProbeNode.cpp
  53. 5 5
      src/anki/scene/SceneNode.h
  54. 2 2
      src/anki/scene/SoftwareRasterizer.cpp
  55. 19 19
      src/anki/scene/Visibility.cpp
  56. 2 2
      src/anki/scene/components/LightComponent.cpp
  57. 12 15
      src/anki/scene/components/RenderComponent.cpp
  58. 1 1
      src/anki/scene/components/SkinComponent.cpp
  59. 2 2
      src/anki/script/Scene.cpp
  60. 2 2
      src/anki/script/Scene.xml
  61. 1 1
      src/anki/shader_compiler/Glslang.cpp
  62. 22 22
      src/anki/shader_compiler/ShaderProgramCompiler.cpp
  63. 15 15
      src/anki/shader_compiler/ShaderProgramParser.cpp
  64. 3 3
      src/anki/ui/Font.cpp
  65. 3 3
      src/anki/util/BitSet.h
  66. 30 31
      src/anki/util/DynamicArray.h
  67. 22 22
      src/anki/util/DynamicArray.inl.h
  68. 1 1
      src/anki/util/String.cpp
  69. 1 1
      src/anki/util/String.h
  70. 13 21
      src/anki/util/WeakArray.h
  71. 6 6
      tests/util/DynamicArray.cpp
  72. 8 8
      tests/util/HashMap.cpp

+ 1 - 1
samples/physics_playground/Main.cpp

@@ -334,7 +334,7 @@ Error MyApp::userMainLoop(Bool& quit)
 		SceneNode& node = getSceneGraph().findSceneNode("trigger");
 		SceneNode& node = getSceneGraph().findSceneNode("trigger");
 		TriggerComponent& comp = node.getComponent<TriggerComponent>();
 		TriggerComponent& comp = node.getComponent<TriggerComponent>();
 
 
-		for(U i = 0; i < comp.getContactSceneNodes().getSize(); ++i)
+		for(U32 i = 0; i < comp.getContactSceneNodes().getSize(); ++i)
 		{
 		{
 			ANKI_LOGI("Touching %s", comp.getContactSceneNodes()[i]->getName().cstr());
 			ANKI_LOGI("Touching %s", comp.getContactSceneNodes()[i]->getName().cstr());
 		}
 		}

+ 3 - 3
src/anki/core/App.cpp

@@ -655,10 +655,10 @@ Error App::mainLoop()
 
 
 void App::injectUiElements(DynamicArrayAuto<UiQueueElement>& newUiElementArr, RenderQueue& rqueue)
 void App::injectUiElements(DynamicArrayAuto<UiQueueElement>& newUiElementArr, RenderQueue& rqueue)
 {
 {
-	const U originalCount = rqueue.m_uis.getSize();
+	const U32 originalCount = rqueue.m_uis.getSize();
 	if(m_displayStats || m_consoleEnabled)
 	if(m_displayStats || m_consoleEnabled)
 	{
 	{
-		const U extraElements = (m_displayStats != 0) + (m_consoleEnabled != 0);
+		const U32 extraElements = (m_displayStats != 0) + (m_consoleEnabled != 0);
 		newUiElementArr.create(originalCount + extraElements);
 		newUiElementArr.create(originalCount + extraElements);
 
 
 		if(originalCount > 0)
 		if(originalCount > 0)
@@ -669,7 +669,7 @@ void App::injectUiElements(DynamicArrayAuto<UiQueueElement>& newUiElementArr, Re
 		rqueue.m_uis = WeakArray<UiQueueElement>(newUiElementArr);
 		rqueue.m_uis = WeakArray<UiQueueElement>(newUiElementArr);
 	}
 	}
 
 
-	U count = originalCount;
+	U32 count = originalCount;
 	if(m_displayStats)
 	if(m_displayStats)
 	{
 	{
 		newUiElementArr[count].m_userData = m_statsUi.get();
 		newUiElementArr[count].m_userData = m_statsUi.get();

+ 20 - 20
src/anki/gr/RenderGraph.cpp

@@ -20,7 +20,7 @@ namespace anki
 
 
 #define ANKI_DBG_RENDER_GRAPH 0
 #define ANKI_DBG_RENDER_GRAPH 0
 
 
-static inline U getTextureSurfOrVolCount(const TexturePtr& tex)
+static inline U32 getTextureSurfOrVolCount(const TexturePtr& tex)
 {
 {
 	return tex->getMipmapCount() * tex->getLayerCount() * (textureTypeIsCube(tex->getTextureType()) ? 6 : 1);
 	return tex->getMipmapCount() * tex->getLayerCount() * (textureTypeIsCube(tex->getTextureType()) ? 6 : 1);
 }
 }
@@ -280,7 +280,7 @@ void RenderGraph::reset()
 	{
 	{
 		if(rt.m_imported)
 		if(rt.m_imported)
 		{
 		{
-			const U surfOrVolumeCount = getTextureSurfOrVolCount(rt.m_texture);
+			const U32 surfOrVolumeCount = getTextureSurfOrVolCount(rt.m_texture);
 
 
 			// Create a new hash because our hash map dislikes concurent keys.
 			// Create a new hash because our hash map dislikes concurent keys.
 			const U64 uuid = rt.m_texture->getUuid();
 			const U64 uuid = rt.m_texture->getUuid();
@@ -301,7 +301,7 @@ void RenderGraph::reset()
 			}
 			}
 
 
 			// Update the usage
 			// Update the usage
-			for(U surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
+			for(U32 surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
 			{
 			{
 				it->m_surfOrVolLastUsages[surfOrVolIdx] = rt.m_surfOrVolUsages[surfOrVolIdx];
 				it->m_surfOrVolLastUsages[surfOrVolIdx] = rt.m_surfOrVolUsages[surfOrVolIdx];
 			}
 			}
@@ -607,7 +607,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 
 
 	// Init the resources
 	// Init the resources
 	ctx->m_rts.create(alloc, descr.m_renderTargets.getSize());
 	ctx->m_rts.create(alloc, descr.m_renderTargets.getSize());
-	for(U rtIdx = 0; rtIdx < ctx->m_rts.getSize(); ++rtIdx)
+	for(U32 rtIdx = 0; rtIdx < ctx->m_rts.getSize(); ++rtIdx)
 	{
 	{
 		RT& outRt = ctx->m_rts[rtIdx];
 		RT& outRt = ctx->m_rts[rtIdx];
 		const RenderGraphDescription::RT& inRt = descr.m_renderTargets[rtIdx];
 		const RenderGraphDescription::RT& inRt = descr.m_renderTargets[rtIdx];
@@ -635,7 +635,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 		}
 		}
 
 
 		// Init the usage
 		// Init the usage
-		const U surfOrVolumeCount = getTextureSurfOrVolCount(outRt.m_texture);
+		const U32 surfOrVolumeCount = getTextureSurfOrVolCount(outRt.m_texture);
 		outRt.m_surfOrVolUsages.create(alloc, surfOrVolumeCount, TextureUsageBit::NONE);
 		outRt.m_surfOrVolUsages.create(alloc, surfOrVolumeCount, TextureUsageBit::NONE);
 		if(imported && inRt.m_importedAndUndefinedUsage)
 		if(imported && inRt.m_importedAndUndefinedUsage)
 		{
 		{
@@ -649,7 +649,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 			ANKI_ASSERT(it != m_importedRenderTargets.getEnd() && "Can't find the imported RT");
 			ANKI_ASSERT(it != m_importedRenderTargets.getEnd() && "Can't find the imported RT");
 
 
 			ANKI_ASSERT(it->m_surfOrVolLastUsages.getSize() == surfOrVolumeCount);
 			ANKI_ASSERT(it->m_surfOrVolLastUsages.getSize() == surfOrVolumeCount);
-			for(U surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
+			for(U32 surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
 			{
 			{
 				outRt.m_surfOrVolUsages[surfOrVolIdx] = it->m_surfOrVolLastUsages[surfOrVolIdx];
 				outRt.m_surfOrVolUsages[surfOrVolIdx] = it->m_surfOrVolLastUsages[surfOrVolIdx];
 			}
 			}
@@ -657,7 +657,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 		else if(imported)
 		else if(imported)
 		{
 		{
 			// Set the usage that was given by the user
 			// Set the usage that was given by the user
-			for(U surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
+			for(U32 surfOrVolIdx = 0; surfOrVolIdx < surfOrVolumeCount; ++surfOrVolIdx)
 			{
 			{
 				outRt.m_surfOrVolUsages[surfOrVolIdx] = inRt.m_importedLastKnownUsage;
 				outRt.m_surfOrVolUsages[surfOrVolIdx] = inRt.m_importedLastKnownUsage;
 			}
 			}
@@ -669,7 +669,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 
 
 	// Buffers
 	// Buffers
 	ctx->m_buffers.create(alloc, descr.m_buffers.getSize());
 	ctx->m_buffers.create(alloc, descr.m_buffers.getSize());
-	for(U buffIdx = 0; buffIdx < ctx->m_buffers.getSize(); ++buffIdx)
+	for(U32 buffIdx = 0; buffIdx < ctx->m_buffers.getSize(); ++buffIdx)
 	{
 	{
 		ctx->m_buffers[buffIdx].m_usage = descr.m_buffers[buffIdx].m_usage;
 		ctx->m_buffers[buffIdx].m_usage = descr.m_buffers[buffIdx].m_usage;
 		ANKI_ASSERT(descr.m_buffers[buffIdx].m_importedBuff.isCreated());
 		ANKI_ASSERT(descr.m_buffers[buffIdx].m_importedBuff.isCreated());
@@ -684,7 +684,7 @@ RenderGraph::BakeContext* RenderGraph::newContext(const RenderGraphDescription&
 void RenderGraph::initRenderPassesAndSetDeps(const RenderGraphDescription& descr, StackAllocator<U8>& alloc)
 void RenderGraph::initRenderPassesAndSetDeps(const RenderGraphDescription& descr, StackAllocator<U8>& alloc)
 {
 {
 	BakeContext& ctx = *m_ctx;
 	BakeContext& ctx = *m_ctx;
-	const U32 passCount = U32(descr.m_passes.getSize());
+	const U32 passCount = descr.m_passes.getSize();
 	ANKI_ASSERT(passCount > 0);
 	ANKI_ASSERT(passCount > 0);
 
 
 	ctx.m_passes.create(alloc, passCount);
 	ctx.m_passes.create(alloc, passCount);
@@ -698,7 +698,7 @@ void RenderGraph::initRenderPassesAndSetDeps(const RenderGraphDescription& descr
 
 
 		// Create consumer info
 		// Create consumer info
 		outPass.m_consumedTextures.resize(alloc, inPass.m_rtDeps.getSize());
 		outPass.m_consumedTextures.resize(alloc, inPass.m_rtDeps.getSize());
-		for(U depIdx = 0; depIdx < inPass.m_rtDeps.getSize(); ++depIdx)
+		for(U32 depIdx = 0; depIdx < inPass.m_rtDeps.getSize(); ++depIdx)
 		{
 		{
 			const RenderPassDependency& inDep = inPass.m_rtDeps[depIdx];
 			const RenderPassDependency& inDep = inPass.m_rtDeps[depIdx];
 			ANKI_ASSERT(inDep.m_isTexture);
 			ANKI_ASSERT(inDep.m_isTexture);
@@ -808,7 +808,7 @@ void RenderGraph::initBatches()
 		for(U32 passIdx : m_ctx->m_batches.getBack().m_passIndices)
 		for(U32 passIdx : m_ctx->m_batches.getBack().m_passIndices)
 		{
 		{
 			m_ctx->m_passIsInBatch.set(passIdx);
 			m_ctx->m_passIsInBatch.set(passIdx);
-			m_ctx->m_passes[passIdx].m_batchIdx = U32(m_ctx->m_batches.getSize() - 1);
+			m_ctx->m_passes[passIdx].m_batchIdx = m_ctx->m_batches.getSize() - 1;
 		}
 		}
 	}
 	}
 }
 }
@@ -816,10 +816,10 @@ void RenderGraph::initBatches()
 void RenderGraph::initGraphicsPasses(const RenderGraphDescription& descr, StackAllocator<U8>& alloc)
 void RenderGraph::initGraphicsPasses(const RenderGraphDescription& descr, StackAllocator<U8>& alloc)
 {
 {
 	BakeContext& ctx = *m_ctx;
 	BakeContext& ctx = *m_ctx;
-	const U passCount = descr.m_passes.getSize();
+	const U32 passCount = descr.m_passes.getSize();
 	ANKI_ASSERT(passCount > 0);
 	ANKI_ASSERT(passCount > 0);
 
 
-	for(U passIdx = 0; passIdx < passCount; ++passIdx)
+	for(U32 passIdx = 0; passIdx < passCount; ++passIdx)
 	{
 	{
 		const RenderPassDescriptionBase& inPass = *descr.m_passes[passIdx];
 		const RenderPassDescriptionBase& inPass = *descr.m_passes[passIdx];
 		Pass& outPass = ctx.m_passes[passIdx];
 		Pass& outPass = ctx.m_passes[passIdx];
@@ -913,7 +913,7 @@ void RenderGraph::setTextureBarrier(Batch& batch, const RenderPassDependency& de
 	RT& rt = ctx.m_rts[rtIdx];
 	RT& rt = ctx.m_rts[rtIdx];
 
 
 	iterateSurfsOrVolumes(
 	iterateSurfsOrVolumes(
-		rt.m_texture, dep.m_texture.m_subresource, [&](U surfOrVolIdx, const TextureSurfaceInfo& surf) {
+		rt.m_texture, dep.m_texture.m_subresource, [&](U32 surfOrVolIdx, const TextureSurfaceInfo& surf) {
 			TextureUsageBit& crntUsage = rt.m_surfOrVolUsages[surfOrVolIdx];
 			TextureUsageBit& crntUsage = rt.m_surfOrVolUsages[surfOrVolIdx];
 			if(crntUsage != depUsage)
 			if(crntUsage != depUsage)
 			{
 			{
@@ -964,7 +964,7 @@ void RenderGraph::setBatchBarriers(const RenderGraphDescription& descr)
 		BitSet<MAX_RENDER_GRAPH_BUFFERS, U64> buffHasBarrierMask = {false};
 		BitSet<MAX_RENDER_GRAPH_BUFFERS, U64> buffHasBarrierMask = {false};
 
 
 		// For all passes of that batch
 		// For all passes of that batch
-		for(U passIdx : batch.m_passIndices)
+		for(U32 passIdx : batch.m_passIndices)
 		{
 		{
 			const RenderPassDescriptionBase& pass = *descr.m_passes[passIdx];
 			const RenderPassDescriptionBase& pass = *descr.m_passes[passIdx];
 
 
@@ -1102,7 +1102,7 @@ void RenderGraph::runSecondLevel(U32 threadIdx)
 
 
 	for(Pass& p : m_ctx->m_passes)
 	for(Pass& p : m_ctx->m_passes)
 	{
 	{
-		const U32 size = U32(p.m_secondLevelCmdbs.getSize());
+		const U32 size = p.m_secondLevelCmdbs.getSize();
 		if(threadIdx < size)
 		if(threadIdx < size)
 		{
 		{
 			ANKI_ASSERT(!p.m_secondLevelCmdbs[threadIdx].isCreated());
 			ANKI_ASSERT(!p.m_secondLevelCmdbs[threadIdx].isCreated());
@@ -1207,7 +1207,7 @@ void RenderGraph::flush()
 {
 {
 	ANKI_TRACE_SCOPED_EVENT(GR_RENDER_GRAPH_FLUSH);
 	ANKI_TRACE_SCOPED_EVENT(GR_RENDER_GRAPH_FLUSH);
 
 
-	for(U i = 0; i < m_ctx->m_graphicsCmdbs.getSize(); ++i)
+	for(U32 i = 0; i < m_ctx->m_graphicsCmdbs.getSize(); ++i)
 	{
 	{
 		// Maybe write a timestamp before flush
 		// Maybe write a timestamp before flush
 		if(ANKI_UNLIKELY(m_ctx->m_gatherStatistics && i == m_ctx->m_graphicsCmdbs.getSize() - 1))
 		if(ANKI_UNLIKELY(m_ctx->m_gatherStatistics && i == m_ctx->m_graphicsCmdbs.getSize() - 1))
@@ -1230,7 +1230,7 @@ void RenderGraph::getCrntUsage(
 	usage = TextureUsageBit::NONE;
 	usage = TextureUsageBit::NONE;
 	const Batch& batch = m_ctx->m_batches[batchIdx];
 	const Batch& batch = m_ctx->m_batches[batchIdx];
 
 
-	for(U passIdx : batch.m_passIndices)
+	for(U32 passIdx : batch.m_passIndices)
 	{
 	{
 		for(const Pass::ConsumedTextureInfo& consumer : m_ctx->m_passes[passIdx].m_consumedTextures)
 		for(const Pass::ConsumedTextureInfo& consumer : m_ctx->m_passes[passIdx].m_consumedTextures)
 		{
 		{
@@ -1245,7 +1245,7 @@ void RenderGraph::getCrntUsage(
 
 
 void RenderGraph::periodicCleanup()
 void RenderGraph::periodicCleanup()
 {
 {
-	U rtsCleanedCount = 0;
+	U32 rtsCleanedCount = 0;
 	for(RenderTargetCacheEntry& entry : m_renderTargetCache)
 	for(RenderTargetCacheEntry& entry : m_renderTargetCache)
 	{
 	{
 		if(entry.m_texturesInUse < entry.m_textures.getSize())
 		if(entry.m_texturesInUse < entry.m_textures.getSize())
@@ -1262,7 +1262,7 @@ void RenderGraph::periodicCleanup()
 			}
 			}
 
 
 			// Populate the new array
 			// Populate the new array
-			for(U i = 0; i < newArray.getSize(); ++i)
+			for(U32 i = 0; i < newArray.getSize(); ++i)
 			{
 			{
 				newArray[i] = std::move(entry.m_textures[i]);
 				newArray[i] = std::move(entry.m_textures[i]);
 			}
 			}

+ 4 - 4
src/anki/gr/RenderGraph.inl.h

@@ -161,7 +161,7 @@ inline void GraphicsRenderPassDescription::setFramebufferInfo(const FramebufferD
 {
 {
 #if ANKI_ASSERTS_ENABLED
 #if ANKI_ASSERTS_ENABLED
 	ANKI_ASSERT(fbInfo.isBacked() && "Forgot call GraphicsRenderPassFramebufferInfo::bake");
 	ANKI_ASSERT(fbInfo.isBacked() && "Forgot call GraphicsRenderPassFramebufferInfo::bake");
-	for(U i = 0; i < colorRenderTargetHandles.getSize(); ++i)
+	for(U32 i = 0; i < colorRenderTargetHandles.getSize(); ++i)
 	{
 	{
 		if(i >= fbInfo.m_colorAttachmentCount)
 		if(i >= fbInfo.m_colorAttachmentCount)
 		{
 		{
@@ -233,7 +233,7 @@ inline RenderTargetHandle RenderGraphDescription::importRenderTarget(TexturePtr
 	rt.setName(tex->getName());
 	rt.setName(tex->getName());
 
 
 	RenderTargetHandle out;
 	RenderTargetHandle out;
-	out.m_idx = U32(m_renderTargets.getSize() - 1);
+	out.m_idx = m_renderTargets.getSize() - 1;
 	return out;
 	return out;
 }
 }
 
 
@@ -256,7 +256,7 @@ inline RenderTargetHandle RenderGraphDescription::newRenderTarget(const RenderTa
 	rt.setName(initInf.getName());
 	rt.setName(initInf.getName());
 
 
 	RenderTargetHandle out;
 	RenderTargetHandle out;
-	out.m_idx = U32(m_renderTargets.getSize() - 1);
+	out.m_idx = m_renderTargets.getSize() - 1;
 	return out;
 	return out;
 }
 }
 
 
@@ -274,7 +274,7 @@ inline RenderPassBufferHandle RenderGraphDescription::importBuffer(BufferPtr buf
 	b.m_importedBuff = buff;
 	b.m_importedBuff = buff;
 
 
 	RenderPassBufferHandle out;
 	RenderPassBufferHandle out;
-	out.m_idx = U32(m_buffers.getSize() - 1);
+	out.m_idx = m_buffers.getSize() - 1;
 	return out;
 	return out;
 }
 }
 
 

+ 3 - 3
src/anki/gr/ShaderCompiler.cpp

@@ -344,7 +344,7 @@ Error ShaderCompiler::genSpirv(CString src, const ShaderCompilerOptions& options
 	glslang::GlslangToSpv(*program.getIntermediate(stage), glslangSpirv, &spvOptions);
 	glslang::GlslangToSpv(*program.getIntermediate(stage), glslangSpirv, &spvOptions);
 
 
 	// Store
 	// Store
-	spirv.resize(glslangSpirv.size() * sizeof(unsigned int));
+	spirv.resize(U32(glslangSpirv.size() * sizeof(unsigned int)));
 	memcpy(&spirv[0], &glslangSpirv[0], spirv.getSizeInBytes());
 	memcpy(&spirv[0], &glslangSpirv[0], spirv.getSizeInBytes());
 
 
 	return Error::NONE;
 	return Error::NONE;
@@ -416,7 +416,7 @@ Error ShaderCompiler::compile(CString source,
 		StringAuto out(m_alloc);
 		StringAuto out(m_alloc);
 		ANKI_CHECK(preprocessCommon(finalSrc.toCString(), options, out));
 		ANKI_CHECK(preprocessCommon(finalSrc.toCString(), options, out));
 
 
-		bin.resize(out.getLength() + 1);
+		bin.resize(U32(out.getLength() + 1));
 		memcpy(&bin[0], &out[0], bin.getSizeInBytes());
 		memcpy(&bin[0], &out[0], bin.getSizeInBytes());
 #endif
 #endif
 	}
 	}
@@ -518,7 +518,7 @@ Error ShaderCompilerCache::compileInternal(CString source,
 		ANKI_CHECK(file.open(fname.toCString(), FileOpenFlag::READ | FileOpenFlag::BINARY));
 		ANKI_CHECK(file.open(fname.toCString(), FileOpenFlag::READ | FileOpenFlag::BINARY));
 
 
 		PtrSize size = file.getSize();
 		PtrSize size = file.getSize();
-		bin.resize(size);
+		bin.resize(U32(size));
 		ANKI_CHECK(file.read(&bin[0], bin.getSize()));
 		ANKI_CHECK(file.read(&bin[0], bin.getSize()));
 	}
 	}
 	else
 	else

+ 16 - 16
src/anki/gr/vulkan/CommandBufferImpl.cpp

@@ -408,12 +408,12 @@ void CommandBufferImpl::flushBarriers()
 	if(m_imgBarrierCount > 0)
 	if(m_imgBarrierCount > 0)
 	{
 	{
 		DynamicArrayAuto<VkImageMemoryBarrier> squashedBarriers(m_alloc);
 		DynamicArrayAuto<VkImageMemoryBarrier> squashedBarriers(m_alloc);
-		U squashedBarrierCount = 0;
+		U32 squashedBarrierCount = 0;
 
 
 		squashedBarriers.create(m_imgBarrierCount);
 		squashedBarriers.create(m_imgBarrierCount);
 
 
 		// Squash the mips by reducing the barriers
 		// Squash the mips by reducing the barriers
-		for(U i = 0; i < m_imgBarrierCount; ++i)
+		for(U32 i = 0; i < m_imgBarrierCount; ++i)
 		{
 		{
 			const VkImageMemoryBarrier* prev = (i > 0) ? &m_imgBarriers[i - 1] : nullptr;
 			const VkImageMemoryBarrier* prev = (i > 0) ? &m_imgBarriers[i - 1] : nullptr;
 			const VkImageMemoryBarrier& crnt = m_imgBarriers[i];
 			const VkImageMemoryBarrier& crnt = m_imgBarriers[i];
@@ -443,7 +443,7 @@ void CommandBufferImpl::flushBarriers()
 		// Squash the layers
 		// Squash the layers
 		finalImgBarriers.create(squashedBarrierCount);
 		finalImgBarriers.create(squashedBarrierCount);
 
 
-		for(U i = 0; i < squashedBarrierCount; ++i)
+		for(U32 i = 0; i < squashedBarrierCount; ++i)
 		{
 		{
 			const VkImageMemoryBarrier* prev = (i > 0) ? &squashedBarriers[i - 1] : nullptr;
 			const VkImageMemoryBarrier* prev = (i > 0) ? &squashedBarriers[i - 1] : nullptr;
 			const VkImageMemoryBarrier& crnt = squashedBarriers[i];
 			const VkImageMemoryBarrier& crnt = squashedBarriers[i];
@@ -514,7 +514,7 @@ void CommandBufferImpl::flushQueryResets()
 	U32 firstQuery = m_queryResetAtoms[0].m_queryIdx;
 	U32 firstQuery = m_queryResetAtoms[0].m_queryIdx;
 	U32 queryCount = 1;
 	U32 queryCount = 1;
 	VkQueryPool pool = m_queryResetAtoms[0].m_pool;
 	VkQueryPool pool = m_queryResetAtoms[0].m_pool;
-	for(U i = 1; i < m_queryResetAtomCount; ++i)
+	for(U32 i = 1; i < m_queryResetAtomCount; ++i)
 	{
 	{
 		const QueryResetAtom& crnt = m_queryResetAtoms[i];
 		const QueryResetAtom& crnt = m_queryResetAtoms[i];
 		const QueryResetAtom& prev = m_queryResetAtoms[i - 1];
 		const QueryResetAtom& prev = m_queryResetAtoms[i - 1];
@@ -575,7 +575,7 @@ void CommandBufferImpl::flushWriteQueryResults()
 	VkQueryPool pool = m_writeQueryAtoms[0].m_pool;
 	VkQueryPool pool = m_writeQueryAtoms[0].m_pool;
 	PtrSize offset = m_writeQueryAtoms[0].m_offset;
 	PtrSize offset = m_writeQueryAtoms[0].m_offset;
 	VkBuffer buff = m_writeQueryAtoms[0].m_buffer;
 	VkBuffer buff = m_writeQueryAtoms[0].m_buffer;
-	for(U i = 1; i < m_writeQueryAtoms.getSize(); ++i)
+	for(U32 i = 1; i < m_writeQueryAtoms.getSize(); ++i)
 	{
 	{
 		const WriteQueryAtom& crnt = m_writeQueryAtoms[i];
 		const WriteQueryAtom& crnt = m_writeQueryAtoms[i];
 		const WriteQueryAtom& prev = m_writeQueryAtoms[i - 1];
 		const WriteQueryAtom& prev = m_writeQueryAtoms[i - 1];
@@ -671,25 +671,25 @@ void CommandBufferImpl::copyBufferToTextureViewInternal(
 
 
 		// Copy to shadow buffer in batches. If the number of pixels is high and we do a single vkCmdCopyBuffer we will
 		// Copy to shadow buffer in batches. If the number of pixels is high and we do a single vkCmdCopyBuffer we will
 		// need many regions. That allocation will be huge so do the copies in batches.
 		// need many regions. That allocation will be huge so do the copies in batches.
-		const U regionCount = width * height * depth;
-		const U REGIONS_PER_CMD_COPY_BUFFER = 32;
-		const U cmdCopyBufferCount = (regionCount + REGIONS_PER_CMD_COPY_BUFFER - 1) / REGIONS_PER_CMD_COPY_BUFFER;
-		for(U cmdCopyBuffer = 0; cmdCopyBuffer < cmdCopyBufferCount; ++cmdCopyBuffer)
+		const U32 regionCount = width * height * depth;
+		const U32 REGIONS_PER_CMD_COPY_BUFFER = 32;
+		const U32 cmdCopyBufferCount = (regionCount + REGIONS_PER_CMD_COPY_BUFFER - 1) / REGIONS_PER_CMD_COPY_BUFFER;
+		for(U32 cmdCopyBuffer = 0; cmdCopyBuffer < cmdCopyBufferCount; ++cmdCopyBuffer)
 		{
 		{
-			const U beginRegion = cmdCopyBuffer * REGIONS_PER_CMD_COPY_BUFFER;
-			const U endRegion = min(regionCount, (cmdCopyBuffer + 1) * REGIONS_PER_CMD_COPY_BUFFER);
+			const U32 beginRegion = cmdCopyBuffer * REGIONS_PER_CMD_COPY_BUFFER;
+			const U32 endRegion = min(regionCount, (cmdCopyBuffer + 1) * REGIONS_PER_CMD_COPY_BUFFER);
 			ANKI_ASSERT(beginRegion < regionCount);
 			ANKI_ASSERT(beginRegion < regionCount);
 			ANKI_ASSERT(endRegion <= regionCount);
 			ANKI_ASSERT(endRegion <= regionCount);
 
 
-			const U crntRegionCount = endRegion - beginRegion;
+			const U32 crntRegionCount = endRegion - beginRegion;
 			DynamicArrayAuto<VkBufferCopy> regions(m_alloc);
 			DynamicArrayAuto<VkBufferCopy> regions(m_alloc);
 			regions.create(crntRegionCount);
 			regions.create(crntRegionCount);
 
 
 			// Populate regions
 			// Populate regions
-			U count = 0;
-			for(U regionIdx = beginRegion; regionIdx < endRegion; ++regionIdx)
+			U32 count = 0;
+			for(U32 regionIdx = beginRegion; regionIdx < endRegion; ++regionIdx)
 			{
 			{
-				U x, y, d;
+				U32 x, y, d;
 				unflatten3dArrayIndex(width, height, depth, regionIdx, x, y, d);
 				unflatten3dArrayIndex(width, height, depth, regionIdx, x, y, d);
 
 
 				VkBufferCopy& c = regions[count++];
 				VkBufferCopy& c = regions[count++];
@@ -711,7 +711,7 @@ void CommandBufferImpl::copyBufferToTextureViewInternal(
 			ANKI_CMD(vkCmdCopyBuffer(m_handle,
 			ANKI_CMD(vkCmdCopyBuffer(m_handle,
 						 static_cast<const BufferImpl&>(*buff).getHandle(),
 						 static_cast<const BufferImpl&>(*buff).getHandle(),
 						 shadowHandle,
 						 shadowHandle,
-						 U32(regions.getSize()),
+						 regions.getSize(),
 						 &regions[0]),
 						 &regions[0]),
 				ANY_OTHER_COMMAND);
 				ANY_OTHER_COMMAND);
 		}
 		}

+ 4 - 4
src/anki/gr/vulkan/CommandBufferImpl.inl.h

@@ -114,7 +114,7 @@ inline void CommandBufferImpl::setImageBarrier(VkPipelineStageFlags srcStage,
 
 
 	if(m_imgBarriers.getSize() <= m_imgBarrierCount)
 	if(m_imgBarriers.getSize() <= m_imgBarrierCount)
 	{
 	{
-		m_imgBarriers.resize(m_alloc, max<U>(2, m_imgBarrierCount * 2));
+		m_imgBarriers.resize(m_alloc, max<U32>(2, m_imgBarrierCount * 2));
 	}
 	}
 
 
 	m_imgBarriers[m_imgBarrierCount++] = inf;
 	m_imgBarriers[m_imgBarrierCount++] = inf;
@@ -230,7 +230,7 @@ inline void CommandBufferImpl::setBufferBarrier(VkPipelineStageFlags srcStage,
 
 
 	if(m_buffBarriers.getSize() <= m_buffBarrierCount)
 	if(m_buffBarriers.getSize() <= m_buffBarrierCount)
 	{
 	{
-		m_buffBarriers.resize(m_alloc, max<U>(2, m_buffBarrierCount * 2));
+		m_buffBarriers.resize(m_alloc, max<U32>(2, m_buffBarrierCount * 2));
 	}
 	}
 
 
 	m_buffBarriers[m_buffBarrierCount++] = b;
 	m_buffBarriers[m_buffBarrierCount++] = b;
@@ -367,7 +367,7 @@ inline void CommandBufferImpl::resetOcclusionQuery(OcclusionQueryPtr query)
 
 
 	if(m_queryResetAtoms.getSize() <= m_queryResetAtomCount)
 	if(m_queryResetAtoms.getSize() <= m_queryResetAtomCount)
 	{
 	{
-		m_queryResetAtoms.resize(m_alloc, max<U>(2, m_queryResetAtomCount * 2));
+		m_queryResetAtoms.resize(m_alloc, max<U32>(2, m_queryResetAtomCount * 2));
 	}
 	}
 
 
 	QueryResetAtom atom;
 	QueryResetAtom atom;
@@ -467,7 +467,7 @@ inline void CommandBufferImpl::pushSecondLevelCommandBuffer(CommandBufferPtr cmd
 
 
 	if(m_secondLevelAtoms.getSize() <= m_secondLevelAtomCount)
 	if(m_secondLevelAtoms.getSize() <= m_secondLevelAtomCount)
 	{
 	{
-		m_secondLevelAtoms.resize(m_alloc, max<U>(8, m_secondLevelAtomCount * 2));
+		m_secondLevelAtoms.resize(m_alloc, max<U32>(8, m_secondLevelAtomCount * 2));
 	}
 	}
 
 
 	m_secondLevelAtoms[m_secondLevelAtomCount++] = static_cast<const CommandBufferImpl&>(*cmdb).m_handle;
 	m_secondLevelAtoms[m_secondLevelAtomCount++] = static_cast<const CommandBufferImpl&>(*cmdb).m_handle;

+ 7 - 7
src/anki/gr/vulkan/DescriptorSet.cpp

@@ -334,8 +334,8 @@ void DSThreadAllocator::writeSet(const Array<AnyBindingExtended, MAX_BINDINGS_PE
 	}
 	}
 
 
 	// Second pass: Populate the VkWriteDescriptorSet with VkDescriptorImageInfo and VkDescriptorBufferInfo
 	// Second pass: Populate the VkWriteDescriptorSet with VkDescriptorImageInfo and VkDescriptorBufferInfo
-	U texCounter = 0;
-	U buffCounter = 0;
+	U32 texCounter = 0;
+	U32 buffCounter = 0;
 
 
 	VkWriteDescriptorSet writeTemplate = {};
 	VkWriteDescriptorSet writeTemplate = {};
 	writeTemplate.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
 	writeTemplate.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
@@ -378,7 +378,7 @@ void DSThreadAllocator::writeSet(const Array<AnyBindingExtended, MAX_BINDINGS_PE
 
 
 	// Write
 	// Write
 	vkUpdateDescriptorSets(m_layoutEntry->m_factory->m_dev,
 	vkUpdateDescriptorSets(m_layoutEntry->m_factory->m_dev,
-		U32(writeInfos.getSize()),
+		writeInfos.getSize(),
 		(writeInfos.getSize() > 0) ? &writeInfos[0] : nullptr,
 		(writeInfos.getSize() > 0) ? &writeInfos[0] : nullptr,
 		0,
 		0,
 		nullptr);
 		nullptr);
@@ -672,7 +672,7 @@ Error DescriptorSetFactory::newDescriptorSetLayout(const DescriptorSetLayoutInit
 {
 {
 	// Compute the hash for the layout
 	// Compute the hash for the layout
 	Array<DescriptorBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET> bindings;
 	Array<DescriptorBinding, MAX_BINDINGS_PER_DESCRIPTOR_SET> bindings;
-	U32 bindingCount = U32(init.m_bindings.getSize());
+	U32 bindingCount = init.m_bindings.getSize();
 	U64 hash;
 	U64 hash;
 
 
 	if(init.m_bindings.getSize() > 0)
 	if(init.m_bindings.getSize() > 0)
@@ -848,7 +848,7 @@ Error BindlessDescriptorSet::init(const GrAllocator<U8>& alloc, VkDevice dev)
 		m_freeTexIndices.create(m_alloc, MAX_BINDLESS_TEXTURES);
 		m_freeTexIndices.create(m_alloc, MAX_BINDLESS_TEXTURES);
 		m_freeTexIndexCount = U16(m_freeTexIndices.getSize());
 		m_freeTexIndexCount = U16(m_freeTexIndices.getSize());
 
 
-		for(U i = 0; i < m_freeTexIndices.getSize(); ++i)
+		for(U32 i = 0; i < m_freeTexIndices.getSize(); ++i)
 		{
 		{
 			m_freeTexIndices[i] = U16(m_freeTexIndices.getSize() - i - 1);
 			m_freeTexIndices[i] = U16(m_freeTexIndices.getSize() - i - 1);
 		}
 		}
@@ -856,7 +856,7 @@ Error BindlessDescriptorSet::init(const GrAllocator<U8>& alloc, VkDevice dev)
 		m_freeImgIndices.create(m_alloc, MAX_BINDLESS_IMAGES);
 		m_freeImgIndices.create(m_alloc, MAX_BINDLESS_IMAGES);
 		m_freeImgIndexCount = U16(m_freeImgIndices.getSize());
 		m_freeImgIndexCount = U16(m_freeImgIndices.getSize());
 
 
-		for(U i = 0; i < m_freeImgIndices.getSize(); ++i)
+		for(U32 i = 0; i < m_freeImgIndices.getSize(); ++i)
 		{
 		{
 			m_freeImgIndices[i] = U16(m_freeImgIndices.getSize() - i - 1);
 			m_freeImgIndices[i] = U16(m_freeImgIndices.getSize() - i - 1);
 		}
 		}
@@ -962,7 +962,7 @@ void BindlessDescriptorSet::unbindCommon(U32 idx, DynamicArray<U16>& freeIndices
 	std::sort(&freeIndices[0], &freeIndices[0] + freeIndexCount, std::greater<U16>());
 	std::sort(&freeIndices[0], &freeIndices[0] + freeIndexCount, std::greater<U16>());
 
 
 	// Make sure there are no duplicates
 	// Make sure there are no duplicates
-	for(U i = 1; i < freeIndexCount; ++i)
+	for(U32 i = 1; i < freeIndexCount; ++i)
 	{
 	{
 		ANKI_ASSERT(freeIndices[i] != freeIndices[i - 1]);
 		ANKI_ASSERT(freeIndices[i] != freeIndices[i - 1]);
 	}
 	}

+ 4 - 4
src/anki/gr/vulkan/FenceFactory.cpp

@@ -10,7 +10,7 @@ namespace anki
 
 
 void FenceFactory::destroy()
 void FenceFactory::destroy()
 {
 {
-	for(U i = 0; i < m_fenceCount; ++i)
+	for(U32 i = 0; i < m_fenceCount; ++i)
 	{
 	{
 		m_alloc.deleteInstance(m_fences[i]);
 		m_alloc.deleteInstance(m_fences[i]);
 	}
 	}
@@ -24,7 +24,7 @@ MicroFence* FenceFactory::newFence()
 
 
 	LockGuard<Mutex> lock(m_mtx);
 	LockGuard<Mutex> lock(m_mtx);
 
 
-	U count = m_fenceCount;
+	U32 count = m_fenceCount;
 	while(count--)
 	while(count--)
 	{
 	{
 		VkResult status;
 		VkResult status;
@@ -35,7 +35,7 @@ MicroFence* FenceFactory::newFence()
 			ANKI_VK_CHECKF(vkResetFences(m_dev, 1, &m_fences[count]->getHandle()));
 			ANKI_VK_CHECKF(vkResetFences(m_dev, 1, &m_fences[count]->getHandle()));
 
 
 			// Pop it
 			// Pop it
-			for(U i = count; i < m_fenceCount - 1; ++i)
+			for(U32 i = count; i < m_fenceCount - 1; ++i)
 			{
 			{
 				m_fences[i] = m_fences[i + 1];
 				m_fences[i] = m_fences[i + 1];
 			}
 			}
@@ -69,7 +69,7 @@ void FenceFactory::deleteFence(MicroFence* fence)
 	if(m_fences.getSize() <= m_fenceCount)
 	if(m_fences.getSize() <= m_fenceCount)
 	{
 	{
 		// Grow storage
 		// Grow storage
-		m_fences.resize(m_alloc, max<U>(1, m_fences.getSize() * 2));
+		m_fences.resize(m_alloc, max<U32>(1, m_fences.getSize() * 2));
 	}
 	}
 
 
 	m_fences[m_fenceCount] = fence;
 	m_fences[m_fenceCount] = fence;

+ 4 - 4
src/anki/gr/vulkan/GpuMemoryManager.cpp

@@ -198,7 +198,7 @@ void GpuMemoryManager::init(VkPhysicalDevice pdev, VkDevice dev, GrAllocator<U8>
 	m_alloc = alloc;
 	m_alloc = alloc;
 
 
 	m_ifaces.create(alloc, m_memoryProperties.memoryTypeCount);
 	m_ifaces.create(alloc, m_memoryProperties.memoryTypeCount);
-	for(U i = 0; i < m_ifaces.getSize(); ++i)
+	for(U32 i = 0; i < m_ifaces.getSize(); ++i)
 	{
 	{
 		Interface& iface = m_ifaces[i];
 		Interface& iface = m_ifaces[i];
 
 
@@ -209,12 +209,12 @@ void GpuMemoryManager::init(VkPhysicalDevice pdev, VkDevice dev, GrAllocator<U8>
 
 
 	// One allocator per type per linear/non-linear resources
 	// One allocator per type per linear/non-linear resources
 	m_callocs.create(alloc, m_memoryProperties.memoryTypeCount * 2);
 	m_callocs.create(alloc, m_memoryProperties.memoryTypeCount * 2);
-	for(U i = 0; i < m_callocs.getSize(); ++i)
+	for(U32 i = 0; i < m_callocs.getSize(); ++i)
 	{
 	{
 		m_callocs[i].init(m_alloc, &m_ifaces[i / 2]);
 		m_callocs[i].init(m_alloc, &m_ifaces[i / 2]);
 
 
-		const U memTypeIdx = i / 2;
-		const U heapIdx = m_memoryProperties.memoryTypes[memTypeIdx].heapIndex;
+		const U32 memTypeIdx = i / 2;
+		const U32 heapIdx = m_memoryProperties.memoryTypes[memTypeIdx].heapIndex;
 		m_callocs[i].m_isDeviceMemory =
 		m_callocs[i].m_isDeviceMemory =
 			!!(m_memoryProperties.memoryHeaps[heapIdx].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT);
 			!!(m_memoryProperties.memoryHeaps[heapIdx].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT);
 	}
 	}

+ 7 - 7
src/anki/gr/vulkan/GrManagerImpl.cpp

@@ -254,7 +254,7 @@ Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 			U32 layersToEnableCount = 0;
 			U32 layersToEnableCount = 0;
 			for(const char* c : LAYERS)
 			for(const char* c : LAYERS)
 			{
 			{
-				for(U i = 0; i < count; ++i)
+				for(U32 i = 0; i < count; ++i)
 				{
 				{
 					if(CString(c) == layerProps[i].layerName)
 					if(CString(c) == layerProps[i].layerName)
 					{
 					{
@@ -267,7 +267,7 @@ Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 			if(layersToEnableCount)
 			if(layersToEnableCount)
 			{
 			{
 				ANKI_VK_LOGI("Will enable the following layers:");
 				ANKI_VK_LOGI("Will enable the following layers:");
-				for(U i = 0; i < layersToEnableCount; ++i)
+				for(U32 i = 0; i < layersToEnableCount; ++i)
 				{
 				{
 					ANKI_VK_LOGI("\t%s", layersToEnable[i]);
 					ANKI_VK_LOGI("\t%s", layersToEnable[i]);
 				}
 				}
@@ -290,14 +290,14 @@ Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 		vkEnumerateInstanceExtensionProperties(nullptr, &extCount, &instExtensionInf[0]);
 		vkEnumerateInstanceExtensionProperties(nullptr, &extCount, &instExtensionInf[0]);
 
 
 		ANKI_VK_LOGI("Found the following instance extensions:");
 		ANKI_VK_LOGI("Found the following instance extensions:");
-		for(U i = 0; i < extCount; ++i)
+		for(U32 i = 0; i < extCount; ++i)
 		{
 		{
 			ANKI_VK_LOGI("\t%s", instExtensionInf[i].extensionName);
 			ANKI_VK_LOGI("\t%s", instExtensionInf[i].extensionName);
 		}
 		}
 
 
 		U32 instExtensionCount = 0;
 		U32 instExtensionCount = 0;
 
 
-		for(U i = 0; i < extCount; ++i)
+		for(U32 i = 0; i < extCount; ++i)
 		{
 		{
 #if ANKI_OS_LINUX
 #if ANKI_OS_LINUX
 			if(CString(instExtensionInf[i].extensionName) == VK_KHR_XCB_SURFACE_EXTENSION_NAME)
 			if(CString(instExtensionInf[i].extensionName) == VK_KHR_XCB_SURFACE_EXTENSION_NAME)
@@ -334,7 +334,7 @@ Error GrManagerImpl::initInstance(const GrManagerInitInfo& init)
 		if(instExtensionCount)
 		if(instExtensionCount)
 		{
 		{
 			ANKI_VK_LOGI("Will enable the following instance extensions:");
 			ANKI_VK_LOGI("Will enable the following instance extensions:");
-			for(U i = 0; i < instExtensionCount; ++i)
+			for(U32 i = 0; i < instExtensionCount; ++i)
 			{
 			{
 				ANKI_VK_LOGI("\t%s", instExtensions[i]);
 				ANKI_VK_LOGI("\t%s", instExtensions[i]);
 			}
 			}
@@ -504,7 +504,7 @@ Error GrManagerImpl::initDevice(const GrManagerInitInfo& init)
 		vkEnumerateDeviceExtensionProperties(m_physicalDevice, nullptr, &extCount, &extensionInfos[0]);
 		vkEnumerateDeviceExtensionProperties(m_physicalDevice, nullptr, &extCount, &extensionInfos[0]);
 
 
 		ANKI_VK_LOGI("Found the following device extensions:");
 		ANKI_VK_LOGI("Found the following device extensions:");
-		for(U i = 0; i < extCount; ++i)
+		for(U32 i = 0; i < extCount; ++i)
 		{
 		{
 			ANKI_VK_LOGI("\t%s", extensionInfos[i].extensionName);
 			ANKI_VK_LOGI("\t%s", extensionInfos[i].extensionName);
 		}
 		}
@@ -573,7 +573,7 @@ Error GrManagerImpl::initDevice(const GrManagerInitInfo& init)
 		}
 		}
 
 
 		ANKI_VK_LOGI("Will enable the following device extensions:");
 		ANKI_VK_LOGI("Will enable the following device extensions:");
-		for(U i = 0; i < extensionsToEnableCount; ++i)
+		for(U32 i = 0; i < extensionsToEnableCount; ++i)
 		{
 		{
 			ANKI_VK_LOGI("\t%s", extensionsToEnable[i]);
 			ANKI_VK_LOGI("\t%s", extensionsToEnable[i]);
 		}
 		}

+ 5 - 5
src/anki/gr/vulkan/MicroObjectRecycler.inl.h

@@ -13,7 +13,7 @@ inline void MicroObjectRecycler<T>::destroy()
 {
 {
 	LockGuard<Mutex> lock(m_mtx);
 	LockGuard<Mutex> lock(m_mtx);
 
 
-	U count = m_objectCount;
+	U32 count = m_objectCount;
 	while(count--)
 	while(count--)
 	{
 	{
 		T* obj = m_objects[count];
 		T* obj = m_objects[count];
@@ -35,7 +35,7 @@ inline void MicroObjectRecycler<T>::destroy()
 template<typename T>
 template<typename T>
 inline void MicroObjectRecycler<T>::releaseFences()
 inline void MicroObjectRecycler<T>::releaseFences()
 {
 {
-	U count = m_objectCount;
+	U32 count = m_objectCount;
 	while(count--)
 	while(count--)
 	{
 	{
 		T& obj = *m_objects[count];
 		T& obj = *m_objects[count];
@@ -56,7 +56,7 @@ inline T* MicroObjectRecycler<T>::findToReuse()
 	{
 	{
 		releaseFences();
 		releaseFences();
 
 
-		U count = m_objectCount;
+		U32 count = m_objectCount;
 		while(count--)
 		while(count--)
 		{
 		{
 			if(!m_objects[count]->getFence())
 			if(!m_objects[count]->getFence())
@@ -64,7 +64,7 @@ inline T* MicroObjectRecycler<T>::findToReuse()
 				out = m_objects[count];
 				out = m_objects[count];
 
 
 				// Pop it
 				// Pop it
-				for(U i = count; i < m_objectCount - 1; ++i)
+				for(U32 i = count; i < m_objectCount - 1; ++i)
 				{
 				{
 					m_objects[i] = m_objects[i + 1];
 					m_objects[i] = m_objects[i + 1];
 				}
 				}
@@ -101,7 +101,7 @@ inline void MicroObjectRecycler<T>::recycle(T* s)
 	if(m_objects.getSize() <= m_objectCount)
 	if(m_objects.getSize() <= m_objectCount)
 	{
 	{
 		// Grow storage
 		// Grow storage
-		m_objects.resize(m_alloc, max<U>(1, m_objects.getSize() * 2));
+		m_objects.resize(m_alloc, max<U32>(1, m_objects.getSize() * 2));
 	}
 	}
 
 
 	m_objects[m_objectCount] = s;
 	m_objects[m_objectCount] = s;

+ 2 - 2
src/anki/gr/vulkan/PipelineCache.cpp

@@ -19,7 +19,7 @@ Error PipelineCache::init(
 	m_dumpFilename.sprintf(alloc, "%s/vk_pipeline_cache", &cacheDir[0]);
 	m_dumpFilename.sprintf(alloc, "%s/vk_pipeline_cache", &cacheDir[0]);
 
 
 	// Try read the pipeline cache file.
 	// Try read the pipeline cache file.
-	DynamicArrayAuto<U8> diskDump(alloc);
+	DynamicArrayAuto<U8, PtrSize> diskDump(alloc);
 	if(fileExists(m_dumpFilename.toCString()))
 	if(fileExists(m_dumpFilename.toCString()))
 	{
 	{
 		File file;
 		File file;
@@ -93,7 +93,7 @@ Error PipelineCache::destroyInternal(VkDevice dev, VkPhysicalDevice pdev, GrAllo
 		if(size > 0)
 		if(size > 0)
 		{
 		{
 			// Read cache
 			// Read cache
-			DynamicArrayAuto<U8> cacheData(alloc);
+			DynamicArrayAuto<U8, PtrSize> cacheData(alloc);
 			cacheData.create(size);
 			cacheData.create(size);
 			ANKI_VK_CHECK(vkGetPipelineCacheData(dev, m_cacheHandle, &size, &cacheData[0]));
 			ANKI_VK_CHECK(vkGetPipelineCacheData(dev, m_cacheHandle, &size, &cacheData[0]));
 
 

+ 2 - 2
src/anki/gr/vulkan/ShaderImpl.cpp

@@ -115,7 +115,7 @@ void ShaderImpl::doReflection(ConstWeakArray<U8> spirv, SpecConstsVector& specCo
 	spirv_cross::ShaderResources rsrc = spvc.get_shader_resources();
 	spirv_cross::ShaderResources rsrc = spvc.get_shader_resources();
 	spirv_cross::ShaderResources rsrcActive = spvc.get_shader_resources(spvc.get_active_interface_variables());
 	spirv_cross::ShaderResources rsrcActive = spvc.get_shader_resources(spvc.get_active_interface_variables());
 
 
-	Array<U, MAX_DESCRIPTOR_SETS> counts = {{
+	Array<U32, MAX_DESCRIPTOR_SETS> counts = {{
 		0,
 		0,
 	}};
 	}};
 	Array2d<DescriptorBinding, MAX_DESCRIPTOR_SETS, MAX_BINDINGS_PER_DESCRIPTOR_SET> descriptors;
 	Array2d<DescriptorBinding, MAX_DESCRIPTOR_SETS, MAX_BINDINGS_PER_DESCRIPTOR_SET> descriptors;
@@ -178,7 +178,7 @@ void ShaderImpl::doReflection(ConstWeakArray<U8> spirv, SpecConstsVector& specCo
 	func(rsrc.storage_buffers, DescriptorType::STORAGE_BUFFER);
 	func(rsrc.storage_buffers, DescriptorType::STORAGE_BUFFER);
 	func(rsrc.storage_images, DescriptorType::IMAGE);
 	func(rsrc.storage_images, DescriptorType::IMAGE);
 
 
-	for(U set = 0; set < MAX_DESCRIPTOR_SETS; ++set)
+	for(U32 set = 0; set < MAX_DESCRIPTOR_SETS; ++set)
 	{
 	{
 		if(counts[set])
 		if(counts[set])
 		{
 		{

+ 6 - 6
src/anki/gr/vulkan/ShaderProgramImpl.cpp

@@ -34,9 +34,9 @@ Error ShaderProgramImpl::init(const ShaderProgramInitInfo& inf)
 	// Merge bindings
 	// Merge bindings
 	//
 	//
 	Array2d<DescriptorBinding, MAX_DESCRIPTOR_SETS, MAX_BINDINGS_PER_DESCRIPTOR_SET> bindings;
 	Array2d<DescriptorBinding, MAX_DESCRIPTOR_SETS, MAX_BINDINGS_PER_DESCRIPTOR_SET> bindings;
-	Array<U, MAX_DESCRIPTOR_SETS> counts = {};
-	U descriptorSetCount = 0;
-	for(U set = 0; set < MAX_DESCRIPTOR_SETS; ++set)
+	Array<U32, MAX_DESCRIPTOR_SETS> counts = {};
+	U32 descriptorSetCount = 0;
+	for(U32 set = 0; set < MAX_DESCRIPTOR_SETS; ++set)
 	{
 	{
 		for(ShaderType stype = ShaderType::FIRST; stype < ShaderType::COUNT; ++stype)
 		for(ShaderType stype = ShaderType::FIRST; stype < ShaderType::COUNT; ++stype)
 		{
 		{
@@ -51,10 +51,10 @@ Error ShaderProgramImpl::init(const ShaderProgramInitInfo& inf)
 
 
 			m_refl.m_activeBindingMask[set] |= simpl.m_activeBindingMask[set];
 			m_refl.m_activeBindingMask[set] |= simpl.m_activeBindingMask[set];
 
 
-			for(U i = 0; i < simpl.m_bindings[set].getSize(); ++i)
+			for(U32 i = 0; i < simpl.m_bindings[set].getSize(); ++i)
 			{
 			{
 				Bool bindingFound = false;
 				Bool bindingFound = false;
-				for(U j = 0; j < counts[set]; ++j)
+				for(U32 j = 0; j < counts[set]; ++j)
 				{
 				{
 					if(bindings[set][j].m_binding == simpl.m_bindings[set][i].m_binding)
 					if(bindings[set][j].m_binding == simpl.m_bindings[set][i].m_binding)
 					{
 					{
@@ -97,7 +97,7 @@ Error ShaderProgramImpl::init(const ShaderProgramInitInfo& inf)
 
 
 	// Create the descriptor set layouts
 	// Create the descriptor set layouts
 	//
 	//
-	for(U set = 0; set < descriptorSetCount; ++set)
+	for(U32 set = 0; set < descriptorSetCount; ++set)
 	{
 	{
 		DescriptorSetLayoutInitInfo inf;
 		DescriptorSetLayoutInitInfo inf;
 		inf.m_bindings = WeakArray<DescriptorBinding>((counts[set]) ? &bindings[set][0] : nullptr, counts[set]);
 		inf.m_bindings = WeakArray<DescriptorBinding>((counts[set]) ? &bindings[set][0] : nullptr, counts[set]);

+ 9 - 9
src/anki/importer/GltfImporter.cpp

@@ -236,7 +236,7 @@ Error GltfImporter::getExtras(const cgltf_extras& extras, HashMapAuto<CString, S
 		return Error::NONE;
 		return Error::NONE;
 	}
 	}
 
 
-	DynamicArrayAuto<char> json(m_alloc);
+	DynamicArrayAuto<char, PtrSize> json(m_alloc);
 	json.create(extrasSize + 1);
 	json.create(extrasSize + 1);
 	cgltf_result res = cgltf_copy_extras_json(m_gltf, &extras, &json[0], &extrasSize);
 	cgltf_result res = cgltf_copy_extras_json(m_gltf, &extras, &json[0], &extrasSize);
 	if(res != cgltf_result_success)
 	if(res != cgltf_result_success)
@@ -258,7 +258,7 @@ Error GltfImporter::getExtras(const cgltf_extras& extras, HashMapAuto<CString, S
 	}
 	}
 
 
 	DynamicArrayAuto<jsmntok_t> tokens(m_alloc);
 	DynamicArrayAuto<jsmntok_t> tokens(m_alloc);
-	tokens.create(tokenCount);
+	tokens.create(U32(tokenCount));
 
 
 	// Get tokens
 	// Get tokens
 	jsmn_init(&parser);
 	jsmn_init(&parser);
@@ -344,12 +344,12 @@ Error GltfImporter::parseArrayOfNumbers(CString str, DynamicArrayAuto<F64>& out,
 	StringListAuto list(m_alloc);
 	StringListAuto list(m_alloc);
 	list.splitString(str, ' ');
 	list.splitString(str, ' ');
 
 
-	out.create(list.getSize());
+	out.create(U32(list.getSize()));
 
 
 	Error err = Error::NONE;
 	Error err = Error::NONE;
 	auto it = list.getBegin();
 	auto it = list.getBegin();
 	auto end = list.getEnd();
 	auto end = list.getEnd();
-	U i = 0;
+	U32 i = 0;
 	while(it != end && !err)
 	while(it != end && !err)
 	{
 	{
 		err = it->toNumber(out[i++]);
 		err = it->toNumber(out[i++]);
@@ -862,7 +862,7 @@ Error GltfImporter::writeAnimation(const cgltf_animation& anim)
 				return Error::USER_DATA;
 				return Error::USER_DATA;
 			}
 			}
 
 
-			for(U i = 0; i < keys.getSize(); ++i)
+			for(U32 i = 0; i < keys.getSize(); ++i)
 			{
 			{
 				ANKI_CHECK(file.writeText("\t\t\t\t<key time=\"%f\">%f %f %f</key>\n",
 				ANKI_CHECK(file.writeText("\t\t\t\t<key time=\"%f\">%f %f %f</key>\n",
 					keys[i],
 					keys[i],
@@ -888,7 +888,7 @@ Error GltfImporter::writeAnimation(const cgltf_animation& anim)
 				return Error::USER_DATA;
 				return Error::USER_DATA;
 			}
 			}
 
 
-			for(U i = 0; i < keys.getSize(); ++i)
+			for(U32 i = 0; i < keys.getSize(); ++i)
 			{
 			{
 				ANKI_CHECK(file.writeText("\t\t\t\t<key time=\"%f\">%f %f %f %f</key>\n",
 				ANKI_CHECK(file.writeText("\t\t\t\t<key time=\"%f\">%f %f %f %f</key>\n",
 					keys[i],
 					keys[i],
@@ -915,7 +915,7 @@ Error GltfImporter::writeAnimation(const cgltf_animation& anim)
 				return Error::USER_DATA;
 				return Error::USER_DATA;
 			}
 			}
 
 
-			for(U i = 0; i < keys.getSize(); ++i)
+			for(U32 i = 0; i < keys.getSize(); ++i)
 			{
 			{
 				const F32 scaleEpsilon = 0.0001f;
 				const F32 scaleEpsilon = 0.0001f;
 				if(absolute(scales[i][0] - scales[i][1]) > scaleEpsilon
 				if(absolute(scales[i][0] - scales[i][1]) > scaleEpsilon
@@ -960,7 +960,7 @@ Error GltfImporter::writeSkeleton(const cgltf_skin& skin)
 
 
 	ANKI_CHECK(file.writeText("%s\n<skeleton>\n", XML_HEADER));
 	ANKI_CHECK(file.writeText("%s\n<skeleton>\n", XML_HEADER));
 
 
-	for(U i = 0; i < skin.joints_count; ++i)
+	for(U32 i = 0; i < skin.joints_count; ++i)
 	{
 	{
 		const cgltf_node& boneNode = *skin.joints[i];
 		const cgltf_node& boneNode = *skin.joints[i];
 
 
@@ -975,7 +975,7 @@ Error GltfImporter::writeSkeleton(const cgltf_skin& skin)
 
 
 		// Bone transform
 		// Bone transform
 		ANKI_CHECK(file.writeText("boneTransform=\""));
 		ANKI_CHECK(file.writeText("boneTransform=\""));
-		for(U j = 0; j < 16; j++)
+		for(U32 j = 0; j < 16; j++)
 		{
 		{
 			ANKI_CHECK(file.writeText("%f ", boneMats[i][j]));
 			ANKI_CHECK(file.writeText("%f ", boneMats[i][j]));
 		}
 		}

+ 35 - 35
src/anki/importer/GltfImporterMesh.cpp

@@ -136,17 +136,17 @@ struct WeightVertex
 
 
 static void reindexSubmesh(SubMesh& submesh, GenericMemoryPoolAllocator<U8> alloc)
 static void reindexSubmesh(SubMesh& submesh, GenericMemoryPoolAllocator<U8> alloc)
 {
 {
-	const PtrSize vertSize = sizeof(submesh.m_verts[0]);
+	const U32 vertSize = sizeof(submesh.m_verts[0]);
 
 
 	DynamicArrayAuto<U32> remap(alloc);
 	DynamicArrayAuto<U32> remap(alloc);
 	remap.create(submesh.m_verts.getSize(), 0);
 	remap.create(submesh.m_verts.getSize(), 0);
 
 
-	const PtrSize vertCount = meshopt_generateVertexRemap(&remap[0],
+	const U32 vertCount = U32(meshopt_generateVertexRemap(&remap[0],
 		&submesh.m_indices[0],
 		&submesh.m_indices[0],
 		submesh.m_indices.getSize(),
 		submesh.m_indices.getSize(),
 		&submesh.m_verts[0],
 		&submesh.m_verts[0],
 		submesh.m_verts.getSize(),
 		submesh.m_verts.getSize(),
-		vertSize);
+		vertSize));
 
 
 	DynamicArrayAuto<U32> newIdxArray(alloc);
 	DynamicArrayAuto<U32> newIdxArray(alloc);
 	newIdxArray.create(submesh.m_indices.getSize(), 0);
 	newIdxArray.create(submesh.m_indices.getSize(), 0);
@@ -197,12 +197,12 @@ static void optimizeSubmesh(SubMesh& submesh, GenericMemoryPoolAllocator<U8> all
 		DynamicArrayAuto<TempVertex> newVertArray(alloc);
 		DynamicArrayAuto<TempVertex> newVertArray(alloc);
 		newVertArray.create(submesh.m_verts.getSize());
 		newVertArray.create(submesh.m_verts.getSize());
 
 
-		const PtrSize newVertCount = meshopt_optimizeVertexFetch(&newVertArray[0],
+		const U32 newVertCount = U32(meshopt_optimizeVertexFetch(&newVertArray[0],
 			&submesh.m_indices[0], // Inplace
 			&submesh.m_indices[0], // Inplace
 			submesh.m_indices.getSize(),
 			submesh.m_indices.getSize(),
 			&submesh.m_verts[0],
 			&submesh.m_verts[0],
 			submesh.m_verts.getSize(),
 			submesh.m_verts.getSize(),
-			vertSize);
+			vertSize));
 
 
 		if(newVertCount != submesh.m_verts.getSize())
 		if(newVertCount != submesh.m_verts.getSize())
 		{
 		{
@@ -226,20 +226,20 @@ static void decimateSubmesh(F32 factor, SubMesh& submesh, GenericMemoryPoolAlloc
 
 
 	// Decimate
 	// Decimate
 	DynamicArrayAuto<U32> newIndices(alloc, submesh.m_indices.getSize());
 	DynamicArrayAuto<U32> newIndices(alloc, submesh.m_indices.getSize());
-	newIndices.resize(meshopt_simplify(&newIndices[0],
+	newIndices.resize(U32(meshopt_simplify(&newIndices[0],
 		&submesh.m_indices[0],
 		&submesh.m_indices[0],
 		submesh.m_indices.getSize(),
 		submesh.m_indices.getSize(),
 		&submesh.m_verts[0].m_position.x(),
 		&submesh.m_verts[0].m_position.x(),
 		submesh.m_verts.getSize(),
 		submesh.m_verts.getSize(),
 		sizeof(TempVertex),
 		sizeof(TempVertex),
 		targetIndexCount,
 		targetIndexCount,
-		1e-2f));
+		1e-2f)));
 
 
 	// Re-pack
 	// Re-pack
 	DynamicArrayAuto<U32> reindexedIndices(alloc);
 	DynamicArrayAuto<U32> reindexedIndices(alloc);
 	DynamicArrayAuto<TempVertex> newVerts(alloc);
 	DynamicArrayAuto<TempVertex> newVerts(alloc);
 	HashMapAuto<U32, U32> vertexStored(alloc);
 	HashMapAuto<U32, U32> vertexStored(alloc);
-	for(PtrSize idx = 0; idx < newIndices.getSize(); ++idx)
+	for(U32 idx = 0; idx < newIndices.getSize(); ++idx)
 	{
 	{
 		U32 newIdx;
 		U32 newIdx;
 		auto it = vertexStored.find(newIndices[idx]);
 		auto it = vertexStored.find(newIndices[idx]);
@@ -247,7 +247,7 @@ static void decimateSubmesh(F32 factor, SubMesh& submesh, GenericMemoryPoolAlloc
 		{
 		{
 			// Store the vertex
 			// Store the vertex
 			newVerts.emplaceBack(submesh.m_verts[newIndices[idx]]);
 			newVerts.emplaceBack(submesh.m_verts[newIndices[idx]]);
-			newIdx = U32(newVerts.getSize() - 1);
+			newIdx = newVerts.getSize() - 1;
 			vertexStored.emplace(newIndices[idx], newIdx);
 			vertexStored.emplace(newIndices[idx], newIdx);
 		}
 		}
 		else
 		else
@@ -308,7 +308,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		U vertCount = primitive->attributes[0].data->count;
+		U32 vertCount = U32(primitive->attributes[0].data->count);
 		submesh.m_verts.create(vertCount);
 		submesh.m_verts.create(vertCount);
 
 
 		//
 		//
@@ -320,7 +320,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		{
 		{
 			if(attrib->type == cgltf_attribute_type_position)
 			if(attrib->type == cgltf_attribute_type_position)
 			{
 			{
-				U count = 0;
+				U32 count = 0;
 				ANKI_CHECK(checkAttribute<Vec3>(*attrib));
 				ANKI_CHECK(checkAttribute<Vec3>(*attrib));
 				visitAccessor<Vec3>(*attrib->data, [&](const Vec3& pos) {
 				visitAccessor<Vec3>(*attrib->data, [&](const Vec3& pos) {
 					submesh.m_aabbMin = submesh.m_aabbMin.min(pos);
 					submesh.m_aabbMin = submesh.m_aabbMin.min(pos);
@@ -330,14 +330,14 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			}
 			}
 			else if(attrib->type == cgltf_attribute_type_normal)
 			else if(attrib->type == cgltf_attribute_type_normal)
 			{
 			{
-				U count = 0;
+				U32 count = 0;
 				ANKI_CHECK(checkAttribute<Vec3>(*attrib));
 				ANKI_CHECK(checkAttribute<Vec3>(*attrib));
 				visitAccessor<Vec3>(
 				visitAccessor<Vec3>(
 					*attrib->data, [&](const Vec3& normal) { submesh.m_verts[count++].m_normal = normal; });
 					*attrib->data, [&](const Vec3& normal) { submesh.m_verts[count++].m_normal = normal; });
 			}
 			}
 			else if(attrib->type == cgltf_attribute_type_texcoord && CString(attrib->name) == "TEXCOORD_0")
 			else if(attrib->type == cgltf_attribute_type_texcoord && CString(attrib->name) == "TEXCOORD_0")
 			{
 			{
-				U count = 0;
+				U32 count = 0;
 				ANKI_CHECK(checkAttribute<Vec2>(*attrib));
 				ANKI_CHECK(checkAttribute<Vec2>(*attrib));
 				visitAccessor<Vec2>(*attrib->data, [&](const Vec2& uv) {
 				visitAccessor<Vec2>(*attrib->data, [&](const Vec2& uv) {
 					maxUvDistance = max(maxUvDistance, max(uv.x(), uv.y()));
 					maxUvDistance = max(maxUvDistance, max(uv.x(), uv.y()));
@@ -347,7 +347,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			}
 			}
 			else if(attrib->type == cgltf_attribute_type_joints)
 			else if(attrib->type == cgltf_attribute_type_joints)
 			{
 			{
-				U count = 0;
+				U32 count = 0;
 				ANKI_CHECK(checkAttribute<U16Vec4>(*attrib));
 				ANKI_CHECK(checkAttribute<U16Vec4>(*attrib));
 				visitAccessor<U16Vec4>(
 				visitAccessor<U16Vec4>(
 					*attrib->data, [&](const U16Vec4& x) { submesh.m_verts[count++].m_boneIds = x; });
 					*attrib->data, [&](const U16Vec4& x) { submesh.m_verts[count++].m_boneIds = x; });
@@ -355,7 +355,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			}
 			}
 			else if(attrib->type == cgltf_attribute_type_weights)
 			else if(attrib->type == cgltf_attribute_type_weights)
 			{
 			{
-				U count = 0;
+				U32 count = 0;
 				ANKI_CHECK(checkAttribute<Vec4>(*attrib));
 				ANKI_CHECK(checkAttribute<Vec4>(*attrib));
 				visitAccessor<Vec4>(
 				visitAccessor<Vec4>(
 					*attrib->data, [&](const Vec4& bw) { submesh.m_verts[count++].m_boneWeights = bw; });
 					*attrib->data, [&](const Vec4& bw) { submesh.m_verts[count++].m_boneWeights = bw; });
@@ -374,12 +374,12 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		//
 		//
 		// Fix normals. If normal A and normal B have the same position then try to merge them
 		// Fix normals. If normal A and normal B have the same position then try to merge them
 		//
 		//
-		for(U v = 0; v < vertCount; ++v)
+		for(U32 v = 0; v < vertCount; ++v)
 		{
 		{
 			const Vec3& pos = submesh.m_verts[v].m_position;
 			const Vec3& pos = submesh.m_verts[v].m_position;
 			Vec3& normal = submesh.m_verts[v].m_normal;
 			Vec3& normal = submesh.m_verts[v].m_normal;
 
 
-			for(U prevV = 0; prevV < v; ++prevV)
+			for(U32 prevV = 0; prevV < v; ++prevV)
 			{
 			{
 				const Vec3& otherPos = submesh.m_verts[prevV].m_position;
 				const Vec3& otherPos = submesh.m_verts[prevV].m_position;
 
 
@@ -415,7 +415,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 				ANKI_GLTF_LOGE("Incorect index count: %d", primitive->indices->count);
 				ANKI_GLTF_LOGE("Incorect index count: %d", primitive->indices->count);
 				return Error::USER_DATA;
 				return Error::USER_DATA;
 			}
 			}
-			submesh.m_indices.create(primitive->indices->count);
+			submesh.m_indices.create(U32(primitive->indices->count));
 			const U8* base = static_cast<const U8*>(primitive->indices->buffer_view->buffer->data)
 			const U8* base = static_cast<const U8*>(primitive->indices->buffer_view->buffer->data)
 							 + primitive->indices->offset + primitive->indices->buffer_view->offset;
 							 + primitive->indices->offset + primitive->indices->buffer_view->offset;
 			for(U32 i = 0; i < primitive->indices->count; ++i)
 			for(U32 i = 0; i < primitive->indices->count; ++i)
@@ -455,11 +455,11 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			DynamicArrayAuto<Vec3> bitangents(m_alloc);
 			DynamicArrayAuto<Vec3> bitangents(m_alloc);
 			bitangents.create(vertCount, Vec3(0.0f));
 			bitangents.create(vertCount, Vec3(0.0f));
 
 
-			for(U i = 0; i < submesh.m_indices.getSize(); i += 3)
+			for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
 			{
 			{
-				const U i0 = submesh.m_indices[i + 0];
-				const U i1 = submesh.m_indices[i + 1];
-				const U i2 = submesh.m_indices[i + 2];
+				const U32 i0 = submesh.m_indices[i + 0];
+				const U32 i1 = submesh.m_indices[i + 1];
+				const U32 i2 = submesh.m_indices[i + 2];
 
 
 				const Vec3& v0 = submesh.m_verts[i0].m_position;
 				const Vec3& v0 = submesh.m_verts[i0].m_position;
 				const Vec3& v1 = submesh.m_verts[i1].m_position;
 				const Vec3& v1 = submesh.m_verts[i1].m_position;
@@ -503,7 +503,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 				bitangents[i2] += b;
 				bitangents[i2] += b;
 			}
 			}
 
 
-			for(U i = 0; i < vertCount; ++i)
+			for(U32 i = 0; i < vertCount; ++i)
 			{
 			{
 				Vec3 t = Vec3(submesh.m_verts[i].m_tangent.xyz());
 				Vec3 t = Vec3(submesh.m_verts[i].m_tangent.xyz());
 				const Vec3& n = submesh.m_verts[i].m_normal;
 				const Vec3& n = submesh.m_verts[i].m_normal;
@@ -547,9 +547,9 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		{
 		{
 			// Finalize
 			// Finalize
 			submesh.m_firstIdx = totalIndexCount;
 			submesh.m_firstIdx = totalIndexCount;
-			submesh.m_idxCount = U32(submesh.m_indices.getSize());
+			submesh.m_idxCount = submesh.m_indices.getSize();
 			totalIndexCount += submesh.m_idxCount;
 			totalIndexCount += submesh.m_idxCount;
-			totalVertexCount += U32(submesh.m_verts.getSize());
+			totalVertexCount += submesh.m_verts.getSize();
 		}
 		}
 	}
 	}
 
 
@@ -563,11 +563,11 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 	Bool convex = true;
 	Bool convex = true;
 	for(const SubMesh& submesh : submeshes)
 	for(const SubMesh& submesh : submeshes)
 	{
 	{
-		for(U i = 0; i < submesh.m_indices.getSize(); i += 3)
+		for(U32 i = 0; i < submesh.m_indices.getSize(); i += 3)
 		{
 		{
-			const U i0 = submesh.m_indices[i + 0];
-			const U i1 = submesh.m_indices[i + 1];
-			const U i2 = submesh.m_indices[i + 2];
+			const U32 i0 = submesh.m_indices[i + 0];
+			const U32 i1 = submesh.m_indices[i + 1];
+			const U32 i2 = submesh.m_indices[i + 2];
 
 
 			const Vec3& v0 = submesh.m_verts[i0].m_position;
 			const Vec3& v0 = submesh.m_verts[i0].m_position;
 			const Vec3& v1 = submesh.m_verts[i1].m_position;
 			const Vec3& v1 = submesh.m_verts[i1].m_position;
@@ -747,7 +747,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		}
 		}
 
 
 		ANKI_CHECK(file.write(&indices[0], indices.getSizeInBytes()));
 		ANKI_CHECK(file.write(&indices[0], indices.getSizeInBytes()));
-		vertCount += U32(submesh.m_verts.getSize());
+		vertCount += submesh.m_verts.getSize();
 	}
 	}
 
 
 	// Write first vert buffer
 	// Write first vert buffer
@@ -758,7 +758,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		{
 		{
 			DynamicArrayAuto<Vec3> positions(m_alloc);
 			DynamicArrayAuto<Vec3> positions(m_alloc);
 			positions.create(submesh.m_verts.getSize());
 			positions.create(submesh.m_verts.getSize());
-			for(U v = 0; v < submesh.m_verts.getSize(); ++v)
+			for(U32 v = 0; v < submesh.m_verts.getSize(); ++v)
 			{
 			{
 				positions[v] = submesh.m_verts[v].m_position;
 				positions[v] = submesh.m_verts[v].m_position;
 			}
 			}
@@ -769,7 +769,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			DynamicArrayAuto<HVec4> pos16(m_alloc);
 			DynamicArrayAuto<HVec4> pos16(m_alloc);
 			pos16.create(submesh.m_verts.getSize());
 			pos16.create(submesh.m_verts.getSize());
 
 
-			for(U v = 0; v < submesh.m_verts.getSize(); ++v)
+			for(U32 v = 0; v < submesh.m_verts.getSize(); ++v)
 			{
 			{
 				pos16[v] = HVec4(F16(submesh.m_verts[v].m_position.x()),
 				pos16[v] = HVec4(F16(submesh.m_verts[v].m_position.x()),
 					F16(submesh.m_verts[v].m_position.y()),
 					F16(submesh.m_verts[v].m_position.y()),
@@ -798,7 +798,7 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 		DynamicArrayAuto<Vert> verts(m_alloc);
 		DynamicArrayAuto<Vert> verts(m_alloc);
 		verts.create(submesh.m_verts.getSize());
 		verts.create(submesh.m_verts.getSize());
 
 
-		for(U i = 0; i < verts.getSize(); ++i)
+		for(U32 i = 0; i < verts.getSize(); ++i)
 		{
 		{
 			const Vec3& normal = submesh.m_verts[i].m_normal;
 			const Vec3& normal = submesh.m_verts[i].m_normal;
 			const Vec4& tangent = submesh.m_verts[i].m_tangent;
 			const Vec4& tangent = submesh.m_verts[i].m_tangent;
@@ -836,11 +836,11 @@ Error GltfImporter::writeMesh(const cgltf_mesh& mesh, CString nameOverride, F32
 			DynamicArrayAuto<WeightVertex> verts(m_alloc);
 			DynamicArrayAuto<WeightVertex> verts(m_alloc);
 			verts.create(submesh.m_verts.getSize());
 			verts.create(submesh.m_verts.getSize());
 
 
-			for(U i = 0; i < verts.getSize(); ++i)
+			for(U32 i = 0; i < verts.getSize(); ++i)
 			{
 			{
 				WeightVertex vert;
 				WeightVertex vert;
 
 
-				for(U c = 0; c < 4; ++c)
+				for(U32 c = 0; c < 4; ++c)
 				{
 				{
 					vert.m_boneIndices[c] = submesh.m_verts[i].m_boneIds[c];
 					vert.m_boneIndices[c] = submesh.m_verts[i].m_boneIds[c];
 					vert.m_weights[c] = U8(submesh.m_verts[i].m_boneWeights[c] * F32(MAX_U8));
 					vert.m_weights[c] = U8(submesh.m_verts[i].m_boneWeights[c] * F32(MAX_U8));

+ 5 - 5
src/anki/misc/Xml.cpp

@@ -49,7 +49,7 @@ Error XmlElement::getMat3(Mat3& out) const
 
 
 	if(!err)
 	if(!err)
 	{
 	{
-		for(U i = 0; i < 9 && !err; i++)
+		for(U32 i = 0; i < 9 && !err; i++)
 		{
 		{
 			out[i] = arr[i];
 			out[i] = arr[i];
 		}
 		}
@@ -76,7 +76,7 @@ Error XmlElement::getMat4(Mat4& out) const
 
 
 	if(!err)
 	if(!err)
 	{
 	{
-		for(U i = 0; i < 16 && !err; i++)
+		for(U32 i = 0; i < 16 && !err; i++)
 		{
 		{
 			out[i] = arr[i];
 			out[i] = arr[i];
 		}
 		}
@@ -103,7 +103,7 @@ Error XmlElement::getVec2(Vec2& out) const
 
 
 	if(!err)
 	if(!err)
 	{
 	{
-		for(U i = 0; i < 2; i++)
+		for(U32 i = 0; i < 2; i++)
 		{
 		{
 			out[i] = arr[i];
 			out[i] = arr[i];
 		}
 		}
@@ -130,7 +130,7 @@ Error XmlElement::getVec3(Vec3& out) const
 
 
 	if(!err)
 	if(!err)
 	{
 	{
-		for(U i = 0; i < 3; i++)
+		for(U32 i = 0; i < 3; i++)
 		{
 		{
 			out[i] = arr[i];
 			out[i] = arr[i];
 		}
 		}
@@ -157,7 +157,7 @@ Error XmlElement::getVec4(Vec4& out) const
 
 
 	if(!err)
 	if(!err)
 	{
 	{
-		for(U i = 0; i < 4; i++)
+		for(U32 i = 0; i < 4; i++)
 		{
 		{
 			out[i] = arr[i];
 			out[i] = arr[i];
 		}
 		}

+ 2 - 2
src/anki/misc/Xml.h

@@ -292,12 +292,12 @@ private:
 		list.splitString(txt, ' ');
 		list.splitString(txt, ' ');
 
 
 		out = DynamicArrayAuto<T>(m_alloc);
 		out = DynamicArrayAuto<T>(m_alloc);
-		out.create(list.getSize());
+		out.create(U32(list.getSize()));
 
 
 		Error err = Error::NONE;
 		Error err = Error::NONE;
 		auto it = list.getBegin();
 		auto it = list.getBegin();
 		auto end = list.getEnd();
 		auto end = list.getEnd();
-		U i = 0;
+		U32 i = 0;
 		while(it != end && !err)
 		while(it != end && !err)
 		{
 		{
 			err = it->toNumber(out[i++]);
 			err = it->toNumber(out[i++]);

+ 1 - 1
src/anki/physics/PhysicsCollisionShape.cpp

@@ -45,7 +45,7 @@ PhysicsTriangleSoup::PhysicsTriangleSoup(
 
 
 		m_mesh.init();
 		m_mesh.init();
 
 
-		for(U i = 0; i < indices.getSize(); i += 3)
+		for(U32 i = 0; i < indices.getSize(); i += 3)
 		{
 		{
 			m_mesh->addTriangle(
 			m_mesh->addTriangle(
 				toBt(positions[indices[i]]), toBt(positions[indices[i + 1]]), toBt(positions[indices[i + 2]]));
 				toBt(positions[indices[i]]), toBt(positions[indices[i + 1]]), toBt(positions[indices[i + 2]]));

+ 37 - 37
src/anki/renderer/ClusterBin.cpp

@@ -90,10 +90,10 @@ public:
 	{
 	{
 	}
 	}
 
 
-	WeakArray<U32> getClusterIndices(const U clusterZ)
+	WeakArray<U32> getClusterIndices(const U32 clusterZ)
 	{
 	{
 		ANKI_ASSERT(clusterZ < m_clusterCountZ);
 		ANKI_ASSERT(clusterZ < m_clusterCountZ);
-		const U perClusterCount = m_indices.getSize() / m_clusterCountZ;
+		const U32 perClusterCount = m_indices.getSize() / m_clusterCountZ;
 		return WeakArray<U32>(&m_indices[perClusterCount * clusterZ], perClusterCount);
 		return WeakArray<U32>(&m_indices[perClusterCount * clusterZ], perClusterCount);
 	}
 	}
 };
 };
@@ -259,8 +259,8 @@ void ClusterBin::prepare(BinCtx& ctx)
 void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 {
 {
 	ANKI_ASSERT(tileIdx < m_clusterCounts[0] * m_clusterCounts[1]);
 	ANKI_ASSERT(tileIdx < m_clusterCounts[0] * m_clusterCounts[1]);
-	const U tileX = tileIdx % m_clusterCounts[0];
-	const U tileY = tileIdx / m_clusterCounts[0];
+	const U32 tileX = tileIdx % m_clusterCounts[0];
+	const U32 tileY = tileIdx / m_clusterCounts[0];
 
 
 	// Compute the tile's cluster edges in view space
 	// Compute the tile's cluster edges in view space
 	WeakArray<Vec4> clusterEdgesVSpace(
 	WeakArray<Vec4> clusterEdgesVSpace(
@@ -275,7 +275,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 		for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2] + 1; ++clusterZ)
 		for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2] + 1; ++clusterZ)
 		{
 		{
 			const F32 zNear = -computeClusterNear(ctx.m_out->m_shaderMagicValues, clusterZ);
 			const F32 zNear = -computeClusterNear(ctx.m_out->m_shaderMagicValues, clusterZ);
-			const U idx = clusterZ * 4;
+			const U32 idx = clusterZ * 4;
 
 
 			clusterEdgesVSpace[idx + 0] = unproject(zNear, startNdc, unprojParams).xyz1();
 			clusterEdgesVSpace[idx + 0] = unproject(zNear, startNdc, unprojParams).xyz1();
 			clusterEdgesVSpace[idx + 1] = unproject(zNear, startNdc + Vec2(tileSize.x(), 0.0f), unprojParams).xyz1();
 			clusterEdgesVSpace[idx + 1] = unproject(zNear, startNdc + Vec2(tileSize.x(), 0.0f), unprojParams).xyz1();
@@ -286,9 +286,9 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 
 
 	// Transform the tile's cluster edges to world space
 	// Transform the tile's cluster edges to world space
 	DynamicArrayAuto<Vec4>& clusterEdgesWSpace = tileCtx.m_clusterEdgesWSpace;
 	DynamicArrayAuto<Vec4>& clusterEdgesWSpace = tileCtx.m_clusterEdgesWSpace;
-	for(U clusterZ = 0; clusterZ < m_clusterCounts[2] + 1; ++clusterZ)
+	for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2] + 1; ++clusterZ)
 	{
 	{
-		const U idx = clusterZ * 4;
+		const U32 idx = clusterZ * 4;
 		clusterEdgesWSpace[idx + 0] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 0]).xyz0();
 		clusterEdgesWSpace[idx + 0] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 0]).xyz0();
 		clusterEdgesWSpace[idx + 1] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 1]).xyz0();
 		clusterEdgesWSpace[idx + 1] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 1]).xyz0();
 		clusterEdgesWSpace[idx + 2] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 2]).xyz0();
 		clusterEdgesWSpace[idx + 2] = (ctx.m_in->m_renderQueue->m_cameraTransform * clusterEdgesVSpace[idx + 2]).xyz0();
@@ -297,8 +297,8 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 
 
 	// Compute the tile frustum
 	// Compute the tile frustum
 	Array<Plane, 4> frustumPlanes;
 	Array<Plane, 4> frustumPlanes;
-	const U lastQuartet = clusterEdgesWSpace.getSize() - 1 - 4;
-	const U beforeLastQuartet = lastQuartet - 4;
+	const U32 lastQuartet = clusterEdgesWSpace.getSize() - 1 - 4;
+	const U32 beforeLastQuartet = lastQuartet - 4;
 	frustumPlanes[0].setFrom3Points(clusterEdgesWSpace[beforeLastQuartet + 0],
 	frustumPlanes[0].setFrom3Points(clusterEdgesWSpace[beforeLastQuartet + 0],
 		clusterEdgesWSpace[beforeLastQuartet + 1],
 		clusterEdgesWSpace[beforeLastQuartet + 1],
 		clusterEdgesWSpace[lastQuartet + 0]);
 		clusterEdgesWSpace[lastQuartet + 0]);
@@ -315,12 +315,12 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 	// Compute the cluster AABBs and spheres
 	// Compute the cluster AABBs and spheres
 	DynamicArrayAuto<Aabb>& clusterBoxes = tileCtx.m_clusterBoxes;
 	DynamicArrayAuto<Aabb>& clusterBoxes = tileCtx.m_clusterBoxes;
 	DynamicArrayAuto<Sphere>& clusterSpheres = tileCtx.m_clusterSpheres;
 	DynamicArrayAuto<Sphere>& clusterSpheres = tileCtx.m_clusterSpheres;
-	for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+	for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 	{
 	{
 		// Compute an AABB and a sphere that contains the cluster
 		// Compute an AABB and a sphere that contains the cluster
 		Vec4 aabbMin(MAX_F32, MAX_F32, MAX_F32, 0.0f);
 		Vec4 aabbMin(MAX_F32, MAX_F32, MAX_F32, 0.0f);
 		Vec4 aabbMax(MIN_F32, MIN_F32, MIN_F32, 0.0f);
 		Vec4 aabbMax(MIN_F32, MIN_F32, MIN_F32, 0.0f);
-		for(U i = 0; i < 8; ++i)
+		for(U32 i = 0; i < 8; ++i)
 		{
 		{
 			aabbMin = aabbMin.min(clusterEdgesWSpace[clusterZ * 4 + i]);
 			aabbMin = aabbMin.min(clusterEdgesWSpace[clusterZ * 4 + i]);
 			aabbMax = aabbMax.max(clusterEdgesWSpace[clusterZ * 4 + i]);
 			aabbMax = aabbMax.max(clusterEdgesWSpace[clusterZ * 4 + i]);
@@ -360,7 +360,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 				continue;
 				continue;
 			}
 			}
 
 
-			for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+			for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 			{
 			{
 				if(!testCollision(lightSphere, clusterBoxes[clusterZ]))
 				if(!testCollision(lightSphere, clusterBoxes[clusterZ]))
 				{
 				{
@@ -390,7 +390,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 				continue;
 				continue;
 			}
 			}
 
 
-			for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+			for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 			{
 			{
 				if(!testCollision(clusterSpheres[clusterZ],
 				if(!testCollision(clusterSpheres[clusterZ],
 					   Cone(slight.m_worldTransform.getTranslationPart().xyz0(),
 					   Cone(slight.m_worldTransform.getTranslationPart().xyz0(),
@@ -420,7 +420,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 				continue;
 				continue;
 			}
 			}
 
 
-			for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+			for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 			{
 			{
 				if(!testCollision(probeBox, clusterBoxes[clusterZ]))
 				if(!testCollision(probeBox, clusterBoxes[clusterZ]))
 				{
 				{
@@ -446,7 +446,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 				continue;
 				continue;
 			}
 			}
 
 
-			for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+			for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 			{
 			{
 				if(!testCollision(probeBox, clusterBoxes[clusterZ]))
 				if(!testCollision(probeBox, clusterBoxes[clusterZ]))
 				{
 				{
@@ -473,7 +473,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 				continue;
 				continue;
 			}
 			}
 
 
-			for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+			for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 			{
 			{
 				if(!testCollision(decalBox, clusterBoxes[clusterZ]))
 				if(!testCollision(decalBox, clusterBoxes[clusterZ]))
 				{
 				{
@@ -502,7 +502,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 					continue;
 					continue;
 				}
 				}
 
 
-				for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+				for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 				{
 				{
 					if(!testCollision(box, clusterBoxes[clusterZ]))
 					if(!testCollision(box, clusterBoxes[clusterZ]))
 					{
 					{
@@ -523,7 +523,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 					continue;
 					continue;
 				}
 				}
 
 
-				for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+				for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 				{
 				{
 					if(!testCollision(sphere, clusterBoxes[clusterZ]))
 					if(!testCollision(sphere, clusterBoxes[clusterZ]))
 					{
 					{
@@ -537,7 +537,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 	}
 	}
 
 
 	// Upload the indices for all clusters of the tile
 	// Upload the indices for all clusters of the tile
-	for(U clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
+	for(U32 clusterZ = 0; clusterZ < m_clusterCounts[2]; ++clusterZ)
 	{
 	{
 		WeakArray<U32> inIndices = tileCtx.getClusterIndices(clusterZ);
 		WeakArray<U32> inIndices = tileCtx.getClusterIndices(clusterZ);
 		const ClusterBin::TileCtx::ClusterMetaInfo& inf = tileCtx.m_clusterInfos[clusterZ];
 		const ClusterBin::TileCtx::ClusterMetaInfo& inf = tileCtx.m_clusterInfos[clusterZ];
@@ -554,18 +554,18 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 
 
 		// Write the offsets
 		// Write the offsets
 		U32 offset = firstIndex + TYPED_OBJECT_COUNT - 1;
 		U32 offset = firstIndex + TYPED_OBJECT_COUNT - 1;
-		for(U i = 1; i < TYPED_OBJECT_COUNT; ++i)
+		for(U32 i = 1; i < TYPED_OBJECT_COUNT; ++i)
 		{
 		{
 			offset += inf.m_counts[i - 1] + 1; // Count plus the stop
 			offset += inf.m_counts[i - 1] + 1; // Count plus the stop
 			outIndices[i - 1] = offset;
 			outIndices[i - 1] = offset;
 		}
 		}
 
 
 		// Write indices
 		// Write indices
-		U outIndicesOffset = TYPED_OBJECT_COUNT - 1;
-		U inIndicesOffset = 0;
-		for(U i = 0; i < TYPED_OBJECT_COUNT; ++i)
+		U32 outIndicesOffset = TYPED_OBJECT_COUNT - 1;
+		U32 inIndicesOffset = 0;
+		for(U32 i = 0; i < TYPED_OBJECT_COUNT; ++i)
 		{
 		{
-			for(U c = 0; c < inf.m_counts[i]; ++c)
+			for(U32 c = 0; c < inf.m_counts[i]; ++c)
 			{
 			{
 				outIndices[outIndicesOffset++] = inIndices[inIndicesOffset++];
 				outIndices[outIndicesOffset++] = inIndices[inIndicesOffset++];
 			}
 			}
@@ -577,7 +577,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 		ANKI_ASSERT(outIndicesOffset == indexCountPlusOther);
 		ANKI_ASSERT(outIndicesOffset == indexCountPlusOther);
 
 
 		// Write the cluster
 		// Write the cluster
-		const U clusterIndex =
+		const U32 clusterIndex =
 			clusterZ * (m_clusterCounts[0] * m_clusterCounts[1]) + tileY * m_clusterCounts[0] + tileX;
 			clusterZ * (m_clusterCounts[0] * m_clusterCounts[1]) + tileY * m_clusterCounts[0] + tileX;
 		ctx.m_clusters[clusterIndex] = firstIndex + TYPED_OBJECT_COUNT - 1; // Points to the first object
 		ctx.m_clusters[clusterIndex] = firstIndex + TYPED_OBJECT_COUNT - 1; // Points to the first object
 	}
 	}
@@ -588,7 +588,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	const RenderQueue& rqueue = *ctx.m_in->m_renderQueue;
 	const RenderQueue& rqueue = *ctx.m_in->m_renderQueue;
 
 
 	// Write the point lights
 	// Write the point lights
-	const U visiblePointLightCount = rqueue.m_pointLights.getSize();
+	const U32 visiblePointLightCount = rqueue.m_pointLights.getSize();
 	if(visiblePointLightCount)
 	if(visiblePointLightCount)
 	{
 	{
 		PointLight* data = static_cast<PointLight*>(ctx.m_in->m_stagingMem->allocateFrame(
 		PointLight* data = static_cast<PointLight*>(ctx.m_in->m_stagingMem->allocateFrame(
@@ -596,7 +596,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 
 
 		WeakArray<PointLight> gpuLights(data, visiblePointLightCount);
 		WeakArray<PointLight> gpuLights(data, visiblePointLightCount);
 
 
-		for(U i = 0; i < visiblePointLightCount; ++i)
+		for(U32 i = 0; i < visiblePointLightCount; ++i)
 		{
 		{
 			const PointLightQueueElement& in = rqueue.m_pointLights[i];
 			const PointLightQueueElement& in = rqueue.m_pointLights[i];
 			PointLight& out = gpuLights[i];
 			PointLight& out = gpuLights[i];
@@ -627,7 +627,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	}
 	}
 
 
 	// Write the spot lights
 	// Write the spot lights
-	const U visibleSpotLightCount = rqueue.m_spotLights.getSize();
+	const U32 visibleSpotLightCount = rqueue.m_spotLights.getSize();
 	if(visibleSpotLightCount)
 	if(visibleSpotLightCount)
 	{
 	{
 		SpotLight* data = static_cast<SpotLight*>(ctx.m_in->m_stagingMem->allocateFrame(
 		SpotLight* data = static_cast<SpotLight*>(ctx.m_in->m_stagingMem->allocateFrame(
@@ -635,7 +635,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 
 
 		WeakArray<SpotLight> gpuLights(data, visibleSpotLightCount);
 		WeakArray<SpotLight> gpuLights(data, visibleSpotLightCount);
 
 
-		for(U i = 0; i < visibleSpotLightCount; ++i)
+		for(U32 i = 0; i < visibleSpotLightCount; ++i)
 		{
 		{
 			const SpotLightQueueElement& in = rqueue.m_spotLights[i];
 			const SpotLightQueueElement& in = rqueue.m_spotLights[i];
 			SpotLight& out = gpuLights[i];
 			SpotLight& out = gpuLights[i];
@@ -674,7 +674,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	}
 	}
 
 
 	// Write the decals
 	// Write the decals
-	const U visibleDecalCount = rqueue.m_decals.getSize();
+	const U32 visibleDecalCount = rqueue.m_decals.getSize();
 	if(visibleDecalCount)
 	if(visibleDecalCount)
 	{
 	{
 		Decal* data = static_cast<Decal*>(ctx.m_in->m_stagingMem->allocateFrame(
 		Decal* data = static_cast<Decal*>(ctx.m_in->m_stagingMem->allocateFrame(
@@ -684,7 +684,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 		TextureView* diffuseAtlas = nullptr;
 		TextureView* diffuseAtlas = nullptr;
 		TextureView* specularRoughnessAtlas = nullptr;
 		TextureView* specularRoughnessAtlas = nullptr;
 
 
-		for(U i = 0; i < visibleDecalCount; ++i)
+		for(U32 i = 0; i < visibleDecalCount; ++i)
 		{
 		{
 			const DecalQueueElement& in = rqueue.m_decals[i];
 			const DecalQueueElement& in = rqueue.m_decals[i];
 			Decal& out = gpuDecals[i];
 			Decal& out = gpuDecals[i];
@@ -722,7 +722,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	}
 	}
 
 
 	// Write the probes
 	// Write the probes
-	const U visibleProbeCount = rqueue.m_reflectionProbes.getSize();
+	const U32 visibleProbeCount = rqueue.m_reflectionProbes.getSize();
 	if(visibleProbeCount)
 	if(visibleProbeCount)
 	{
 	{
 		ReflectionProbe* data = static_cast<ReflectionProbe*>(
 		ReflectionProbe* data = static_cast<ReflectionProbe*>(
@@ -732,7 +732,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 
 
 		WeakArray<ReflectionProbe> gpuProbes(data, visibleProbeCount);
 		WeakArray<ReflectionProbe> gpuProbes(data, visibleProbeCount);
 
 
-		for(U i = 0; i < visibleProbeCount; ++i)
+		for(U32 i = 0; i < visibleProbeCount; ++i)
 		{
 		{
 			const ReflectionProbeQueueElement& in = rqueue.m_reflectionProbes[i];
 			const ReflectionProbeQueueElement& in = rqueue.m_reflectionProbes[i];
 			ReflectionProbe& out = gpuProbes[i];
 			ReflectionProbe& out = gpuProbes[i];
@@ -749,7 +749,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	}
 	}
 
 
 	// Fog volumes
 	// Fog volumes
-	const U visibleFogVolumeCount = rqueue.m_fogDensityVolumes.getSize();
+	const U32 visibleFogVolumeCount = rqueue.m_fogDensityVolumes.getSize();
 	if(visibleFogVolumeCount)
 	if(visibleFogVolumeCount)
 	{
 	{
 		FogDensityVolume* data = static_cast<FogDensityVolume*>(
 		FogDensityVolume* data = static_cast<FogDensityVolume*>(
@@ -759,7 +759,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 
 
 		WeakArray<FogDensityVolume> gpuFogVolumes(data, visibleFogVolumeCount);
 		WeakArray<FogDensityVolume> gpuFogVolumes(data, visibleFogVolumeCount);
 
 
-		for(U i = 0; i < visibleFogVolumeCount; ++i)
+		for(U32 i = 0; i < visibleFogVolumeCount; ++i)
 		{
 		{
 			const FogDensityQueueElement& in = rqueue.m_fogDensityVolumes[i];
 			const FogDensityQueueElement& in = rqueue.m_fogDensityVolumes[i];
 			FogDensityVolume& out = gpuFogVolumes[i];
 			FogDensityVolume& out = gpuFogVolumes[i];
@@ -785,7 +785,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 	}
 	}
 
 
 	// Write the probes
 	// Write the probes
-	const U visibleGiProbeCount = rqueue.m_giProbes.getSize();
+	const U32 visibleGiProbeCount = rqueue.m_giProbes.getSize();
 	if(visibleGiProbeCount)
 	if(visibleGiProbeCount)
 	{
 	{
 		GlobalIlluminationProbe* data = static_cast<GlobalIlluminationProbe*>(
 		GlobalIlluminationProbe* data = static_cast<GlobalIlluminationProbe*>(
@@ -795,7 +795,7 @@ void ClusterBin::writeTypedObjectsToGpuBuffers(BinCtx& ctx) const
 
 
 		WeakArray<GlobalIlluminationProbe> gpuProbes(data, visibleGiProbeCount);
 		WeakArray<GlobalIlluminationProbe> gpuProbes(data, visibleGiProbeCount);
 
 
-		for(U i = 0; i < visibleGiProbeCount; ++i)
+		for(U32 i = 0; i < visibleGiProbeCount; ++i)
 		{
 		{
 			const GlobalIlluminationProbeQueueElement& in = rqueue.m_giProbes[i];
 			const GlobalIlluminationProbeQueueElement& in = rqueue.m_giProbes[i];
 			GlobalIlluminationProbe& out = gpuProbes[i];
 			GlobalIlluminationProbe& out = gpuProbes[i];

+ 4 - 4
src/anki/renderer/Dbg.cpp

@@ -85,11 +85,11 @@ void Dbg::run(RenderPassWorkContext& rgraphCtx, const RenderingContext& ctx)
 	// Draw renderables
 	// Draw renderables
 	const U32 threadId = rgraphCtx.m_currentSecondLevelCommandBufferIndex;
 	const U32 threadId = rgraphCtx.m_currentSecondLevelCommandBufferIndex;
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
-	const U32 problemSize = U32(ctx.m_renderQueue->m_renderables.getSize());
+	const U32 problemSize = ctx.m_renderQueue->m_renderables.getSize();
 	U32 start, end;
 	U32 start, end;
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 
 
-	for(U i = start; i < end; ++i)
+	for(U32 i = start; i < end; ++i)
 	{
 	{
 		const RenderableQueueElement& el = ctx.m_renderQueue->m_renderables[i];
 		const RenderableQueueElement& el = ctx.m_renderQueue->m_renderables[i];
 		Array<void*, 1> a = {{const_cast<void*>(el.m_userData)}};
 		Array<void*, 1> a = {{const_cast<void*>(el.m_userData)}};
@@ -109,7 +109,7 @@ void Dbg::run(RenderPassWorkContext& rgraphCtx, const RenderingContext& ctx)
 	// Draw lights
 	// Draw lights
 	if(threadId == 0)
 	if(threadId == 0)
 	{
 	{
-		U count = ctx.m_renderQueue->m_pointLights.getSize();
+		U32 count = ctx.m_renderQueue->m_pointLights.getSize();
 		while(count--)
 		while(count--)
 		{
 		{
 			const PointLightQueueElement& el = ctx.m_renderQueue->m_pointLights[count];
 			const PointLightQueueElement& el = ctx.m_renderQueue->m_pointLights[count];
@@ -181,7 +181,7 @@ void Dbg::populateRenderGraph(RenderingContext& ctx)
 			self->run(rgraphCtx, *self->m_runCtx.m_ctx);
 			self->run(rgraphCtx, *self->m_runCtx.m_ctx);
 		},
 		},
 		this,
 		this,
-		computeNumberOfSecondLevelCommandBuffers(U32(ctx.m_renderQueue->m_renderables.getSize())));
+		computeNumberOfSecondLevelCommandBuffers(ctx.m_renderQueue->m_renderables.getSize()));
 
 
 	pass.setFramebufferInfo(m_fbDescr, {m_runCtx.m_rt}, m_r->getGBuffer().getDepthRt());
 	pass.setFramebufferInfo(m_fbDescr, {m_runCtx.m_rt}, m_r->getGBuffer().getDepthRt());
 
 

+ 1 - 1
src/anki/renderer/ForwardShading.cpp

@@ -31,7 +31,7 @@ void ForwardShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgr
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	const U32 threadId = rgraphCtx.m_currentSecondLevelCommandBufferIndex;
 	const U32 threadId = rgraphCtx.m_currentSecondLevelCommandBufferIndex;
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
-	const U32 problemSize = U32(ctx.m_renderQueue->m_forwardShadingRenderables.getSize());
+	const U32 problemSize = ctx.m_renderQueue->m_forwardShadingRenderables.getSize();
 	U32 start, end;
 	U32 start, end;
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 
 

+ 3 - 3
src/anki/renderer/GBuffer.cpp

@@ -76,8 +76,8 @@ void GBuffer::runInThread(const RenderingContext& ctx, RenderPassWorkContext& rg
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
 	const U32 threadCount = rgraphCtx.m_secondLevelCommandBufferCount;
 
 
 	// Get some stuff
 	// Get some stuff
-	const U32 earlyZCount = U32(ctx.m_renderQueue->m_earlyZRenderables.getSize());
-	const U32 problemSize = U32(ctx.m_renderQueue->m_renderables.getSize() + earlyZCount);
+	const U32 earlyZCount = ctx.m_renderQueue->m_earlyZRenderables.getSize();
+	const U32 problemSize = ctx.m_renderQueue->m_renderables.getSize() + earlyZCount;
 	U32 start, end;
 	U32 start, end;
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 	splitThreadedProblem(threadId, threadCount, problemSize, start, end);
 	ANKI_ASSERT(end != start);
 	ANKI_ASSERT(end != start);
@@ -165,7 +165,7 @@ void GBuffer::populateRenderGraph(RenderingContext& ctx)
 		},
 		},
 		this,
 		this,
 		computeNumberOfSecondLevelCommandBuffers(
 		computeNumberOfSecondLevelCommandBuffers(
-			U32(ctx.m_renderQueue->m_earlyZRenderables.getSize() + ctx.m_renderQueue->m_renderables.getSize())));
+			ctx.m_renderQueue->m_earlyZRenderables.getSize() + ctx.m_renderQueue->m_renderables.getSize()));
 
 
 	for(U i = 0; i < GBUFFER_COLOR_ATTACHMENT_COUNT; ++i)
 	for(U i = 0; i < GBUFFER_COLOR_ATTACHMENT_COUNT; ++i)
 	{
 	{

+ 10 - 11
src/anki/renderer/GlobalIllumination.cpp

@@ -72,14 +72,14 @@ const RenderTargetHandle& GlobalIllumination::getVolumeRenderTarget(
 	ANKI_ASSERT(m_giCtx);
 	ANKI_ASSERT(m_giCtx);
 	ANKI_ASSERT(&probe >= &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getFront()
 	ANKI_ASSERT(&probe >= &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getFront()
 				&& &probe <= &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getBack());
 				&& &probe <= &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getBack());
-	const U idx = &probe - &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getFront();
+	const U32 idx = U32(&probe - &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getFront());
 	return m_giCtx->m_irradianceProbeRts[idx];
 	return m_giCtx->m_irradianceProbeRts[idx];
 }
 }
 
 
 void GlobalIllumination::setRenderGraphDependencies(
 void GlobalIllumination::setRenderGraphDependencies(
 	RenderingContext& ctx, RenderPassDescriptionBase& pass, TextureUsageBit usage) const
 	RenderingContext& ctx, RenderPassDescriptionBase& pass, TextureUsageBit usage) const
 {
 {
-	for(U idx = 0; idx < ctx.m_renderQueue->m_giProbes.getSize(); ++idx)
+	for(U32 idx = 0; idx < ctx.m_renderQueue->m_giProbes.getSize(); ++idx)
 	{
 	{
 		pass.newDependency({getVolumeRenderTarget(ctx.m_renderQueue->m_giProbes[idx]), usage});
 		pass.newDependency({getVolumeRenderTarget(ctx.m_renderQueue->m_giProbes[idx]), usage});
 	}
 	}
@@ -230,7 +230,7 @@ Error GlobalIllumination::initIrradiance(const ConfigSet& cfg)
 	ANKI_CHECK(m_r->getResourceManager().loadResource("shaders/IrradianceDice.glslp", m_irradiance.m_prog));
 	ANKI_CHECK(m_r->getResourceManager().loadResource("shaders/IrradianceDice.glslp", m_irradiance.m_prog));
 
 
 	ShaderProgramResourceConstantValueInitList<1> consts(m_irradiance.m_prog);
 	ShaderProgramResourceConstantValueInitList<1> consts(m_irradiance.m_prog);
-	consts.add("WORKGROUP_SIZE", U32(m_tileSize));
+	consts.add("WORKGROUP_SIZE", m_tileSize);
 
 
 	ShaderProgramResourceMutationInitList<3> mutations(m_irradiance.m_prog);
 	ShaderProgramResourceMutationInitList<3> mutations(m_irradiance.m_prog);
 	mutations.add("LIGHT_SHADING_TEX", 0);
 	mutations.add("LIGHT_SHADING_TEX", 0);
@@ -271,12 +271,11 @@ void GlobalIllumination::populateRenderGraph(RenderingContext& rctx)
 		for(const RenderQueue* rq : giCtx->m_probeToUpdateThisFrame->m_renderQueues)
 		for(const RenderQueue* rq : giCtx->m_probeToUpdateThisFrame->m_renderQueues)
 		{
 		{
 			ANKI_ASSERT(rq);
 			ANKI_ASSERT(rq);
-			giCtx->m_gbufferDrawcallCount += U32(rq->m_renderables.getSize());
+			giCtx->m_gbufferDrawcallCount += rq->m_renderables.getSize();
 
 
 			if(rq->m_directionalLight.hasShadow())
 			if(rq->m_directionalLight.hasShadow())
 			{
 			{
-				giCtx->m_smDrawcallCount +=
-					U32(rq->m_directionalLight.m_shadowRenderQueues[0]->m_renderables.getSize());
+				giCtx->m_smDrawcallCount += rq->m_directionalLight.m_shadowRenderQueues[0]->m_renderables.getSize();
 			}
 			}
 		}
 		}
 
 
@@ -418,12 +417,12 @@ void GlobalIllumination::populateRenderGraph(RenderingContext& rctx)
 
 
 		pass.newDependency({giCtx->m_lightShadingRt, TextureUsageBit::SAMPLED_COMPUTE});
 		pass.newDependency({giCtx->m_lightShadingRt, TextureUsageBit::SAMPLED_COMPUTE});
 
 
-		for(U i = 0; i < GBUFFER_COLOR_ATTACHMENT_COUNT - 1; ++i)
+		for(U32 i = 0; i < GBUFFER_COLOR_ATTACHMENT_COUNT - 1; ++i)
 		{
 		{
 			pass.newDependency({giCtx->m_gbufferColorRts[i], TextureUsageBit::SAMPLED_COMPUTE});
 			pass.newDependency({giCtx->m_gbufferColorRts[i], TextureUsageBit::SAMPLED_COMPUTE});
 		}
 		}
 
 
-		const U probeIdx = giCtx->m_probeToUpdateThisFrame - &giCtx->m_ctx->m_renderQueue->m_giProbes.getFront();
+		const U32 probeIdx = U32(giCtx->m_probeToUpdateThisFrame - &giCtx->m_ctx->m_renderQueue->m_giProbes.getFront());
 		pass.newDependency({giCtx->m_irradianceProbeRts[probeIdx], TextureUsageBit::IMAGE_COMPUTE_WRITE});
 		pass.newDependency({giCtx->m_irradianceProbeRts[probeIdx], TextureUsageBit::IMAGE_COMPUTE_WRITE});
 	}
 	}
 }
 }
@@ -446,7 +445,7 @@ void GlobalIllumination::prepareProbes(InternalContext& giCtx)
 	newListOfProbes.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_giProbes.getSize());
 	newListOfProbes.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_giProbes.getSize());
 	DynamicArray<RenderTargetHandle> volumeRts;
 	DynamicArray<RenderTargetHandle> volumeRts;
 	volumeRts.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_giProbes.getSize());
 	volumeRts.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_giProbes.getSize());
-	U newListOfProbeCount = 0;
+	U32 newListOfProbeCount = 0;
 	Bool foundProbeToUpdateNextFrame = false;
 	Bool foundProbeToUpdateNextFrame = false;
 	for(U32 probeIdx = 0; probeIdx < ctx.m_renderQueue->m_giProbes.getSize(); ++probeIdx)
 	for(U32 probeIdx = 0; probeIdx < ctx.m_renderQueue->m_giProbes.getSize(); ++probeIdx)
 	{
 	{
@@ -579,7 +578,7 @@ void GlobalIllumination::prepareProbes(InternalContext& giCtx)
 	if(newListOfProbeCount > 0)
 	if(newListOfProbeCount > 0)
 	{
 	{
 		GlobalIlluminationProbeQueueElement* firstProbe;
 		GlobalIlluminationProbeQueueElement* firstProbe;
-		PtrSize probeCount, storage;
+		U32 probeCount, storage;
 		newListOfProbes.moveAndReset(firstProbe, probeCount, storage);
 		newListOfProbes.moveAndReset(firstProbe, probeCount, storage);
 		ctx.m_renderQueue->m_giProbes = WeakArray<GlobalIlluminationProbeQueueElement>(firstProbe, newListOfProbeCount);
 		ctx.m_renderQueue->m_giProbes = WeakArray<GlobalIlluminationProbeQueueElement>(firstProbe, newListOfProbeCount);
 
 
@@ -769,7 +768,7 @@ void GlobalIllumination::runIrradiance(RenderPassWorkContext& rgraphCtx, Interna
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	ANKI_ASSERT(giCtx.m_probeToUpdateThisFrame);
 	ANKI_ASSERT(giCtx.m_probeToUpdateThisFrame);
 	const GlobalIlluminationProbeQueueElement& probe = *giCtx.m_probeToUpdateThisFrame;
 	const GlobalIlluminationProbeQueueElement& probe = *giCtx.m_probeToUpdateThisFrame;
-	const U probeIdx = &probe - &giCtx.m_ctx->m_renderQueue->m_giProbes.getFront();
+	const U32 probeIdx = U32(&probe - &giCtx.m_ctx->m_renderQueue->m_giProbes.getFront());
 
 
 	cmdb->bindShaderProgram(m_irradiance.m_grProg);
 	cmdb->bindShaderProgram(m_irradiance.m_grProg);
 
 

+ 6 - 6
src/anki/renderer/LensFlare.cpp

@@ -89,7 +89,7 @@ Error LensFlare::initOcclusion(const ConfigSet& config)
 void LensFlare::updateIndirectInfo(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx)
 void LensFlare::updateIndirectInfo(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx)
 {
 {
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
 	CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
-	U32 count = min<U32>(U32(ctx.m_renderQueue->m_lensFlares.getSize()), m_maxFlares);
+	U32 count = min<U32>(ctx.m_renderQueue->m_lensFlares.getSize(), m_maxFlares);
 	ANKI_ASSERT(count > 0);
 	ANKI_ASSERT(count > 0);
 
 
 	cmdb->bindShaderProgram(m_updateIndirectBuffGrProg);
 	cmdb->bindShaderProgram(m_updateIndirectBuffGrProg);
@@ -99,7 +99,7 @@ void LensFlare::updateIndirectInfo(const RenderingContext& ctx, RenderPassWorkCo
 	*reinterpret_cast<Mat4*>(flarePositions) = ctx.m_matrices.m_viewProjectionJitter;
 	*reinterpret_cast<Mat4*>(flarePositions) = ctx.m_matrices.m_viewProjectionJitter;
 	flarePositions += 4;
 	flarePositions += 4;
 
 
-	for(U i = 0; i < count; ++i)
+	for(U32 i = 0; i < count; ++i)
 	{
 	{
 		*flarePositions = Vec4(ctx.m_renderQueue->m_lensFlares[i].m_worldPosition, 1.0f);
 		*flarePositions = Vec4(ctx.m_renderQueue->m_lensFlares[i].m_worldPosition, 1.0f);
 		++flarePositions;
 		++flarePositions;
@@ -149,13 +149,13 @@ void LensFlare::runDrawFlares(const RenderingContext& ctx, CommandBufferPtr& cmd
 		return;
 		return;
 	}
 	}
 
 
-	const U count = min<U>(ctx.m_renderQueue->m_lensFlares.getSize(), m_maxFlares);
+	const U32 count = min<U32>(ctx.m_renderQueue->m_lensFlares.getSize(), m_maxFlares);
 
 
 	cmdb->bindShaderProgram(m_realGrProg);
 	cmdb->bindShaderProgram(m_realGrProg);
 	cmdb->setBlendFactors(0, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA);
 	cmdb->setBlendFactors(0, BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA);
 	cmdb->setDepthWrite(false);
 	cmdb->setDepthWrite(false);
 
 
-	for(U i = 0; i < count; ++i)
+	for(U32 i = 0; i < count; ++i)
 	{
 	{
 		const LensFlareQueueElement& flareEl = ctx.m_renderQueue->m_lensFlares[i];
 		const LensFlareQueueElement& flareEl = ctx.m_renderQueue->m_lensFlares[i];
 
 
@@ -170,8 +170,8 @@ void LensFlare::runDrawFlares(const RenderingContext& ctx, CommandBufferPtr& cmd
 			ANKI_ASSERT(0 && "Check that before");
 			ANKI_ASSERT(0 && "Check that before");
 		}*/
 		}*/
 
 
-		U c = 0;
-		U spritesCount = max<U>(1, m_maxSpritesPerFlare);
+		U32 c = 0;
+		U32 spritesCount = max<U32>(1, m_maxSpritesPerFlare);
 
 
 		// Get uniform memory
 		// Get uniform memory
 		LensFlareSprite* tmpSprites =
 		LensFlareSprite* tmpSprites =

+ 2 - 2
src/anki/renderer/LightShading.cpp

@@ -85,7 +85,7 @@ Error LightShading::initApplyFog(const ConfigSet& config)
 	ANKI_CHECK(getResourceManager().loadResource("shaders/LightShadingApplyFog.glslp", m_applyFog.m_prog));
 	ANKI_CHECK(getResourceManager().loadResource("shaders/LightShadingApplyFog.glslp", m_applyFog.m_prog));
 
 
 	ShaderProgramResourceConstantValueInitList<1> consts(m_applyFog.m_prog);
 	ShaderProgramResourceConstantValueInitList<1> consts(m_applyFog.m_prog);
-	consts.add("FOG_LAST_CLASTER", U32(m_r->getVolumetricFog().getFinalClusterInZ()));
+	consts.add("FOG_LAST_CLASTER", m_r->getVolumetricFog().getFinalClusterInZ());
 
 
 	const ShaderProgramResourceVariant* variant;
 	const ShaderProgramResourceVariant* variant;
 	m_applyFog.m_prog->getOrCreateVariant(consts.get(), variant);
 	m_applyFog.m_prog->getOrCreateVariant(consts.get(), variant);
@@ -189,7 +189,7 @@ void LightShading::populateRenderGraph(RenderingContext& ctx)
 	pass.setWork(
 	pass.setWork(
 		[](RenderPassWorkContext& rgraphCtx) { static_cast<LightShading*>(rgraphCtx.m_userData)->run(rgraphCtx); },
 		[](RenderPassWorkContext& rgraphCtx) { static_cast<LightShading*>(rgraphCtx.m_userData)->run(rgraphCtx); },
 		this,
 		this,
-		computeNumberOfSecondLevelCommandBuffers(U32(ctx.m_renderQueue->m_forwardShadingRenderables.getSize())));
+		computeNumberOfSecondLevelCommandBuffers(ctx.m_renderQueue->m_forwardShadingRenderables.getSize()));
 	pass.setFramebufferInfo(m_lightShading.m_fbDescr, {{m_runCtx.m_rt}}, {m_r->getGBuffer().getDepthRt()});
 	pass.setFramebufferInfo(m_lightShading.m_fbDescr, {{m_runCtx.m_rt}}, {m_r->getGBuffer().getDepthRt()});
 
 
 	// Light shading
 	// Light shading

+ 6 - 6
src/anki/renderer/ProbeReflections.cpp

@@ -129,7 +129,7 @@ Error ProbeReflections::initLightShading(const ConfigSet& config)
 			"CubeRefl refl");
 			"CubeRefl refl");
 		texinit.m_mipmapCount = U8(m_lightShading.m_mipCount);
 		texinit.m_mipmapCount = U8(m_lightShading.m_mipCount);
 		texinit.m_type = TextureType::CUBE_ARRAY;
 		texinit.m_type = TextureType::CUBE_ARRAY;
-		texinit.m_layerCount = U32(m_cacheEntries.getSize());
+		texinit.m_layerCount = m_cacheEntries.getSize();
 		texinit.m_initialUsage = TextureUsageBit::SAMPLED_FRAGMENT;
 		texinit.m_initialUsage = TextureUsageBit::SAMPLED_FRAGMENT;
 
 
 		m_lightShading.m_cubeArr = m_r->createAndClearRenderTarget(texinit);
 		m_lightShading.m_cubeArr = m_r->createAndClearRenderTarget(texinit);
@@ -251,7 +251,7 @@ void ProbeReflections::prepareProbes(RenderingContext& ctx,
 	// - Find the cache entries for each probe
 	// - Find the cache entries for each probe
 	DynamicArray<ReflectionProbeQueueElement> newListOfProbes;
 	DynamicArray<ReflectionProbeQueueElement> newListOfProbes;
 	newListOfProbes.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_reflectionProbes.getSize());
 	newListOfProbes.create(ctx.m_tempAllocator, ctx.m_renderQueue->m_reflectionProbes.getSize());
-	U newListOfProbeCount = 0;
+	U32 newListOfProbeCount = 0;
 	Bool foundProbeToUpdateNextFrame = false;
 	Bool foundProbeToUpdateNextFrame = false;
 	for(U32 probeIdx = 0; probeIdx < ctx.m_renderQueue->m_reflectionProbes.getSize(); ++probeIdx)
 	for(U32 probeIdx = 0; probeIdx < ctx.m_renderQueue->m_reflectionProbes.getSize(); ++probeIdx)
 	{
 	{
@@ -326,7 +326,7 @@ void ProbeReflections::prepareProbes(RenderingContext& ctx,
 	if(newListOfProbeCount > 0)
 	if(newListOfProbeCount > 0)
 	{
 	{
 		ReflectionProbeQueueElement* firstProbe;
 		ReflectionProbeQueueElement* firstProbe;
-		PtrSize probeCount, storage;
+		U32 probeCount, storage;
 		newListOfProbes.moveAndReset(firstProbe, probeCount, storage);
 		newListOfProbes.moveAndReset(firstProbe, probeCount, storage);
 		ctx.m_renderQueue->m_reflectionProbes = WeakArray<ReflectionProbeQueueElement>(firstProbe, newListOfProbeCount);
 		ctx.m_renderQueue->m_reflectionProbes = WeakArray<ReflectionProbeQueueElement>(firstProbe, newListOfProbeCount);
 	}
 	}
@@ -556,7 +556,7 @@ void ProbeReflections::populateRenderGraph(RenderingContext& rctx)
 		m_ctx.m_gbufferRenderableCount = 0;
 		m_ctx.m_gbufferRenderableCount = 0;
 		for(U32 i = 0; i < 6; ++i)
 		for(U32 i = 0; i < 6; ++i)
 		{
 		{
-			m_ctx.m_gbufferRenderableCount += U32(probeToUpdate->m_renderQueues[i]->m_renderables.getSize());
+			m_ctx.m_gbufferRenderableCount += probeToUpdate->m_renderQueues[i]->m_renderables.getSize();
 		}
 		}
 		const U32 taskCount = computeNumberOfSecondLevelCommandBuffers(m_ctx.m_gbufferRenderableCount);
 		const U32 taskCount = computeNumberOfSecondLevelCommandBuffers(m_ctx.m_gbufferRenderableCount);
 
 
@@ -618,8 +618,8 @@ void ProbeReflections::populateRenderGraph(RenderingContext& rctx)
 		m_ctx.m_shadowRenderableCount = 0;
 		m_ctx.m_shadowRenderableCount = 0;
 		for(U32 i = 0; i < 6; ++i)
 		for(U32 i = 0; i < 6; ++i)
 		{
 		{
-			m_ctx.m_shadowRenderableCount += U32(
-				probeToUpdate->m_renderQueues[i]->m_directionalLight.m_shadowRenderQueues[0]->m_renderables.getSize());
+			m_ctx.m_shadowRenderableCount +=
+				probeToUpdate->m_renderQueues[i]->m_directionalLight.m_shadowRenderQueues[0]->m_renderables.getSize();
 		}
 		}
 		const U32 taskCount = computeNumberOfSecondLevelCommandBuffers(m_ctx.m_shadowRenderableCount);
 		const U32 taskCount = computeNumberOfSecondLevelCommandBuffers(m_ctx.m_shadowRenderableCount);
 
 

+ 6 - 6
src/anki/renderer/ShadowMapping.cpp

@@ -624,7 +624,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForScra
 					light->m_shadowRenderQueues[face]->m_shadowRenderablesLastUpdateTimestamp;
 					light->m_shadowRenderQueues[face]->m_shadowRenderablesLastUpdateTimestamp;
 
 
 				drawcallCounts[numOfFacesThatHaveDrawcalls] =
 				drawcallCounts[numOfFacesThatHaveDrawcalls] =
-					U32(light->m_shadowRenderQueues[face]->m_renderables.getSize());
+					light->m_shadowRenderQueues[face]->m_renderables.getSize();
 
 
 				lods[numOfFacesThatHaveDrawcalls] = lod;
 				lods[numOfFacesThatHaveDrawcalls] = lod;
 
 
@@ -712,7 +712,7 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForScra
 		TileAllocatorResult subResult;
 		TileAllocatorResult subResult;
 		Viewport atlasViewport;
 		Viewport atlasViewport;
 		Viewport scratchViewport;
 		Viewport scratchViewport;
-		const U32 localDrawcallCount = U32(light->m_shadowRenderQueue->m_renderables.getSize());
+		const U32 localDrawcallCount = light->m_shadowRenderQueue->m_renderables.getSize();
 
 
 		Bool blurAtlas;
 		Bool blurAtlas;
 		const U32 lod = choseLod(cameraOrigin, *light, blurAtlas);
 		const U32 lod = choseLod(cameraOrigin, *light, blurAtlas);
@@ -808,8 +808,8 @@ void ShadowMapping::processLights(RenderingContext& ctx, U32& threadCountForScra
 		// All good, store the work items for the threads to pick up
 		// All good, store the work items for the threads to pick up
 		{
 		{
 			Scratch::WorkItem* items;
 			Scratch::WorkItem* items;
-			PtrSize itemSize;
-			PtrSize itemStorageSize;
+			U32 itemSize;
+			U32 itemStorageSize;
 			workItems.moveAndReset(items, itemSize, itemStorageSize);
 			workItems.moveAndReset(items, itemSize, itemStorageSize);
 
 
 			ANKI_ASSERT(items && itemSize && itemStorageSize);
 			ANKI_ASSERT(items && itemSize && itemStorageSize);
@@ -840,9 +840,9 @@ void ShadowMapping::newScratchAndAtlasResloveRenderWorkItems(const Viewport& atl
 	// Scratch work item
 	// Scratch work item
 	{
 	{
 		Scratch::LightToRenderToScratchInfo toRender = {
 		Scratch::LightToRenderToScratchInfo toRender = {
-			scratchVewport, lightRenderQueue, U32(lightRenderQueue->m_renderables.getSize())};
+			scratchVewport, lightRenderQueue, lightRenderQueue->m_renderables.getSize()};
 		scratchWorkItem.emplaceBack(toRender);
 		scratchWorkItem.emplaceBack(toRender);
-		drawcallCount += U32(lightRenderQueue->m_renderables.getSize());
+		drawcallCount += lightRenderQueue->m_renderables.getSize();
 	}
 	}
 
 
 	// Atlas resolve work item
 	// Atlas resolve work item

+ 1 - 1
src/anki/renderer/VolumetricFog.cpp

@@ -36,7 +36,7 @@ Error VolumetricFog::init(const ConfigSet& config)
 	ShaderProgramResourceConstantValueInitList<5> consts(m_prog);
 	ShaderProgramResourceConstantValueInitList<5> consts(m_prog);
 	consts.add("VOLUME_SIZE", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]))
 	consts.add("VOLUME_SIZE", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]))
 		.add("CLUSTER_COUNT", UVec3(m_r->getClusterCount()[0], m_r->getClusterCount()[1], m_r->getClusterCount()[2]))
 		.add("CLUSTER_COUNT", UVec3(m_r->getClusterCount()[0], m_r->getClusterCount()[1], m_r->getClusterCount()[2]))
-		.add("FINAL_CLUSTER_Z", U32(m_finalClusterZ))
+		.add("FINAL_CLUSTER_Z", m_finalClusterZ)
 		.add("FRACTION", UVec3(fractionXY, fractionXY, fractionZ))
 		.add("FRACTION", UVec3(fractionXY, fractionXY, fractionZ))
 		.add("WORKGROUP_SIZE", UVec2(m_workgroupSize[0], m_workgroupSize[1]));
 		.add("WORKGROUP_SIZE", UVec2(m_workgroupSize[0], m_workgroupSize[1]));
 
 

+ 3 - 3
src/anki/resource/AnimationResource.cpp

@@ -216,7 +216,7 @@ Error AnimationResource::load(const ResourceFilename& filename, Bool async)
 	return Error::NONE;
 	return Error::NONE;
 }
 }
 
 
-void AnimationResource::interpolate(U channelIndex, Second time, Vec3& pos, Quat& rot, F32& scale) const
+void AnimationResource::interpolate(U32 channelIndex, Second time, Vec3& pos, Quat& rot, F32& scale) const
 {
 {
 	// Audjust time
 	// Audjust time
 	if(time > m_startTime + m_duration)
 	if(time > m_startTime + m_duration)
@@ -232,7 +232,7 @@ void AnimationResource::interpolate(U channelIndex, Second time, Vec3& pos, Quat
 	// Position
 	// Position
 	if(channel.m_positions.getSize() > 1)
 	if(channel.m_positions.getSize() > 1)
 	{
 	{
-		for(U i = 0; i < channel.m_positions.getSize() - 1; ++i)
+		for(U32 i = 0; i < channel.m_positions.getSize() - 1; ++i)
 		{
 		{
 			const AnimationKeyframe<Vec3>& left = channel.m_positions[i];
 			const AnimationKeyframe<Vec3>& left = channel.m_positions[i];
 			const AnimationKeyframe<Vec3>& right = channel.m_positions[i + 1];
 			const AnimationKeyframe<Vec3>& right = channel.m_positions[i + 1];
@@ -248,7 +248,7 @@ void AnimationResource::interpolate(U channelIndex, Second time, Vec3& pos, Quat
 	// Rotation
 	// Rotation
 	if(channel.m_rotations.getSize() > 1)
 	if(channel.m_rotations.getSize() > 1)
 	{
 	{
-		for(U i = 0; i < channel.m_rotations.getSize() - 1; ++i)
+		for(U32 i = 0; i < channel.m_rotations.getSize() - 1; ++i)
 		{
 		{
 			const AnimationKeyframe<Quat>& left = channel.m_rotations[i];
 			const AnimationKeyframe<Quat>& left = channel.m_rotations[i];
 			const AnimationKeyframe<Quat>& right = channel.m_rotations[i + 1];
 			const AnimationKeyframe<Quat>& right = channel.m_rotations[i + 1];

+ 1 - 1
src/anki/resource/AnimationResource.h

@@ -92,7 +92,7 @@ public:
 	}
 	}
 
 
 	/// Get the interpolated data
 	/// Get the interpolated data
-	void interpolate(U channelIndex, Second time, Vec3& position, Quat& rotation, F32& scale) const;
+	void interpolate(U32 channelIndex, Second time, Vec3& position, Quat& rotation, F32& scale) const;
 
 
 private:
 private:
 	DynamicArray<AnimationChannel> m_channels;
 	DynamicArray<AnimationChannel> m_channels;

+ 1 - 1
src/anki/resource/GenericResource.cpp

@@ -23,7 +23,7 @@ Error GenericResource::load(const ResourceFilename& filename, Bool async)
 	ResourceFilePtr file;
 	ResourceFilePtr file;
 	ANKI_CHECK(openFile(filename, file));
 	ANKI_CHECK(openFile(filename, file));
 
 
-	PtrSize size = file->getSize();
+	const U32 size = U32(file->getSize());
 	m_data.create(getAllocator(), size);
 	m_data.create(getAllocator(), size);
 	ANKI_CHECK(file->read(&m_data[0], size));
 	ANKI_CHECK(file->read(&m_data[0], size));
 
 

+ 12 - 12
src/anki/resource/ImageLoader.cpp

@@ -220,14 +220,14 @@ Error ImageLoader::loadUncompressedTga(
 	}
 	}
 
 
 	// read the data
 	// read the data
-	I bytesPerPxl = (bpp / 8);
-	I imageSize = bytesPerPxl * width * height;
+	U32 bytesPerPxl = (bpp / 8);
+	U32 imageSize = bytesPerPxl * width * height;
 	data.create(alloc, imageSize);
 	data.create(alloc, imageSize);
 
 
 	ANKI_CHECK(fs.read(reinterpret_cast<char*>(&data[0]), imageSize));
 	ANKI_CHECK(fs.read(reinterpret_cast<char*>(&data[0]), imageSize));
 
 
 	// swap red with blue
 	// swap red with blue
-	for(I i = 0; i < imageSize; i += bytesPerPxl)
+	for(U32 i = 0; i < imageSize; i += bytesPerPxl)
 	{
 	{
 		U8 temp = data[i];
 		U8 temp = data[i];
 		data[i] = data[i + 2];
 		data[i] = data[i + 2];
@@ -253,20 +253,20 @@ Error ImageLoader::loadCompressedTga(
 		return Error::USER_DATA;
 		return Error::USER_DATA;
 	}
 	}
 
 
-	I bytesPerPxl = (bpp / 8);
-	I imageSize = bytesPerPxl * width * height;
+	U32 bytesPerPxl = (bpp / 8);
+	U32 imageSize = bytesPerPxl * width * height;
 	data.create(alloc, imageSize);
 	data.create(alloc, imageSize);
 
 
-	U pixelcount = height * width;
-	U currentpixel = 0;
-	U currentbyte = 0;
+	U32 pixelcount = height * width;
+	U32 currentpixel = 0;
+	U32 currentbyte = 0;
 	U8 colorbuffer[4];
 	U8 colorbuffer[4];
 
 
 	do
 	do
 	{
 	{
 		U8 chunkheader = 0;
 		U8 chunkheader = 0;
 
 
-		ANKI_CHECK(fs.read((char*)&chunkheader, sizeof(U8)));
+		ANKI_CHECK(fs.read(&chunkheader, sizeof(U8)));
 
 
 		if(chunkheader < 128)
 		if(chunkheader < 128)
 		{
 		{
@@ -299,7 +299,7 @@ Error ImageLoader::loadCompressedTga(
 			chunkheader = U8(chunkheader - 127);
 			chunkheader = U8(chunkheader - 127);
 			ANKI_CHECK(fs.read(&colorbuffer[0], bytesPerPxl));
 			ANKI_CHECK(fs.read(&colorbuffer[0], bytesPerPxl));
 
 
-			for(int counter = 0; counter < chunkheader; counter++)
+			for(U32 counter = 0; counter < chunkheader; counter++)
 			{
 			{
 				data[currentbyte] = colorbuffer[2];
 				data[currentbyte] = colorbuffer[2];
 				data[currentbyte + 1] = colorbuffer[1];
 				data[currentbyte + 1] = colorbuffer[1];
@@ -463,7 +463,7 @@ Error ImageLoader::loadAnkiTexture(FileInterface& file,
 
 
 	colorFormat = header.m_colorFormat;
 	colorFormat = header.m_colorFormat;
 
 
-	U faceCount = 1;
+	U32 faceCount = 1;
 	switch(header.m_type)
 	switch(header.m_type)
 	{
 	{
 	case ImageLoaderTextureType::_2D:
 	case ImageLoaderTextureType::_2D:
@@ -609,7 +609,7 @@ Error ImageLoader::loadStb(
 	// Read the file
 	// Read the file
 	DynamicArrayAuto<U8> fileData = {alloc};
 	DynamicArrayAuto<U8> fileData = {alloc};
 	const PtrSize fileSize = fs.getSize();
 	const PtrSize fileSize = fs.getSize();
-	fileData.create(fileSize);
+	fileData.create(U32(fileSize));
 	ANKI_CHECK(fs.read(&fileData[0], fileSize));
 	ANKI_CHECK(fs.read(&fileData[0], fileSize));
 
 
 	// Use STB to read the image
 	// Use STB to read the image

+ 12 - 11
src/anki/resource/MaterialResource.cpp

@@ -167,7 +167,7 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		for(U i = 0; i < MAX_INSTANCE_GROUPS; ++i)
+		for(U32 i = 0; i < MAX_INSTANCE_GROUPS; ++i)
 		{
 		{
 			if(m_instanceMutator->getValues()[i] != (1 << i))
 			if(m_instanceMutator->getValues()[i] != (1 << i))
 			{
 			{
@@ -182,13 +182,13 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 	m_passMutator = m_prog->tryFindMutator("PASS");
 	m_passMutator = m_prog->tryFindMutator("PASS");
 	if(m_passMutator)
 	if(m_passMutator)
 	{
 	{
-		if(m_passMutator->getValues().getSize() != U(Pass::COUNT))
+		if(m_passMutator->getValues().getSize() != U32(Pass::COUNT))
 		{
 		{
 			ANKI_RESOURCE_LOGE("Mutator PASS should have %u values in the program", U(Pass::COUNT));
 			ANKI_RESOURCE_LOGE("Mutator PASS should have %u values in the program", U(Pass::COUNT));
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		for(U i = 0; i < U(Pass::COUNT); ++i)
+		for(U32 i = 0; i < U(Pass::COUNT); ++i)
 		{
 		{
 			if(m_passMutator->getValues()[i] != I(i))
 			if(m_passMutator->getValues()[i] != I(i))
 			{
 			{
@@ -215,7 +215,7 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		for(U i = 0; i < m_lodMutator->getValues().getSize(); ++i)
+		for(U32 i = 0; i < m_lodMutator->getValues().getSize(); ++i)
 		{
 		{
 			if(m_lodMutator->getValues()[i] != I(i))
 			if(m_lodMutator->getValues()[i] != I(i))
 			{
 			{
@@ -237,7 +237,7 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		for(U i = 0; i < m_bonesMutator->getValues().getSize(); ++i)
+		for(U32 i = 0; i < m_bonesMutator->getValues().getSize(); ++i)
 		{
 		{
 			if(m_bonesMutator->getValues()[i] != I(i))
 			if(m_bonesMutator->getValues()[i] != I(i))
 			{
 			{
@@ -258,7 +258,7 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		for(U i = 0; i < m_velocityMutator->getValues().getSize(); ++i)
+		for(U32 i = 0; i < m_velocityMutator->getValues().getSize(); ++i)
 		{
 		{
 			if(m_velocityMutator->getValues()[i] != I(i))
 			if(m_velocityMutator->getValues()[i] != I(i))
 			{
 			{
@@ -282,8 +282,8 @@ Error MaterialResource::parseMutators(XmlElement mutatorsEl)
 Error MaterialResource::parseInputs(XmlElement inputsEl, Bool async)
 Error MaterialResource::parseInputs(XmlElement inputsEl, Bool async)
 {
 {
 	// Iterate the program's variables and get counts
 	// Iterate the program's variables and get counts
-	U constInputCount = 0;
-	U nonConstInputCount = 0;
+	U32 constInputCount = 0;
+	U32 nonConstInputCount = 0;
 	for(const ShaderProgramResourceInputVariable& in : m_prog->getInputVariables())
 	for(const ShaderProgramResourceInputVariable& in : m_prog->getInputVariables())
 	{
 	{
 		if(!in.acceptAllMutations(m_mutations))
 		if(!in.acceptAllMutations(m_mutations))
@@ -538,12 +538,13 @@ const MaterialVariant& MaterialResource::getOrCreateVariant(const RenderingKey&
 
 
 	if(variant.m_variant == nullptr)
 	if(variant.m_variant == nullptr)
 	{
 	{
-		const U mutatorCount = m_mutations.getSize() + ((m_instanceMutator) ? 1 : 0) + ((m_passMutator) ? 1 : 0)
-							   + ((m_lodMutator) ? 1 : 0) + ((m_bonesMutator) ? 1 : 0) + ((m_velocityMutator) ? 1 : 0);
+		const U32 mutatorCount = m_mutations.getSize() + ((m_instanceMutator) ? 1 : 0) + ((m_passMutator) ? 1 : 0)
+								 + ((m_lodMutator) ? 1 : 0) + ((m_bonesMutator) ? 1 : 0)
+								 + ((m_velocityMutator) ? 1 : 0);
 
 
 		DynamicArrayAuto<ShaderProgramResourceMutation> mutations(getTempAllocator());
 		DynamicArrayAuto<ShaderProgramResourceMutation> mutations(getTempAllocator());
 		mutations.create(mutatorCount);
 		mutations.create(mutatorCount);
-		U count = m_mutations.getSize();
+		U32 count = m_mutations.getSize();
 		if(m_mutations.getSize())
 		if(m_mutations.getSize())
 		{
 		{
 			memcpy(&mutations[0], &m_mutations[0], m_mutations.getSize() * sizeof(m_mutations[0]));
 			memcpy(&mutations[0], &m_mutations[0], m_mutations.getSize() * sizeof(m_mutations[0]));

+ 4 - 4
src/anki/resource/MeshLoader.cpp

@@ -272,14 +272,14 @@ Error MeshLoader::storeIndicesAndPosition(DynamicArrayAuto<U32>& indices, Dynami
 
 
 		// Create staging buff
 		// Create staging buff
 		const PtrSize idxBufferSize = getIndexBufferSize();
 		const PtrSize idxBufferSize = getIndexBufferSize();
-		DynamicArrayAuto<U8> staging(m_alloc);
+		DynamicArrayAuto<U8, PtrSize> staging(m_alloc);
 		staging.create(idxBufferSize);
 		staging.create(idxBufferSize);
 
 
 		// Store to staging buff
 		// Store to staging buff
 		ANKI_CHECK(storeIndexBuffer(&staging[0], staging.getSizeInBytes()));
 		ANKI_CHECK(storeIndexBuffer(&staging[0], staging.getSizeInBytes()));
 
 
 		// Copy
 		// Copy
-		for(U i = 0; i < m_header.m_totalIndexCount; ++i)
+		for(U32 i = 0; i < m_header.m_totalIndexCount; ++i)
 		{
 		{
 			if(m_header.m_indexType == IndexType::U32)
 			if(m_header.m_indexType == IndexType::U32)
 			{
 			{
@@ -301,14 +301,14 @@ Error MeshLoader::storeIndicesAndPosition(DynamicArrayAuto<U32>& indices, Dynami
 
 
 		// Create staging buff
 		// Create staging buff
 		const PtrSize vertBuffSize = m_header.m_totalVertexCount * buffInfo.m_vertexStride;
 		const PtrSize vertBuffSize = m_header.m_totalVertexCount * buffInfo.m_vertexStride;
-		DynamicArrayAuto<U8> staging(m_alloc);
+		DynamicArrayAuto<U8, PtrSize> staging(m_alloc);
 		staging.create(vertBuffSize);
 		staging.create(vertBuffSize);
 
 
 		// Store to staging buff
 		// Store to staging buff
 		ANKI_CHECK(storeVertexBuffer(attrib.m_bufferBinding, &staging[0], staging.getSizeInBytes()));
 		ANKI_CHECK(storeVertexBuffer(attrib.m_bufferBinding, &staging[0], staging.getSizeInBytes()));
 
 
 		// Copy
 		// Copy
-		for(U i = 0; i < m_header.m_totalVertexCount; ++i)
+		for(U32 i = 0; i < m_header.m_totalVertexCount; ++i)
 		{
 		{
 			Vec3 vert(0.0f);
 			Vec3 vert(0.0f);
 			if(attrib.m_format == Format::R32G32B32_SFLOAT)
 			if(attrib.m_format == Format::R32G32B32_SFLOAT)

+ 2 - 2
src/anki/resource/MeshResource.cpp

@@ -84,7 +84,7 @@ Error MeshResource::load(const ResourceFilename& filename, Bool async)
 
 
 	// Get submeshes
 	// Get submeshes
 	m_subMeshes.create(getAllocator(), header.m_subMeshCount);
 	m_subMeshes.create(getAllocator(), header.m_subMeshCount);
-	for(U i = 0; i < m_subMeshes.getSize(); ++i)
+	for(U32 i = 0; i < m_subMeshes.getSize(); ++i)
 	{
 	{
 		m_subMeshes[i].m_firstIndex = loader.getSubMeshes()[i].m_firstIndex;
 		m_subMeshes[i].m_firstIndex = loader.getSubMeshes()[i].m_firstIndex;
 		m_subMeshes[i].m_indexCount = loader.getSubMeshes()[i].m_indexCount;
 		m_subMeshes[i].m_indexCount = loader.getSubMeshes()[i].m_indexCount;
@@ -111,7 +111,7 @@ Error MeshResource::load(const ResourceFilename& filename, Bool async)
 	m_vertBufferInfos.create(getAllocator(), header.m_vertexBufferCount);
 	m_vertBufferInfos.create(getAllocator(), header.m_vertexBufferCount);
 
 
 	U32 totalVertexBuffSize = 0;
 	U32 totalVertexBuffSize = 0;
-	for(U i = 0; i < header.m_vertexBufferCount; ++i)
+	for(U32 i = 0; i < header.m_vertexBufferCount; ++i)
 	{
 	{
 		alignRoundUp(VERTEX_BUFFER_ALIGNMENT, totalVertexBuffSize);
 		alignRoundUp(VERTEX_BUFFER_ALIGNMENT, totalVertexBuffSize);
 
 

+ 3 - 3
src/anki/resource/MeshResource.h

@@ -41,7 +41,7 @@ public:
 	}
 	}
 
 
 	/// Get submesh info.
 	/// Get submesh info.
-	void getSubMeshInfo(U subMeshId, U32& firstIndex, U32& indexCount, const Obb*& obb) const
+	void getSubMeshInfo(U32 subMeshId, U32& firstIndex, U32& indexCount, const Obb*& obb) const
 	{
 	{
 		const SubMesh& sm = m_subMeshes[subMeshId];
 		const SubMesh& sm = m_subMeshes[subMeshId];
 		firstIndex = sm.m_firstIndex;
 		firstIndex = sm.m_firstIndex;
@@ -51,7 +51,7 @@ public:
 
 
 	U32 getSubMeshCount() const
 	U32 getSubMeshCount() const
 	{
 	{
-		return U32(m_subMeshes.getSize());
+		return m_subMeshes.getSize();
 	}
 	}
 
 
 	/// Get all info around vertex indices.
 	/// Get all info around vertex indices.
@@ -66,7 +66,7 @@ public:
 	/// Get the number of logical vertex buffers.
 	/// Get the number of logical vertex buffers.
 	U32 getVertexBufferCount() const
 	U32 getVertexBufferCount() const
 	{
 	{
-		return U32(m_vertBufferInfos.getSize());
+		return m_vertBufferInfos.getSize();
 	}
 	}
 
 
 	/// Get vertex buffer info.
 	/// Get vertex buffer info.

+ 3 - 3
src/anki/resource/ModelResource.cpp

@@ -123,7 +123,7 @@ Error ModelPatch::init(ModelResource* model,
 
 
 	// Load meshes
 	// Load meshes
 	m_meshCount = 0;
 	m_meshCount = 0;
-	for(U i = 0; i < meshFNames.getSize(); i++)
+	for(U32 i = 0; i < meshFNames.getSize(); i++)
 	{
 	{
 		ANKI_CHECK(manager->loadResource(meshFNames[i], m_meshes[i], async));
 		ANKI_CHECK(manager->loadResource(meshFNames[i], m_meshes[i], async));
 
 
@@ -172,7 +172,7 @@ Error ModelResource::load(const ResourceFilename& filename, Bool async)
 	ANKI_CHECK(modelPatchesEl.getChildElement("modelPatch", modelPatchEl));
 	ANKI_CHECK(modelPatchesEl.getChildElement("modelPatch", modelPatchEl));
 
 
 	// Count
 	// Count
-	U count = 0;
+	U32 count = 0;
 	do
 	do
 	{
 	{
 		++count;
 		++count;
@@ -197,7 +197,7 @@ Error ModelResource::load(const ResourceFilename& filename, Bool async)
 		ANKI_CHECK(modelPatchEl.getChildElement("material", materialEl));
 		ANKI_CHECK(modelPatchEl.getChildElement("material", materialEl));
 
 
 		Array<CString, 3> meshesFnames;
 		Array<CString, 3> meshesFnames;
-		U meshesCount = 1;
+		U32 meshesCount = 1;
 
 
 		// Get mesh
 		// Get mesh
 		XmlElement meshEl;
 		XmlElement meshEl;

+ 4 - 4
src/anki/resource/ShaderProgramPreProcessor.cpp

@@ -411,7 +411,7 @@ Error ShaderProgramPreprocessor::parsePragmaMutator(
 				ANKI_PP_ERROR("Can't have more than one instanced mutators");
 				ANKI_PP_ERROR("Can't have more than one instanced mutators");
 			}
 			}
 
 
-			m_instancedMutatorIdx = U32(m_mutators.getSize() - 1);
+			m_instancedMutatorIdx = m_mutators.getSize() - 1;
 			++begin;
 			++begin;
 		}
 		}
 		else
 		else
@@ -429,7 +429,7 @@ Error ShaderProgramPreprocessor::parsePragmaMutator(
 		}
 		}
 
 
 		// Check for duplicate mutators
 		// Check for duplicate mutators
-		for(U i = 0; i < m_mutators.getSize() - 1; ++i)
+		for(U32 i = 0; i < m_mutators.getSize() - 1; ++i)
 		{
 		{
 			if(m_mutators[i].m_name == *begin)
 			if(m_mutators[i].m_name == *begin)
 			{
 			{
@@ -471,7 +471,7 @@ Error ShaderProgramPreprocessor::parsePragmaMutator(
 		std::sort(mutator.m_values.getBegin(), mutator.m_values.getEnd());
 		std::sort(mutator.m_values.getBegin(), mutator.m_values.getEnd());
 
 
 		// Check for duplicates
 		// Check for duplicates
-		for(U i = 1; i < mutator.m_values.getSize(); ++i)
+		for(U32 i = 1; i < mutator.m_values.getSize(); ++i)
 		{
 		{
 			if(mutator.m_values[i - 1] == mutator.m_values[i])
 			if(mutator.m_values[i - 1] == mutator.m_values[i])
 			{
 			{
@@ -546,7 +546,7 @@ Error ShaderProgramPreprocessor::parsePragmaInput(
 		}
 		}
 
 
 		// Check if there are duplicates
 		// Check if there are duplicates
-		for(U i = 0; i < m_inputs.getSize() - 1; ++i)
+		for(U32 i = 0; i < m_inputs.getSize() - 1; ++i)
 		{
 		{
 			if(m_inputs[i].m_name == *begin)
 			if(m_inputs[i].m_name == *begin)
 			{
 			{

+ 6 - 6
src/anki/resource/ShaderProgramResource.cpp

@@ -16,7 +16,7 @@ Bool ShaderProgramResourceInputVariable::evalPreproc(ConstWeakArray<te_variable>
 	ANKI_ASSERT(vars.getSize() == m_program->getMutators().getSize());
 	ANKI_ASSERT(vars.getSize() == m_program->getMutators().getSize());
 
 
 	int err;
 	int err;
-	te_expr* n = te_compile(m_preprocExpr.cstr(), &vars[0], U32(vars.getSize()), &err);
+	te_expr* n = te_compile(m_preprocExpr.cstr(), &vars[0], vars.getSize(), &err);
 
 
 	if(!n)
 	if(!n)
 	{
 	{
@@ -41,7 +41,7 @@ Bool ShaderProgramResourceInputVariable::recusiveSpin(U32 crntMissingMutatorIdx,
 {
 {
 	for(ShaderProgramResourceMutatorValue val : missingMutators[crntMissingMutatorIdx]->getValues())
 	for(ShaderProgramResourceMutatorValue val : missingMutators[crntMissingMutatorIdx]->getValues())
 	{
 	{
-		const U valIdx = varIdxOffset + crntMissingMutatorIdx;
+		const U32 valIdx = varIdxOffset + crntMissingMutatorIdx;
 		varValues[valIdx] = val;
 		varValues[valIdx] = val;
 		vars[valIdx] = {missingMutators[crntMissingMutatorIdx]->getName().cstr(), &varValues[valIdx], 0, 0};
 		vars[valIdx] = {missingMutators[crntMissingMutatorIdx]->getName().cstr(), &varValues[valIdx], 0, 0};
 
 
@@ -181,19 +181,19 @@ Error ShaderProgramResource::load(const ResourceFilename& filename, Bool async)
 	m_source.create(getAllocator(), pp.getSource());
 	m_source.create(getAllocator(), pp.getSource());
 
 
 	// Create the mutators
 	// Create the mutators
-	U instancedMutatorIdx = MAX_U;
+	U32 instancedMutatorIdx = MAX_U32;
 	if(pp.getMutators().getSize())
 	if(pp.getMutators().getSize())
 	{
 	{
 		m_mutators.create(getAllocator(), pp.getMutators().getSize());
 		m_mutators.create(getAllocator(), pp.getMutators().getSize());
 
 
-		for(U i = 0; i < m_mutators.getSize(); ++i)
+		for(U32 i = 0; i < m_mutators.getSize(); ++i)
 		{
 		{
 			Mutator& out = m_mutators[i];
 			Mutator& out = m_mutators[i];
 			const ShaderProgramPreprocessorMutator& in = pp.getMutators()[i];
 			const ShaderProgramPreprocessorMutator& in = pp.getMutators()[i];
 
 
 			out.m_name.create(getAllocator(), in.getName());
 			out.m_name.create(getAllocator(), in.getName());
 			out.m_values.create(getAllocator(), in.getValues().getSize());
 			out.m_values.create(getAllocator(), in.getValues().getSize());
-			for(U j = 0; j < out.m_values.getSize(); ++j)
+			for(U32 j = 0; j < out.m_values.getSize(); ++j)
 			{
 			{
 				out.m_values[j] = in.getValues()[j];
 				out.m_values[j] = in.getValues()[j];
 			}
 			}
@@ -231,7 +231,7 @@ Error ShaderProgramResource::load(const ResourceFilename& filename, Bool async)
 	// Set some other vars
 	// Set some other vars
 	m_descriptorSet = U8(pp.getDescritproSet());
 	m_descriptorSet = U8(pp.getDescritproSet());
 	m_shaderStages = pp.getShaderTypes();
 	m_shaderStages = pp.getShaderTypes();
-	if(instancedMutatorIdx != MAX_U)
+	if(instancedMutatorIdx != MAX_U32)
 	{
 	{
 		m_instancingMutator = &m_mutators[instancedMutatorIdx];
 		m_instancingMutator = &m_mutators[instancedMutatorIdx];
 	}
 	}

+ 6 - 6
src/anki/resource/ShaderProgramResource.h

@@ -374,7 +374,7 @@ private:
 };
 };
 
 
 /// Smart initializer of multiple ShaderProgramResourceConstantValue.
 /// Smart initializer of multiple ShaderProgramResourceConstantValue.
-template<U count>
+template<U32 count>
 class ShaderProgramResourceConstantValueInitList
 class ShaderProgramResourceConstantValueInitList
 {
 {
 public:
 public:
@@ -407,19 +407,19 @@ public:
 		return ConstWeakArray<ShaderProgramResourceConstantValue>(&m_constantValues[0], m_count);
 		return ConstWeakArray<ShaderProgramResourceConstantValue>(&m_constantValues[0], m_count);
 	}
 	}
 
 
-	ShaderProgramResourceConstantValue& operator[](U idx)
+	ShaderProgramResourceConstantValue& operator[](U32 idx)
 	{
 	{
 		return m_constantValues[idx];
 		return m_constantValues[idx];
 	}
 	}
 
 
 private:
 private:
 	ShaderProgramResourcePtr m_ptr;
 	ShaderProgramResourcePtr m_ptr;
-	U m_count = 0;
+	U32 m_count = 0;
 	Array<ShaderProgramResourceConstantValue, count> m_constantValues;
 	Array<ShaderProgramResourceConstantValue, count> m_constantValues;
 };
 };
 
 
 /// Smart initializer of multiple ShaderProgramResourceMutation.
 /// Smart initializer of multiple ShaderProgramResourceMutation.
-template<U count>
+template<U32 count>
 class ShaderProgramResourceMutationInitList
 class ShaderProgramResourceMutationInitList
 {
 {
 public:
 public:
@@ -449,14 +449,14 @@ public:
 		return ConstWeakArray<ShaderProgramResourceMutation>(&m_mutations[0], m_count);
 		return ConstWeakArray<ShaderProgramResourceMutation>(&m_mutations[0], m_count);
 	}
 	}
 
 
-	ShaderProgramResourceMutation& operator[](U idx)
+	ShaderProgramResourceMutation& operator[](U32 idx)
 	{
 	{
 		return m_mutations[idx];
 		return m_mutations[idx];
 	}
 	}
 
 
 private:
 private:
 	ShaderProgramResourcePtr m_ptr;
 	ShaderProgramResourcePtr m_ptr;
-	U m_count = 0;
+	U32 m_count = 0;
 	Array<ShaderProgramResourceMutation, count> m_mutations;
 	Array<ShaderProgramResourceMutation, count> m_mutations;
 };
 };
 /// @}
 /// @}

+ 2 - 2
src/anki/resource/SkeletonResource.cpp

@@ -95,13 +95,13 @@ Error SkeletonResource::load(const ResourceFilename& filename, Bool async)
 
 
 	// Resolve the parents
 	// Resolve the parents
 	auto it = boneParents.getBegin();
 	auto it = boneParents.getBegin();
-	for(U i = 0; i < m_bones.getSize(); ++i)
+	for(U32 i = 0; i < m_bones.getSize(); ++i)
 	{
 	{
 		Bone& bone = m_bones[i];
 		Bone& bone = m_bones[i];
 
 
 		if(!it->isEmpty())
 		if(!it->isEmpty())
 		{
 		{
-			for(U j = 0; j < m_bones.getSize(); ++j)
+			for(U32 j = 0; j < m_bones.getSize(); ++j)
 			{
 			{
 				if(m_bones[j].m_name == *it)
 				if(m_bones[j].m_name == *it)
 				{
 				{

+ 3 - 3
src/anki/resource/TextureAtlasResource.cpp

@@ -62,8 +62,8 @@ Error TextureAtlasResource::load(const ResourceFilename& filename, Bool async)
 	//
 	//
 
 
 	// Get counts
 	// Get counts
-	PtrSize namesSize = 0;
-	PtrSize subTexesCount = 0;
+	U32 namesSize = 0;
+	U32 subTexesCount = 0;
 	XmlElement subTexesEl, subTexEl;
 	XmlElement subTexesEl, subTexEl;
 	ANKI_CHECK(rootel.getChildElement("subTextures", subTexesEl));
 	ANKI_CHECK(rootel.getChildElement("subTextures", subTexesEl));
 	ANKI_CHECK(subTexesEl.getChildElement("subTexture", subTexEl));
 	ANKI_CHECK(subTexesEl.getChildElement("subTexture", subTexEl));
@@ -79,7 +79,7 @@ Error TextureAtlasResource::load(const ResourceFilename& filename, Bool async)
 			return Error::USER_DATA;
 			return Error::USER_DATA;
 		}
 		}
 
 
-		namesSize += name.getLength() + 1;
+		namesSize += U32(name.getLength()) + 1;
 		++subTexesCount;
 		++subTexesCount;
 
 
 		ANKI_CHECK(subTexEl.getNextSiblingElement("subTexture", subTexEl));
 		ANKI_CHECK(subTexEl.getNextSiblingElement("subTexture", subTexEl));

+ 4 - 4
src/anki/scene/DebugDrawer.cpp

@@ -369,7 +369,7 @@ void DebugDrawer2::drawCubes(ConstWeakArray<Mat4> mvps,
 	mutators.add("COLOR_TEXTURE", 0);
 	mutators.add("COLOR_TEXTURE", 0);
 	mutators.add("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
 	mutators.add("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
 	ShaderProgramResourceConstantValueInitList<1> consts(m_prog);
 	ShaderProgramResourceConstantValueInitList<1> consts(m_prog);
-	consts.add("INSTANCE_COUNT", U32(mvps.getSize()));
+	consts.add("INSTANCE_COUNT", mvps.getSize());
 	const ShaderProgramResourceVariant* variant;
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
 	m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
 	cmdb->bindShaderProgram(variant->getProgram());
 	cmdb->bindShaderProgram(variant->getProgram());
@@ -381,7 +381,7 @@ void DebugDrawer2::drawCubes(ConstWeakArray<Mat4> mvps,
 	cmdb->bindUniformBuffer(1, 0, unisToken.m_buffer, unisToken.m_offset, unisToken.m_range);
 	cmdb->bindUniformBuffer(1, 0, unisToken.m_buffer, unisToken.m_offset, unisToken.m_range);
 
 
 	cmdb->setLineWidth(lineSize);
 	cmdb->setLineWidth(lineSize);
-	cmdb->drawElements(PrimitiveTopology::LINES, indexCount, U32(mvps.getSize()));
+	cmdb->drawElements(PrimitiveTopology::LINES, indexCount, mvps.getSize());
 }
 }
 
 
 void DebugDrawer2::drawBillboardTextures(const Mat4& projMat,
 void DebugDrawer2::drawBillboardTextures(const Mat4& projMat,
@@ -444,7 +444,7 @@ void DebugDrawer2::drawBillboardTextures(const Mat4& projMat,
 	mutators.add("COLOR_TEXTURE", 1);
 	mutators.add("COLOR_TEXTURE", 1);
 	mutators.add("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
 	mutators.add("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
 	ShaderProgramResourceConstantValueInitList<1> consts(m_prog);
 	ShaderProgramResourceConstantValueInitList<1> consts(m_prog);
-	consts.add("INSTANCE_COUNT", U32(positions.getSize()));
+	consts.add("INSTANCE_COUNT", positions.getSize());
 	const ShaderProgramResourceVariant* variant;
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
 	m_prog->getOrCreateVariant(mutators.get(), consts.get(), variant);
 	cmdb->bindShaderProgram(variant->getProgram());
 	cmdb->bindShaderProgram(variant->getProgram());
@@ -458,7 +458,7 @@ void DebugDrawer2::drawBillboardTextures(const Mat4& projMat,
 	cmdb->bindSampler(1, 1, sampler);
 	cmdb->bindSampler(1, 1, sampler);
 	cmdb->bindTexture(1, 2, tex, TextureUsageBit::SAMPLED_FRAGMENT);
 	cmdb->bindTexture(1, 2, tex, TextureUsageBit::SAMPLED_FRAGMENT);
 
 
-	cmdb->drawArrays(PrimitiveTopology::TRIANGLE_STRIP, 4, U32(positions.getSize()));
+	cmdb->drawArrays(PrimitiveTopology::TRIANGLE_STRIP, 4, positions.getSize());
 }
 }
 
 
 } // end namespace anki
 } // end namespace anki

+ 1 - 1
src/anki/scene/DecalNode.cpp

@@ -99,7 +99,7 @@ void DecalNode::drawCallback(RenderQueueDrawContext& ctx, ConstWeakArray<void*>
 {
 {
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
-	for(U i = 0; i < userData.getSize(); ++i)
+	for(U32 i = 0; i < userData.getSize(); ++i)
 	{
 	{
 		const DecalNode& self = *static_cast<const DecalNode*>(userData[i]);
 		const DecalNode& self = *static_cast<const DecalNode*>(userData[i]);
 		const DecalComponent& decalComp = self.getComponent<DecalComponent>();
 		const DecalComponent& decalComp = self.getComponent<DecalComponent>();

+ 1 - 1
src/anki/scene/GlobalIlluminationProbeNode.cpp

@@ -210,7 +210,7 @@ void GlobalIlluminationProbeNode::debugDrawCallback(RenderQueueDrawContext& ctx,
 {
 {
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
-	for(U i = 0; i < userData.getSize(); ++i)
+	for(U32 i = 0; i < userData.getSize(); ++i)
 	{
 	{
 		const GlobalIlluminationProbeNode& self = *static_cast<const GlobalIlluminationProbeNode*>(userData[i]);
 		const GlobalIlluminationProbeNode& self = *static_cast<const GlobalIlluminationProbeNode*>(userData[i]);
 		const GlobalIlluminationProbeComponent& giComp = self.getComponent<GlobalIlluminationProbeComponent>();
 		const GlobalIlluminationProbeComponent& giComp = self.getComponent<GlobalIlluminationProbeComponent>();

+ 2 - 2
src/anki/scene/LightNode.cpp

@@ -223,7 +223,7 @@ void PointLightNode::onMoveUpdate(const MoveComponent& move)
 	onMoveUpdateCommon(move);
 	onMoveUpdateCommon(move);
 
 
 	// Update the frustums
 	// Update the frustums
-	U count = 0;
+	U32 count = 0;
 	Error err = iterateComponentsOfType<FrustumComponent>([&](FrustumComponent& fr) -> Error {
 	Error err = iterateComponentsOfType<FrustumComponent>([&](FrustumComponent& fr) -> Error {
 		Transform trf = m_shadowData[count].m_localTrf;
 		Transform trf = m_shadowData[count].m_localTrf;
 		trf.setOrigin(move.getWorldTransform().getOrigin());
 		trf.setOrigin(move.getWorldTransform().getOrigin());
@@ -276,7 +276,7 @@ Error PointLightNode::frameUpdate(Second prevUpdateTime, Second crntTime)
 		m_shadowData[5].m_localTrf.setRotation(Mat3x4(rot));
 		m_shadowData[5].m_localTrf.setRotation(Mat3x4(rot));
 
 
 		const Vec4& origin = getComponent<MoveComponent>().getWorldTransform().getOrigin();
 		const Vec4& origin = getComponent<MoveComponent>().getWorldTransform().getOrigin();
-		for(U i = 0; i < 6; i++)
+		for(U32 i = 0; i < 6; i++)
 		{
 		{
 			Transform trf = m_shadowData[i].m_localTrf;
 			Transform trf = m_shadowData[i].m_localTrf;
 			trf.setOrigin(origin);
 			trf.setOrigin(origin);

+ 3 - 3
src/anki/scene/ModelNode.cpp

@@ -136,7 +136,7 @@ void ModelNode::draw(RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData
 		trfs[0] = Mat4(movec.getWorldTransform());
 		trfs[0] = Mat4(movec.getWorldTransform());
 		prevTrfs[0] = Mat4(movec.getPreviousWorldTransform());
 		prevTrfs[0] = Mat4(movec.getPreviousWorldTransform());
 		Bool moved = trfs[0] != prevTrfs[0];
 		Bool moved = trfs[0] != prevTrfs[0];
-		for(U i = 1; i < userData.getSize(); ++i)
+		for(U32 i = 1; i < userData.getSize(); ++i)
 		{
 		{
 			const ModelNode& self2 = *static_cast<const ModelNode*>(userData[i]);
 			const ModelNode& self2 = *static_cast<const ModelNode*>(userData[i]);
 			const MoveComponent& movec = self2.getComponent<MoveComponent>();
 			const MoveComponent& movec = self2.getComponent<MoveComponent>();
@@ -195,7 +195,7 @@ void ModelNode::draw(RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData
 		// Draw
 		// Draw
 		cmdb->drawElements(PrimitiveTopology::TRIANGLES,
 		cmdb->drawElements(PrimitiveTopology::TRIANGLES,
 			modelInf.m_indicesCountArray[0],
 			modelInf.m_indicesCountArray[0],
-			U32(userData.getSize()),
+			userData.getSize(),
 			U32(modelInf.m_indicesOffsetArray[0] / sizeof(U16)),
 			U32(modelInf.m_indicesOffsetArray[0] / sizeof(U16)),
 			0,
 			0,
 			0);
 			0);
@@ -205,7 +205,7 @@ void ModelNode::draw(RenderQueueDrawContext& ctx, ConstWeakArray<void*> userData
 		// Draw the bounding volumes
 		// Draw the bounding volumes
 
 
 		Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 		Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
-		for(U i = 0; i < userData.getSize(); ++i)
+		for(U32 i = 0; i < userData.getSize(); ++i)
 		{
 		{
 			const ModelNode& self2 = *static_cast<const ModelNode*>(userData[i]);
 			const ModelNode& self2 = *static_cast<const ModelNode*>(userData[i]);
 
 

+ 4 - 4
src/anki/scene/OccluderNode.cpp

@@ -48,7 +48,7 @@ Error OccluderNode::init(const CString& meshFname)
 	MeshLoader loader(&getSceneGraph().getResourceManager());
 	MeshLoader loader(&getSceneGraph().getResourceManager());
 	ANKI_CHECK(loader.load(meshFname));
 	ANKI_CHECK(loader.load(meshFname));
 
 
-	const U indexCount = loader.getHeader().m_totalIndexCount;
+	const U32 indexCount = loader.getHeader().m_totalIndexCount;
 	m_vertsL.create(getAllocator(), indexCount);
 	m_vertsL.create(getAllocator(), indexCount);
 	m_vertsW.create(getAllocator(), indexCount);
 	m_vertsW.create(getAllocator(), indexCount);
 
 
@@ -56,7 +56,7 @@ Error OccluderNode::init(const CString& meshFname)
 	DynamicArrayAuto<U32> indices(getAllocator());
 	DynamicArrayAuto<U32> indices(getAllocator());
 	ANKI_CHECK(loader.storeIndicesAndPosition(indices, positions));
 	ANKI_CHECK(loader.storeIndicesAndPosition(indices, positions));
 
 
-	for(U i = 0; i < indices.getSize(); ++i)
+	for(U32 i = 0; i < indices.getSize(); ++i)
 	{
 	{
 		m_vertsL[i] = positions[indices[i]];
 		m_vertsL[i] = positions[indices[i]];
 	}
 	}
@@ -72,14 +72,14 @@ Error OccluderNode::init(const CString& meshFname)
 void OccluderNode::onMoveComponentUpdate(MoveComponent& movec)
 void OccluderNode::onMoveComponentUpdate(MoveComponent& movec)
 {
 {
 	const Transform& trf(movec.getWorldTransform());
 	const Transform& trf(movec.getWorldTransform());
-	U count = m_vertsL.getSize();
+	U32 count = m_vertsL.getSize();
 	while(count--)
 	while(count--)
 	{
 	{
 
 
 		m_vertsW[count] = trf.transform(m_vertsL[count]);
 		m_vertsW[count] = trf.transform(m_vertsL[count]);
 	}
 	}
 
 
-	getComponent<OccluderComponent>().setVertices(&m_vertsW[0], U32(m_vertsW.getSize()), sizeof(m_vertsW[0]));
+	getComponent<OccluderComponent>().setVertices(&m_vertsW[0], m_vertsW.getSize(), sizeof(m_vertsW[0]));
 }
 }
 
 
 } // end namespace anki
 } // end namespace anki

+ 2 - 2
src/anki/scene/ParticleEmitterNode.cpp

@@ -356,7 +356,7 @@ void ParticleEmitterNode::createParticlesPhysicsSimulation(SceneGraph* scene)
 
 
 	m_particles.create(getAllocator(), m_maxNumOfParticles);
 	m_particles.create(getAllocator(), m_maxNumOfParticles);
 
 
-	for(U i = 0; i < m_maxNumOfParticles; i++)
+	for(U32 i = 0; i < m_maxNumOfParticles; i++)
 	{
 	{
 		binit.m_mass = getRandomRange(m_particle.m_minMass, m_particle.m_maxMass);
 		binit.m_mass = getRandomRange(m_particle.m_minMass, m_particle.m_maxMass);
 
 
@@ -370,7 +370,7 @@ void ParticleEmitterNode::createParticlesSimpleSimulation()
 {
 {
 	m_particles.create(getAllocator(), m_maxNumOfParticles);
 	m_particles.create(getAllocator(), m_maxNumOfParticles);
 
 
-	for(U i = 0; i < m_maxNumOfParticles; i++)
+	for(U32 i = 0; i < m_maxNumOfParticles; i++)
 	{
 	{
 		ParticleSimple* part = getAllocator().newInstance<ParticleSimple>();
 		ParticleSimple* part = getAllocator().newInstance<ParticleSimple>();
 
 

+ 1 - 1
src/anki/scene/ReflectionProbeNode.cpp

@@ -168,7 +168,7 @@ void ReflectionProbeNode::drawCallback(RenderQueueDrawContext& ctx, ConstWeakArr
 {
 {
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Mat4* const mvps = ctx.m_frameAllocator.newArray<Mat4>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
 	Vec3* const positions = ctx.m_frameAllocator.newArray<Vec3>(userData.getSize());
-	for(U i = 0; i < userData.getSize(); ++i)
+	for(U32 i = 0; i < userData.getSize(); ++i)
 	{
 	{
 		const ReflectionProbeNode& self = *static_cast<const ReflectionProbeNode*>(userData[i]);
 		const ReflectionProbeNode& self = *static_cast<const ReflectionProbeNode*>(userData[i]);
 		const ReflectionProbeComponent& rComp = self.getComponent<ReflectionProbeComponent>();
 		const ReflectionProbeComponent& rComp = self.getComponent<ReflectionProbeComponent>();

+ 5 - 5
src/anki/scene/SceneNode.h

@@ -134,7 +134,7 @@ public:
 	template<typename Component>
 	template<typename Component>
 	Component* tryGetComponent()
 	Component* tryGetComponent()
 	{
 	{
-		U count = m_components.getSize();
+		U32 count = m_components.getSize();
 		while(count-- != 0)
 		while(count-- != 0)
 		{
 		{
 			SceneComponent* comp = m_components[count];
 			SceneComponent* comp = m_components[count];
@@ -150,7 +150,7 @@ public:
 	template<typename Component>
 	template<typename Component>
 	const Component* tryGetComponent() const
 	const Component* tryGetComponent() const
 	{
 	{
-		U count = m_components.getSize();
+		U32 count = m_components.getSize();
 		while(count-- != 0)
 		while(count-- != 0)
 		{
 		{
 			const SceneComponent* comp = m_components[count];
 			const SceneComponent* comp = m_components[count];
@@ -182,7 +182,7 @@ public:
 
 
 	/// Get the nth component.
 	/// Get the nth component.
 	template<typename Component>
 	template<typename Component>
-	Component& getComponentAt(U idx)
+	Component& getComponentAt(U32 idx)
 	{
 	{
 		ANKI_ASSERT(m_components[idx]->getType() == Component::CLASS_TYPE);
 		ANKI_ASSERT(m_components[idx]->getType() == Component::CLASS_TYPE);
 		return *static_cast<Component*>(m_components[idx]);
 		return *static_cast<Component*>(m_components[idx]);
@@ -190,13 +190,13 @@ public:
 
 
 	/// Get the nth component.
 	/// Get the nth component.
 	template<typename Component>
 	template<typename Component>
-	const Component& getComponentAt(U idx) const
+	const Component& getComponentAt(U32 idx) const
 	{
 	{
 		ANKI_ASSERT(m_components[idx]->getType() == Component::CLASS_TYPE);
 		ANKI_ASSERT(m_components[idx]->getType() == Component::CLASS_TYPE);
 		return *static_cast<const Component*>(m_components[idx]);
 		return *static_cast<const Component*>(m_components[idx]);
 	}
 	}
 
 
-	U getComponentCount() const
+	U32 getComponentCount() const
 	{
 	{
 		return m_components.getSize();
 		return m_components.getSize();
 	}
 	}

+ 2 - 2
src/anki/scene/SoftwareRasterizer.cpp

@@ -24,7 +24,7 @@ void SoftwareRasterizer::prepare(const Mat4& mv, const Mat4& p, U32 width, U32 h
 	ANKI_ASSERT(width > 0 && height > 0);
 	ANKI_ASSERT(width > 0 && height > 0);
 	m_width = width;
 	m_width = width;
 	m_height = height;
 	m_height = height;
-	U size = width * height;
+	U32 size = width * height;
 	if(m_zbuffer.getSize() < size)
 	if(m_zbuffer.getSize() < size)
 	{
 	{
 		m_zbuffer.destroy(m_alloc);
 		m_zbuffer.destroy(m_alloc);
@@ -394,7 +394,7 @@ void SoftwareRasterizer::fillDepthBuffer(ConstWeakArray<F32> depthValues)
 {
 {
 	ANKI_ASSERT(m_zbuffer.getSize() == depthValues.getSize());
 	ANKI_ASSERT(m_zbuffer.getSize() == depthValues.getSize());
 
 
-	U count = depthValues.getSize();
+	U32 count = depthValues.getSize();
 	while(count--)
 	while(count--)
 	{
 	{
 		F32 depth = depthValues[count];
 		F32 depth = depthValues[count];

+ 19 - 19
src/anki/scene/Visibility.cpp

@@ -326,8 +326,8 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 		};
 		};
 		Array<SpatialTemp, MAX_SUB_DRAWCALLS> sps;
 		Array<SpatialTemp, MAX_SUB_DRAWCALLS> sps;
 
 
-		U spIdx = 0;
-		U count = 0;
+		U32 spIdx = 0;
+		U32 count = 0;
 		Error err = node.iterateComponentsOfType<SpatialComponent>([&](SpatialComponent& sp) {
 		Error err = node.iterateComponentsOfType<SpatialComponent>([&](SpatialComponent& sp) {
 			if(spatialInsideFrustum(testedFrc, sp) && testAgainstRasterizer(sp.getAabb()))
 			if(spatialInsideFrustum(testedFrc, sp) && testAgainstRasterizer(sp.getAabb()))
 			{
 			{
@@ -464,7 +464,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 			{
 			{
 				ANKI_ASSERT(lc->getShadowEnabled() == true && "Only with shadow for now");
 				ANKI_ASSERT(lc->getShadowEnabled() == true && "Only with shadow for now");
 
 
-				U cascadeCount;
+				U32 cascadeCount;
 				if(ANKI_UNLIKELY(!castsShadow))
 				if(ANKI_UNLIKELY(!castsShadow))
 				{
 				{
 					cascadeCount = 0;
 					cascadeCount = 0;
@@ -488,7 +488,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 										 cascadeCount * sizeof(FrustumComponent), alignof(FrustumComponent)))
 										 cascadeCount * sizeof(FrustumComponent), alignof(FrustumComponent)))
 								   : nullptr,
 								   : nullptr,
 					cascadeCount);
 					cascadeCount);
-				for(U i = 0; i < cascadeCount; ++i)
+				for(U32 i = 0; i < cascadeCount; ++i)
 				{
 				{
 					::new(&cascadeFrustumComponents[i]) FrustumComponent(&node, FrustumType::ORTHOGRAPHIC);
 					::new(&cascadeFrustumComponents[i]) FrustumComponent(&node, FrustumType::ORTHOGRAPHIC);
 				}
 				}
@@ -497,7 +497,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 
 
 				nextQueues = WeakArray<RenderQueue>(
 				nextQueues = WeakArray<RenderQueue>(
 					(cascadeCount) ? alloc.newArray<RenderQueue>(cascadeCount) : nullptr, cascadeCount);
 					(cascadeCount) ? alloc.newArray<RenderQueue>(cascadeCount) : nullptr, cascadeCount);
-				for(U i = 0; i < cascadeCount; ++i)
+				for(U32 i = 0; i < cascadeCount; ++i)
 				{
 				{
 					result.m_directionalLight.m_shadowRenderQueues[i] = &nextQueues[i];
 					result.m_directionalLight.m_shadowRenderQueues[i] = &nextQueues[i];
 				}
 				}
@@ -508,7 +508,7 @@ void VisibilityTestTask::test(ThreadHive& hive, U32 taskId)
 				result.m_directionalLight.m_uuid = testedNode.getUuid();
 				result.m_directionalLight.m_uuid = testedNode.getUuid();
 
 
 				// Manually update the dummy components
 				// Manually update the dummy components
-				for(U i = 0; i < cascadeCount; ++i)
+				for(U32 i = 0; i < cascadeCount; ++i)
 				{
 				{
 					cascadeFrustumComponents[i].setEnabledVisibilityTests(
 					cascadeFrustumComponents[i].setEnabledVisibilityTests(
 						FrustumComponentVisibilityTestFlag::SHADOW_CASTERS);
 						FrustumComponentVisibilityTestFlag::SHADOW_CASTERS);
@@ -633,9 +633,9 @@ void CombineResultsTask::combine()
 	RenderQueue& results = *m_frcCtx->m_renderQueue;
 	RenderQueue& results = *m_frcCtx->m_renderQueue;
 
 
 	// Compute the timestamp
 	// Compute the timestamp
-	const U threadCount = m_frcCtx->m_queueViews.getSize();
+	const U32 threadCount = m_frcCtx->m_queueViews.getSize();
 	results.m_shadowRenderablesLastUpdateTimestamp = 0;
 	results.m_shadowRenderablesLastUpdateTimestamp = 0;
-	for(U i = 0; i < threadCount; ++i)
+	for(U32 i = 0; i < threadCount; ++i)
 	{
 	{
 		results.m_shadowRenderablesLastUpdateTimestamp =
 		results.m_shadowRenderablesLastUpdateTimestamp =
 			max(results.m_shadowRenderablesLastUpdateTimestamp, m_frcCtx->m_queueViews[i].m_timestamp);
 			max(results.m_shadowRenderablesLastUpdateTimestamp, m_frcCtx->m_queueViews[i].m_timestamp);
@@ -645,7 +645,7 @@ void CombineResultsTask::combine()
 #define ANKI_VIS_COMBINE(t_, member_) \
 #define ANKI_VIS_COMBINE(t_, member_) \
 	{ \
 	{ \
 		Array<TRenderQueueElementStorage<t_>, 64> subStorages; \
 		Array<TRenderQueueElementStorage<t_>, 64> subStorages; \
-		for(U i = 0; i < threadCount; ++i) \
+		for(U32 i = 0; i < threadCount; ++i) \
 		{ \
 		{ \
 			subStorages[i] = m_frcCtx->m_queueViews[i].member_; \
 			subStorages[i] = m_frcCtx->m_queueViews[i].member_; \
 		} \
 		} \
@@ -660,7 +660,7 @@ void CombineResultsTask::combine()
 	{ \
 	{ \
 		Array<TRenderQueueElementStorage<t_>, 64> subStorages; \
 		Array<TRenderQueueElementStorage<t_>, 64> subStorages; \
 		Array<TRenderQueueElementStorage<U32>, 64> ptrSubStorages; \
 		Array<TRenderQueueElementStorage<U32>, 64> ptrSubStorages; \
-		for(U i = 0; i < threadCount; ++i) \
+		for(U32 i = 0; i < threadCount; ++i) \
 		{ \
 		{ \
 			subStorages[i] = m_frcCtx->m_queueViews[i].member_; \
 			subStorages[i] = m_frcCtx->m_queueViews[i].member_; \
 			ptrSubStorages[i] = m_frcCtx->m_queueViews[i].ptrMember_; \
 			ptrSubStorages[i] = m_frcCtx->m_queueViews[i].ptrMember_; \
@@ -685,7 +685,7 @@ void CombineResultsTask::combine()
 	ANKI_VIS_COMBINE(GlobalIlluminationProbeQueueElement, m_giProbes);
 	ANKI_VIS_COMBINE(GlobalIlluminationProbeQueueElement, m_giProbes);
 	ANKI_VIS_COMBINE(GenericGpuComputeJobQueueElement, m_genericGpuComputeJobs);
 	ANKI_VIS_COMBINE(GenericGpuComputeJobQueueElement, m_genericGpuComputeJobs);
 
 
-	for(U i = 0; i < threadCount; ++i)
+	for(U32 i = 0; i < threadCount; ++i)
 	{
 	{
 		if(m_frcCtx->m_queueViews[i].m_directionalLight.m_uuid != 0)
 		if(m_frcCtx->m_queueViews[i].m_directionalLight.m_uuid != 0)
 		{
 		{
@@ -735,9 +735,9 @@ void CombineResultsTask::combineQueueElements(SceneFrameAllocator<U8>& alloc,
 	WeakArray<T>& combined,
 	WeakArray<T>& combined,
 	WeakArray<T*>* ptrCombined)
 	WeakArray<T*>* ptrCombined)
 {
 {
-	U totalElCount = subStorages[0].m_elementCount;
-	U biggestSubStorageIdx = 0;
-	for(U i = 1; i < subStorages.getSize(); ++i)
+	U32 totalElCount = subStorages[0].m_elementCount;
+	U32 biggestSubStorageIdx = 0;
+	for(U32 i = 1; i < subStorages.getSize(); ++i)
 	{
 	{
 		totalElCount += subStorages[i].m_elementCount;
 		totalElCount += subStorages[i].m_elementCount;
 
 
@@ -757,9 +757,9 @@ void CombineResultsTask::combineQueueElements(SceneFrameAllocator<U8>& alloc,
 	if(ptrSubStorages != nullptr)
 	if(ptrSubStorages != nullptr)
 	{
 	{
 		ANKI_ASSERT(ptrCombined);
 		ANKI_ASSERT(ptrCombined);
-		U ptrTotalElCount = (*ptrSubStorages)[0].m_elementCount;
+		U32 ptrTotalElCount = (*ptrSubStorages)[0].m_elementCount;
 
 
-		for(U i = 1; i < ptrSubStorages->getSize(); ++i)
+		for(U32 i = 1; i < ptrSubStorages->getSize(); ++i)
 		{
 		{
 			ptrTotalElCount += (*ptrSubStorages)[i].m_elementCount;
 			ptrTotalElCount += (*ptrSubStorages)[i].m_elementCount;
 		}
 		}
@@ -778,7 +778,7 @@ void CombineResultsTask::combineQueueElements(SceneFrameAllocator<U8>& alloc,
 		// Can't reuse any of the existing storage, will allocate a brand new one
 		// Can't reuse any of the existing storage, will allocate a brand new one
 
 
 		it = alloc.newArray<T>(totalElCount);
 		it = alloc.newArray<T>(totalElCount);
-		biggestSubStorageIdx = MAX_U;
+		biggestSubStorageIdx = MAX_U32;
 
 
 		combined = WeakArray<T>(it, totalElCount);
 		combined = WeakArray<T>(it, totalElCount);
 	}
 	}
@@ -791,7 +791,7 @@ void CombineResultsTask::combineQueueElements(SceneFrameAllocator<U8>& alloc,
 		combined = WeakArray<T>(subStorages[biggestSubStorageIdx].m_elements, totalElCount);
 		combined = WeakArray<T>(subStorages[biggestSubStorageIdx].m_elements, totalElCount);
 	}
 	}
 
 
-	for(U i = 0; i < subStorages.getSize(); ++i)
+	for(U32 i = 0; i < subStorages.getSize(); ++i)
 	{
 	{
 		if(subStorages[i].m_elementCount == 0)
 		if(subStorages[i].m_elementCount == 0)
 		{
 		{
@@ -803,7 +803,7 @@ void CombineResultsTask::combineQueueElements(SceneFrameAllocator<U8>& alloc,
 		{
 		{
 			T* base = (i != biggestSubStorageIdx) ? it : subStorages[biggestSubStorageIdx].m_elements;
 			T* base = (i != biggestSubStorageIdx) ? it : subStorages[biggestSubStorageIdx].m_elements;
 
 
-			for(U x = 0; x < (*ptrSubStorages)[i].m_elementCount; ++x)
+			for(U32 x = 0; x < (*ptrSubStorages)[i].m_elementCount; ++x)
 			{
 			{
 				ANKI_ASSERT((*ptrSubStorages)[i].m_elements[x] < subStorages[i].m_elementCount);
 				ANKI_ASSERT((*ptrSubStorages)[i].m_elements[x] < subStorages[i].m_elementCount);
 
 

+ 2 - 2
src/anki/scene/components/LightComponent.cpp

@@ -85,7 +85,7 @@ void LightComponent::setupDirectionalLightQueueElement(const FrustumComponent& f
 	ANKI_ASSERT(m_type == LightComponentType::DIRECTIONAL);
 	ANKI_ASSERT(m_type == LightComponentType::DIRECTIONAL);
 	ANKI_ASSERT(cascadeFrustumComponents.getSize() <= MAX_SHADOW_CASCADES);
 	ANKI_ASSERT(cascadeFrustumComponents.getSize() <= MAX_SHADOW_CASCADES);
 
 
-	const U32 shadowCascadeCount = U32(cascadeFrustumComponents.getSize());
+	const U32 shadowCascadeCount = cascadeFrustumComponents.getSize();
 
 
 	el.m_drawCallback = m_drawCallback;
 	el.m_drawCallback = m_drawCallback;
 	el.m_drawCallbackUserData = m_drawCallbackUserData;
 	el.m_drawCallbackUserData = m_drawCallbackUserData;
@@ -150,7 +150,7 @@ void LightComponent::setupDirectionalLightQueueElement(const FrustumComponent& f
 		}
 		}
 
 
 		// Compute the matrices
 		// Compute the matrices
-		for(U i = 0; i < shadowCascadeCount; ++i)
+		for(U32 i = 0; i < shadowCascadeCount; ++i)
 		{
 		{
 			const Sphere& sphere = boundingSpheres[i];
 			const Sphere& sphere = boundingSpheres[i];
 			const Vec3 sphereCenter = sphere.getCenter().xyz();
 			const Vec3 sphereCenter = sphere.getCenter().xyz();

+ 12 - 15
src/anki/scene/components/RenderComponent.cpp

@@ -20,7 +20,7 @@ MaterialRenderComponent::MaterialRenderComponent(SceneNode* node, MaterialResour
 
 
 	// Create the material variables
 	// Create the material variables
 	m_vars.create(m_node->getAllocator(), m_mtl->getVariables().getSize());
 	m_vars.create(m_node->getAllocator(), m_mtl->getVariables().getSize());
-	U count = 0;
+	U32 count = 0;
 	for(const MaterialVariable& mv : m_mtl->getVariables())
 	for(const MaterialVariable& mv : m_mtl->getVariables())
 	{
 	{
 		m_vars[count++].m_mvar = &mv;
 		m_vars[count++].m_mvar = &mv;
@@ -141,7 +141,7 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				DynamicArrayAuto<Mat3> normMats(m_node->getFrameAllocator());
 				DynamicArrayAuto<Mat3> normMats(m_node->getFrameAllocator());
 				normMats.create(transforms.getSize());
 				normMats.create(transforms.getSize());
 
 
-				for(U i = 0; i < transforms.getSize(); i++)
+				for(U32 i = 0; i < transforms.getSize(); i++)
 				{
 				{
 					Mat4 mv = ctx.m_viewMatrix * transforms[i];
 					Mat4 mv = ctx.m_viewMatrix * transforms[i];
 					normMats[i] = mv.getRotationPart();
 					normMats[i] = mv.getRotationPart();
@@ -149,7 +149,7 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				}
 				}
 
 
 				progVariant.writeShaderBlockMemory(
 				progVariant.writeShaderBlockMemory(
-					progvar, &normMats[0], U32(transforms.getSize()), uniformsBegin, uniformsEnd);
+					progvar, &normMats[0], transforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::ROTATION_MATRIX:
 			case BuiltinMaterialVariableId::ROTATION_MATRIX:
@@ -159,13 +159,12 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				DynamicArrayAuto<Mat3> rots(m_node->getFrameAllocator());
 				DynamicArrayAuto<Mat3> rots(m_node->getFrameAllocator());
 				rots.create(transforms.getSize());
 				rots.create(transforms.getSize());
 
 
-				for(U i = 0; i < transforms.getSize(); i++)
+				for(U32 i = 0; i < transforms.getSize(); i++)
 				{
 				{
 					rots[i] = transforms[i].getRotationPart();
 					rots[i] = transforms[i].getRotationPart();
 				}
 				}
 
 
-				progVariant.writeShaderBlockMemory(
-					progvar, &rots[0], U32(transforms.getSize()), uniformsBegin, uniformsEnd);
+				progVariant.writeShaderBlockMemory(progvar, &rots[0], transforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::CAMERA_ROTATION_MATRIX:
 			case BuiltinMaterialVariableId::CAMERA_ROTATION_MATRIX:
@@ -197,13 +196,12 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				DynamicArrayAuto<Mat4> mvp(m_node->getFrameAllocator());
 				DynamicArrayAuto<Mat4> mvp(m_node->getFrameAllocator());
 				mvp.create(transforms.getSize());
 				mvp.create(transforms.getSize());
 
 
-				for(U i = 0; i < transforms.getSize(); i++)
+				for(U32 i = 0; i < transforms.getSize(); i++)
 				{
 				{
 					mvp[i] = ctx.m_viewProjectionMatrix * transforms[i];
 					mvp[i] = ctx.m_viewProjectionMatrix * transforms[i];
 				}
 				}
 
 
-				progVariant.writeShaderBlockMemory(
-					progvar, &mvp[0], U32(transforms.getSize()), uniformsBegin, uniformsEnd);
+				progVariant.writeShaderBlockMemory(progvar, &mvp[0], transforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::PREVIOUS_MODEL_VIEW_PROJECTION_MATRIX:
 			case BuiltinMaterialVariableId::PREVIOUS_MODEL_VIEW_PROJECTION_MATRIX:
@@ -213,13 +211,13 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				DynamicArrayAuto<Mat4> mvp(m_node->getFrameAllocator());
 				DynamicArrayAuto<Mat4> mvp(m_node->getFrameAllocator());
 				mvp.create(prevTransforms.getSize());
 				mvp.create(prevTransforms.getSize());
 
 
-				for(U i = 0; i < prevTransforms.getSize(); i++)
+				for(U32 i = 0; i < prevTransforms.getSize(); i++)
 				{
 				{
 					mvp[i] = ctx.m_previousViewProjectionMatrix * prevTransforms[i];
 					mvp[i] = ctx.m_previousViewProjectionMatrix * prevTransforms[i];
 				}
 				}
 
 
 				progVariant.writeShaderBlockMemory(
 				progVariant.writeShaderBlockMemory(
-					progvar, &mvp[0], U32(prevTransforms.getSize()), uniformsBegin, uniformsEnd);
+					progvar, &mvp[0], prevTransforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::MODEL_VIEW_MATRIX:
 			case BuiltinMaterialVariableId::MODEL_VIEW_MATRIX:
@@ -229,13 +227,12 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				DynamicArrayAuto<Mat4> mv(m_node->getFrameAllocator());
 				DynamicArrayAuto<Mat4> mv(m_node->getFrameAllocator());
 				mv.create(transforms.getSize());
 				mv.create(transforms.getSize());
 
 
-				for(U i = 0; i < transforms.getSize(); i++)
+				for(U32 i = 0; i < transforms.getSize(); i++)
 				{
 				{
 					mv[i] = ctx.m_viewMatrix * transforms[i];
 					mv[i] = ctx.m_viewMatrix * transforms[i];
 				}
 				}
 
 
-				progVariant.writeShaderBlockMemory(
-					progvar, &mv[0], U32(transforms.getSize()), uniformsBegin, uniformsEnd);
+				progVariant.writeShaderBlockMemory(progvar, &mv[0], transforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::MODEL_MATRIX:
 			case BuiltinMaterialVariableId::MODEL_MATRIX:
@@ -243,7 +240,7 @@ void MaterialRenderComponent::allocateAndSetupUniforms(U32 set,
 				ANKI_ASSERT(transforms.getSize() > 0);
 				ANKI_ASSERT(transforms.getSize() > 0);
 
 
 				progVariant.writeShaderBlockMemory(
 				progVariant.writeShaderBlockMemory(
-					progvar, &transforms[0], U32(transforms.getSize()), uniformsBegin, uniformsEnd);
+					progvar, &transforms[0], transforms.getSize(), uniformsBegin, uniformsEnd);
 				break;
 				break;
 			}
 			}
 			case BuiltinMaterialVariableId::VIEW_PROJECTION_MATRIX:
 			case BuiltinMaterialVariableId::VIEW_PROJECTION_MATRIX:

+ 1 - 1
src/anki/scene/components/SkinComponent.cpp

@@ -59,7 +59,7 @@ Error SkinComponent::update(SceneNode& node, Second prevTime, Second crntTime, B
 
 
 		// Iterate the animation channels and interpolate
 		// Iterate the animation channels and interpolate
 		BitSet<128> bonesAnimated(false);
 		BitSet<128> bonesAnimated(false);
-		for(U i = 0; i < track.m_anim->getChannels().getSize(); ++i)
+		for(U32 i = 0; i < track.m_anim->getChannels().getSize(); ++i)
 		{
 		{
 			const AnimationChannel& channel = track.m_anim->getChannels()[i];
 			const AnimationChannel& channel = track.m_anim->getChannels()[i];
 			const Bone* bone = m_skeleton->tryFindBone(channel.m_name.toCString());
 			const Bone* bone = m_skeleton->tryFindBone(channel.m_name.toCString());

+ 2 - 2
src/anki/script/Scene.cpp

@@ -97,7 +97,7 @@ static inline int pwrapWeakArraySceneNodePtrgetSize(lua_State* l)
 	WeakArraySceneNodePtr* self = ud->getData<WeakArraySceneNodePtr>();
 	WeakArraySceneNodePtr* self = ud->getData<WeakArraySceneNodePtr>();
 
 
 	// Call the method
 	// Call the method
-	PtrSize ret = self->getSize();
+	U32 ret = self->getSize();
 
 
 	// Push return value
 	// Push return value
 	lua_pushnumber(l, lua_Number(ret));
 	lua_pushnumber(l, lua_Number(ret));
@@ -142,7 +142,7 @@ static inline int pwrapWeakArraySceneNodePtrgetAt(lua_State* l)
 	WeakArraySceneNodePtr* self = ud->getData<WeakArraySceneNodePtr>();
 	WeakArraySceneNodePtr* self = ud->getData<WeakArraySceneNodePtr>();
 
 
 	// Pop arguments
 	// Pop arguments
-	U arg0;
+	U32 arg0;
 	if(ANKI_UNLIKELY(LuaBinder::checkNumber(l, 2, arg0)))
 	if(ANKI_UNLIKELY(LuaBinder::checkNumber(l, 2, arg0)))
 	{
 	{
 		return -1;
 		return -1;

+ 2 - 2
src/anki/script/Scene.xml

@@ -67,11 +67,11 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 		<class name="WeakArraySceneNodePtr">
 		<class name="WeakArraySceneNodePtr">
 			<methods>
 			<methods>
 				<method name="getSize">
 				<method name="getSize">
-					<return>PtrSize</return>
+					<return>U32</return>
 				</method>
 				</method>
 				<method name="getAt">
 				<method name="getAt">
 					<overrideCall><![CDATA[SceneNode* ret = (*self)[arg0];]]></overrideCall>
 					<overrideCall><![CDATA[SceneNode* ret = (*self)[arg0];]]></overrideCall>
-					<args><arg>U</arg></args>
+					<args><arg>U32</arg></args>
 					<return>SceneNode*</return>
 					<return>SceneNode*</return>
 				</method>
 				</method>
 			</methods>
 			</methods>

+ 1 - 1
src/anki/shader_compiler/Glslang.cpp

@@ -262,7 +262,7 @@ Error compilerGlslToSpirv(
 	glslang::GlslangToSpv(*program.getIntermediate(stage), glslangSpirv, &spvOptions);
 	glslang::GlslangToSpv(*program.getIntermediate(stage), glslangSpirv, &spvOptions);
 
 
 	// Store
 	// Store
-	spirv.resize(glslangSpirv.size() * sizeof(unsigned int));
+	spirv.resize(U32(glslangSpirv.size() * sizeof(unsigned int)));
 	memcpy(&spirv[0], &glslangSpirv[0], spirv.getSizeInBytes());
 	memcpy(&spirv[0], &glslangSpirv[0], spirv.getSizeInBytes());
 
 
 	return Error::NONE;
 	return Error::NONE;

+ 22 - 22
src/anki/shader_compiler/ShaderProgramCompiler.cpp

@@ -89,7 +89,7 @@ static Bool spinDials(DynamicArrayAuto<U32>& dials, ConstWeakArray<ShaderProgram
 	ANKI_ASSERT(dials.getSize() == mutators.getSize() && dials.getSize() > 0);
 	ANKI_ASSERT(dials.getSize() == mutators.getSize() && dials.getSize() > 0);
 	Bool done = true;
 	Bool done = true;
 
 
-	U crntDial = dials.getSize() - 1;
+	U32 crntDial = dials.getSize() - 1;
 	while(true)
 	while(true)
 	{
 	{
 		// Turn dial
 		// Turn dial
@@ -136,7 +136,7 @@ static Error compileVariant(ConstWeakArray<MutatorValue> mutation,
 	// Active vars
 	// Active vars
 	{
 	{
 		variant.m_activeVariables = ActiveProgramInputVariableMask(false);
 		variant.m_activeVariables = ActiveProgramInputVariableMask(false);
-		for(PtrSize i = 0; i < parser.getInputs().getSize(); ++i)
+		for(U32 i = 0; i < parser.getInputs().getSize(); ++i)
 		{
 		{
 			if(parserVariant.isInputActive(parser.getInputs()[i]))
 			if(parserVariant.isInputActive(parser.getInputs()[i]))
 			{
 			{
@@ -162,12 +162,12 @@ static Error compileVariant(ConstWeakArray<MutatorValue> mutation,
 		// Check if the spirv is already generated
 		// Check if the spirv is already generated
 		const U64 newHash = computeHash(&spirv[0], spirv.getSize());
 		const U64 newHash = computeHash(&spirv[0], spirv.getSize());
 		Bool found = false;
 		Bool found = false;
-		for(PtrSize i = 0; i < codeBlockHashes.getSize(); ++i)
+		for(U32 i = 0; i < codeBlockHashes.getSize(); ++i)
 		{
 		{
 			if(codeBlockHashes[i] == newHash)
 			if(codeBlockHashes[i] == newHash)
 			{
 			{
 				// Found it
 				// Found it
-				variant.m_binaryIndices[shaderType] = U32(i);
+				variant.m_binaryIndices[shaderType] = i;
 				found = true;
 				found = true;
 				break;
 				break;
 			}
 			}
@@ -186,13 +186,13 @@ static Error compileVariant(ConstWeakArray<MutatorValue> mutation,
 
 
 			codeBlockHashes.emplaceBack(newHash);
 			codeBlockHashes.emplaceBack(newHash);
 
 
-			variant.m_binaryIndices[shaderType] = U32(codeBlocks.getSize() - 1);
+			variant.m_binaryIndices[shaderType] = codeBlocks.getSize() - 1;
 		}
 		}
 	}
 	}
 
 
 	// Mutator values
 	// Mutator values
 	variant.m_mutatorValues = binaryAlloc.newArray<I32>(parser.getMutators().getSize());
 	variant.m_mutatorValues = binaryAlloc.newArray<I32>(parser.getMutators().getSize());
-	for(PtrSize i = 0; i < parser.getMutators().getSize(); ++i)
+	for(U32 i = 0; i < parser.getMutators().getSize(); ++i)
 	{
 	{
 		variant.m_mutatorValues[i] = mutation[i];
 		variant.m_mutatorValues[i] = mutation[i];
 	}
 	}
@@ -208,7 +208,7 @@ static Error compileVariant(ConstWeakArray<MutatorValue> mutation,
 
 
 		variant.m_bindings = binaryAlloc.newArray<I16>(parser.getInputs().getSize(), -1);
 		variant.m_bindings = binaryAlloc.newArray<I16>(parser.getInputs().getSize(), -1);
 
 
-		for(PtrSize i = 0; i < parser.getInputs().getSize(); ++i)
+		for(U32 i = 0; i < parser.getInputs().getSize(); ++i)
 		{
 		{
 			const ShaderProgramParserInput& parserInput = parser.getInputs()[i];
 			const ShaderProgramParserInput& parserInput = parser.getInputs()[i];
 			if(!parserVariant.isInputActive(parserInput))
 			if(!parserVariant.isInputActive(parserInput))
@@ -229,8 +229,8 @@ static Error compileVariant(ConstWeakArray<MutatorValue> mutation,
 	}
 	}
 
 
 	// Misc
 	// Misc
-	variant.m_mutatorValueCount = U32(parser.getMutators().getSize());
-	variant.m_inputVariableCount = U32(parser.getInputs().getSize());
+	variant.m_mutatorValueCount = parser.getMutators().getSize();
+	variant.m_inputVariableCount = parser.getInputs().getSize();
 	variant.m_blockSize = parserVariant.getBlockSize();
 	variant.m_blockSize = parserVariant.getBlockSize();
 	variant.m_usesPushConstants = parserVariant.usesPushConstants();
 	variant.m_usesPushConstants = parserVariant.usesPushConstants();
 
 
@@ -263,7 +263,7 @@ Error compileShaderProgram(CString fname,
 	// Inputs
 	// Inputs
 	if(parser.getInputs().getSize() > 0)
 	if(parser.getInputs().getSize() > 0)
 	{
 	{
-		binary.m_inputVariableCount = U32(parser.getInputs().getSize());
+		binary.m_inputVariableCount = parser.getInputs().getSize();
 		binary.m_inputVariables = binaryAllocator.newArray<ShaderProgramBinaryInput>(binary.m_inputVariableCount);
 		binary.m_inputVariables = binaryAllocator.newArray<ShaderProgramBinaryInput>(binary.m_inputVariableCount);
 
 
 		for(U32 i = 0; i < binary.m_inputVariableCount; ++i)
 		for(U32 i = 0; i < binary.m_inputVariableCount; ++i)
@@ -289,7 +289,7 @@ Error compileShaderProgram(CString fname,
 	// Mutators
 	// Mutators
 	if(parser.getMutators().getSize() > 0)
 	if(parser.getMutators().getSize() > 0)
 	{
 	{
-		binary.m_mutatorCount = U32(parser.getMutators().getSize());
+		binary.m_mutatorCount = parser.getMutators().getSize();
 		binary.m_mutators = binaryAllocator.newArray<ShaderProgramBinaryMutator>(binary.m_mutatorCount);
 		binary.m_mutators = binaryAllocator.newArray<ShaderProgramBinaryMutator>(binary.m_mutatorCount);
 
 
 		for(U32 i = 0; i < binary.m_mutatorCount; ++i)
 		for(U32 i = 0; i < binary.m_mutatorCount; ++i)
@@ -300,7 +300,7 @@ Error compileShaderProgram(CString fname,
 			ANKI_ASSERT(in.getName().getLength() < out.m_name.getSize());
 			ANKI_ASSERT(in.getName().getLength() < out.m_name.getSize());
 			memcpy(&out.m_name[0], in.getName().cstr(), in.getName().getLength() + 1);
 			memcpy(&out.m_name[0], in.getName().cstr(), in.getName().getLength() + 1);
 
 
-			out.m_valueCount = U32(in.getValues().getSize());
+			out.m_valueCount = in.getValues().getSize();
 			out.m_values = binaryAllocator.newArray<I32>(out.m_valueCount);
 			out.m_values = binaryAllocator.newArray<I32>(out.m_valueCount);
 			memcpy(out.m_values, &in.getValues()[0], in.getValues().getSizeInBytes());
 			memcpy(out.m_values, &in.getValues()[0], in.getValues().getSizeInBytes());
 
 
@@ -322,7 +322,7 @@ Error compileShaderProgram(CString fname,
 		DynamicArrayAuto<ShaderProgramBinaryVariant> variants(binaryAllocator);
 		DynamicArrayAuto<ShaderProgramBinaryVariant> variants(binaryAllocator);
 		DynamicArrayAuto<ShaderProgramBinaryCode> codeBlocks(binaryAllocator);
 		DynamicArrayAuto<ShaderProgramBinaryCode> codeBlocks(binaryAllocator);
 		DynamicArrayAuto<U64> codeBlockHashes(tempAllocator);
 		DynamicArrayAuto<U64> codeBlockHashes(tempAllocator);
-		HashMapAuto<U64, U> mutationToVariantIdx(tempAllocator);
+		HashMapAuto<U64, U32> mutationToVariantIdx(tempAllocator);
 
 
 		// Spin for all possible combinations of mutators and
 		// Spin for all possible combinations of mutators and
 		// - Create the spirv
 		// - Create the spirv
@@ -330,7 +330,7 @@ Error compileShaderProgram(CString fname,
 		do
 		do
 		{
 		{
 			// Create the mutation
 			// Create the mutation
-			for(PtrSize i = 0; i < parser.getMutators().getSize(); ++i)
+			for(U32 i = 0; i < parser.getMutators().getSize(); ++i)
 			{
 			{
 				mutation[i] = parser.getMutators()[i].getValues()[dials[i]];
 				mutation[i] = parser.getMutators()[i].getValues()[dials[i]];
 				mutation2[i] = mutation[i];
 				mutation2[i] = mutation[i];
@@ -353,9 +353,9 @@ Error compileShaderProgram(CString fname,
 			{
 			{
 				// Check if the original variant exists
 				// Check if the original variant exists
 				auto it = mutationToVariantIdx.find(computeHash(&mutation[0], mutation.getSizeInBytes()));
 				auto it = mutationToVariantIdx.find(computeHash(&mutation[0], mutation.getSizeInBytes()));
-				U originalVariantIdx = (it != mutationToVariantIdx.getEnd()) ? *it : MAX_U;
+				U32 originalVariantIdx = (it != mutationToVariantIdx.getEnd()) ? *it : MAX_U32;
 
 
-				if(originalVariantIdx == MAX_U)
+				if(originalVariantIdx == MAX_U32)
 				{
 				{
 					// Original variant not found, create it
 					// Original variant not found, create it
 
 
@@ -395,17 +395,17 @@ Error compileShaderProgram(CString fname,
 					}
 					}
 
 
 					mutationToVariantIdx.emplace(
 					mutationToVariantIdx.emplace(
-						computeHash(&mutation2[0], mutation2.getSizeInBytes()), &variant - &variants[0]);
+						computeHash(&mutation2[0], mutation2.getSizeInBytes()), U32(&variant - &variants[0]));
 				}
 				}
 			}
 			}
 		} while(!spinDials(dials, parser.getMutators()));
 		} while(!spinDials(dials, parser.getMutators()));
 
 
 		// Store to binary
 		// Store to binary
-		binary.m_variantCount = U32(variants.getSize());
-		PtrSize size, storage;
+		binary.m_variantCount = variants.getSize();
+		U32 size, storage;
 		variants.moveAndReset(binary.m_variants, size, storage);
 		variants.moveAndReset(binary.m_variants, size, storage);
 
 
-		binary.m_codeBlockCount = U32(codeBlocks.getSize());
+		binary.m_codeBlockCount = codeBlocks.getSize();
 		codeBlocks.moveAndReset(binary.m_codeBlocks, size, storage);
 		codeBlocks.moveAndReset(binary.m_codeBlocks, size, storage);
 	}
 	}
 	else
 	else
@@ -421,8 +421,8 @@ Error compileShaderProgram(CString fname,
 			mutation, parser, binary.m_variants[0], codeBlocks, codeBlockHashes, tempAllocator, binaryAllocator));
 			mutation, parser, binary.m_variants[0], codeBlocks, codeBlockHashes, tempAllocator, binaryAllocator));
 		ANKI_ASSERT(codeBlocks.getSize() == U32(__builtin_popcount(U32(parser.getShaderTypes()))));
 		ANKI_ASSERT(codeBlocks.getSize() == U32(__builtin_popcount(U32(parser.getShaderTypes()))));
 
 
-		binary.m_codeBlockCount = U32(codeBlocks.getSize());
-		PtrSize size, storage;
+		binary.m_codeBlockCount = codeBlocks.getSize();
+		U32 size, storage;
 		codeBlocks.moveAndReset(binary.m_codeBlocks, size, storage);
 		codeBlocks.moveAndReset(binary.m_codeBlocks, size, storage);
 	}
 	}
 
 

+ 15 - 15
src/anki/shader_compiler/ShaderProgramParser.cpp

@@ -390,7 +390,7 @@ Error ShaderProgramParser::parsePragmaInput(const StringAuto* begin, const Strin
 
 
 	m_inputs.emplaceBack(m_alloc);
 	m_inputs.emplaceBack(m_alloc);
 	Input& input = m_inputs.getBack();
 	Input& input = m_inputs.getBack();
-	input.m_idx = U32(m_inputs.getSize() - 1);
+	input.m_idx = m_inputs.getSize() - 1;
 
 
 	// const
 	// const
 	Bool isConst;
 	Bool isConst;
@@ -445,7 +445,7 @@ Error ShaderProgramParser::parsePragmaInput(const StringAuto* begin, const Strin
 		}
 		}
 
 
 		// Check if there are duplicates
 		// Check if there are duplicates
-		for(PtrSize i = 0; i < m_inputs.getSize() - 1; ++i)
+		for(U32 i = 0; i < m_inputs.getSize() - 1; ++i)
 		{
 		{
 			if(m_inputs[i].m_name == *begin)
 			if(m_inputs[i].m_name == *begin)
 			{
 			{
@@ -637,7 +637,7 @@ Error ShaderProgramParser::parsePragmaMutator(
 				ANKI_PP_ERROR_MALFORMED_MSG("Can't have more than one instanced mutators");
 				ANKI_PP_ERROR_MALFORMED_MSG("Can't have more than one instanced mutators");
 			}
 			}
 
 
-			m_instancedMutatorIdx = U32(m_mutators.getSize() - 1);
+			m_instancedMutatorIdx = m_mutators.getSize() - 1;
 			++begin;
 			++begin;
 		}
 		}
 		else
 		else
@@ -655,7 +655,7 @@ Error ShaderProgramParser::parsePragmaMutator(
 		}
 		}
 
 
 		// Check for duplicate mutators
 		// Check for duplicate mutators
-		for(U i = 0; i < m_mutators.getSize() - 1; ++i)
+		for(U32 i = 0; i < m_mutators.getSize() - 1; ++i)
 		{
 		{
 			if(m_mutators[i].m_name == *begin)
 			if(m_mutators[i].m_name == *begin)
 			{
 			{
@@ -701,7 +701,7 @@ Error ShaderProgramParser::parsePragmaMutator(
 		std::sort(mutator.m_values.getBegin(), mutator.m_values.getEnd());
 		std::sort(mutator.m_values.getBegin(), mutator.m_values.getEnd());
 
 
 		// Check for duplicates
 		// Check for duplicates
-		for(U i = 1; i < mutator.m_values.getSize(); ++i)
+		for(U32 i = 1; i < mutator.m_values.getSize(); ++i)
 		{
 		{
 			if(mutator.m_values[i - 1] == mutator.m_values[i])
 			if(mutator.m_values[i - 1] == mutator.m_values[i])
 			{
 			{
@@ -768,11 +768,11 @@ Error ShaderProgramParser::parsePragmaRewriteMutation(
 			if(servingFrom)
 			if(servingFrom)
 			{
 			{
 				MutationRewrite::Record& rec = *rewrite.m_records.emplaceBack();
 				MutationRewrite::Record& rec = *rewrite.m_records.emplaceBack();
-				for(U i = 0; i < m_mutators.getSize(); ++i)
+				for(U32 i = 0; i < m_mutators.getSize(); ++i)
 				{
 				{
 					if(m_mutators[i].getName() == mutatorName)
 					if(m_mutators[i].getName() == mutatorName)
 					{
 					{
-						rec.m_mutatorIndex = U32(i);
+						rec.m_mutatorIndex = i;
 						break;
 						break;
 					}
 					}
 				}
 				}
@@ -825,7 +825,7 @@ Error ShaderProgramParser::parsePragmaRewriteMutation(
 		});
 		});
 
 
 	// More cross checking
 	// More cross checking
-	for(U i = 1; i < rewrite.m_records.getSize(); ++i)
+	for(U32 i = 1; i < rewrite.m_records.getSize(); ++i)
 	{
 	{
 		if(rewrite.m_records[i - 1].m_mutatorIndex == rewrite.m_records[i].m_mutatorIndex)
 		if(rewrite.m_records[i - 1].m_mutatorIndex == rewrite.m_records[i].m_mutatorIndex)
 		{
 		{
@@ -833,7 +833,7 @@ Error ShaderProgramParser::parsePragmaRewriteMutation(
 		}
 		}
 	}
 	}
 
 
-	for(U i = 0; i < m_mutationRewrites.getSize() - 1; ++i)
+	for(U32 i = 0; i < m_mutationRewrites.getSize() - 1; ++i)
 	{
 	{
 		const MutationRewrite& other = m_mutationRewrites[i];
 		const MutationRewrite& other = m_mutationRewrites[i];
 
 
@@ -843,7 +843,7 @@ Error ShaderProgramParser::parsePragmaRewriteMutation(
 		}
 		}
 
 
 		Bool same = true;
 		Bool same = true;
-		for(U j = 0; j < rewrite.m_records.getSize(); ++j)
+		for(U32 j = 0; j < rewrite.m_records.getSize(); ++j)
 		{
 		{
 			if(rewrite.m_records[j] != other.m_records[j])
 			if(rewrite.m_records[j] != other.m_records[j])
 			{
 			{
@@ -1180,7 +1180,7 @@ Error ShaderProgramParser::generateVariant(
 	// Sanity checks
 	// Sanity checks
 	ANKI_ASSERT(m_codeSource.getLength() > 0);
 	ANKI_ASSERT(m_codeSource.getLength() > 0);
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
-	for(U i = 0; i < mutation.getSize(); ++i)
+	for(U32 i = 0; i < mutation.getSize(); ++i)
 	{
 	{
 		ANKI_ASSERT(mutatorHasValue(m_mutators[i], mutation[i]) && "Value not found");
 		ANKI_ASSERT(mutatorHasValue(m_mutators[i], mutation[i]) && "Value not found");
 	}
 	}
@@ -1200,7 +1200,7 @@ Error ShaderProgramParser::generateVariant(
 
 
 	// Create the mutator defines
 	// Create the mutator defines
 	StringAuto mutatorDefines(m_alloc);
 	StringAuto mutatorDefines(m_alloc);
-	for(U i = 0; i < mutation.getSize(); ++i)
+	for(U32 i = 0; i < mutation.getSize(); ++i)
 	{
 	{
 		mutatorDefines.append(StringAuto(m_alloc).sprintf("#define %s %d\n", m_mutators[i].m_name.cstr(), mutation[i]));
 		mutatorDefines.append(StringAuto(m_alloc).sprintf("#define %s %d\n", m_mutators[i].m_name.cstr(), mutation[i]));
 	}
 	}
@@ -1396,7 +1396,7 @@ Bool ShaderProgramParser::rewriteMutation(WeakArray<MutatorValue> mutation) cons
 {
 {
 	// Checks
 	// Checks
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
 	ANKI_ASSERT(mutation.getSize() == m_mutators.getSize());
-	for(PtrSize i = 0; i < mutation.getSize(); ++i)
+	for(U32 i = 0; i < mutation.getSize(); ++i)
 	{
 	{
 		ANKI_ASSERT(mutatorHasValue(m_mutators[i], mutation[i]));
 		ANKI_ASSERT(mutatorHasValue(m_mutators[i], mutation[i]));
 	}
 	}
@@ -1411,7 +1411,7 @@ Bool ShaderProgramParser::rewriteMutation(WeakArray<MutatorValue> mutation) cons
 	for(const MutationRewrite& rewrite : m_mutationRewrites)
 	for(const MutationRewrite& rewrite : m_mutationRewrites)
 	{
 	{
 		Bool found = true;
 		Bool found = true;
-		for(U i = 0; i < rewrite.m_records.getSize(); ++i)
+		for(U32 i = 0; i < rewrite.m_records.getSize(); ++i)
 		{
 		{
 			if(rewrite.m_records[i].m_valueFrom != mutation[rewrite.m_records[i].m_mutatorIndex])
 			if(rewrite.m_records[i].m_valueFrom != mutation[rewrite.m_records[i].m_mutatorIndex])
 			{
 			{
@@ -1423,7 +1423,7 @@ Bool ShaderProgramParser::rewriteMutation(WeakArray<MutatorValue> mutation) cons
 		if(found)
 		if(found)
 		{
 		{
 			// Rewrite it
 			// Rewrite it
-			for(U i = 0; i < rewrite.m_records.getSize(); ++i)
+			for(U32 i = 0; i < rewrite.m_records.getSize(); ++i)
 			{
 			{
 				mutation[rewrite.m_records[i].m_mutatorIndex] = rewrite.m_records[i].m_valueTo;
 				mutation[rewrite.m_records[i].m_mutatorIndex] = rewrite.m_records[i].m_valueTo;
 			}
 			}

+ 3 - 3
src/anki/ui/Font.cpp

@@ -33,15 +33,15 @@ Error Font::init(const CString& filename, const std::initializer_list<U32>& font
 	// Load font in memory
 	// Load font in memory
 	ResourceFilePtr file;
 	ResourceFilePtr file;
 	ANKI_CHECK(m_manager->getResourceManager().getFilesystem().openFile(filename, file));
 	ANKI_CHECK(m_manager->getResourceManager().getFilesystem().openFile(filename, file));
-	m_fontData.create(getAllocator(), file->getSize());
+	m_fontData.create(getAllocator(), U32(file->getSize()));
 	ANKI_CHECK(file->read(&m_fontData[0], file->getSize()));
 	ANKI_CHECK(file->read(&m_fontData[0], file->getSize()));
 
 
-	m_fonts.create(getAllocator(), fontHeights.size());
+	m_fonts.create(getAllocator(), U32(fontHeights.size()));
 
 
 	// Bake font
 	// Bake font
 	ImFontConfig cfg;
 	ImFontConfig cfg;
 	cfg.FontDataOwnedByAtlas = false;
 	cfg.FontDataOwnedByAtlas = false;
-	U count = 0;
+	U32 count = 0;
 	for(U32 height : fontHeights)
 	for(U32 height : fontHeights)
 	{
 	{
 		cfg.SizePixels = F32(height);
 		cfg.SizePixels = F32(height);

+ 3 - 3
src/anki/util/BitSet.h

@@ -60,7 +60,7 @@ public:
 	{
 	{
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		{
 		{
-			m_chunks[i] |= b.m_chunks[i];
+			m_chunks[i] = m_chunks[i] | b.m_chunks[i];
 		}
 		}
 		return *this;
 		return *this;
 	}
 	}
@@ -81,7 +81,7 @@ public:
 	{
 	{
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		{
 		{
-			m_chunks[i] &= b.m_chunks[i];
+			m_chunks[i] = m_chunks[i] & b.m_chunks[i];
 		}
 		}
 		return *this;
 		return *this;
 	}
 	}
@@ -102,7 +102,7 @@ public:
 	{
 	{
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		for(U32 i = 0; i < CHUNK_COUNT; ++i)
 		{
 		{
-			m_chunks[i] ^= b.m_chunks[i];
+			m_chunks[i] = m_chunks[i] ^ b.m_chunks[i];
 		}
 		}
 		return *this;
 		return *this;
 	}
 	}

+ 30 - 31
src/anki/util/DynamicArray.h

@@ -12,7 +12,7 @@ namespace anki
 {
 {
 
 
 // Forward
 // Forward
-template<typename T>
+template<typename T, typename TSize>
 class DynamicArrayAuto;
 class DynamicArrayAuto;
 
 
 /// @addtogroup util_containers
 /// @addtogroup util_containers
@@ -20,7 +20,9 @@ class DynamicArrayAuto;
 
 
 /// Dynamic array with manual destruction. It doesn't hold the allocator and that makes it compact. At the same time
 /// Dynamic array with manual destruction. It doesn't hold the allocator and that makes it compact. At the same time
 /// that requires manual destruction. Used in permanent classes.
 /// that requires manual destruction. Used in permanent classes.
-template<typename T>
+/// @tparam T The type this array will hold.
+/// @tparam TSize The type that denotes the maximum number of elements of the array.
+template<typename T, typename TSize = U32>
 class DynamicArray
 class DynamicArray
 {
 {
 public:
 public:
@@ -29,6 +31,7 @@ public:
 	using ConstIterator = const Value*;
 	using ConstIterator = const Value*;
 	using Reference = Value&;
 	using Reference = Value&;
 	using ConstReference = const Value&;
 	using ConstReference = const Value&;
+	using Size = TSize;
 
 
 	static constexpr F32 GROW_SCALE = 2.0f;
 	static constexpr F32 GROW_SCALE = 2.0f;
 	static constexpr F32 SHRINK_SCALE = 2.0f;
 	static constexpr F32 SHRINK_SCALE = 2.0f;
@@ -69,18 +72,18 @@ public:
 	}
 	}
 
 
 	/// Move DynamicArrayAuto to this.
 	/// Move DynamicArrayAuto to this.
-	DynamicArray& operator=(DynamicArrayAuto<T>&& b);
+	DynamicArray& operator=(DynamicArrayAuto<T, TSize>&& b);
 
 
 	// Non-copyable
 	// Non-copyable
 	DynamicArray& operator=(const DynamicArray& b) = delete;
 	DynamicArray& operator=(const DynamicArray& b) = delete;
 
 
-	Reference operator[](const PtrSize n)
+	Reference operator[](const Size n)
 	{
 	{
 		ANKI_ASSERT(n < m_size);
 		ANKI_ASSERT(n < m_size);
 		return m_data[n];
 		return m_data[n];
 	}
 	}
 
 
-	ConstReference operator[](const PtrSize n) const
+	ConstReference operator[](const Size n) const
 	{
 	{
 		ANKI_ASSERT(n < m_size);
 		ANKI_ASSERT(n < m_size);
 		return m_data[n];
 		return m_data[n];
@@ -158,16 +161,11 @@ public:
 		return m_data[m_size - 1];
 		return m_data[m_size - 1];
 	}
 	}
 
 
-	PtrSize getSize() const
+	Size getSize() const
 	{
 	{
 		return m_size;
 		return m_size;
 	}
 	}
 
 
-	PtrSize getByteSize() const
-	{
-		return m_size * sizeof(Value);
-	}
-
 	Bool isEmpty() const
 	Bool isEmpty() const
 	{
 	{
 		return m_size == 0;
 		return m_size == 0;
@@ -180,7 +178,7 @@ public:
 
 
 	/// Only create the array. Useful if @a T is non-copyable or movable .
 	/// Only create the array. Useful if @a T is non-copyable or movable .
 	template<typename TAllocator>
 	template<typename TAllocator>
-	void create(TAllocator alloc, PtrSize size)
+	void create(TAllocator alloc, Size size)
 	{
 	{
 		ANKI_ASSERT(m_data == nullptr && m_size == 0 && m_capacity == 0);
 		ANKI_ASSERT(m_data == nullptr && m_size == 0 && m_capacity == 0);
 		if(size > 0)
 		if(size > 0)
@@ -193,7 +191,7 @@ public:
 
 
 	/// Only create the array. Useful if @a T is non-copyable or movable .
 	/// Only create the array. Useful if @a T is non-copyable or movable .
 	template<typename TAllocator>
 	template<typename TAllocator>
-	void create(TAllocator alloc, PtrSize size, const Value& v)
+	void create(TAllocator alloc, Size size, const Value& v)
 	{
 	{
 		ANKI_ASSERT(m_data == nullptr && m_size == 0 && m_capacity == 0);
 		ANKI_ASSERT(m_data == nullptr && m_size == 0 && m_capacity == 0);
 		if(size > 0)
 		if(size > 0)
@@ -206,11 +204,11 @@ public:
 
 
 	/// Grow or create the array. @a T needs to be copyable and moveable.
 	/// Grow or create the array. @a T needs to be copyable and moveable.
 	template<typename TAllocator>
 	template<typename TAllocator>
-	void resize(TAllocator alloc, PtrSize size, const Value& v);
+	void resize(TAllocator alloc, Size size, const Value& v);
 
 
 	/// Grow or create the array. @a T needs to be copyable, moveable and default constructible.
 	/// Grow or create the array. @a T needs to be copyable, moveable and default constructible.
 	template<typename TAllocator>
 	template<typename TAllocator>
-	void resize(TAllocator alloc, PtrSize size);
+	void resize(TAllocator alloc, Size size);
 
 
 	/// Push back value.
 	/// Push back value.
 	template<typename TAllocator, typename... TArgs>
 	template<typename TAllocator, typename... TArgs>
@@ -273,7 +271,7 @@ public:
 
 
 	/// Move the data from this object. It's like moving (operator or constructor) but instead of moving to another
 	/// Move the data from this object. It's like moving (operator or constructor) but instead of moving to another
 	/// object of the same type it moves to 3 values.
 	/// object of the same type it moves to 3 values.
-	void moveAndReset(Value*& data, PtrSize& size, PtrSize& storageSize)
+	void moveAndReset(Value*& data, Size& size, Size& storageSize)
 	{
 	{
 		data = m_data;
 		data = m_data;
 		size = m_size;
 		size = m_size;
@@ -285,28 +283,29 @@ public:
 
 
 protected:
 protected:
 	Value* m_data;
 	Value* m_data;
-	PtrSize m_size;
-	PtrSize m_capacity = 0;
+	Size m_size;
+	Size m_capacity = 0;
 
 
 private:
 private:
 	/// Resizes the storage but DOESN'T CONSTRUCT ANY ELEMENTS. It only moves or destroys.
 	/// Resizes the storage but DOESN'T CONSTRUCT ANY ELEMENTS. It only moves or destroys.
 	template<typename TAllocator>
 	template<typename TAllocator>
-	void resizeStorage(TAllocator& alloc, PtrSize newSize);
+	void resizeStorage(TAllocator& alloc, Size newSize);
 };
 };
 
 
 /// Dynamic array with automatic destruction. It's the same as DynamicArray but it holds the allocator in order to
 /// Dynamic array with automatic destruction. It's the same as DynamicArray but it holds the allocator in order to
 /// perform automatic destruction. Use it for temp operations and on transient classes.
 /// perform automatic destruction. Use it for temp operations and on transient classes.
-template<typename T>
-class DynamicArrayAuto : public DynamicArray<T>
+template<typename T, typename TSize = U32>
+class DynamicArrayAuto : public DynamicArray<T, TSize>
 {
 {
 public:
 public:
-	using Base = DynamicArray<T>;
+	using Base = DynamicArray<T, TSize>;
 	using Base::m_capacity;
 	using Base::m_capacity;
 	using Base::m_data;
 	using Base::m_data;
 	using Base::m_size;
 	using Base::m_size;
 	using typename Base::Value;
 	using typename Base::Value;
 	using typename Base::Iterator;
 	using typename Base::Iterator;
 	using typename Base::ConstIterator;
 	using typename Base::ConstIterator;
+	using typename Base::Size;
 
 
 	template<typename TAllocator>
 	template<typename TAllocator>
 	DynamicArrayAuto(TAllocator alloc)
 	DynamicArrayAuto(TAllocator alloc)
@@ -317,7 +316,7 @@ public:
 
 
 	/// And resize
 	/// And resize
 	template<typename TAllocator>
 	template<typename TAllocator>
-	DynamicArrayAuto(TAllocator alloc, PtrSize size)
+	DynamicArrayAuto(TAllocator alloc, Size size)
 		: Base()
 		: Base()
 		, m_alloc(alloc)
 		, m_alloc(alloc)
 	{
 	{
@@ -326,7 +325,7 @@ public:
 
 
 	/// With default value
 	/// With default value
 	template<typename TAllocator>
 	template<typename TAllocator>
-	DynamicArrayAuto(TAllocator alloc, PtrSize size, const T& v)
+	DynamicArrayAuto(TAllocator alloc, Size size, const T& v)
 		: Base()
 		: Base()
 		, m_alloc(alloc)
 		, m_alloc(alloc)
 	{
 	{
@@ -353,7 +352,7 @@ public:
 		if(b.getSize())
 		if(b.getSize())
 		{
 		{
 			create(b.getSize());
 			create(b.getSize());
-			for(PtrSize i = 0; i < b.getSize(); ++i)
+			for(Size i = 0; i < b.getSize(); ++i)
 			{
 			{
 				(*this)[i] = b[i];
 				(*this)[i] = b[i];
 			}
 			}
@@ -383,7 +382,7 @@ public:
 		if(b.getSize())
 		if(b.getSize())
 		{
 		{
 			create(b.getSize());
 			create(b.getSize());
-			for(PtrSize i = 0; i < b.getSize(); ++i)
+			for(Size i = 0; i < b.getSize(); ++i)
 			{
 			{
 				(*this)[i] = b[i];
 				(*this)[i] = b[i];
 			}
 			}
@@ -392,13 +391,13 @@ public:
 	}
 	}
 
 
 	/// @copydoc DynamicArray::create
 	/// @copydoc DynamicArray::create
-	void create(PtrSize size)
+	void create(Size size)
 	{
 	{
 		Base::create(m_alloc, size);
 		Base::create(m_alloc, size);
 	}
 	}
 
 
 	/// @copydoc DynamicArray::create
 	/// @copydoc DynamicArray::create
-	void create(PtrSize size, const Value& v)
+	void create(Size size, const Value& v)
 	{
 	{
 		Base::create(m_alloc, size, v);
 		Base::create(m_alloc, size, v);
 	}
 	}
@@ -410,7 +409,7 @@ public:
 	}
 	}
 
 
 	/// @copydoc DynamicArray::resize
 	/// @copydoc DynamicArray::resize
-	void resize(PtrSize size, const Value& v)
+	void resize(Size size, const Value& v)
 	{
 	{
 		Base::resize(m_alloc, size, v);
 		Base::resize(m_alloc, size, v);
 	}
 	}
@@ -430,13 +429,13 @@ public:
 	}
 	}
 
 
 	/// @copydoc DynamicArray::resize
 	/// @copydoc DynamicArray::resize
-	void resize(PtrSize size)
+	void resize(Size size)
 	{
 	{
 		Base::resize(m_alloc, size);
 		Base::resize(m_alloc, size);
 	}
 	}
 
 
 	/// @copydoc DynamicArray::moveAndReset
 	/// @copydoc DynamicArray::moveAndReset
-	void moveAndReset(Value*& data, PtrSize& size, PtrSize& storageSize)
+	void moveAndReset(Value*& data, Size& size, Size& storageSize)
 	{
 	{
 		Base::moveAndReset(data, size, storageSize);
 		Base::moveAndReset(data, size, storageSize);
 		// Don't touch the m_alloc
 		// Don't touch the m_alloc

+ 22 - 22
src/anki/util/DynamicArray.inl.h

@@ -8,12 +8,12 @@
 namespace anki
 namespace anki
 {
 {
 
 
-template<typename T>
-DynamicArray<T>& DynamicArray<T>::operator=(DynamicArrayAuto<T>&& b)
+template<typename T, typename TSize>
+DynamicArray<T, TSize>& DynamicArray<T, TSize>::operator=(DynamicArrayAuto<T, TSize>&& b)
 {
 {
 	ANKI_ASSERT(m_data == nullptr && m_size == 0 && "Cannot move before destroying");
 	ANKI_ASSERT(m_data == nullptr && m_size == 0 && "Cannot move before destroying");
 	T* data;
 	T* data;
-	PtrSize size, storageSize;
+	Size size, storageSize;
 	b.moveAndReset(data, size, storageSize);
 	b.moveAndReset(data, size, storageSize);
 	m_data = data;
 	m_data = data;
 	m_size = size;
 	m_size = size;
@@ -21,23 +21,22 @@ DynamicArray<T>& DynamicArray<T>::operator=(DynamicArrayAuto<T>&& b)
 	return *this;
 	return *this;
 }
 }
 
 
-template<typename T>
+template<typename T, typename TSize>
 template<typename TAllocator>
 template<typename TAllocator>
-void DynamicArray<T>::resizeStorage(TAllocator& alloc, PtrSize newSize)
+void DynamicArray<T, TSize>::resizeStorage(TAllocator& alloc, Size newSize)
 {
 {
 	if(newSize > m_capacity)
 	if(newSize > m_capacity)
 	{
 	{
 		// Need to grow
 		// Need to grow
 
 
-		m_capacity =
-			(newSize > PtrSize(F32(m_capacity) * GROW_SCALE)) ? newSize : PtrSize(F32(m_capacity) * GROW_SCALE);
+		m_capacity = (newSize > Size(F32(m_capacity) * GROW_SCALE)) ? newSize : Size(F32(m_capacity) * GROW_SCALE);
 		Value* newStorage =
 		Value* newStorage =
 			static_cast<Value*>(alloc.getMemoryPool().allocate(m_capacity * sizeof(Value), alignof(Value)));
 			static_cast<Value*>(alloc.getMemoryPool().allocate(m_capacity * sizeof(Value), alignof(Value)));
 
 
 		// Move old elements to the new storage
 		// Move old elements to the new storage
 		if(m_data)
 		if(m_data)
 		{
 		{
-			for(PtrSize i = 0; i < m_size; ++i)
+			for(Size i = 0; i < m_size; ++i)
 			{
 			{
 				alloc.construct(&newStorage[i], std::move(m_data[i]));
 				alloc.construct(&newStorage[i], std::move(m_data[i]));
 				m_data[i].~T();
 				m_data[i].~T();
@@ -62,7 +61,7 @@ void DynamicArray<T>::resizeStorage(TAllocator& alloc, PtrSize newSize)
 
 
 		m_size = newSize;
 		m_size = newSize;
 
 
-		if(newSize < PtrSize(F32(m_capacity) / SHRINK_SCALE) || newSize == 0)
+		if(newSize < Size(F32(m_capacity) / SHRINK_SCALE) || newSize == 0)
 		{
 		{
 			// Need to shrink
 			// Need to shrink
 
 
@@ -72,7 +71,7 @@ void DynamicArray<T>::resizeStorage(TAllocator& alloc, PtrSize newSize)
 				Value* newStorage =
 				Value* newStorage =
 					static_cast<Value*>(alloc.getMemoryPool().allocate(m_capacity * sizeof(Value), alignof(Value)));
 					static_cast<Value*>(alloc.getMemoryPool().allocate(m_capacity * sizeof(Value), alignof(Value)));
 
 
-				for(PtrSize i = 0; i < m_size; ++i)
+				for(Size i = 0; i < m_size; ++i)
 				{
 				{
 					alloc.construct(&newStorage[i], std::move(m_data[i]));
 					alloc.construct(&newStorage[i], std::move(m_data[i]));
 					m_data[i].~T();
 					m_data[i].~T();
@@ -90,9 +89,9 @@ void DynamicArray<T>::resizeStorage(TAllocator& alloc, PtrSize newSize)
 	}
 	}
 }
 }
 
 
-template<typename T>
+template<typename T, typename TSize>
 template<typename TAllocator>
 template<typename TAllocator>
-void DynamicArray<T>::resize(TAllocator alloc, PtrSize newSize, const Value& v)
+void DynamicArray<T, TSize>::resize(TAllocator alloc, Size newSize, const Value& v)
 {
 {
 	const Bool willGrow = newSize > m_size;
 	const Bool willGrow = newSize > m_size;
 	resizeStorage(alloc, newSize);
 	resizeStorage(alloc, newSize);
@@ -112,9 +111,9 @@ void DynamicArray<T>::resize(TAllocator alloc, PtrSize newSize, const Value& v)
 	ANKI_ASSERT(m_size == newSize);
 	ANKI_ASSERT(m_size == newSize);
 }
 }
 
 
-template<typename T>
+template<typename T, typename TSize>
 template<typename TAllocator>
 template<typename TAllocator>
-void DynamicArray<T>::resize(TAllocator alloc, PtrSize newSize)
+void DynamicArray<T, TSize>::resize(TAllocator alloc, Size newSize)
 {
 {
 	const Bool willGrow = newSize > m_size;
 	const Bool willGrow = newSize > m_size;
 	resizeStorage(alloc, newSize);
 	resizeStorage(alloc, newSize);
@@ -134,12 +133,13 @@ void DynamicArray<T>::resize(TAllocator alloc, PtrSize newSize)
 	ANKI_ASSERT(m_size == newSize);
 	ANKI_ASSERT(m_size == newSize);
 }
 }
 
 
-template<typename T>
+template<typename T, typename TSize>
 template<typename TAllocator, typename... TArgs>
 template<typename TAllocator, typename... TArgs>
-typename DynamicArray<T>::Iterator DynamicArray<T>::emplaceAt(TAllocator alloc, ConstIterator where, TArgs&&... args)
+typename DynamicArray<T, TSize>::Iterator DynamicArray<T, TSize>::emplaceAt(
+	TAllocator alloc, ConstIterator where, TArgs&&... args)
 {
 {
 	const Value* wherePtr = where;
 	const Value* wherePtr = where;
-	PtrSize outIdx = MAX_PTR_SIZE;
+	Size outIdx = getMaxNumericLimit<Size>();
 
 
 	if(wherePtr != nullptr)
 	if(wherePtr != nullptr)
 	{
 	{
@@ -150,15 +150,15 @@ typename DynamicArray<T>::Iterator DynamicArray<T>::emplaceAt(TAllocator alloc,
 		ANKI_ASSERT(wherePtr <= m_data + m_size);
 		ANKI_ASSERT(wherePtr <= m_data + m_size);
 		ANKI_ASSERT(!isEmpty());
 		ANKI_ASSERT(!isEmpty());
 
 
-		const PtrSize oldSize = m_size;
+		const Size oldSize = m_size;
 
 
-		const PtrSize whereIdx = wherePtr - m_data; // Get that before grow the storage
+		const Size whereIdx = Size(wherePtr - m_data); // Get that before grow the storage
 		ANKI_ASSERT(whereIdx >= 0u && whereIdx <= oldSize);
 		ANKI_ASSERT(whereIdx >= 0u && whereIdx <= oldSize);
 
 
 		// Resize storage
 		// Resize storage
 		resizeStorage(alloc, oldSize + 1u);
 		resizeStorage(alloc, oldSize + 1u);
 
 
-		PtrSize elementsToMoveRight = oldSize - whereIdx;
+		Size elementsToMoveRight = oldSize - whereIdx;
 		if(elementsToMoveRight == 0)
 		if(elementsToMoveRight == 0)
 		{
 		{
 			// "where" arg points to the end of the array
 			// "where" arg points to the end of the array
@@ -173,7 +173,7 @@ typename DynamicArray<T>::Iterator DynamicArray<T>::emplaceAt(TAllocator alloc,
 			// Move the elements one place to the right
 			// Move the elements one place to the right
 			while(elementsToMoveRight--)
 			while(elementsToMoveRight--)
 			{
 			{
-				const PtrSize idx = whereIdx + elementsToMoveRight;
+				const Size idx = whereIdx + elementsToMoveRight;
 
 
 				m_data[idx + 1] = std::move(m_data[idx]);
 				m_data[idx + 1] = std::move(m_data[idx]);
 			}
 			}
@@ -196,7 +196,7 @@ typename DynamicArray<T>::Iterator DynamicArray<T>::emplaceAt(TAllocator alloc,
 	}
 	}
 
 
 	// Construct the new object
 	// Construct the new object
-	ANKI_ASSERT(outIdx != MAX_PTR_SIZE);
+	ANKI_ASSERT(outIdx != getMaxNumericLimit<Size>());
 	alloc.construct(&m_data[outIdx], std::forward<TArgs>(args)...);
 	alloc.construct(&m_data[outIdx], std::forward<TArgs>(args)...);
 
 
 	// Increase the size because resizeStorage will not
 	// Increase the size because resizeStorage will not

+ 1 - 1
src/anki/util/String.cpp

@@ -187,7 +187,7 @@ void String::appendInternal(Allocator& alloc, const Char* str, PtrSize strLen)
 		size = 1;
 		size = 1;
 	}
 	}
 
 
-	DynamicArray<Char> newData;
+	DynamicArray<Char, PtrSize> newData;
 	newData.create(alloc, size + strLen);
 	newData.create(alloc, size + strLen);
 
 
 	if(!m_data.isEmpty())
 	if(!m_data.isEmpty())

+ 1 - 1
src/anki/util/String.h

@@ -595,7 +595,7 @@ public:
 	String& replaceAll(Allocator alloc, CString from, CString to);
 	String& replaceAll(Allocator alloc, CString from, CString to);
 
 
 protected:
 protected:
-	DynamicArray<Char> m_data;
+	DynamicArray<Char, PtrSize> m_data;
 
 
 	void checkInit() const
 	void checkInit() const
 	{
 	{

+ 13 - 21
src/anki/util/WeakArray.h

@@ -15,7 +15,7 @@ namespace anki
 /// @{
 /// @{
 
 
 /// Array that doesn't own the memory.
 /// Array that doesn't own the memory.
-template<typename T>
+template<typename T, typename TSize = U32>
 class WeakArray
 class WeakArray
 {
 {
 public:
 public:
@@ -24,8 +24,9 @@ public:
 	using ConstIterator = const Value*;
 	using ConstIterator = const Value*;
 	using Reference = Value&;
 	using Reference = Value&;
 	using ConstReference = const Value&;
 	using ConstReference = const Value&;
+	using Size = TSize;
 
 
-	WeakArray(T* mem, PtrSize size)
+	WeakArray(T* mem, Size size)
 		: m_data(mem)
 		: m_data(mem)
 		, m_size(size)
 		, m_size(size)
 	{
 	{
@@ -87,13 +88,13 @@ public:
 		return *this;
 		return *this;
 	}
 	}
 
 
-	Reference operator[](const PtrSize n)
+	Reference operator[](const Size n)
 	{
 	{
 		ANKI_ASSERT(n < m_size);
 		ANKI_ASSERT(n < m_size);
 		return m_data[n];
 		return m_data[n];
 	}
 	}
 
 
-	ConstReference operator[](const PtrSize n) const
+	ConstReference operator[](const Size n) const
 	{
 	{
 		ANKI_ASSERT(n < m_size);
 		ANKI_ASSERT(n < m_size);
 		return m_data[n];
 		return m_data[n];
@@ -171,16 +172,11 @@ public:
 		return m_data[m_size - 1];
 		return m_data[m_size - 1];
 	}
 	}
 
 
-	PtrSize getSize() const
+	Size getSize() const
 	{
 	{
 		return m_size;
 		return m_size;
 	}
 	}
 
 
-	PtrSize getByteSize() const
-	{
-		return m_size * sizeof(Value);
-	}
-
 	Bool isEmpty() const
 	Bool isEmpty() const
 	{
 	{
 		return m_size == 0;
 		return m_size == 0;
@@ -193,19 +189,20 @@ public:
 
 
 private:
 private:
 	Value* m_data;
 	Value* m_data;
-	PtrSize m_size;
+	Size m_size;
 };
 };
 
 
 /// Array that doesn't own the memory.
 /// Array that doesn't own the memory.
-template<typename T>
+template<typename T, typename TSize = U32>
 class ConstWeakArray
 class ConstWeakArray
 {
 {
 public:
 public:
 	using Value = T;
 	using Value = T;
 	using ConstIterator = const Value*;
 	using ConstIterator = const Value*;
 	using ConstReference = const Value&;
 	using ConstReference = const Value&;
+	using Size = TSize;
 
 
-	ConstWeakArray(const T* mem, PtrSize size)
+	ConstWeakArray(const T* mem, Size size)
 		: m_data(mem)
 		: m_data(mem)
 		, m_size(size)
 		, m_size(size)
 	{
 	{
@@ -275,7 +272,7 @@ public:
 		return *this;
 		return *this;
 	}
 	}
 
 
-	ConstReference operator[](const PtrSize n) const
+	ConstReference operator[](const Size n) const
 	{
 	{
 		ANKI_ASSERT(n < m_size);
 		ANKI_ASSERT(n < m_size);
 		return m_data[n];
 		return m_data[n];
@@ -317,16 +314,11 @@ public:
 		return m_data[m_size - 1];
 		return m_data[m_size - 1];
 	}
 	}
 
 
-	PtrSize getSize() const
+	Size getSize() const
 	{
 	{
 		return m_size;
 		return m_size;
 	}
 	}
 
 
-	PtrSize getByteSize() const
-	{
-		return m_size * sizeof(Value);
-	}
-
 	Bool isEmpty() const
 	Bool isEmpty() const
 	{
 	{
 		return m_size == 0;
 		return m_size == 0;
@@ -339,7 +331,7 @@ public:
 
 
 private:
 private:
 	const Value* m_data;
 	const Value* m_data;
-	PtrSize m_size;
+	Size m_size;
 };
 };
 /// @}
 /// @}
 
 

+ 6 - 6
tests/util/DynamicArray.cpp

@@ -110,11 +110,11 @@ ANKI_TEST(Util, DynamicArray)
 		for(U i = 0; i < ITERATIONS; ++i)
 		for(U i = 0; i < ITERATIONS; ++i)
 		{
 		{
 			const Bool grow = arr.getSize() > 0 && (rand() & 1);
 			const Bool grow = arr.getSize() > 0 && (rand() & 1);
-			PtrSize newSize;
+			U32 newSize;
 			U32 value = rand();
 			U32 value = rand();
 			if(grow)
 			if(grow)
 			{
 			{
-				newSize = vec.size() * getRandomRange(1, 4);
+				newSize = U32(vec.size()) * getRandomRange(1, 4);
 			}
 			}
 			else
 			else
 			{
 			{
@@ -126,9 +126,9 @@ ANKI_TEST(Util, DynamicArray)
 
 
 			// Validate
 			// Validate
 			ANKI_TEST_EXPECT_EQ(arr.getSize(), vec.size());
 			ANKI_TEST_EXPECT_EQ(arr.getSize(), vec.size());
-			for(U i = 0; i < arr.getSize(); ++i)
+			for(U32 j = 0; j < arr.getSize(); ++j)
 			{
 			{
-				ANKI_TEST_EXPECT_EQ(arr[i].m_x, vec[i].m_x);
+				ANKI_TEST_EXPECT_EQ(arr[j].m_x, vec[j].m_x);
 			}
 			}
 
 
 			arr.validate();
 			arr.validate();
@@ -187,7 +187,7 @@ ANKI_TEST(Util, DynamicArrayEmplaceAt)
 
 
 		arr.emplaceAt(arr.getBegin() + 4, 666);
 		arr.emplaceAt(arr.getBegin() + 4, 666);
 
 
-		for(I i = 0; i < 10 + 1; ++i)
+		for(I32 i = 0; i < 10 + 1; ++i)
 		{
 		{
 			if(i < 4)
 			if(i < 4)
 			{
 			{
@@ -243,7 +243,7 @@ ANKI_TEST(Util, DynamicArrayEmplaceAt)
 
 
 		// Check
 		// Check
 		ANKI_TEST_EXPECT_EQ(arr.getSize(), vec.size());
 		ANKI_TEST_EXPECT_EQ(arr.getSize(), vec.size());
-		for(PtrSize i = 0; i < arr.getSize(); ++i)
+		for(U32 i = 0; i < arr.getSize(); ++i)
 		{
 		{
 			ANKI_TEST_EXPECT_EQ(arr[i].m_x, vec[i].m_x);
 			ANKI_TEST_EXPECT_EQ(arr[i].m_x, vec[i].m_x);
 		}
 		}

+ 8 - 8
tests/util/HashMap.cpp

@@ -153,11 +153,11 @@ ANKI_TEST(Util, HashMap)
 		HighRezTimer timer;
 		HighRezTimer timer;
 
 
 		// Create a huge set
 		// Create a huge set
-		const U COUNT = 1024 * 1024 * 10;
+		const U32 COUNT = 1024 * 1024 * 10;
 		DynamicArrayAuto<int> vals(alloc);
 		DynamicArrayAuto<int> vals(alloc);
 		vals.create(COUNT);
 		vals.create(COUNT);
 
 
-		for(U i = 0; i < COUNT; ++i)
+		for(U32 i = 0; i < COUNT; ++i)
 		{
 		{
 			// Put unique keys
 			// Put unique keys
 			int v;
 			int v;
@@ -174,7 +174,7 @@ ANKI_TEST(Util, HashMap)
 		{
 		{
 			// Put the vals AnKi
 			// Put the vals AnKi
 			timer.start();
 			timer.start();
-			for(U i = 0; i < COUNT; ++i)
+			for(U32 i = 0; i < COUNT; ++i)
 			{
 			{
 				akMap.emplace(alloc, vals[i], vals[i]);
 				akMap.emplace(alloc, vals[i], vals[i]);
 			}
 			}
@@ -183,7 +183,7 @@ ANKI_TEST(Util, HashMap)
 
 
 			// Put the vals STL
 			// Put the vals STL
 			timer.start();
 			timer.start();
-			for(U i = 0; i < COUNT; ++i)
+			for(U32 i = 0; i < COUNT; ++i)
 			{
 			{
 				stdMap[vals[i]] = vals[i];
 				stdMap[vals[i]] = vals[i];
 			}
 			}
@@ -199,7 +199,7 @@ ANKI_TEST(Util, HashMap)
 
 
 			// Find values AnKi
 			// Find values AnKi
 			timer.start();
 			timer.start();
-			for(U i = 0; i < COUNT; ++i)
+			for(U32 i = 0; i < COUNT; ++i)
 			{
 			{
 				auto it = akMap.find(vals[i]);
 				auto it = akMap.find(vals[i]);
 				count += *it;
 				count += *it;
@@ -209,7 +209,7 @@ ANKI_TEST(Util, HashMap)
 
 
 			// Find values STL
 			// Find values STL
 			timer.start();
 			timer.start();
-			for(U i = 0; i < COUNT; ++i)
+			for(U32 i = 0; i < COUNT; ++i)
 			{
 			{
 				count += stdMap[vals[i]];
 				count += stdMap[vals[i]];
 			}
 			}
@@ -227,7 +227,7 @@ ANKI_TEST(Util, HashMap)
 
 
 			// Random delete AnKi
 			// Random delete AnKi
 			Second akTime = 0.0;
 			Second akTime = 0.0;
-			for(U i = 0; i < vals.getSize(); ++i)
+			for(U32 i = 0; i < vals.getSize(); ++i)
 			{
 			{
 				auto it = akMap.find(vals[i]);
 				auto it = akMap.find(vals[i]);
 
 
@@ -239,7 +239,7 @@ ANKI_TEST(Util, HashMap)
 
 
 			// Random delete STL
 			// Random delete STL
 			Second stlTime = 0.0;
 			Second stlTime = 0.0;
-			for(U i = 0; i < vals.getSize(); ++i)
+			for(U32 i = 0; i < vals.getSize(); ++i)
 			{
 			{
 				auto it = stdMap.find(vals[i]);
 				auto it = stdMap.find(vals[i]);