diff options
| author | Yong He <yonghe@outlook.com> | 2021-03-04 16:25:58 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 16:25:58 -0800 |
| commit | a5ac4999b4dea546a7ef824669ab1809224b6448 (patch) | |
| tree | 15bb22eb98a94f7f81489deef55396461501d3dc /tools/render-test/png-serialize-util.cpp | |
| parent | 13ff0bd345990c0fdfb7b52ebd5339cddb04889e (diff) | |
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 <yhe@nvidia.com>
Diffstat (limited to 'tools/render-test/png-serialize-util.cpp')
| -rw-r--r-- | tools/render-test/png-serialize-util.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
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; } |
