summaryrefslogtreecommitdiffstats
path: root/tools/render-test/main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-05-04 12:00:53 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2018-05-04 09:00:53 -0700
commitee47232fc17f31ef2bd95ca480372216a79def56 (patch)
tree75d1fdd76e2ed4e081699aaae8b6df819f181260 /tools/render-test/main.cpp
parent494330d4941ccaf50e07ef309fd783c2f44a492e (diff)
Use Surface for screen capture in Renderer interface (#551)
* Remove serialization of screen captures from a renderer implementation, capture now writes to a Surface. Then client code can decide to serialize (or use as needed). * Improved comment for captureScreenSurface.
Diffstat (limited to 'tools/render-test/main.cpp')
-rw-r--r--tools/render-test/main.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/render-test/main.cpp b/tools/render-test/main.cpp
index df9220b58..adcad42a7 100644
--- a/tools/render-test/main.cpp
+++ b/tools/render-test/main.cpp
@@ -8,6 +8,8 @@
#include "render-vk.h"
#include "slang-support.h"
+#include "surface.h"
+#include "png-serialize-util.h"
#include "shader-renderer-util.h"
@@ -68,6 +70,8 @@ class RenderTestApp
Result writeBindingOutput(const char* fileName);
+ Result writeScreen(const char* filename);
+
protected:
/// Called in initialize
Result initializeShaders(ShaderCompiler* shaderCompiler);
@@ -312,6 +316,14 @@ Result RenderTestApp::writeBindingOutput(const char* fileName)
return SLANG_OK;
}
+
+Result RenderTestApp::writeScreen(const char* filename)
+{
+ Surface surface;
+ SLANG_RETURN_ON_FAIL(m_renderer->captureScreenSurface(surface));
+ return PngSerializeUtil::write(filename, surface);
+}
+
//
// We use a bare-minimum window procedure to get things up and running.
//
@@ -504,7 +516,8 @@ SlangResult innerMain(int argc, char** argv)
}
else
{
- Result res = renderer->captureScreenShot(gOptions.outputPath);
+ Result res = app.writeScreen(gOptions.outputPath);
+
if (SLANG_FAILED(res))
{
fprintf(stderr, "ERROR: failed to write screen capture to file\n");