Merge "Add depth/stencil formats to ColorBufferGl path" into main
diff --git a/guest/egl/egl.cpp b/guest/egl/egl.cpp
index 95b82f9..1b7193d 100644
--- a/guest/egl/egl.cpp
+++ b/guest/egl/egl.cpp
@@ -2265,6 +2265,11 @@
             case HAL_PIXEL_FORMAT_RGBA_1010102:
             case HAL_PIXEL_FORMAT_YCBCR_420_888:
             case HAL_PIXEL_FORMAT_YCBCR_P010:
+            case HAL_PIXEL_FORMAT_DEPTH_16:
+            case HAL_PIXEL_FORMAT_DEPTH_24:
+            case HAL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
+            case HAL_PIXEL_FORMAT_DEPTH_32F:
+            case HAL_PIXEL_FORMAT_DEPTH_32F_STENCIL_8:
                 break;
             case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
                 ALOGW("%s:%d using HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED\n", __func__, __LINE__);
diff --git a/host/gl/ColorBufferGl.cpp b/host/gl/ColorBufferGl.cpp
index d0129b2..213de8a 100644
--- a/host/gl/ColorBufferGl.cpp
+++ b/host/gl/ColorBufferGl.cpp
@@ -203,6 +203,38 @@
             *bytesPerPixel = 2;
             *sizedInternalFormat = GL_RG8;
             return true;
+        case GL_DEPTH_COMPONENT:
+        case GL_DEPTH_COMPONENT16:
+            *texFormat = GL_DEPTH_COMPONENT;
+            *pixelType = GL_UNSIGNED_SHORT;
+            *bytesPerPixel = 2;
+            *sizedInternalFormat = GL_DEPTH_COMPONENT16;
+            return true;
+        case GL_DEPTH_COMPONENT24:
+            *texFormat = GL_DEPTH_COMPONENT;
+            *pixelType = GL_UNSIGNED_INT;
+            *bytesPerPixel = 4;
+            *sizedInternalFormat = GL_DEPTH_COMPONENT24;
+            return true;
+        case GL_DEPTH_COMPONENT32F:
+            *texFormat = GL_DEPTH_COMPONENT;
+            *pixelType = GL_FLOAT;
+            *bytesPerPixel = 4;
+            *sizedInternalFormat = GL_DEPTH_COMPONENT32F;
+            return true;
+        case GL_DEPTH_STENCIL:
+        case GL_DEPTH24_STENCIL8:
+            *texFormat = GL_DEPTH_STENCIL;
+            *pixelType = GL_UNSIGNED_INT_24_8;
+            *bytesPerPixel = 4;
+            *sizedInternalFormat = GL_DEPTH24_STENCIL8;
+            return true;
+        case GL_DEPTH32F_STENCIL8:
+            *texFormat = GL_DEPTH_STENCIL;
+            *pixelType = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
+            *bytesPerPixel = 8;
+            *sizedInternalFormat = GL_DEPTH32F_STENCIL8;
+            return true;
         default:
             fprintf(stderr, "%s: Unknown format 0x%x\n", __func__,
                     *internalFormat);