Browse Source

Fixes and optimizations

Panagiotis Christopoulos Charitos 10 years ago
parent
commit
ee04f4267e

+ 19 - 0
include/anki/renderer/Common.h

@@ -31,11 +31,30 @@ class DownscaleBlur;
 
 
 class RenderingContext;
 class RenderingContext;
 
 
+/// @addtogroup renderer
+/// @{
+
+/// WARNING: If you change the tile size you need to change some shaders
+const U TILE_SIZE = 64;
+
+/// FS size is rendererSize/FS_FRACTION.
+const U FS_FRACTION = 2;
+
+/// SSAO size is rendererSize/SSAO_FRACTION.
+const U SSAO_FRACTION = 4;
+
+/// Bloom size is rendererSize/BLOOM_FRACTION.
+const U BLOOM_FRACTION = 4;
+
+/// IS mimap count is: log2(BLOOM_FRACTION)+2 extra mips for bloom+1
+const U IS_MIPMAP_COUNT = __builtin_popcount(BLOOM_FRACTION - 1) + 1 + 2;
+
 /// Computes the 'a' and 'b' numbers for linearizeDepthOptimal
 /// Computes the 'a' and 'b' numbers for linearizeDepthOptimal
 inline void computeLinearizeDepthOptimal(F32 near, F32 far, F32& a, F32& b)
 inline void computeLinearizeDepthOptimal(F32 near, F32 far, F32& a, F32& b)
 {
 {
 	a = (far + near) / (2.0 * near);
 	a = (far + near) / (2.0 * near);
 	b = (near - far) / (2.0 * near);
 	b = (near - far) / (2.0 * near);
 }
 }
+/// @}
 
 
 } // end namespace anki
 } // end namespace anki

+ 1 - 1
include/anki/renderer/DownscaleBlur.h

@@ -37,7 +37,7 @@ private:
 		FramebufferPtr m_fb;
 		FramebufferPtr m_fb;
 	};
 	};
 
 
-	Array<Subpass, 5> m_passes;
+	Array<Subpass, IS_MIPMAP_COUNT - 1> m_passes;
 
 
 	Error initSubpass(U idx, const UVec2& inputTexSize);
 	Error initSubpass(U idx, const UVec2& inputTexSize);
 };
 };

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

@@ -39,6 +39,8 @@ anki_internal:
 	}
 	}
 
 
 private:
 private:
+	U m_width;
+	U m_height;
 	FramebufferPtr m_fb;
 	FramebufferPtr m_fb;
 	TexturePtr m_rt;
 	TexturePtr m_rt;
 	ResourceGroupPtr m_globalResources;
 	ResourceGroupPtr m_globalResources;

+ 0 - 3
include/anki/renderer/Is.h

