summaryrefslogtreecommitdiff
path: root/src/helpers/MiscFunctions.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-10-30 15:56:02 +0000
committerVaxry <vaxry@vaxry.net>2023-10-30 15:56:16 +0000
commit4b592d0819e2f4563d59e6cbb2c3c236ec8f23af (patch)
tree0224cb3f7e1ff4c72c2030d103af35500bc9aed4 /src/helpers/MiscFunctions.cpp
parenta1924ae4356657a06e43e740f1cf2e1634fa958d (diff)
renderer: properly pass 10-bit formats to opengl
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
-rw-r--r--src/helpers/MiscFunctions.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 3cce73d2..acb9cf20 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -750,4 +750,16 @@ std::vector<SCallstackFrameInfo> getBacktrace() {
void throwError(const std::string& err) {
Debug::log(CRIT, "Critical error thrown: {}", err);
throw std::runtime_error(err);
+}
+
+uint32_t drmFormatToGL(uint32_t drm) {
+ switch (drm) {
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888: return GL_RGBA; // doesn't matter, opengl is gucci in this case.
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XBGR2101010: return GL_RGB10_A2;
+ default: return GL_RGBA;
+ }
+ UNREACHABLE();
+ return GL_RGBA;
} \ No newline at end of file