diff options
| author | Yong He <yonghe@outlook.com> | 2021-01-17 22:00:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-17 22:00:49 -0800 |
| commit | 1296c7bb55b14db24308f31cacdda7f7a71fc937 (patch) | |
| tree | 935ebf1e829361a17f98f5ead3460998719acf42 /tools/render-test/render-test-main.cpp | |
| parent | 2a5d5b32348c33aac7ca62aa9a4c2bb7cff8e08a (diff) | |
Make `gfx` compile to a DLL. (#1660)
* Make `gfx` compile to a DLL.
* Fix cuda
* Fix cuda build
* Bug gl screen capture bug.
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
| -rw-r--r-- | tools/render-test/render-test-main.cpp | 19 |
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); } |
