Commit b3c0c739 by Nicolas Capens

Set the EGL_NATIVE_VISUAL_ID attribute for Android HAL formats.

Bug 25390254 Change-Id: I6ac37912435e2c73f5e905db7c78af7884f0c93c Reviewed-on: https://swiftshader-review.googlesource.com/4187Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 5716cf03
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include "common/debug.h" #include "common/debug.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
#ifdef __ANDROID__
#include <system/graphics.h>
#endif
#include <string.h> #include <string.h>
#include <algorithm> #include <algorithm>
...@@ -33,6 +36,8 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -33,6 +36,8 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mBindToTextureRGB = EGL_FALSE; mBindToTextureRGB = EGL_FALSE;
mBindToTextureRGBA = EGL_FALSE; mBindToTextureRGBA = EGL_FALSE;
mNativeVisualID = 0;
switch(renderTargetFormat) switch(renderTargetFormat)
{ {
case sw::FORMAT_A1R5G5B5: case sw::FORMAT_A1R5G5B5:
...@@ -53,6 +58,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -53,6 +58,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mBlueSize = 8; mBlueSize = 8;
mAlphaSize = 8; mAlphaSize = 8;
mBindToTextureRGBA = EGL_TRUE; mBindToTextureRGBA = EGL_TRUE;
#ifdef __ANDROID__
mNativeVisualID = HAL_PIXEL_FORMAT_BGRA_8888;
#endif
break; break;
case sw::FORMAT_A8B8G8R8: case sw::FORMAT_A8B8G8R8:
mRedSize = 8; mRedSize = 8;
...@@ -60,12 +68,18 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -60,12 +68,18 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mBlueSize = 8; mBlueSize = 8;
mAlphaSize = 8; mAlphaSize = 8;
mBindToTextureRGBA = EGL_TRUE; mBindToTextureRGBA = EGL_TRUE;
#ifdef __ANDROID__
mNativeVisualID = HAL_PIXEL_FORMAT_RGBA_8888;
#endif
break; break;
case sw::FORMAT_R5G6B5: case sw::FORMAT_R5G6B5:
mRedSize = 5; mRedSize = 5;
mGreenSize = 6; mGreenSize = 6;
mBlueSize = 5; mBlueSize = 5;
mAlphaSize = 0; mAlphaSize = 0;
#ifdef __ANDROID__
mNativeVisualID = HAL_PIXEL_FORMAT_RGB_565;
#endif
break; break;
case sw::FORMAT_X8R8G8B8: case sw::FORMAT_X8R8G8B8:
mRedSize = 8; mRedSize = 8;
...@@ -73,6 +87,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -73,6 +87,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mBlueSize = 8; mBlueSize = 8;
mAlphaSize = 0; mAlphaSize = 0;
mBindToTextureRGB = EGL_TRUE; mBindToTextureRGB = EGL_TRUE;
#ifdef __ANDROID__
mNativeVisualID = HAL_PIXEL_FORMAT_BGRA_8888;
#endif
break; break;
case sw::FORMAT_X8B8G8R8: case sw::FORMAT_X8B8G8R8:
mRedSize = 8; mRedSize = 8;
...@@ -80,6 +97,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -80,6 +97,9 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mBlueSize = 8; mBlueSize = 8;
mAlphaSize = 0; mAlphaSize = 0;
mBindToTextureRGBA = EGL_TRUE; mBindToTextureRGBA = EGL_TRUE;
#ifdef __ANDROID__
mNativeVisualID = HAL_PIXEL_FORMAT_RGBX_8888;
#endif
break; break;
default: default:
UNREACHABLE(renderTargetFormat); // Other formats should not be valid UNREACHABLE(renderTargetFormat); // Other formats should not be valid
...@@ -151,7 +171,6 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, ...@@ -151,7 +171,6 @@ Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval,
mMaxSwapInterval = maxInterval; mMaxSwapInterval = maxInterval;
mMinSwapInterval = minInterval; mMinSwapInterval = minInterval;
mNativeRenderable = EGL_FALSE; mNativeRenderable = EGL_FALSE;
mNativeVisualID = 0;
mNativeVisualType = 0; mNativeVisualType = 0;
mRenderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT mRenderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT
#ifndef __ANDROID__ // Do not allow GLES 3.0 on Android #ifndef __ANDROID__ // Do not allow GLES 3.0 on Android
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment