Browse Source

Some work on IBL

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
fe1bb0fbc1

BIN
engine_data/SplitSumIntegration.ankitex


BIN
engine_data/SplitSumIntegration.png


+ 7 - 3
include/anki/gr/Framebuffer.h

@@ -15,12 +15,14 @@ namespace anki
 /// @addtogroup graphics
 /// @addtogroup graphics
 /// @{
 /// @{
 
 
-/// Framebuffer attachment.
+/// Framebuffer attachment info.
 class Attachment
 class Attachment
 {
 {
 public:
 public:
 	TexturePtr m_texture;
 	TexturePtr m_texture;
-	U32 m_layer = 0;
+	U32 m_arrayIndex = 0; ///< For array textures
+	U32 m_depth = 0; ///< For 3D textures
+	U32 m_faceIndex = 0; ///< For cubemap textures
 	U32 m_mipmap = 0;
 	U32 m_mipmap = 0;
 	PixelFormat m_format;
 	PixelFormat m_format;
 	AttachmentLoadOperation m_loadOperation = AttachmentLoadOperation::CLEAR;
 	AttachmentLoadOperation m_loadOperation = AttachmentLoadOperation::CLEAR;
@@ -49,7 +51,9 @@ public:
 	Attachment& operator=(const Attachment& b)
 	Attachment& operator=(const Attachment& b)
 	{
 	{
 		m_texture = b.m_texture;
 		m_texture = b.m_texture;
-		m_layer = b.m_layer;
+		m_arrayIndex = b.m_arrayIndex;
+		m_depth = b.m_depth;
+		m_faceIndex = b.m_faceIndex;
 		m_mipmap = b.m_mipmap;
 		m_mipmap = b.m_mipmap;
 		m_format = b.m_format;
 		m_format = b.m_format;
 		m_loadOperation = b.m_loadOperation;
 		m_loadOperation = b.m_loadOperation;

+ 1 - 1
include/anki/gr/gl/FramebufferImpl.h

@@ -45,7 +45,7 @@ private:
 
 
 	/// Attach a texture
 	/// Attach a texture
 	static void attachTextureInternal(
 	static void attachTextureInternal(
-		GLenum attachment, const TextureImpl& tex, const U32 layer);
+		GLenum attachment, const TextureImpl& tex, const Attachment& info);
 
 
 	/// Create the FBO
 	/// Create the FBO
 	ANKI_USE_RESULT Error createFbo(
 	ANKI_USE_RESULT Error createFbo(

+ 8 - 1
include/anki/renderer/Ir.h

@@ -75,7 +75,6 @@ private:
 
 
 	Renderer m_nestedR;
 	Renderer m_nestedR;
 	TexturePtr m_envCubemapArr;
 	TexturePtr m_envCubemapArr;
-	TexturePtr m_irradianceCubemapArr;
 	U16 m_cubemapArrMipCount = 0;
 	U16 m_cubemapArrMipCount = 0;
 	U16 m_cubemapArrSize = 0;
 	U16 m_cubemapArrSize = 0;
 	U16 m_fbSize = 0;
 	U16 m_fbSize = 0;
@@ -83,11 +82,19 @@ private:
 	Barrier m_barrier;
 	Barrier m_barrier;
 	Clusterer m_clusterer;
 	Clusterer m_clusterer;
 
 
+	// Irradiance
+	TexturePtr m_irradianceCubemapArr;
+	ShaderResourcePtr m_computeIrradianceFrag;
+	PipelinePtr m_computeIrradiancePpline;
+	ResourceGroupPtr m_computeIrradianceResources;
+
 	// Tokens
 	// Tokens
 	DynamicBufferToken m_probesToken;
 	DynamicBufferToken m_probesToken;
 	DynamicBufferToken m_clustersToken;
 	DynamicBufferToken m_clustersToken;
 	DynamicBufferToken m_indicesToken;
 	DynamicBufferToken m_indicesToken;
 
 
+	ANKI_USE_RESULT Error initIrradiance();
+
 	/// Bin probes in clusters.
 	/// Bin probes in clusters.
 	void binProbes(U32 threadId, PtrSize threadsCount, IrRunContext& ctx);
 	void binProbes(U32 threadId, PtrSize threadsCount, IrRunContext& ctx);
 
 

+ 2 - 0
include/anki/renderer/Refl.h

@@ -50,6 +50,8 @@ private:
 	ResourceGroupPtr m_rcGroup;
 	ResourceGroupPtr m_rcGroup;
 	BufferPtr m_uniforms;
 	BufferPtr m_uniforms;
 	Timestamp m_uniformsUpdateTimestamp = 0;
 	Timestamp m_uniformsUpdateTimestamp = 0;
+	TextureResourcePtr m_integrationLut;
+	SamplerPtr m_integrationLutSampler;
 
 
 	// 2nd pass: Blit
 	// 2nd pass: Blit
 	ResourceGroupPtr m_blitRcGroup;
 	ResourceGroupPtr m_blitRcGroup;

+ 3 - 2
include/anki/resource/Common.h

@@ -83,10 +83,11 @@ using TempResourceAllocator = StackAllocator<T>;
 using ResourceFilename = CString;
 using ResourceFilename = CString;
 
 
 /// Given a shader type return the appropriate file extension.
 /// Given a shader type return the appropriate file extension.
-const CString& shaderTypeToFileExtension(ShaderType type);
+ANKI_USE_RESULT const CString& shaderTypeToFileExtension(ShaderType type);
 
 
 /// Given a filename return the shader type.
 /// Given a filename return the shader type.
-Error fileExtensionToShaderType(const CString& filename, ShaderType& type);
+ANKI_USE_RESULT Error fileExtensionToShaderType(
+	const CString& filename, ShaderType& type);
 /// @}
 /// @}
 
 
 } // end namespace anki
 } // end namespace anki

+ 13 - 14
include/anki/script/ScriptManager.h

@@ -20,20 +20,6 @@ class SceneGraph;
 class ScriptManager
 class ScriptManager
 {
 {
 public:
 public:
-#ifdef ANKI_BUILD
-	ScriptManager();
-	~ScriptManager();
-
-	/// Create the script manager.
-	ANKI_USE_RESULT Error create(
-		AllocAlignedCallback allocCb, void* allocCbData, SceneGraph* scene);
-
-	SceneGraph& _getSceneGraph()
-	{
-		return *m_scene;
-	}
-#endif
-
 	/// Expose a variable to the scripting engine.
 	/// Expose a variable to the scripting engine.
 	template<typename T>
 	template<typename T>
 	void exposeVariable(const char* name, T* y)
 	void exposeVariable(const char* name, T* y)
@@ -47,6 +33,19 @@ public:
 		return m_lua.evalString(str);
 		return m_lua.evalString(str);
 	}
 	}
 
 
+anki_internal:
+	ScriptManager();
+	~ScriptManager();
+
+	/// Create the script manager.
+	ANKI_USE_RESULT Error create(
+		AllocAlignedCallback allocCb, void* allocCbData, SceneGraph* scene);
+
+	SceneGraph& _getSceneGraph()
+	{
+		return *m_scene;
+	}
+
 private:
 private:
 	SceneGraph* m_scene = nullptr;
 	SceneGraph* m_scene = nullptr;
 	ChainAllocator<U8> m_alloc;
 	ChainAllocator<U8> m_alloc;

+ 8 - 8
shaders/Irradiance.glsl → shaders/Irradiance.frag.glsl

@@ -8,12 +8,14 @@
 #include "shaders/Common.glsl"
 #include "shaders/Common.glsl"
 
 
 layout(location = 0) in vec2 in_uv;
 layout(location = 0) in vec2 in_uv;
+layout(location = 0) out vec3 out_color;
 
 
-layout(TEX_BINDING(0, 0)) samplerCube u_envTex;
+layout(TEX_BINDING(0, 0)) uniform samplerCube u_envTex;
 
 
-layout(location = 0) out vec3 out_color0;
-layout(location = 1) out vec3 out_color1;
-layout(location = 2) out vec3 out_color2;
+layout(UBO_BINDING(0, 0)) uniform u0_
+{
+	uvec4 u_faceIdxPad3;
+};
 
 
 const mat3 CUBE_ROTATIONS[6] = mat3[](mat3(vec3(0.000000, 0.000000, -1.000000),
 const mat3 CUBE_ROTATIONS[6] = mat3[](mat3(vec3(0.000000, 0.000000, -1.000000),
 										  vec3(0.000000, -1.000000, 0.000000),
 										  vec3(0.000000, -1.000000, 0.000000),
@@ -47,7 +49,7 @@ vec3 computeIrradiance(in uint face)
 
 
 	vec3 outCol = vec3(0.0);
 	vec3 outCol = vec3(0.0);
 	float weight = 0.0;
 	float weight = 0.0;
-	
+
 	// For all the faces and texels of the environment map calculate a color sum
 	// For all the faces and texels of the environment map calculate a color sum
 	for(uint f = 0u; f < 6u; ++f)
 	for(uint f = 0u; f < 6u; ++f)
 	{
 	{
@@ -74,7 +76,5 @@ vec3 computeIrradiance(in uint face)
 //==============================================================================
 //==============================================================================
 void main()
 void main()
 {
 {
-	out_color0 = computeIrradiance(FACE_INDEX + 0);
-	out_color1 = computeIrradiance(FACE_INDEX + 1);
-	out_color2 = computeIrradiance(FACE_INDEX + 2);
+	out_color = computeIrradiance(u_faceIdxPad3.x);
 }
 }

+ 0 - 1
src/core/Config.cpp

@@ -55,7 +55,6 @@ Config::Config()
 	newOption("pps.gammaCorrection", true);
 	newOption("pps.gammaCorrection", true);
 
 
 	// Reflections
 	// Reflections
-	newOption("refl.renderingQuality", 0.5);
 	newOption("ir.enabled", true);
 	newOption("ir.enabled", true);
 	newOption("ir.rendererSize", 128);
 	newOption("ir.rendererSize", 128);
 	newOption("ir.cubemapTextureArraySize", 16);
 	newOption("ir.cubemapTextureArraySize", 16);

+ 41 - 20
src/gr/gl/FramebufferImpl.cpp

@@ -41,8 +41,7 @@ Error FramebufferImpl::create(const FramebufferInitializer& init)
 		const Attachment& att = m_in.m_colorAttachments[i];
 		const Attachment& att = m_in.m_colorAttachments[i];
 		const GLenum binding = GL_COLOR_ATTACHMENT0 + i;
 		const GLenum binding = GL_COLOR_ATTACHMENT0 + i;
 
 
-		attachTextureInternal(
-			binding, att.m_texture->getImplementation(), att.m_layer);
+		attachTextureInternal(binding, att.m_texture->getImplementation(), att);
 
 
 		m_drawBuffers[i] = binding;
 		m_drawBuffers[i] = binding;
 
 
@@ -58,8 +57,7 @@ Error FramebufferImpl::create(const FramebufferInitializer& init)
 		const Attachment& att = m_in.m_depthStencilAttachment;
 		const Attachment& att = m_in.m_depthStencilAttachment;
 		const GLenum binding = GL_DEPTH_ATTACHMENT;
 		const GLenum binding = GL_DEPTH_ATTACHMENT;
 
 
-		attachTextureInternal(
-			binding, att.m_texture->getImplementation(), att.m_layer);
+		attachTextureInternal(binding, att.m_texture->getImplementation(), att);
 
 
 		if(att.m_loadOperation == AttachmentLoadOperation::DONT_CARE)
 		if(att.m_loadOperation == AttachmentLoadOperation::DONT_CARE)
 		{
 		{
@@ -81,8 +79,10 @@ Error FramebufferImpl::create(const FramebufferInitializer& init)
 
 
 //==============================================================================
 //==============================================================================
 void FramebufferImpl::attachTextureInternal(
 void FramebufferImpl::attachTextureInternal(
-	GLenum attachment, const TextureImpl& tex, const U32 layer)
+	GLenum attachment, const TextureImpl& tex, const Attachment& info)
 {
 {
+	ANKI_ASSERT(info.m_mipmap < tex.m_mipsCount);
+
 	const GLenum target = GL_FRAMEBUFFER;
 	const GLenum target = GL_FRAMEBUFFER;
 	switch(tex.m_target)
 	switch(tex.m_target)
 	{
 	{
@@ -90,32 +90,53 @@ void FramebufferImpl::attachTextureInternal(
 #if ANKI_GL == ANKI_GL_DESKTOP
 #if ANKI_GL == ANKI_GL_DESKTOP
 	case GL_TEXTURE_2D_MULTISAMPLE:
 	case GL_TEXTURE_2D_MULTISAMPLE:
 #endif
 #endif
-		ANKI_ASSERT(layer == 0);
+		ANKI_ASSERT(info.m_arrayIndex == 0);
+		ANKI_ASSERT(info.m_depth == 0);
+		ANKI_ASSERT(info.m_faceIndex == 0);
+
 		glFramebufferTexture2D(
 		glFramebufferTexture2D(
-			target, attachment, tex.m_target, tex.getGlName(), 0);
+			target, attachment, tex.m_target, tex.getGlName(), info.m_mipmap);
 		break;
 		break;
 	case GL_TEXTURE_CUBE_MAP:
 	case GL_TEXTURE_CUBE_MAP:
-		ANKI_ASSERT(layer < 6);
+		ANKI_ASSERT(info.m_arrayIndex == 0);
+		ANKI_ASSERT(info.m_depth == 0);
+		ANKI_ASSERT(info.m_faceIndex < 6);
+
 		glFramebufferTexture2D(target,
 		glFramebufferTexture2D(target,
 			attachment,
 			attachment,
-			GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer,
+			GL_TEXTURE_CUBE_MAP_POSITIVE_X + info.m_faceIndex,
 			tex.getGlName(),
 			tex.getGlName(),
-			0);
+			info.m_mipmap);
 		break;
 		break;
 	case GL_TEXTURE_2D_ARRAY:
 	case GL_TEXTURE_2D_ARRAY:
+		ANKI_ASSERT(info.m_arrayIndex < tex.m_depth);
+		ANKI_ASSERT(info.m_depth == 0);
+		ANKI_ASSERT(info.m_faceIndex == 0);
+
+		glFramebufferTextureLayer(target,
+			attachment,
+			tex.getGlName(),
+			info.m_mipmap,
+			info.m_arrayIndex);
+		break;
 	case GL_TEXTURE_3D:
 	case GL_TEXTURE_3D:
-	case GL_TEXTURE_CUBE_MAP_ARRAY:
-		if(tex.m_target == GL_TEXTURE_CUBE_MAP_ARRAY)
-		{
-			ANKI_ASSERT((GLuint)layer < tex.m_depth * 6);
-		}
-		else
-		{
-			ANKI_ASSERT((GLuint)layer < tex.m_depth);
-		}
+		ANKI_ASSERT(info.m_arrayIndex == 0);
+		ANKI_ASSERT(info.m_depth < tex.m_depth);
+		ANKI_ASSERT(info.m_faceIndex == 0);
+
 		glFramebufferTextureLayer(
 		glFramebufferTextureLayer(
-			target, attachment, tex.getGlName(), 0, layer);
+			target, attachment, tex.getGlName(), info.m_mipmap, info.m_depth);
 		break;
 		break;
+	case GL_TEXTURE_CUBE_MAP_ARRAY:
+		ANKI_ASSERT(info.m_arrayIndex < tex.m_depth);
+		ANKI_ASSERT(info.m_depth == 0);
+		ANKI_ASSERT(info.m_faceIndex < 6);
+
+		glFramebufferTextureLayer(target,
+			attachment,
+			tex.getGlName(),
+			info.m_mipmap,
+			info.m_arrayIndex * 6 + info.m_faceIndex);
 		break;
 		break;
 	default:
 	default:
 		ANKI_ASSERT(0);
 		ANKI_ASSERT(0);

+ 5 - 5
src/renderer/Drawer.cpp

@@ -98,8 +98,8 @@ Error SetupRenderableVariableVisitor::visit(
 		}
 		}
 
 
 		uniSet(mvar, &mvp[0], cachedTrfs);
 		uniSet(mvar, &mvp[0], cachedTrfs);
+		break;
 	}
 	}
-	break;
 	case BuiltinMaterialVariableId::MV_MATRIX:
 	case BuiltinMaterialVariableId::MV_MATRIX:
 	{
 	{
 		ANKI_ASSERT(cachedTrfs > 0);
 		ANKI_ASSERT(cachedTrfs > 0);
@@ -113,8 +113,8 @@ Error SetupRenderableVariableVisitor::visit(
 		}
 		}
 
 
 		uniSet(mvar, &mv[0], cachedTrfs);
 		uniSet(mvar, &mv[0], cachedTrfs);
+		break;
 	}
 	}
-	break;
 	case BuiltinMaterialVariableId::VP_MATRIX:
 	case BuiltinMaterialVariableId::VP_MATRIX:
 		ANKI_ASSERT(cachedTrfs == 0 && "Cannot have transform");
 		ANKI_ASSERT(cachedTrfs == 0 && "Cannot have transform");
 		uniSet(mvar, &vp, 1);
 		uniSet(mvar, &vp, 1);
@@ -134,8 +134,8 @@ Error SetupRenderableVariableVisitor::visit(
 		}
 		}
 
 
 		uniSet(mvar, &normMats[0], cachedTrfs);
 		uniSet(mvar, &normMats[0], cachedTrfs);
+		break;
 	}
 	}
-	break;
 	case BuiltinMaterialVariableId::BILLBOARD_MVP_MATRIX:
 	case BuiltinMaterialVariableId::BILLBOARD_MVP_MATRIX:
 	{
 	{
 		// Calc the billboard rotation matrix
 		// Calc the billboard rotation matrix
@@ -152,8 +152,8 @@ Error SetupRenderableVariableVisitor::visit(
 		}
 		}
 
 
 		uniSet(mvar, &bmvp[0], cachedTrfs);
 		uniSet(mvar, &bmvp[0], cachedTrfs);
+		break;
 	}
 	}
-	break;
 	case BuiltinMaterialVariableId::MAX_TESS_LEVEL:
 	case BuiltinMaterialVariableId::MAX_TESS_LEVEL:
 	{
 	{
 		const RenderComponentVariable& base = rvar;
 		const RenderComponentVariable& base = rvar;
@@ -171,8 +171,8 @@ Error SetupRenderableVariableVisitor::visit(
 		}
 		}
 
 
 		uniSet(mvar, &tess, 1);
 		uniSet(mvar, &tess, 1);
+		break;
 	}
 	}
-	break;
 	case BuiltinMaterialVariableId::MS_DEPTH_MAP:
 	case BuiltinMaterialVariableId::MS_DEPTH_MAP:
 		// Do nothing
 		// Do nothing
 		break;
 		break;

+ 70 - 18
src/renderer/Ir.cpp

@@ -207,7 +207,7 @@ Error Ir::init(const ConfigSet& config)
 		m_r->getGlobalTimestampPtr()));
 		m_r->getGlobalTimestampPtr()));
 	m_nestedR.getPps().setFog(Vec3(1.0, 0.0, 1.0), 0.0);
 	m_nestedR.getPps().setFog(Vec3(1.0, 0.0, 1.0), 0.0);
 
 
-	// Init the texture
+	// Init the textures
 	TextureInitializer texinit;
 	TextureInitializer texinit;
 
 
 	texinit.m_width = m_fbSize;
 	texinit.m_width = m_fbSize;
@@ -224,14 +224,14 @@ Error Ir::init(const ConfigSet& config)
 	m_irradianceCubemapArr = getGrManager().newInstance<Texture>(texinit);
 	m_irradianceCubemapArr = getGrManager().newInstance<Texture>(texinit);
 	m_cubemapArrMipCount = computeMaxMipmapCount(m_fbSize, m_fbSize);
 	m_cubemapArrMipCount = computeMaxMipmapCount(m_fbSize, m_fbSize);
 
 
+	// Create irradiance stuff
+	ANKI_CHECK(initIrradiance());
+
 	getGrManager().finish();
 	getGrManager().finish();
 
 
 	// Init the clusterer
 	// Init the clusterer
-	F32 reflQuality = config.getNumber("refl.renderingQuality");
-	U width =
-		getAlignedRoundUp(Renderer::TILE_SIZE, m_r->getWidth() * reflQuality);
-	U height =
-		getAlignedRoundUp(Renderer::TILE_SIZE, m_r->getHeight() * reflQuality);
+	U width = m_r->getWidth() / 2;
+	U height = m_r->getHeight() / 2;
 
 
 	U tileCountX = width / Renderer::TILE_SIZE;
 	U tileCountX = width / Renderer::TILE_SIZE;
 	U tileCountY = height / Renderer::TILE_SIZE;
 	U tileCountY = height / Renderer::TILE_SIZE;
@@ -242,6 +242,40 @@ Error Ir::init(const ConfigSet& config)
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }
 
 
+//==============================================================================
+Error Ir::initIrradiance()
+{
+	// Create the shader
+	StringAuto pps(getFrameAllocator());
+	pps.sprintf("#define CUBEMAP_SIZE %u\n", m_fbSize);
+
+	ANKI_CHECK(getResourceManager().loadResourceToCache(m_computeIrradianceFrag,
+		"shaders/Irradiance.frag.glsl",
+		pps.toCString(),
+		"r_ir_"));
+
+	// Create the ppline
+	ColorStateInfo colorInf;
+	colorInf.m_attachmentCount = 3;
+	PixelFormat pfs(ComponentFormat::R8G8B8, TransformFormat::UNORM);
+	colorInf.m_attachments[0].m_format = pfs;
+	colorInf.m_attachments[2].m_format = pfs;
+	colorInf.m_attachments[3].m_format = pfs;
+
+	m_r->createDrawQuadPipeline(m_computeIrradianceFrag->getGrShader(),
+		colorInf,
+		m_computeIrradiancePpline);
+
+	// Create the resources
+	ResourceGroupInitializer rcInit;
+	rcInit.m_uniformBuffers[0].m_dynamic = true;
+
+	m_computeIrradianceResources =
+		getGrManager().newInstance<ResourceGroup>(rcInit);
+
+	return ErrorCode::NONE;
+}
+
 //==============================================================================
 //==============================================================================
 Error Ir::run(CommandBufferPtr cmdb)
 Error Ir::run(CommandBufferPtr cmdb)
 {
 {
@@ -538,32 +572,50 @@ Error Ir::renderReflection(
 	// Render cubemap
 	// Render cubemap
 	for(U i = 0; i < 6; ++i)
 	for(U i = 0; i < 6; ++i)
 	{
 	{
-		Array<CommandBufferPtr, RENDERER_COMMAND_BUFFERS_COUNT> cmdb;
-		for(U j = 0; j < cmdb.getSize(); ++j)
+		Array<CommandBufferPtr, RENDERER_COMMAND_BUFFERS_COUNT> cmdbs;
+		for(U j = 0; j < cmdbs.getSize(); ++j)
 		{
 		{
-			cmdb[j] = getGrManager().newInstance<CommandBuffer>();
+			cmdbs[j] = getGrManager().newInstance<CommandBuffer>();
 		}
 		}
 
 
 		// Render
 		// Render
-		ANKI_CHECK(m_nestedR.render(node, i, cmdb));
+		ANKI_CHECK(m_nestedR.render(node, i, cmdbs));
+		auto& cmdb = cmdbs[cmdbs.getSize() - 1];
 
 
-		// Copy textures
-		cmdb[cmdb.getSize() - 1]->copyTextureToTexture(
-			m_nestedR.getPps().getRt(),
+		// Copy env texture
+		cmdb->copyTextureToTexture(m_nestedR.getPps().getRt(),
 			0,
 			0,
 			0,
 			0,
 			m_envCubemapArr,
 			m_envCubemapArr,
 			6 * cubemapIdx + i,
 			6 * cubemapIdx + i,
 			0);
 			0);
 
 
-		// Gen mips
-		cmdb[cmdb.getSize() - 1]->generateMipmaps(
-			m_envCubemapArr, 6 * cubemapIdx + i);
+		// Gen mips of env tex
+		cmdb->generateMipmaps(m_envCubemapArr, 6 * cubemapIdx + i);
+
+		// Compute irradiance
+		/*DynamicBufferInfo dinf;
+		UVec4* faceIdx =
+			static_cast<UVec4*>(getGrManager().allocateFrameHostVisibleMemory(
+				sizeof(UVec4), BufferUsage::UNIFORM, dinf.m_uniformBuffers[0]));
+		faceIdx->x() = i;
+
+		FramebufferInitializer fbinit;
+		fbinit.m_colorAttachmentsCount = 1;
+		fbinit.m_colorAttachments[0].m_texture = m_irradianceCubemapArr;
+		fbinit.m_colorAttachments[0].m_arrayIndex = cubemapIdx;
+		fbinit.m_colorAttachments[0].m_faceIndex = i;
+		FramebufferPtr fb = getGrManager().newInstance<Framebuffer>(fbinit);
+
+		cmdb->bindFramebuffer(fb);
+		cmdb->bindResourceGroup(0, m_computeIrradianceResources, &dinf);
+		cmdb->bindPipeline(m_computeIrradiancePpline);
+		m_r->drawQuad(cmdb);*/
 
 
 		// Flush
 		// Flush
-		for(U j = 0; j < cmdb.getSize(); ++j)
+		for(U j = 0; j < cmdbs.getSize(); ++j)
 		{
 		{
-			cmdb[j]->flush();
+			cmdbs[j]->flush();
 		}
 		}
 	}
 	}
 
 

+ 12 - 0
src/renderer/Refl.cpp

@@ -171,6 +171,18 @@ Error Refl::init1stPass(const ConfigSet& config)
 		AttachmentLoadOperation::DONT_CARE;
 		AttachmentLoadOperation::DONT_CARE;
 	m_fb = getGrManager().newInstance<Framebuffer>(fbInit);
 	m_fb = getGrManager().newInstance<Framebuffer>(fbInit);
 
 
+	// Load split sum integration LUT
+	ANKI_CHECK(getResourceManager().loadResource(
+		"engine_data/SplitSumIntegration.ankitex", m_integrationLut));
+
+	sinit = SamplerInitializer();
+	sinit.m_minMagFilter = SamplingFilter::LINEAR;
+	sinit.m_mipmapFilter = SamplingFilter::BASE;
+	sinit.m_minLod = 0.0;
+	sinit.m_maxLod = 1.0;
+	sinit.m_repeat = false;
+	m_integrationLutSampler = getGrManager().newInstance<Sampler>(sinit);
+
 	return ErrorCode::NONE;
 	return ErrorCode::NONE;
 }
 }
 
 

+ 3 - 2
src/renderer/Sm.cpp

@@ -73,7 +73,7 @@ Error Sm::init(const ConfigSet& config)
 	{
 	{
 		sm.m_layerId = layer;
 		sm.m_layerId = layer;
 
 
-		fbInit.m_depthStencilAttachment.m_layer = layer;
+		fbInit.m_depthStencilAttachment.m_arrayIndex = layer;
 		sm.m_fb = getGrManager().newInstance<Framebuffer>(fbInit);
 		sm.m_fb = getGrManager().newInstance<Framebuffer>(fbInit);
 
 
 		++layer;
 		++layer;
@@ -91,7 +91,8 @@ Error Sm::init(const ConfigSet& config)
 
 
 		for(U i = 0; i < 6; ++i)
 		for(U i = 0; i < 6; ++i)
 		{
 		{
-			fbInit.m_depthStencilAttachment.m_layer = layer * 6 + i;
+			fbInit.m_depthStencilAttachment.m_arrayIndex = layer;
+			fbInit.m_depthStencilAttachment.m_faceIndex = i;
 			sm.m_fb[i] = getGrManager().newInstance<Framebuffer>(fbInit);
 			sm.m_fb[i] = getGrManager().newInstance<Framebuffer>(fbInit);
 		}
 		}
 
 

+ 7 - 8
src/resource/Common.cpp

@@ -8,17 +8,16 @@
 namespace anki
 namespace anki
 {
 {
 
 
-//==============================================================================
-static const Array<CString, U(ShaderType::COUNT)> mapping = {{".vert.glsl",
-	".tc.glsl",
-	".te.glsl",
-	".geom.glsl",
-	".frag.glsl",
-	".comp.glsl"}};
-
 //==============================================================================
 //==============================================================================
 const CString& shaderTypeToFileExtension(ShaderType type)
 const CString& shaderTypeToFileExtension(ShaderType type)
 {
 {
+	static const Array<CString, U(ShaderType::COUNT)> mapping = {{".vert.glsl",
+		".tc.glsl",
+		".te.glsl",
+		".geom.glsl",
+		".frag.glsl",
+		".comp.glsl"}};
+
 	return mapping[type];
 	return mapping[type];
 }
 }
 
 

+ 0 - 1
testapp/Main.cpp

@@ -525,7 +525,6 @@ Error initSubsystems(int argc, char* argv[])
 	config.set("samples", 1);
 	config.set("samples", 1);
 	config.set("tessellation", true);
 	config.set("tessellation", true);
 	// config.set("maxTextureSize", 256);
 	// config.set("maxTextureSize", 256);
-	config.set("refl.renderingQuality", 1.0);
 	config.set("ir.enabled", true);
 	config.set("ir.enabled", true);
 	// config.set("ir.clusterSizeZ", 32);
 	// config.set("ir.clusterSizeZ", 32);
 	config.set("sslr.enabled", false);
 	config.set("sslr.enabled", false);