renderer: properly pass 10-bit formats to opengl

This commit is contained in:
Vaxry
2023-10-30 15:56:02 +00:00
parent a1924ae435
commit 4b592d0819
7 changed files with 33 additions and 13 deletions

View File

@@ -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;
}