summaryrefslogtreecommitdiffstats
path: root/src/common/color.h
diff options
context:
space:
mode:
authorTony Wasserka <neobrainx@gmail.com>2015-05-21 16:51:31 +0200
committerTony Wasserka <neobrainx@gmail.com>2015-07-13 23:54:39 +0200
commit5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e (patch)
treedd61e70261a8f3488344f0ce90df6c5bb67e6c81 /src/common/color.h
parentcitra-qt: Add depth formats to framebuffer viewing widget. (diff)
downloadyuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar.gz
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar.bz2
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar.lz
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar.xz
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.tar.zst
yuzu-5e79706db23a956ea0d6f3e5cc5a57b3a5d86b5e.zip
Diffstat (limited to '')
-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) {
* @param bytes Pointer where to store the encoded value
*/
inline void EncodeD24S8(u32 depth, u8 stencil, u8* bytes) {
- *reinterpret_cast<u32_le*>(bytes) = (stencil << 24) | depth;
+ bytes[0] = depth & 0xFF;
+ bytes[1] = (depth >> 8) & 0xFF;
+ bytes[2] = (depth >> 16) & 0xFF;
+ bytes[3] = stencil;
+}
+
+/**
+ * Encode a 24 bit depth value as D24X8 format (32 bits per pixel with 8 bits unused)
+ * @param depth 24 bit source depth value to encode
+ * @param bytes Pointer where to store the encoded value
+ * @note unused bits will not be modified
+ */
+inline void EncodeD24X8(u32 depth, u8* bytes) {
+ bytes[0] = depth & 0xFF;
+ bytes[1] = (depth >> 8) & 0xFF;
+ bytes[2] = (depth >> 16) & 0xFF;
+}
+
+/**
+ * Encode an 8 bit stencil value as X24S8 format (32 bits per pixel with 24 bits unused)
+ * @param stencil 8 bit source stencil value to encode
+ * @param bytes Pointer where to store the encoded value
+ * @note unused bits will not be modified
+ */
+inline void EncodeX24S8(u8 stencil, u8* bytes) {
+ bytes[3] = stencil;
}
} // namespace