summaryrefslogtreecommitdiffstats
path: root/tools/render-test/render-test-main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
-rw-r--r--tools/render-test/render-test-main.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 89bb25871..184373f0c 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -4,7 +4,7 @@
#include "options.h"
#include "render.h"
-#include "shader-cursor.h"
+#include "tools/gfx-util/shader-cursor.h"
#include "slang-support.h"
#include "surface.h"
#include "png-serialize-util.h"
@@ -827,8 +827,23 @@ Result ShaderObjectRenderTestApp::writeBindingOutput(BindRoot* bindRoot, const c
Result RenderTestApp::writeScreen(const char* filename)
{
+ size_t rowPitch, bufferSize, pixelSize;
+ List<uint8_t> buffer;
+
+ SLANG_RETURN_ON_FAIL(m_renderer->captureScreenSurface(nullptr, &bufferSize, &rowPitch, &pixelSize));
+ buffer.setCount(bufferSize);
+ SLANG_RETURN_ON_FAIL(
+ m_renderer->captureScreenSurface(buffer.getBuffer(), &bufferSize, &rowPitch, &pixelSize));
+
Surface surface;
- SLANG_RETURN_ON_FAIL(m_renderer->captureScreenSurface(surface));
+ size_t width = rowPitch / pixelSize;
+ size_t height = bufferSize / rowPitch;
+ surface.setUnowned(
+ width,
+ height,
+ gfx::Format::RGBA_Unorm_UInt8,
+ rowPitch,
+ buffer.getBuffer());
return PngSerializeUtil::write(filename, surface);
}