@@ -38,9 +38,6 @@ class Is : public RenderingPass
 {
 {
 	friend class WriteLightsTask;
 	friend class WriteLightsTask;
 
 
-public:
-	static const U MIPMAPS_COUNT = 7;
-
 anki_internal:
 anki_internal:
 	static const PixelFormat RT_PIXEL_FORMAT;
 	static const PixelFormat RT_PIXEL_FORMAT;
 
 

+ 0 - 3
include/anki/renderer/Renderer.h

@@ -219,9 +219,6 @@ public:
 	ANKI_USE_RESULT Error render(RenderingContext& ctx);
 	ANKI_USE_RESULT Error render(RenderingContext& ctx);
 
 
 anki_internal:
 anki_internal:
-	/// WARNING: If you change the tile size you need to change some shaders
-	static const U TILE_SIZE = 64;
-
 	void getOutputFramebuffer(FramebufferPtr& outputFb, U32& width, U32& height)
 	void getOutputFramebuffer(FramebufferPtr& outputFb, U32& width, U32& height)
 	{
 	{
 		if(m_outputFb.isCreated())
 		if(m_outputFb.isCreated())

+ 4 - 3
shaders/Bloom.frag.glsl

@@ -6,6 +6,10 @@
 #include "shaders/Common.glsl"
 #include "shaders/Common.glsl"
 #include "shaders/Tonemapping.glsl"
 #include "shaders/Tonemapping.glsl"
 
 
+#if MIPMAP - 2 < 0
+#error See file
+#endif
+
 // Vars
 // Vars
 layout(TEX_BINDING(0, 0)) uniform lowp sampler2D u_tex; ///< Its the IS RT
 layout(TEX_BINDING(0, 0)) uniform lowp sampler2D u_tex; ///< Its the IS RT
 
 
@@ -22,9 +26,6 @@ layout(SS_BINDING(0, 0), std140) readonly buffer ss0_
 layout(location = 0) in vec2 in_texCoord;
 layout(location = 0) in vec2 in_texCoord;
 layout(location = 0) out vec3 out_color;
 layout(location = 0) out vec3 out_color;
 
 
-// Consts
-const uint MIPMAP = 5;
-
 vec3 readTexture(in uint mipmap)
 vec3 readTexture(in uint mipmap)
 {
 {
 	uint w = ANKI_RENDERER_WIDTH / (2 << (mipmap - 1));
 	uint w = ANKI_RENDERER_WIDTH / (2 << (mipmap - 1));

+ 6 - 7
shaders/NearDepthUpscale.frag.glsl

@@ -6,8 +6,7 @@
 #include "shaders/Common.glsl"
 #include "shaders/Common.glsl"
 #include "shaders/LinearDepth.glsl"
 #include "shaders/LinearDepth.glsl"
 
 
-layout(location = 0) in vec2 in_uvLow;
-layout(location = 1) in vec2 in_uvHigh;
+layout(location = 0) in vec2 in_uv;
 
 
 layout(location = 0) out vec3 out_color;
 layout(location = 0) out vec3 out_color;
 
 
@@ -38,19 +37,19 @@ const vec2 OFFSETS[8] =
 void main()
 void main()
 {
 {
 	// Get the depth of the current fragment
 	// Get the depth of the current fragment
-	float depth = texture(u_depthFullTex, in_uvHigh).r;
+	float depth = texture(u_depthFullTex, in_uv).r;
 
 
 	// Gather the depths around the current fragment and:
 	// Gather the depths around the current fragment and:
 	// - Get the min difference compared to crnt depth
 	// - Get the min difference compared to crnt depth
 	// - Get the new UV that is closer to the crnt depth
 	// - Get the new UV that is closer to the crnt depth
-	float lowDepth = texture(u_depthHalfTex, in_uvLow).r;
+	float lowDepth = texture(u_depthHalfTex, in_uv).r;
 	float minDiff = abs(depth - lowDepth);
 	float minDiff = abs(depth - lowDepth);
 	float maxDiff = minDiff;
 	float maxDiff = minDiff;
-	vec2 newUv = in_uvLow;
+	vec2 newUv = in_uv;
 	for(uint i = 0u; i < 8u; ++i)
 	for(uint i = 0u; i < 8u; ++i)
 	{
 	{
 		// Read the low depth
 		// Read the low depth
-		vec2 uv = in_uvLow + OFFSETS[i];
+		vec2 uv = in_uv + OFFSETS[i];
 		float lowDepth = texture(u_depthHalfTex, uv).r;
 		float lowDepth = texture(u_depthHalfTex, uv).r;
 
 
 		// Update the max difference compared to the current fragment
 		// Update the max difference compared to the current fragment
@@ -79,7 +78,7 @@ void main()
 	if(maxDiffLinear < DEPTH_THRESHOLD)
 	if(maxDiffLinear < DEPTH_THRESHOLD)
 	{
 	{
 		// No major discontinuites, sample with bilinear
 		// No major discontinuites, sample with bilinear
-		out_color = textureLod(u_colorTexLinear, in_uvLow, 0.0).rgb;
+		out_color = textureLod(u_colorTexLinear, in_uv, 0.0).rgb;
 	}
 	}
 	else
 	else
 	{
 	{

+ 2 - 14
shaders/NearDepthUpscale.vert.glsl

@@ -10,8 +10,7 @@ out gl_PerVertex
 	vec4 gl_Position;
 	vec4 gl_Position;
 };
 };
 
 
-layout(location = 0) out vec2 out_uvLow;
-layout(location = 1) out vec2 out_uvHigh;
+layout(location = 0) out vec2 out_uv;
 
 
 void main()
 void main()
 {
 {
@@ -20,16 +19,5 @@ void main()
 
 
 	vec2 pos = POSITIONS[gl_VertexID];
 	vec2 pos = POSITIONS[gl_VertexID];
 	gl_Position = vec4(pos, 0.0, 1.0);
 	gl_Position = vec4(pos, 0.0, 1.0);
-
-	// Compute some offset in order to align the texture coordinates to texel
-	// center
-	const vec2 TEXEL_SIZE_LOW =
-		vec2(1.0 / float(TEXTURE_WIDTH), 1.0 / float(TEXTURE_HEIGHT));
-	const vec2 UV_OFFSET_LOW = TEXEL_SIZE_LOW / 2.0;
-	out_uvLow = pos * 0.5 + (0.5 + UV_OFFSET_LOW);
-
-	const vec2 TEXEL_SIZE_HIGH =
-		vec2(1.0 / float(2 * TEXTURE_WIDTH), 1.0 / float(2 * TEXTURE_HEIGHT));
-	const vec2 UV_OFFSET_HIGH = TEXEL_SIZE_HIGH / 2.0;
-	out_uvHigh = pos * 0.5 + (0.5 + UV_OFFSET_HIGH);
+	out_uv = pos * 0.5 + 0.5;
 }
 }

+ 1 - 1
shaders/Pps.frag.glsl

@@ -169,7 +169,7 @@ void main()
 
 
 #if 0
 #if 0
 	{
 	{
-		out_color = bloom;
+		out_color = textureLod(u_isRt, in_uv, 0.0).rgb;;
 	}
 	}
 #endif
 #endif
 }
 }

+ 4 - 5
src/renderer/Bloom.cpp

@@ -43,8 +43,8 @@ Error Bloom::initFb(FramebufferPtr& fb, TexturePtr& rt)
 //==============================================================================
 //==============================================================================
 Error Bloom::initInternal(const ConfigSet& config)
 Error Bloom::initInternal(const ConfigSet& config)
 {
 {
-	m_width = m_r->getWidth() / 4;
-	m_height = m_r->getHeight() / 4;
+	m_width = m_r->getWidth() / BLOOM_FRACTION;
+	m_height = m_r->getHeight() / BLOOM_FRACTION;
 
 
 	m_threshold = config.getNumber("bloom.threshold");
 	m_threshold = config.getNumber("bloom.threshold");
 	m_scale = config.getNumber("bloom.scale");
 	m_scale = config.getNumber("bloom.scale");
@@ -67,11 +67,10 @@ Error Bloom::initInternal(const ConfigSet& config)
 	StringAuto pps(getAllocator());
 	StringAuto pps(getAllocator());
 	pps.sprintf("#define ANKI_RENDERER_WIDTH %u\n"
 	pps.sprintf("#define ANKI_RENDERER_WIDTH %u\n"
 				"#define ANKI_RENDERER_HEIGHT %u\n"
 				"#define ANKI_RENDERER_HEIGHT %u\n"
-				"#define UV_OFFSET vec2(%f, %f)\n",
+				"#define MIPMAP %u\n",
 		m_r->getWidth(),
 		m_r->getWidth(),
 		m_r->getHeight(),
 		m_r->getHeight(),
-		(1.0 / m_width) / 2.0,
-		(1.0 / m_height) / 2.0);
+		IS_MIPMAP_COUNT - 1);
 
 
 	ANKI_CHECK(getResourceManager().loadResourceToCache(
 	ANKI_CHECK(getResourceManager().loadResourceToCache(
 		m_quadVert, "shaders/Quad.vert.glsl", pps.toCString(), "r_"));
 		m_quadVert, "shaders/Quad.vert.glsl", pps.toCString(), "r_"));

+ 2 - 6
src/renderer/DownscaleBlur.cpp

@@ -24,12 +24,8 @@ Error DownscaleBlur::initSubpass(U idx, const UVec2& inputTexSize)
 	StringAuto pps(getAllocator());
 	StringAuto pps(getAllocator());
 
 
 	// vert shader
 	// vert shader
-	pps.sprintf("#define UV_OFFSET vec2(%f, %f)\n",
-		1.0 / inputTexSize.x(),
-		1.0 / inputTexSize.y());
-
-	ANKI_CHECK(getResourceManager().loadResourceToCache(
-		pass.m_vert, "shaders/Quad.vert.glsl", pps.toCString(), "r_"));
+	ANKI_CHECK(getResourceManager().loadResource(
+		"shaders/Quad.vert.glsl", pass.m_vert));
 
 
 	ppinit.m_shaders[ShaderType::VERTEX] = pass.m_vert->getGrShader();
 	ppinit.m_shaders[ShaderType::VERTEX] = pass.m_vert->getGrShader();
 
 

+ 7 - 4
src/renderer/Fs.cpp

@@ -22,9 +22,12 @@ Fs::~Fs()
 //==============================================================================
 //==============================================================================
 Error Fs::init(const ConfigSet&)
 Error Fs::init(const ConfigSet&)
 {
 {
+	m_width = m_r->getWidth() / FS_FRACTION;
+	m_height = m_r->getHeight() / FS_FRACTION;
+
 	// Create RT
 	// Create RT
-	m_r->createRenderTarget(m_r->getWidth() / 2,
-		m_r->getHeight() / 2,
+	m_r->createRenderTarget(m_width,
+		m_height,
 		Is::RT_PIXEL_FORMAT,
 		Is::RT_PIXEL_FORMAT,
 		1,
 		1,
 		SamplingFilter::NEAREST,
 		SamplingFilter::NEAREST,
@@ -100,7 +103,7 @@ Error Fs::buildCommandBuffers(
 	CommandBufferPtr cmdb = m_r->getGrManager().newInstance<CommandBuffer>();
 	CommandBufferPtr cmdb = m_r->getGrManager().newInstance<CommandBuffer>();
 	ctx.m_fs.m_commandBuffers[threadId] = cmdb;
 	ctx.m_fs.m_commandBuffers[threadId] = cmdb;
 
 
-	cmdb->setViewport(0, 0, m_r->getWidth() / 2, m_r->getHeight() / 2);
+	cmdb->setViewport(0, 0, m_width, m_height);
 	cmdb->setPolygonOffset(0.0, 0.0);
 	cmdb->setPolygonOffset(0.0, 0.0);
 	cmdb->bindResourceGroup(m_globalResources, 1, &ctx.m_fs.m_set1DynInfo);
 	cmdb->bindResourceGroup(m_globalResources, 1, &ctx.m_fs.m_set1DynInfo);
 
 
@@ -119,7 +122,7 @@ void Fs::run(RenderingContext& ctx)
 {
 {
 	CommandBufferPtr& cmdb = ctx.m_commandBuffer;
 	CommandBufferPtr& cmdb = ctx.m_commandBuffer;
 	cmdb->bindFramebuffer(m_fb);
 	cmdb->bindFramebuffer(m_fb);
-	cmdb->setViewport(0, 0, m_r->getWidth() / 2, m_r->getHeight() / 2);
+	cmdb->setViewport(0, 0, m_width, m_height);
 	cmdb->setPolygonOffset(0.0, 0.0);
 	cmdb->setPolygonOffset(0.0, 0.0);
 
 
 	for(U i = 0; i < m_r->getThreadPool().getThreadsCount(); ++i)
 	for(U i = 0; i < m_r->getThreadPool().getThreadsCount(); ++i)

+ 1 - 2
src/renderer/Ir.cpp

@@ -160,7 +160,7 @@ Error Ir::init(const ConfigSet& config)
 	ANKI_LOGI("Initializing IR (Image Reflections)");
 	ANKI_LOGI("Initializing IR (Image Reflections)");
 	m_fbSize = config.getNumber("ir.rendererSize");
 	m_fbSize = config.getNumber("ir.rendererSize");
 
 
-	if(m_fbSize < Renderer::TILE_SIZE)
+	if(m_fbSize < TILE_SIZE)
 	{
 	{
 		ANKI_LOGE("Too low ir.rendererSize");
 		ANKI_LOGE("Too low ir.rendererSize");
 		return ErrorCode::USER_DATA;
 		return ErrorCode::USER_DATA;
@@ -289,7 +289,6 @@ Error Ir::initIrradiance()
 Error Ir::run(RenderingContext& rctx)
 Error Ir::run(RenderingContext& rctx)
 {
 {
 	ANKI_TRACE_START_EVENT(RENDER_IR);
 	ANKI_TRACE_START_EVENT(RENDER_IR);
-	CommandBufferPtr& cmdb = rctx.m_commandBuffer;
 	FrustumComponent& frc = *rctx.m_frustumComponent;
 	FrustumComponent& frc = *rctx.m_frustumComponent;
 	VisibilityTestResults& visRez = frc.getVisibilityTestResults();
 	VisibilityTestResults& visRez = frc.getVisibilityTestResults();
 
 

+ 1 - 1
src/renderer/Is.cpp

@@ -290,7 +290,7 @@ Error Is::initInternal(const ConfigSet& config)
 		RT_PIXEL_FORMAT,
 		RT_PIXEL_FORMAT,
 		1,
 		1,
 		SamplingFilter::LINEAR,
 		SamplingFilter::LINEAR,
-		MIPMAPS_COUNT,
+		IS_MIPMAP_COUNT,
 		m_rt);
 		m_rt);
 
 
 	FramebufferInitInfo fbInit;
 	FramebufferInitInfo fbInit;

+ 3 - 3
src/renderer/MainRenderer.cpp

@@ -60,8 +60,8 @@ Error MainRenderer::create(ThreadPool* threadpool,
 	m_renderingQuality = config.getNumber("renderingQuality");
 	m_renderingQuality = config.getNumber("renderingQuality");
 	UVec2 size(
 	UVec2 size(
 		m_renderingQuality * F32(m_width), m_renderingQuality * F32(m_height));
 		m_renderingQuality * F32(m_width), m_renderingQuality * F32(m_height));
-	size.x() = getAlignedRoundDown(Renderer::TILE_SIZE, size.x() / 2) * 2;
-	size.y() = getAlignedRoundDown(Renderer::TILE_SIZE, size.y() / 2) * 2;
+	size.x() = getAlignedRoundDown(TILE_SIZE, size.x() / 2) * 2;
+	size.y() = getAlignedRoundDown(TILE_SIZE, size.y() / 2) * 2;
 
 
 	config2.set("width", size.x());
 	config2.set("width", size.x());
 	config2.set("height", size.y());
 	config2.set("height", size.y());
@@ -82,7 +82,7 @@ Error MainRenderer::create(ThreadPool* threadpool,
 		"#define TILE_SIZE %u\n",
 		"#define TILE_SIZE %u\n",
 		m_r->getWidth(),
 		m_r->getWidth(),
 		m_r->getHeight(),
 		m_r->getHeight(),
-		Renderer::TILE_SIZE);
+		TILE_SIZE);
 
 
 	// Init other
 	// Init other
 	ANKI_CHECK(m_r->getResourceManager().loadResource(
 	ANKI_CHECK(m_r->getResourceManager().loadResource(

+ 2 - 2
src/renderer/Ms.cpp

@@ -37,7 +37,7 @@ Error Ms::createRt(U32 samples)
 		DEPTH_RT_PIXEL_FORMAT,
 		DEPTH_RT_PIXEL_FORMAT,
 		samples,
 		samples,
 		SamplingFilter::NEAREST,
 		SamplingFilter::NEAREST,
-		3,
+		log2(SSAO_FRACTION) + 1,
 		m_depthRt);
 		m_depthRt);
 
 
 	m_r->createRenderTarget(m_r->getWidth(),
 	m_r->createRenderTarget(m_r->getWidth(),
@@ -61,7 +61,7 @@ Error Ms::createRt(U32 samples)
 		RT_PIXEL_FORMATS[2],
 		RT_PIXEL_FORMATS[2],
 		samples,
 		samples,
 		SamplingFilter::NEAREST,
 		SamplingFilter::NEAREST,
-		3,
+		log2(SSAO_FRACTION) + 1,
 		m_rt2);
 		m_rt2);
 
 
 	AttachmentLoadOperation loadop = AttachmentLoadOperation::DONT_CARE;
 	AttachmentLoadOperation loadop = AttachmentLoadOperation::DONT_CARE;

+ 2 - 2
src/renderer/Renderer.cpp

@@ -87,8 +87,8 @@ Error Renderer::initInternal(const ConfigSet& config)
 	// Set from the config
 	// Set from the config
 	m_width = config.getNumber("width");
 	m_width = config.getNumber("width");
 	m_height = config.getNumber("height");
 	m_height = config.getNumber("height");
-	ANKI_ASSERT(isAligned(Renderer::TILE_SIZE, m_width)
-		&& isAligned(Renderer::TILE_SIZE, m_height));
+	ANKI_ASSERT(
+		isAligned(TILE_SIZE, m_width) && isAligned(TILE_SIZE, m_height));
 	ANKI_LOGI("Initializing offscreen renderer. Size %ux%u", m_width, m_height);
 	ANKI_LOGI("Initializing offscreen renderer. Size %ux%u", m_width, m_height);
 
 
 	m_lodDistance = config.getNumber("lodDistance");
 	m_lodDistance = config.getNumber("lodDistance");

+ 4 - 12
src/renderer/Ssao.cpp

@@ -91,12 +91,8 @@ Error Ssao::initInternal(const ConfigSet& config)
 	//
 	//
 	// Init the widths/heights
 	// Init the widths/heights
 	//
 	//
-	const F32 quality = config.getNumber("ssao.renderingQuality");
-
-	m_width = quality * (F32)m_r->getWidth();
-	alignRoundUp(16, m_width);
-	m_height = quality * (F32)m_r->getHeight();
-	alignRoundUp(16, m_height);
+	m_width = m_r->getWidth() / SSAO_FRACTION;
+	m_height = m_r->getHeight() / SSAO_FRACTION;
 
 
 	ANKI_LOGI("Initializing SSAO. Size %ux%u", m_width, m_height);
 	ANKI_LOGI("Initializing SSAO. Size %ux%u", m_width, m_height);
 
 
@@ -167,12 +163,8 @@ Error Ssao::initInternal(const ConfigSet& config)
 	StringAuto pps(getAllocator());
 	StringAuto pps(getAllocator());
 
 
 	// vert shader
 	// vert shader
-	pps.sprintf("#define UV_OFFSET vec2(%f, %f)\n",
-		(1.0 / m_width) / 2.0,
-		(1.0 / m_height) / 2.0);
-
-	ANKI_CHECK(getResourceManager().loadResourceToCache(
-		m_quadVert, "shaders/Quad.vert.glsl", pps.toCString(), "r_"));
+	ANKI_CHECK(getResourceManager().loadResource(
+		"shaders/Quad.vert.glsl", m_quadVert));
 
 
 	ppinit.m_shaders[ShaderType::VERTEX] = m_quadVert->getGrShader();
 	ppinit.m_shaders[ShaderType::VERTEX] = m_quadVert->getGrShader();
 
 

+ 2 - 2
src/renderer/Tiler.cpp

@@ -49,8 +49,8 @@ Error Tiler::initInternal()
 				"#define TILE_SIZE_Y %u\n"
 				"#define TILE_SIZE_Y %u\n"
 				"#define TILES_COUNT_X %u\n"
 				"#define TILES_COUNT_X %u\n"
 				"#define TILES_COUNT_Y %u\n",
 				"#define TILES_COUNT_Y %u\n",
-		Renderer::TILE_SIZE,
-		Renderer::TILE_SIZE,
+		TILE_SIZE,
+		TILE_SIZE,
 		m_r->getTileCountXY().x(),
 		m_r->getTileCountXY().x(),
 		m_r->getTileCountXY().y());
 		m_r->getTileCountXY().y());
 
 

+ 3 - 2
src/renderer/Tm.cpp

@@ -16,17 +16,18 @@ Error Tm::create(const ConfigSet& initializer)
 	// Create shader
 	// Create shader
 	StringAuto pps(getAllocator());
 	StringAuto pps(getAllocator());
 
 
+	ANKI_ASSERT(IS_MIPMAP_COUNT > 1);
 	pps.sprintf("#define IS_RT_MIPMAP %u\n"
 	pps.sprintf("#define IS_RT_MIPMAP %u\n"
 				"#define ANKI_RENDERER_WIDTH %u\n"
 				"#define ANKI_RENDERER_WIDTH %u\n"
 				"#define ANKI_RENDERER_HEIGHT %u\n",
 				"#define ANKI_RENDERER_HEIGHT %u\n",
-		min<U>(Is::MIPMAPS_COUNT, 5) - 1,
+		IS_MIPMAP_COUNT - 1,
 		m_r->getWidth(),
 		m_r->getWidth(),
 		m_r->getHeight());
 		m_r->getHeight());
 
 
 	ANKI_CHECK(getResourceManager().loadResourceToCache(m_luminanceShader,
 	ANKI_CHECK(getResourceManager().loadResourceToCache(m_luminanceShader,
 		"shaders/PpsTmAverageLuminance.comp.glsl",
 		"shaders/PpsTmAverageLuminance.comp.glsl",
 		pps.toCString(),
 		pps.toCString(),
-		"rppstm_"));
+		"r_"));
 
 
 	// Create ppline
 	// Create ppline
 	PipelineInitInfo pplineInit;
 	PipelineInitInfo pplineInit;

+ 8 - 12
src/renderer/Upsample.cpp

@@ -46,18 +46,14 @@ Error Upsample::init(const ConfigSet& config)
 	StringAuto pps(getFrameAllocator());
 	StringAuto pps(getFrameAllocator());
 	pps.sprintf("#define TEXTURE_WIDTH %uu\n"
 	pps.sprintf("#define TEXTURE_WIDTH %uu\n"
 				"#define TEXTURE_HEIGHT %uu\n",
 				"#define TEXTURE_HEIGHT %uu\n",
-		m_r->getWidth() / 2,
-		m_r->getHeight() / 2);
-
-	ANKI_CHECK(getResourceManager().loadResourceToCache(m_frag,
-		"shaders/NearDepthUpscale.frag.glsl",
-		pps.toCString(),
-		"r_refl_"));
-
-	ANKI_CHECK(getResourceManager().loadResourceToCache(m_vert,
-		"shaders/NearDepthUpscale.vert.glsl",
-		pps.toCString(),
-		"r_refl_"));
+		m_r->getWidth() / FS_FRACTION,
+		m_r->getHeight() / FS_FRACTION);
+
+	ANKI_CHECK(getResourceManager().loadResourceToCache(
+		m_frag, "shaders/NearDepthUpscale.frag.glsl", pps.toCString(), "r_"));
+
+	ANKI_CHECK(getResourceManager().loadResourceToCache(
+		m_vert, "shaders/NearDepthUpscale.vert.glsl", pps.toCString(), "r_"));
 
 
 	// Ppline
 	// Ppline
 	PipelineInitInfo ppinit;
 	PipelineInitInfo ppinit;