From a5ac4999b4dea546a7ef824669ab1809224b6448 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 4 Mar 2021 16:25:58 -0800 Subject: Refactor `gfx` to surface `CommandBuffer` interface. (#1735) * Refactor `gfx` to surface `CommandBuffer` interface. * Fixes. * Fix code review issues, and make vulkan runnable on devices without VK_EXT_extended_dynamic_states. * Update solution files * Move out-of-date examples to examples/experimental Co-authored-by: Yong He --- tools/render-test/png-serialize-util.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'tools/render-test/png-serialize-util.cpp') diff --git a/tools/render-test/png-serialize-util.cpp b/tools/render-test/png-serialize-util.cpp index a7f6aa83a..dc1a9f241 100644 --- a/tools/render-test/png-serialize-util.cpp +++ b/tools/render-test/png-serialize-util.cpp @@ -12,25 +12,14 @@ namespace renderer_test { using namespace Slang; -/* static */Slang::Result PngSerializeUtil::write(const char* filename, const Surface& surface) +/* static */ Slang::Result PngSerializeUtil::write( + const char* filename, + ISlangBlob* pixels, + uint32_t width, + uint32_t height) { - int numComps = 0; - switch (surface.m_format) - { - case Format::RGBA_Unorm_UInt8: - { - numComps = 4; - break; - } - default: break; - } - - if (numComps <= 0) - { - return SLANG_FAIL; - } - - int stbResult = stbi_write_png(filename, surface.m_width, surface.m_height, numComps, surface.m_data, surface.m_rowStrideInBytes); + int stbResult = + stbi_write_png(filename, width, height, 4, pixels->getBufferPointer(), width * 4); return stbResult ? SLANG_OK : SLANG_FAIL; } -- cgit v1.2.3