From 1296c7bb55b14db24308f31cacdda7f7a71fc937 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sun, 17 Jan 2021 22:00:49 -0800 Subject: Make `gfx` compile to a DLL. (#1660) * Make `gfx` compile to a DLL. * Fix cuda * Fix cuda build * Bug gl screen capture bug. --- tools/render-test/render-test-main.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tools/render-test/render-test-main.cpp') 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 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); } -- cgit v1.2.3