summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/color.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/common/color.h b/src/common/color.h
index 422fdc8af..9dafdca0c 100644
--- a/src/common/color.h
+++ b/src/common/color.h
@@ -208,7 +208,32 @@ inline void EncodeD24(u32 value, u8* bytes) {
208 * @param bytes Pointer where to store the encoded value 208 * @param bytes Pointer where to store the encoded value
209 */ 209 */
210inline void EncodeD24S8(u32 depth, u8 stencil, u8* bytes) { 210inline void EncodeD24S8(u32 depth, u8 stencil, u8* bytes) {
211 *reinterpret_cast<u32_le*>(bytes) = (stencil << 24) | depth; 211 bytes[0] = depth & 0xFF;
212 bytes[1] = (depth >> 8) & 0xFF;
213 bytes[2] = (depth >> 16) & 0xFF;
214 bytes[3] = stencil;
215}
216
217/**
218 * Encode a 24 bit depth value as D24X8 format (32 bits per pixel with 8 bits unused)
219 * @param depth 24 bit source depth value to encode
220 * @param bytes Pointer where to store the encoded value
221 * @note unused bits will not be modified
222 */
223inline void EncodeD24X8(u32 depth, u8* bytes) {
224 bytes[0] = depth & 0xFF;
225 bytes[1] = (depth >> 8) & 0xFF;
226 bytes[2] = (depth >> 16) & 0xFF;
227}
228
229/**
230 * Encode an 8 bit stencil value as X24S8 format (32 bits per pixel with 24 bits unused)
231 * @param stencil 8 bit source stencil value to encode
232 * @param bytes Pointer where to store the encoded value
233 * @note unused bits will not be modified
234 */
235inline void EncodeX24S8(u8 stencil, u8* bytes) {
236 bytes[3] = stencil;
212} 237}
213 238
214} // namespace 239} // namespace