This commit is contained in:
Bigfoot71 2025-10-27 22:15:30 +01:00
parent cb6ef52f27
commit 152cdf4fff

40
src/external/rlsw.h vendored
View File

@ -1271,6 +1271,15 @@ static inline void sw_framebuffer_read_color8(uint8_t dst[4], const sw_pixel_t *
#endif
}
static inline float sw_framebuffer_read_depth(const sw_pixel_t *src)
{
#if SW_DEPTH_IS_PACKED
return src->depth[0]*SW_DEPTH_SCALE;
#else
return SW_UNPACK_DEPTH(src->depth)*SW_DEPTH_SCALE;
#endif
}
static inline void sw_framebuffer_write_color(sw_pixel_t *dst, const float src[4])
{
#if SW_COLOR_IS_PACKED
@ -1280,6 +1289,17 @@ static inline void sw_framebuffer_write_color(sw_pixel_t *dst, const float src[4
#endif
}
static inline void sw_framebuffer_write_depth(sw_pixel_t *dst, float depth)
{
#if SW_DEPTH_IS_PACKED
dst->depth[0] = SW_PACK_DEPTH(depth);
#else
dst->depth[0] = SW_PACK_DEPTH_0(depth);
dst->depth[1] = SW_PACK_DEPTH_1(depth);
dst->depth[2] = SW_PACK_DEPTH_2(depth);
#endif
}
static inline void sw_framebuffer_fill_color(sw_pixel_t *ptr, int size, const float color[4])
{
#if SW_COLOR_IS_PACKED
@ -1316,26 +1336,6 @@ static inline void sw_framebuffer_fill_color(sw_pixel_t *ptr, int size, const fl
}
}
static inline float sw_framebuffer_read_depth(const sw_pixel_t *src)
{
#if SW_DEPTH_IS_PACKED
return src->depth[0]*SW_DEPTH_SCALE;
#else
return SW_UNPACK_DEPTH(src->depth)*SW_DEPTH_SCALE;
#endif
}
static inline void sw_framebuffer_write_depth(sw_pixel_t *dst, float depth)
{
#if SW_DEPTH_IS_PACKED
dst->depth[0] = SW_PACK_DEPTH(depth);
#else
dst->depth[0] = SW_PACK_DEPTH_0(depth);
dst->depth[1] = SW_PACK_DEPTH_1(depth);
dst->depth[2] = SW_PACK_DEPTH_2(depth);
#endif
}
static inline void sw_framebuffer_fill_depth(sw_pixel_t *ptr, int size, float depth)
{
#if SW_DEPTH_IS_PACKED