yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Simon KallweitUpdate slang-rhi (#7303)8abaec701

master
608 B29 linesraw
1// png-serialize-util.cpp
2#define _CRT_SECURE_NO_WARNINGS
3
4#include "png-serialize-util.h"
5
6#include <stdio.h>
7#include <stdlib.h>
8
9#define STB_IMAGE_WRITE_IMPLEMENTATION
10#include "stb_image_write.h"
11
12namespace renderer_test
13{
14using namespace Slang;
15
16/* static */ Slang::Result PngSerializeUtil::write(
17    const char* filename,
18    ISlangBlob* pixels,
19    uint32_t width,
20    uint32_t height,
21    uint32_t rowPitch)
22{
23    int stbResult =
24        stbi_write_png(filename, width, height, 4, pixels->getBufferPointer(), rowPitch);
25
26    return stbResult ? SLANG_OK : SLANG_FAIL;
27}
28
29} // namespace renderer_test