Panagiotis Christopoulos Charitos преди 3 години
родител
ревизия
55c392bd04
променени са 4 файла, в които са добавени 37 реда и са изтрити 27 реда
  1. 7 1
      AnKi/Gr/RenderGraph.cpp
  2. 1 1
      AnKi/Renderer/DepthDownscale.cpp
  3. 28 0
      AnKi/Shaders/Functions.glsl
  4. 1 25
      AnKi/Shaders/VrsSriVisualizeRenderTarget.ankiprog

+ 7 - 1
AnKi/Gr/RenderGraph.cpp

@@ -1460,6 +1460,11 @@ void RenderGraph::getStatistics(RenderGraphStatistics& statistics) const
 #if ANKI_DBG_RENDER_GRAPH
 StringAuto RenderGraph::textureUsageToStr(StackAllocator<U8>& alloc, TextureUsageBit usage)
 {
+	if(!usage)
+	{
+		return StringAuto(alloc, "None");
+	}
+
 	StringListAuto slist(alloc);
 
 #	define ANKI_TEX_USAGE(u) \
@@ -1485,10 +1490,11 @@ StringAuto RenderGraph::textureUsageToStr(StackAllocator<U8>& alloc, TextureUsag
 	ANKI_TEX_USAGE(TRANSFER_DESTINATION);
 	ANKI_TEX_USAGE(GENERATE_MIPMAPS);
 	ANKI_TEX_USAGE(PRESENT);
+	ANKI_TEX_USAGE(FRAMEBUFFER_SHADING_RATE);
 
 	if(!usage)
 	{
-		slist.pushBackSprintf("NONE");
+		slist.pushBackSprintf("?");
 	}
 
 #	undef ANKI_TEX_USAGE

+ 1 - 1
AnKi/Renderer/DepthDownscale.cpp

@@ -348,7 +348,7 @@ void DepthDownscale::runGraphics(U32 mip, RenderPassWorkContext& rgraphCtx)
 
 	cmdb->bindStorageBuffer(0, 2, m_clientBuffer, 0, MAX_PTR_SIZE);
 
-	UVec4 pc((mip != m_mipCount - 1) ? 0 : m_lastMipSize.x());
+	const UVec4 pc((mip != m_mipCount - 1) ? 0 : m_lastMipSize.x());
 	cmdb->setPushConstants(&pc, sizeof(pc));
 
 	const UVec2 size = (m_r->getInternalResolution() / 2) >> mip;

+ 28 - 0
AnKi/Shaders/Functions.glsl

@@ -633,6 +633,34 @@ U32 encodeAndSanitizeVrsRate(UVec2 rate)
 	return encodeVrsRate(rate);
 }
 
+Vec3 visualizeVrsRate(UVec2 rate)
+{
+	if(rate == UVec2(1u))
+	{
+		return Vec3(1.0, 0.0, 0.0);
+	}
+	else if(rate == UVec2(2u, 1u) || rate == UVec2(1u, 2u))
+	{
+		return Vec3(1.0, 0.5, 0.0);
+	}
+	else if(rate == UVec2(2u))
+	{
+		return Vec3(1.0, 1.0, 0.0);
+	}
+	else if(rate == UVec2(4u, 2u) || rate == UVec2(2u, 4u))
+	{
+		return Vec3(0.5, 1.0, 0.0);
+	}
+	else if(rate == UVec2(4u))
+	{
+		return Vec3(0.0, 1.0, 0.0);
+	}
+	else
+	{
+		return Vec3(0.0, 0.0, 0.0);
+	}
+}
+
 /// Decodes a number produced by encodeVrsRate(). Returns the shading rates.
 UVec2 decodeVrsRate(U32 texel)
 {

+ 1 - 25
AnKi/Shaders/VrsSriVisualizeRenderTarget.ankiprog

@@ -20,30 +20,6 @@ void main()
 {
 	const U32 texel = textureLod(u_inTex, u_nearestAnyClampSampler, in_uv, 0.0).x;
 	const UVec2 rate = decodeVrsRate(texel);
-
-	if(rate == UVec2(1u))
-	{
-		out_color = Vec3(1.0, 0.0, 0.0);
-	}
-	else if(rate == UVec2(2u, 1u) || rate == UVec2(1u, 2u))
-	{
-		out_color = Vec3(1.0, 0.5, 0.0);
-	}
-	else if(rate == UVec2(2u))
-	{
-		out_color = Vec3(1.0, 1.0, 0.0);
-	}
-	else if(rate == UVec2(4u, 2u) || rate == UVec2(2u, 4u))
-	{
-		out_color = Vec3(0.5, 1.0, 0.0);
-	}
-	else if(rate == UVec2(4u))
-	{
-		out_color = Vec3(0.0, 1.0, 0.0);
-	}
-	else
-	{
-		out_color = Vec3(0.0, 0.0, 0.0);
-	}
+	out_color = visualizeVrsRate(rate);
 }
 #pragma anki end