From d1f47afd964a676fe34147dc1e5bc73b0035f32c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 15 Feb 2021 02:26:20 +0100 Subject: [PATCH] Add debug code for showing the render slices --- src/rendering/swrenderer/scene/r_scene.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/rendering/swrenderer/scene/r_scene.cpp b/src/rendering/swrenderer/scene/r_scene.cpp index 3f1d85898..d419fea3e 100644 --- a/src/rendering/swrenderer/scene/r_scene.cpp +++ b/src/rendering/swrenderer/scene/r_scene.cpp @@ -292,6 +292,38 @@ namespace swrenderer thread->TranslucentPass->Render(); } + +#if 0 // shows the render slice edges + if (thread->Viewport->RenderTarget->IsBgra()) + { + uint32_t* left = (uint32_t*)thread->Viewport->GetDest(thread->X1, 0); + uint32_t* right = (uint32_t*)thread->Viewport->GetDest(thread->X2 - 1, 0); + int pitch = thread->Viewport->RenderTarget->GetPitch(); + uint32_t c = MAKEARGB(255, 0, 0, 0); + for (int i = 0; i < viewheight; i++) + { + *left = c; + *right = c; + left += pitch; + right += pitch; + } + } + else + { + uint8_t* left = (uint8_t*)thread->Viewport->GetDest(thread->X1, 0); + uint8_t* right = (uint8_t*)thread->Viewport->GetDest(thread->X2 - 1, 0); + int pitch = thread->Viewport->RenderTarget->GetPitch(); + int r = 0, g = 0, b = 0; + uint8_t c = RGB32k.RGB[(r >> 3)][(g >> 3)][(b >> 3)]; + for (int i = 0; i < viewheight; i++) + { + *left = c; + *right = c; + left += pitch; + right += pitch; + } + } +#endif } void RenderScene::StartThreads(size_t numThreads)