aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guest/platform/rutabaga/RutabagaLayer.cpp5
-rw-r--r--host/ColorBuffer.cpp1
-rw-r--r--host/FrameBuffer.cpp10
-rw-r--r--host/NativeSubWindow.h3
-rw-r--r--host/NativeSubWindow_android.cpp3
-rw-r--r--host/NativeSubWindow_cocoa.m3
-rw-r--r--host/NativeSubWindow_qnx.cpp2
-rw-r--r--host/NativeSubWindow_stub.cpp2
-rw-r--r--host/NativeSubWindow_win32.cpp18
-rw-r--r--host/NativeSubWindow_x11.cpp16
-rw-r--r--host/gl/EmulationGl.cpp5
-rw-r--r--host/gl/OpenGLESDispatch/render_egl_extensions.entries1
-rw-r--r--host/gl/glestranslator/EGL/EglDisplay.cpp8
-rw-r--r--host/gl/glestranslator/EGL/EglDisplay.h4
-rw-r--r--host/gl/glestranslator/EGL/EglImp.cpp13
-rw-r--r--host/gl/glestranslator/GLES_CM/GLEScmContext.cpp6
-rw-r--r--host/gl/glestranslator/GLES_CM/GLEScmContext.h2
-rw-r--r--host/gl/glestranslator/GLES_CM/GLEScmImp.cpp6
-rw-r--r--host/gl/glestranslator/GLES_V2/GLESv2Context.cpp9
-rw-r--r--host/gl/glestranslator/GLES_V2/GLESv2Context.h2
-rw-r--r--host/gl/glestranslator/GLES_V2/GLESv2Imp.cpp8
-rw-r--r--host/gl/glestranslator/GLES_V2/GLESv30Imp.cpp34
-rw-r--r--host/gl/glestranslator/GLcommon/GLEScontext.cpp9
-rw-r--r--host/gl/glestranslator/include/GLcommon/GLEScontext.h6
-rw-r--r--host/gl/glestranslator/include/GLcommon/TranslatorIfaces.h2
-rw-r--r--include/OpenGLESDispatch/RenderEGL_extensions_functions.h3
-rw-r--r--include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h3
27 files changed, 130 insertions, 54 deletions
diff --git a/guest/platform/rutabaga/RutabagaLayer.cpp b/guest/platform/rutabaga/RutabagaLayer.cpp
index bd854cd7..eee5f10b 100644
--- a/guest/platform/rutabaga/RutabagaLayer.cpp
+++ b/guest/platform/rutabaga/RutabagaLayer.cpp
@@ -18,6 +18,7 @@
#include <inttypes.h>
#include <log/log.h>
+#include <string.h>
#include <algorithm>
#include <cstdlib>
@@ -381,7 +382,7 @@ bool EmulatedVirtioGpu::EmulatedVirtioGpuImpl::GetCaps(uint32_t capsetId, uint32
auto capsetData = mCapsets[capsetId];
auto copySize = std::min(static_cast<size_t>(guestCapsSize), capsetData.size());
- std::memcpy(capset, capsetData.data(), copySize);
+ memcpy(capset, capsetData.data(), copySize);
return true;
}
@@ -1009,7 +1010,7 @@ std::shared_ptr<EmulatedVirtioGpu> EmulatedVirtioGpu::Get() {
{"GFXSTREAM_EMULATED_VIRTIO_GPU_WITH_VK", &withVk},
{"GFXSTREAM_EMULATED_VIRTIO_GPU_WITH_VK_SNAPSHOTS", &withVkSnapshots},
};
- for (const Option option : options) {
+ for (const Option &option : options) {
const char* val = std::getenv(option.env.c_str());
if (val != nullptr && (val[0] == 'Y' || val[0] == 'y')) {
*option.val = true;
diff --git a/host/ColorBuffer.cpp b/host/ColorBuffer.cpp
index 3cdecbfb..2a9bcd19 100644
--- a/host/ColorBuffer.cpp
+++ b/host/ColorBuffer.cpp
@@ -99,7 +99,6 @@ std::shared_ptr<ColorBuffer> ColorBuffer::create(gl::EmulationGl* emulationGl,
colorBuffer->mGlAndVkAreSharingExternalMemory = true;
} else {
ERR("Failed to import memory to ColorBufferGl:%d", handle);
- return nullptr;
}
}
}
diff --git a/host/FrameBuffer.cpp b/host/FrameBuffer.cpp
index 54f78b98..61a35097 100644
--- a/host/FrameBuffer.cpp
+++ b/host/FrameBuffer.cpp
@@ -937,11 +937,11 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
if (m_displayVk) {
m_displaySurface =
- vk::createDisplaySurface(m_subWin, m_windowWidth, m_windowHeight);
+ vk::createDisplaySurface(m_subWin, m_windowWidth * dpr, m_windowHeight * dpr);
} else if (m_emulationGl) {
#if GFXSTREAM_ENABLE_HOST_GLES
- m_displaySurface = m_emulationGl->createWindowSurface(m_windowWidth,
- m_windowHeight,
+ m_displaySurface = m_emulationGl->createWindowSurface(m_windowWidth * dpr,
+ m_windowHeight * dpr,
m_subWin);
#endif
} else {
@@ -1004,9 +1004,9 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
{
auto watchdog = WATCHDOG_BUILDER(m_healthMonitor.get(), "Moving subwindow").build();
success = moveSubWindow(m_nativeWindow, m_subWin, m_x, m_y, m_windowWidth,
- m_windowHeight);
+ m_windowHeight, dpr);
}
- m_displaySurface->updateSize(m_windowWidth, m_windowHeight);
+ m_displaySurface->updateSize(m_windowWidth * dpr, m_windowHeight * dpr);
}
// We are safe to unblock the PostWorker thread now, because we have completed all the
// operations that could modify the state of the m_subWin. We need to unblock the PostWorker
diff --git a/host/NativeSubWindow.h b/host/NativeSubWindow.h
index aff117c7..af79e07f 100644
--- a/host/NativeSubWindow.h
+++ b/host/NativeSubWindow.h
@@ -67,7 +67,8 @@ int moveSubWindow(FBNativeWindowType p_parent_window,
int x,
int y,
int width,
- int height);
+ int height,
+ float dpr);
#ifdef __cplusplus
}
diff --git a/host/NativeSubWindow_android.cpp b/host/NativeSubWindow_android.cpp
index ec661548..12f148fd 100644
--- a/host/NativeSubWindow_android.cpp
+++ b/host/NativeSubWindow_android.cpp
@@ -41,7 +41,8 @@ int moveSubWindow(FBNativeWindowType p_parent_window,
int x,
int y,
int width,
- int height) {
+ int height,
+ float dpr) {
// moving windows not supported in Android; we can't create an actual sub window
return true;
}
diff --git a/host/NativeSubWindow_cocoa.m b/host/NativeSubWindow_cocoa.m
index 2b764fca..ac2c797d 100644
--- a/host/NativeSubWindow_cocoa.m
+++ b/host/NativeSubWindow_cocoa.m
@@ -111,7 +111,8 @@ int moveSubWindow(FBNativeWindowType p_parent_window,
int x,
int y,
int width,
- int height) {
+ int height,
+ float dpr) {
NSWindow *win = (NSWindow *)p_parent_window;
if (!win) {
return 0;
diff --git a/host/NativeSubWindow_qnx.cpp b/host/NativeSubWindow_qnx.cpp
index f983d324..12128634 100644
--- a/host/NativeSubWindow_qnx.cpp
+++ b/host/NativeSubWindow_qnx.cpp
@@ -116,7 +116,7 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window, int x, int y, i
void destroySubWindow(EGLNativeWindowType win) { screen_destroy_window(win); }
int moveSubWindow(FBNativeWindowType p_parent_window, EGLNativeWindowType p_sub_window, int x,
- int y, int width, int height) {
+ int y, int width, int height, float dpr) {
int pos[2] = {x, y};
if (screen_set_window_property_iv(p_sub_window, SCREEN_PROPERTY_POSITION, pos)) {
return 0;
diff --git a/host/NativeSubWindow_stub.cpp b/host/NativeSubWindow_stub.cpp
index 75a1ea85..b413a312 100644
--- a/host/NativeSubWindow_stub.cpp
+++ b/host/NativeSubWindow_stub.cpp
@@ -27,6 +27,6 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window, int x, int y, i
void destroySubWindow(EGLNativeWindowType win) { return; }
int moveSubWindow(FBNativeWindowType p_parent_window, EGLNativeWindowType p_sub_window, int x,
- int y, int width, int height) {
+ int y, int width, int height, float dpr) {
return 0;
}
diff --git a/host/NativeSubWindow_win32.cpp b/host/NativeSubWindow_win32.cpp
index a5d7a1b6..26ff662b 100644
--- a/host/NativeSubWindow_win32.cpp
+++ b/host/NativeSubWindow_win32.cpp
@@ -15,6 +15,7 @@
*/
#include "NativeSubWindow.h"
+#include <stdio.h>
struct SubWindowUserData {
SubWindowRepaintCallback repaint_callback;
void* repaint_callback_param;
@@ -50,6 +51,12 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
RegisterClassA(&wc);
}
+ // We assume size/pos are passed in as logical size/coordinates. Convert it to pixel
+ // coordinates.
+ x *= dpr;
+ y *= dpr;
+ width *= dpr;
+ height *= dpr;
EGLNativeWindowType ret = CreateWindowExA(
WS_EX_NOPARENTNOTIFY, // do not bother our parent window
className,
@@ -80,12 +87,13 @@ int moveSubWindow(FBNativeWindowType p_parent_window,
int x,
int y,
int width,
- int height) {
+ int height,
+ float dpr) {
BOOL ret = MoveWindow(p_sub_window,
- x,
- y,
- width,
- height,
+ x * dpr,
+ y * dpr,
+ width * dpr,
+ height * dpr,
TRUE);
return ret;
}
diff --git a/host/NativeSubWindow_x11.cpp b/host/NativeSubWindow_x11.cpp
index 58f96fd3..d660b3a8 100644
--- a/host/NativeSubWindow_x11.cpp
+++ b/host/NativeSubWindow_x11.cpp
@@ -59,10 +59,10 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
wa.override_redirect = True;
Window win = x11->XCreateWindow(s_display,
p_window,
- x,
- y,
- width,
- height,
+ x * dpr,
+ y * dpr,
+ width * dpr,
+ height * dpr,
0,
CopyFromParent,
CopyFromParent,
@@ -91,13 +91,19 @@ int moveSubWindow(FBNativeWindowType p_parent_window,
int x,
int y,
int width,
- int height) {
+ int height,
+ float dpr) {
// This value is set during create, so if it is still null, simply
// return because the global state is corrupted
if (!s_display) {
return false;
}
+ x *= dpr;
+ y *= dpr;
+ width *= dpr;
+ height *= dpr;
+
auto x11 = getX11Api();
// Make sure something has changed, otherwise XIfEvent will block and
diff --git a/host/gl/EmulationGl.cpp b/host/gl/EmulationGl.cpp
index 5514f4cb..7ac056c1 100644
--- a/host/gl/EmulationGl.cpp
+++ b/host/gl/EmulationGl.cpp
@@ -242,6 +242,11 @@ std::unique_ptr<EmulationGl> EmulationGl::create(uint32_t width, uint32_t height
return nullptr;
}
+ if (s_egl.eglSetNativeTextureDecompressionEnabledANDROID) {
+ s_egl.eglSetNativeTextureDecompressionEnabledANDROID(
+ emulationGl->mEglDisplay, feature_is_enabled(kFeature_NativeTextureDecompression));
+ }
+
s_egl.eglBindAPI(EGL_OPENGL_ES_API);
#ifdef ENABLE_GL_LOG
diff --git a/host/gl/OpenGLESDispatch/render_egl_extensions.entries b/host/gl/OpenGLESDispatch/render_egl_extensions.entries
index 8c4c303d..d9d46d01 100644
--- a/host/gl/OpenGLESDispatch/render_egl_extensions.entries
+++ b/host/gl/OpenGLESDispatch/render_egl_extensions.entries
@@ -27,3 +27,4 @@ EGLImage eglGetNativeImageANDROID(EGLDisplay display, EGLImage image);
EGLBoolean eglSetImageInfoANDROID(EGLDisplay display, EGLImage image, EGLint width, EGLint height, EGLint internalformat);
EGLImage eglImportImageANDROID(EGLDisplay display, EGLImage image);
EGLint eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const EGLAttrib * attrib_list);
+EGLBoolean eglSetNativeTextureDecompressionEnabledANDROID(EGLDisplay display, EGLBoolean enabled);
diff --git a/host/gl/glestranslator/EGL/EglDisplay.cpp b/host/gl/glestranslator/EGL/EglDisplay.cpp
index 68c953b6..f601315d 100644
--- a/host/gl/glestranslator/EGL/EglDisplay.cpp
+++ b/host/gl/glestranslator/EGL/EglDisplay.cpp
@@ -702,3 +702,11 @@ void EglDisplay::onLoadAllImages(android::base::Stream* stream,
void EglDisplay::postLoadAllImages(android::base::Stream* stream) {
m_globalNameSpace.postLoad(stream);
}
+
+bool EglDisplay::nativeTextureDecompressionEnabled() const {
+ return m_nativeTextureDecompressionEnabled;
+}
+
+void EglDisplay::setNativeTextureDecompressionEnabled(bool enabled) {
+ m_nativeTextureDecompressionEnabled = enabled;
+} \ No newline at end of file
diff --git a/host/gl/glestranslator/EGL/EglDisplay.h b/host/gl/glestranslator/EGL/EglDisplay.h
index 177413fd..d26ec9aa 100644
--- a/host/gl/glestranslator/EGL/EglDisplay.h
+++ b/host/gl/glestranslator/EGL/EglDisplay.h
@@ -149,6 +149,9 @@ public:
SaveableTexture::creator_t creator);
void postLoadAllImages(android::base::Stream* stream);
+ bool nativeTextureDecompressionEnabled() const;
+ void setNativeTextureDecompressionEnabled(bool enabled);
+
private:
static void addConfig(void* opaque, const EglOS::ConfigInfo* configInfo);
@@ -171,6 +174,7 @@ private:
unsigned int m_nextEglImageId = 0;
mutable std::shared_ptr<EglOS::Context> m_globalSharedContext;
ConfigSet m_uniqueConfigs;
+ bool m_nativeTextureDecompressionEnabled = false;
};
#endif
diff --git a/host/gl/glestranslator/EGL/EglImp.cpp b/host/gl/glestranslator/EGL/EglImp.cpp
index c5de1e5e..3095f471 100644
--- a/host/gl/glestranslator/EGL/EglImp.cpp
+++ b/host/gl/glestranslator/EGL/EglImp.cpp
@@ -130,6 +130,7 @@ EGLAPI void EGLAPIENTRY eglWaitImageFenceANDROID(EGLDisplay display, void* fence
EGLAPI void EGLAPIENTRY eglAddLibrarySearchPathANDROID(const char* path);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryVulkanInteropSupportANDROID(void);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay display, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetNativeTextureDecompressionEnabledANDROID(EGLDisplay display, EGLBoolean enabled);
EGLAPI EGLBoolean EGLAPIENTRY eglSaveConfig(EGLDisplay display, EGLConfig config, EGLStreamKHR stream);
EGLAPI EGLConfig EGLAPIENTRY eglLoadConfig(EGLDisplay display, EGLStreamKHR stream);
@@ -191,6 +192,8 @@ static const ExtensionDescriptor s_eglExtensions[] = {
(__eglMustCastToProperFunctionPointerType)eglQueryVulkanInteropSupportANDROID },
{"eglGetSyncAttribKHR",
(__eglMustCastToProperFunctionPointerType)eglGetSyncAttribKHR },
+ {"eglSetNativeTextureDecompressionEnabledANDROID",
+ (__eglMustCastToProperFunctionPointerType)eglSetNativeTextureDecompressionEnabledANDROID },
};
static const int s_eglExtensionsSize =
@@ -1176,7 +1179,8 @@ EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay display,
thread->updateInfo(newCtx,dpy,newCtx->getGlesContext(),newCtx->getShareGroup(),dpy->getManager(newCtx->version()));
newCtx->setSurfaces(newReadSrfc,newDrawSrfc);
- g_eglInfo->getIface(newCtx->version())->initContext(newCtx->getGlesContext(),newCtx->getShareGroup());
+ g_eglInfo->getIface(newCtx->version())->initContext(newCtx->getGlesContext(), newCtx->getShareGroup(),
+ dpy->nativeTextureDecompressionEnabled());
g_eglInfo->sweepDestroySurfaces();
}
@@ -1654,6 +1658,13 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryVulkanInteropSupportANDROID(void) {
return iface->vulkanInteropSupported() ? EGL_TRUE : EGL_FALSE;
}
+EGLAPI EGLBoolean EGLAPIENTRY eglSetNativeTextureDecompressionEnabledANDROID(EGLDisplay display, EGLBoolean enabled) {
+ MEM_TRACE("EMUGL");
+ VALIDATE_DISPLAY_RETURN(display, EGL_FALSE);
+ dpy->setNativeTextureDecompressionEnabled(enabled == EGL_TRUE);
+ return EGL_TRUE;
+}
+
/*********************************************************************************/
EGLAPI EGLBoolean EGLAPIENTRY eglPreSaveContext(EGLDisplay display, EGLContext contex, EGLStreamKHR stream) {
diff --git a/host/gl/glestranslator/GLES_CM/GLEScmContext.cpp b/host/gl/glestranslator/GLES_CM/GLEScmContext.cpp
index 1797540f..4e39f98e 100644
--- a/host/gl/glestranslator/GLES_CM/GLEScmContext.cpp
+++ b/host/gl/glestranslator/GLES_CM/GLEScmContext.cpp
@@ -39,10 +39,10 @@ void GLEScmContext::setMaxGlesVersion(GLESVersion version) {
s_maxGlesVersion = version;
}
-void GLEScmContext::init() {
+void GLEScmContext::init(bool nativeTextureDecompressionEnabled) {
android::base::AutoLock mutex(s_lock);
if(!m_initialized) {
- GLEScontext::init();
+ GLEScontext::init(nativeTextureDecompressionEnabled);
addVertexArrayObject(0);
setVertexArrayObject(0);
@@ -719,7 +719,7 @@ const GLESpointer* GLEScmContext::getPointer(GLenum arrType) {
void GLEScmContext::initExtensionString() {
if (s_glExtensionsGles1Initialized) return;
initCapsLocked((const GLubyte*)getHostExtensionsString(&s_glDispatch).c_str(),
- s_glSupportGles1);
+ m_nativeTextureDecompressionEnabled, s_glSupportGles1);
*s_glExtensionsGles1 = "GL_OES_blend_func_separate GL_OES_blend_equation_separate GL_OES_blend_subtract "
"GL_OES_byte_coordinates GL_OES_compressed_paletted_texture GL_OES_point_size_array "
"GL_OES_point_sprite GL_OES_single_precision GL_OES_stencil_wrap GL_OES_texture_env_crossbar "
diff --git a/host/gl/glestranslator/GLES_CM/GLEScmContext.h b/host/gl/glestranslator/GLES_CM/GLEScmContext.h
index b5184ab2..f7227a92 100644
--- a/host/gl/glestranslator/GLES_CM/GLEScmContext.h
+++ b/host/gl/glestranslator/GLES_CM/GLEScmContext.h
@@ -37,7 +37,7 @@ class CoreProfileEngine;
class GLEScmContext: public GLEScontext
{
public:
- virtual void init() override;
+ virtual void init(bool nativeTextureDecompressionEnabled) override;
virtual const GLSupport* getCaps() const override { return &(GLEScontext::s_glSupportGles1); }
static void initGlobal(EGLiface* eglIface);
GLEScmContext(int maj, int min, GlobalNameSpace* globalNameSpace,
diff --git a/host/gl/glestranslator/GLES_CM/GLEScmImp.cpp b/host/gl/glestranslator/GLES_CM/GLEScmImp.cpp
index dec84813..a1f5a20b 100644
--- a/host/gl/glestranslator/GLES_CM/GLEScmImp.cpp
+++ b/host/gl/glestranslator/GLES_CM/GLEScmImp.cpp
@@ -64,7 +64,7 @@ extern "C" {
//decleration
static void initGLESx(bool isGles2Gles);
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp);
+static void initContext(GLEScontext* ctx, ShareGroupPtr grp, bool nativeTextureDecompressionEnabled);
static void setMaxGlesVersion(GLESVersion version);
static void deleteGLESContext(GLEScontext* ctx);
static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
@@ -203,7 +203,7 @@ static void initGLESx(bool isGles2Gles) {
return;
}
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
+static void initContext(GLEScontext* ctx, ShareGroupPtr grp, bool nativeTextureDecompressionEnabled) {
setCoreProfile(ctx->isCoreProfile());
GLEScmContext::initGlobal(s_eglIface);
@@ -220,7 +220,7 @@ static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
ctx->setShareGroup(grp);
}
if (!ctx->isInitialized()) {
- ctx->init();
+ ctx->init(nativeTextureDecompressionEnabled);
translator::gles1::glBindTexture(GL_TEXTURE_2D,0);
translator::gles1::glBindTexture(GL_TEXTURE_CUBE_MAP_OES,0);
}
diff --git a/host/gl/glestranslator/GLES_V2/GLESv2Context.cpp b/host/gl/glestranslator/GLES_V2/GLESv2Context.cpp
index 31f6a3f8..c734fb0d 100644
--- a/host/gl/glestranslator/GLES_V2/GLESv2Context.cpp
+++ b/host/gl/glestranslator/GLES_V2/GLESv2Context.cpp
@@ -64,10 +64,10 @@ void GLESv2Context::initGlobal(EGLiface* iface) {
GLEScontext::initGlobal(iface);
}
-void GLESv2Context::init() {
+void GLESv2Context::init(bool nativeTextureDecompressionEnabled) {
android::base::AutoLock mutex(s_lock);
if(!m_initialized) {
- GLEScontext::init();
+ GLEScontext::init(nativeTextureDecompressionEnabled);
addVertexArrayObject(0);
setVertexArrayObject(0);
setAttribute0value(0.0, 0.0, 0.0, 1.0);
@@ -800,13 +800,14 @@ void InitExtensionString(GLSupport& glSupport, std::string& ext) {
void GLESv2Context::initExtensionString() {
if (m_glesMajorVersion == 3 && m_glesMinorVersion == 1) {
if (s_glExtensionsGles31Initialized) return;
- initCapsLocked((const GLubyte*)getHostExtensionsString(&s_glDispatch).c_str(), s_glSupportGles31);
+ initCapsLocked((const GLubyte*)getHostExtensionsString(&s_glDispatch).c_str(),
+ m_nativeTextureDecompressionEnabled, s_glSupportGles31);
InitExtensionString(s_glSupportGles31, *s_glExtensionsGles31);
s_glExtensionsGles31Initialized = true;
} else {
if (s_glExtensionsInitialized) return;
initCapsLocked((const GLubyte*)getHostExtensionsString(&s_glDispatch).c_str(),
- s_glSupport);
+ m_nativeTextureDecompressionEnabled, s_glSupport);
InitExtensionString(s_glSupport, *s_glExtensions);
s_glExtensionsInitialized = true;
}
diff --git a/host/gl/glestranslator/GLES_V2/GLESv2Context.h b/host/gl/glestranslator/GLES_V2/GLESv2Context.h
index 091fa461..683fba5a 100644
--- a/host/gl/glestranslator/GLES_V2/GLESv2Context.h
+++ b/host/gl/glestranslator/GLES_V2/GLESv2Context.h
@@ -33,7 +33,7 @@ class TransformFeedbackData;
class GLESv2Context : public GLEScontext{
public:
- virtual void init();
+ virtual void init(bool nativeTextureDecompressionEnabled) override;
virtual const GLSupport* getCaps() const override {
if (m_glesMajorVersion == 3 && m_glesMinorVersion == 1) {
return &s_glSupportGles31;
diff --git a/host/gl/glestranslator/GLES_V2/GLESv2Imp.cpp b/host/gl/glestranslator/GLES_V2/GLESv2Imp.cpp
index 7021eedf..f85edd18 100644
--- a/host/gl/glestranslator/GLES_V2/GLESv2Imp.cpp
+++ b/host/gl/glestranslator/GLES_V2/GLESv2Imp.cpp
@@ -75,7 +75,7 @@ extern "C" {
//decleration
static void initGLESx(bool isGles2Gles);
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp);
+static void initContext(GLEScontext* ctx, ShareGroupPtr grp, bool nativeTextureDecompressionEnabled);
static void setMaxGlesVersion(GLESVersion version);
static void deleteGLESContext(GLEScontext* ctx);
static void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp);
@@ -164,7 +164,7 @@ GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT(GLenum target, GLuint index,
// GL_EXT_memory_object
GL_APICALL void GL_APIENTRY glImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT(GLuint memory, GLuint64 size, GLenum handleType, void* handle);
-GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects);
+GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects);
GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT(GLuint memoryObject);
GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects);
GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, const GLint *params);
@@ -241,7 +241,7 @@ static void setMaxGlesVersion(GLESVersion version) {
GLESv2Context::setMaxGlesVersion(version);
}
-static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
+static void initContext(GLEScontext* ctx, ShareGroupPtr grp, bool nativeTextureDecompressionEnabled) {
setCoreProfile(ctx->isCoreProfile());
GLESv2Context::initGlobal(s_eglIface);
@@ -249,7 +249,7 @@ static void initContext(GLEScontext* ctx,ShareGroupPtr grp) {
ctx->setShareGroup(grp);
}
if (!ctx->isInitialized()) {
- ctx->init();
+ ctx->init(nativeTextureDecompressionEnabled);
translator::gles2::glBindTexture(GL_TEXTURE_2D,0);
translator::gles2::glBindTexture(GL_TEXTURE_CUBE_MAP,0);
}
diff --git a/host/gl/glestranslator/GLES_V2/GLESv30Imp.cpp b/host/gl/glestranslator/GLES_V2/GLESv30Imp.cpp
index 5903eeb7..fea7f60e 100644
--- a/host/gl/glestranslator/GLES_V2/GLESv30Imp.cpp
+++ b/host/gl/glestranslator/GLES_V2/GLESv30Imp.cpp
@@ -1,8 +1,3 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=translator_passthrough android/android-emugl/host/libs/libOpenGLESDispatch/gles3_only.entries --output=android/android-emugl/host/libs/Translator/GLES_V2/GLESv30Imp.cpp
-// This file is best left unedited.
-// Try to make changes through gen_translator in gen-entries.py,
-// and/or parcel out custom functionality in separate code.
-
EXTERN_PART GL_APICALL GLconstubyteptr GL_APIENTRY glGetStringi(GLenum name, GLint index) {
GET_CTX_V2_RET(0);
GLconstubyteptr glGetStringiRET = ctx->dispatcher().glGetStringi(name, index);
@@ -988,7 +983,36 @@ GL_APICALL void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat,
GET_CTX_V2();
if (ctx->shareGroup().get()) {
const GLuint globalProgramName = ctx->shareGroup()->getGlobalName(NamedObjectType::SHADER_OR_PROGRAM, program);
+ SET_ERROR_IF(globalProgramName == 0, GL_INVALID_VALUE);
+
+ auto objData =
+ ctx->shareGroup()->getObjectData(NamedObjectType::SHADER_OR_PROGRAM, program);
+ SET_ERROR_IF(!objData, GL_INVALID_OPERATION);
+ SET_ERROR_IF(objData->getDataType() != PROGRAM_DATA, GL_INVALID_OPERATION);
+
+ ProgramData* programData = (ProgramData*)objData;
+
ctx->dispatcher().glProgramBinary(globalProgramName, binaryFormat, binary, length);
+
+ GLint linkStatus = GL_FALSE;
+ ctx->dispatcher().glGetProgramiv(globalProgramName, GL_LINK_STATUS, &linkStatus);
+
+ programData->setHostLinkStatus(linkStatus);
+ programData->setLinkStatus(linkStatus);
+
+ GLsizei infoLogLength = 0;
+ ctx->dispatcher().glGetProgramiv(globalProgramName, GL_INFO_LOG_LENGTH, &infoLogLength);
+
+ if (infoLogLength > 0) {
+ std::vector<GLchar> infoLog(infoLogLength);
+ ctx->dispatcher().glGetProgramInfoLog(globalProgramName, infoLogLength, &infoLogLength,
+ infoLog.data());
+
+ if (infoLogLength) {
+ infoLog.resize(infoLogLength);
+ programData->setInfoLog(infoLog.data());
+ }
+ }
}
}
diff --git a/host/gl/glestranslator/GLcommon/GLEScontext.cpp b/host/gl/glestranslator/GLcommon/GLEScontext.cpp
index c494c6be..fe2eff58 100644
--- a/host/gl/glestranslator/GLcommon/GLEScontext.cpp
+++ b/host/gl/glestranslator/GLcommon/GLEScontext.cpp
@@ -19,7 +19,6 @@
#include "aemu/base/synchronization/Lock.h"
#include "aemu/base/containers/Lookup.h"
#include "aemu/base/files/StreamSerializing.h"
-#include "host-common/feature_control.h"
#include "host-common/logging.h"
#include <GLcommon/GLconversion_macros.h>
@@ -402,8 +401,10 @@ void GLEScontext::initGlobal(EGLiface* iface) {
s_lock.unlock();
}
-void GLEScontext::init() {
+void GLEScontext::init(bool nativeTextureDecompressionEnabled) {
if (!m_initialized) {
+ m_nativeTextureDecompressionEnabled = nativeTextureDecompressionEnabled;
+
initExtensionString();
m_maxTexUnits = getMaxCombinedTexUnits();
@@ -1792,7 +1793,7 @@ void GLEScontext::releaseGlobalLock() {
s_lock.unlock();
}
-void GLEScontext::initCapsLocked(const GLubyte * extensionString, GLSupport& glSupport)
+void GLEScontext::initCapsLocked(const GLubyte * extensionString, bool nativeTextureDecompressionEnabled, GLSupport& glSupport)
{
const char* cstring = (const char*)extensionString;
@@ -1826,7 +1827,7 @@ void GLEScontext::initCapsLocked(const GLubyte * extensionString, GLSupport& glS
s_glDispatch.glGetIntegerv(GL_MAX_VERTEX_ATTRIB_BINDINGS, &glSupport.maxVertexAttribBindings);
// Compressed texture format query
- if(feature_is_enabled(kFeature_NativeTextureDecompression)) {
+ if (nativeTextureDecompressionEnabled) {
bool hasEtc2Support = false;
bool hasAstcSupport = false;
int numCompressedFormats = 0;
diff --git a/host/gl/glestranslator/include/GLcommon/GLEScontext.h b/host/gl/glestranslator/include/GLcommon/GLEScontext.h
index 238f21ad..de18de80 100644
--- a/host/gl/glestranslator/include/GLcommon/GLEScontext.h
+++ b/host/gl/glestranslator/include/GLcommon/GLEScontext.h
@@ -248,7 +248,7 @@ public:
GLEScontext();
GLEScontext(GlobalNameSpace* globalNameSpace, android::base::Stream* stream,
GlLibrary* glLib);
- virtual void init();
+ virtual void init(bool nativeTextureDecompressionEnabled);
static void initGlobal(EGLiface* eglIface);
GLenum getGLerror();
void setGLerror(GLenum err);
@@ -531,7 +531,7 @@ protected:
void convertDirectVBO(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum array_id,GLESpointer* p);
void convertIndirect(GLESConversionArrays& fArrs,GLsizei count,GLenum type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
void convertIndirectVBO(GLESConversionArrays& fArrs,GLsizei count,GLenum indices_type,const GLvoid* indices,GLenum array_id,GLESpointer* p);
- static void initCapsLocked(const GLubyte * extensionString, GLSupport& glSupport);
+ static void initCapsLocked(const GLubyte * extensionString, bool nativeTextureDecompressionEnabled, GLSupport& glSupport);
virtual void initExtensionString() =0;
bool m_needRestoreFromSnapshot = false;
@@ -673,6 +673,8 @@ protected:
GLuint m_useProgram = 0;
+ bool m_nativeTextureDecompressionEnabled = false;
+
private:
GLenum m_glError = GL_NO_ERROR;
diff --git a/host/gl/glestranslator/include/GLcommon/TranslatorIfaces.h b/host/gl/glestranslator/include/GLcommon/TranslatorIfaces.h
index 4f3a2a88..37d9f350 100644
--- a/host/gl/glestranslator/include/GLcommon/TranslatorIfaces.h
+++ b/host/gl/glestranslator/include/GLcommon/TranslatorIfaces.h
@@ -95,7 +95,7 @@ namespace android_studio {
typedef struct {
void (*initGLESx)(bool isGles2Gles);
GLEScontext* (*createGLESContext)(int majorVersion, int minorVersion, GlobalNameSpace* globalNameSpace, android::base::Stream* stream);
- void (*initContext)(GLEScontext*,ShareGroupPtr);
+ void (*initContext)(GLEScontext*, ShareGroupPtr, bool);
void (*setMaxGlesVersion)(GLESVersion);
void (*deleteGLESContext)(GLEScontext*);
void (*flush)();
diff --git a/include/OpenGLESDispatch/RenderEGL_extensions_functions.h b/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
index 3ea98c88..6e642144 100644
--- a/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
+++ b/include/OpenGLESDispatch/RenderEGL_extensions_functions.h
@@ -1,4 +1,4 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=functions stream-servers/gl/OpenGLESDispatch/render_egl_extensions.entries --output=include/OpenGLESDispatch/RenderEGL_extensions_functions.h
+// Auto-generated with: android/scripts/gen-entries.py --mode=functions host/gl/OpenGLESDispatch/render_egl_extensions.entries --output=include/OpenGLESDispatch/RenderEGL_extensions_functions.h
// DO NOT EDIT THIS FILE
#ifndef RENDER_EGL_EXTENSIONS_FUNCTIONS_H
@@ -27,6 +27,7 @@
X(EGLBoolean, eglSetImageInfoANDROID, (EGLDisplay display, EGLImage image, EGLint width, EGLint height, EGLint internalformat)) \
X(EGLImage, eglImportImageANDROID, (EGLDisplay display, EGLImage image)) \
X(EGLint, eglDebugMessageControlKHR, (EGLDEBUGPROCKHR callback, const EGLAttrib * attrib_list)) \
+ X(EGLBoolean, eglSetNativeTextureDecompressionEnabledANDROID, (EGLDisplay display, EGLBoolean enabled)) \
EGLAPI EGLint EGLAPIENTRY eglGetMaxGLESVersion(EGLDisplay display);
EGLAPI void EGLAPIENTRY eglBlitFromCurrentReadBufferANDROID(EGLDisplay display, EGLImageKHR image);
diff --git a/include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h b/include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h
index ddd4894d..cbc84f1d 100644
--- a/include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h
+++ b/include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h
@@ -1,4 +1,4 @@
-// Auto-generated with: android/scripts/gen-entries.py --mode=static_translator_namespaced_header stream-servers/gl/OpenGLESDispatch/render_egl_extensions.entries --output=include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h
+// Auto-generated with: android/scripts/gen-entries.py --mode=static_translator_namespaced_header host/gl/OpenGLESDispatch/render_egl_extensions.entries --output=include/OpenGLESDispatch/RenderEGL_extensions_static_translator_namespaced_header.h
// DO NOT EDIT THIS FILE
#pragma once
@@ -27,5 +27,6 @@ EGLAPI EGLImage EGLAPIENTRY eglGetNativeImageANDROID(EGLDisplay display, EGLImag
EGLAPI EGLBoolean EGLAPIENTRY eglSetImageInfoANDROID(EGLDisplay display, EGLImage image, EGLint width, EGLint height, EGLint internalformat);
EGLAPI EGLImage EGLAPIENTRY eglImportImageANDROID(EGLDisplay display, EGLImage image);
EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const EGLAttrib * attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetNativeTextureDecompressionEnabledANDROID(EGLDisplay display, EGLBoolean enabled);
} // namespace translator
} // namespace egl