Panagiotis Christopoulos Charitos 4 yıl önce
ebeveyn
işleme
0394b0775d

+ 2 - 2
AnKi/Gr/Utils/StackGpuAllocator.cpp

@@ -44,8 +44,8 @@ void StackGpuAllocator::init(GenericMemoryPoolAllocator<U8> alloc, StackGpuAlloc
 
 	m_alignment = iface->getMaxAlignment();
 	ANKI_ASSERT(m_alignment > 0);
-	ANKI_ASSERT(m_initialSize >= m_alignment);
-	ANKI_ASSERT((m_initialSize % m_alignment) == 0);
+
+	alignRoundUp(m_alignment, m_initialSize);
 }
 
 Error StackGpuAllocator::allocate(PtrSize size, StackGpuAllocatorHandle& handle)

+ 1 - 1
AnKi/Renderer/Tonemapping.cpp

@@ -12,7 +12,7 @@ namespace anki
 
 Error Tonemapping::init(const ConfigSet& cfg)
 {
-	Error err = initInternal(cfg);
+	const Error err = initInternal(cfg);
 	if(err)
 	{
 		ANKI_R_LOGE("Failed to initialize tonemapping");

+ 5 - 1
AnKi/Resource/ImageResource.cpp

@@ -7,6 +7,7 @@
 #include <AnKi/Resource/ImageLoader.h>
 #include <AnKi/Resource/ResourceManager.h>
 #include <AnKi/Resource/AsyncLoader.h>
+#include <AnKi/Util/Filesystem.h>
 
 namespace anki
 {
@@ -67,7 +68,10 @@ Error ImageResource::load(const ResourceFilename& filename, Bool async)
 	}
 	ImageLoader& loader = ctx->m_loader;
 
-	TextureInitInfo init("RsrcTex");
+	StringAuto filenameExt(getTempAllocator());
+	getFilepathFilename(filename, filenameExt);
+
+	TextureInitInfo init(filenameExt);
 	init.m_usage = TextureUsageBit::ALL_SAMPLED | TextureUsageBit::TRANSFER_DESTINATION;
 	init.m_initialUsage = TextureUsageBit::ALL_SAMPLED;
 	U32 faces = 0;

+ 1 - 1
AnKi/Resource/TransferGpuAllocator.cpp

@@ -63,7 +63,7 @@ public:
 
 	U32 getMaxAlignment() final
 	{
-		return 16;
+		return TransferGpuAllocator::GPU_BUFFER_ALIGNMENT;
 	}
 };
 

+ 4 - 0
AnKi/Resource/TransferGpuAllocator.h

@@ -88,6 +88,10 @@ class TransferGpuAllocator
 	friend class TransferGpuAllocatorHandle;
 
 public:
+	/// Choose an alignment that satisfies 16 bytes and 3 bytes. RGB8 formats require 3 bytes alignment for the source
+	/// of the buffer to image copies.
+	static constexpr U32 GPU_BUFFER_ALIGNMENT = 16 * 3;
+
 	static const U32 FRAME_COUNT = 3;
 	static const PtrSize CHUNK_INITIAL_SIZE = 64_MB;
 	static constexpr Second MAX_FENCE_WAIT_TIME = 500.0_ms;

+ 1 - 2
AnKi/Shaders/TonemappingAverageLuminance.ankiprog

@@ -8,10 +8,9 @@ ANKI_SPECIALIZATION_CONSTANT_UVEC2(INPUT_TEX_SIZE, 0u);
 #pragma anki start comp
 #define LOG_AVG 0
 
-#include <AnKi/Shaders/Common.glsl>
 #include <AnKi/Shaders/TonemappingFunctions.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(32u, 32u);
+const UVec2 WORKGROUP_SIZE = UVec2(32u, 16u);
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 
 // Align the tex size to workgroup size