diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-11 18:15:05 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-11 18:15:05 +0000 |
commit | f6d929af543a15f8352e021643ce838049689bb3 (patch) | |
tree | 4534bb42fab7a013e76d0fcfe25ff13d27682cde | |
parent | b68ad7dbfeb1f7d51db62ae36f34443b51ee74ef (diff) | |
parent | 3b32088273b2c947185680d7888a097bcdf18149 (diff) | |
download | gfxstream-emu-34-2-release.tar.gz |
Snap for 11702928 from 3b32088273b2c947185680d7888a097bcdf18149 to emu-34-2-releaseemu-34-2-release
Change-Id: I6b9fe2c2af103eb04c5daca0c76e730c44e4a7cc
23 files changed, 107 insertions, 49 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 c1e0f8fe..61a35097 100644 --- a/host/FrameBuffer.cpp +++ b/host/FrameBuffer.cpp @@ -1964,9 +1964,6 @@ static void loadProcOwnedCollection(Stream* stream, Collection* c) { int FrameBuffer::getScreenshot(unsigned int nChannels, unsigned int* width, unsigned int* height, uint8_t* pixels, size_t* cPixels, int displayId, int desiredWidth, int desiredHeight, int desiredRotation, Rect rect) { - if (emugl::shouldSkipDraw()) { - return -1; - } AutoLock mutex(m_lock); uint32_t w, h, cb, screenWidth, screenHeight; if (!emugl::get_emugl_multi_display_operations().getMultiDisplay( diff --git a/host/PostWorkerGl.cpp b/host/PostWorkerGl.cpp index 7d25ec47..7d630e7b 100644 --- a/host/PostWorkerGl.cpp +++ b/host/PostWorkerGl.cpp @@ -88,11 +88,7 @@ std::shared_future<void> PostWorkerGl::postImpl(ColorBuffer* cb) { const auto& multiDisplay = emugl::get_emugl_multi_display_operations(); const bool pixel_fold = multiDisplay.isPixelFold(); if (pixel_fold) { - if (emugl::shouldSkipDraw()) { - post.layers.clear(); - } else { - post.layers.push_back(postWithOverlay(cb)); - } + post.layers.push_back(postWithOverlay(cb)); } else if (multiDisplay.isMultiDisplayEnabled()) { if (multiDisplay.isMultiDisplayWindow()) { diff --git a/host/gl/DisplayGl.cpp b/host/gl/DisplayGl.cpp index 529bb5c6..4b2f7849 100644 --- a/host/gl/DisplayGl.cpp +++ b/host/gl/DisplayGl.cpp @@ -38,10 +38,6 @@ std::shared_future<void> DisplayGl::post(const Post& post) { if (!surface) { return getCompletedFuture(); } - if (post.layers.empty()) { - clear(); - return getCompletedFuture(); - } const auto* surfaceGl = static_cast<const DisplaySurfaceGl*>(surface->getImpl()); bool hasDrawLayer = false; @@ -89,4 +85,4 @@ void DisplayGl::clear() { } } // namespace gl -} // namespace gfxstream +} // namespace gfxstream
\ No newline at end of file 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/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index 2536720e..4c26a281 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -245,6 +245,17 @@ class BoxedHandleManager { return res; } + void update(uint64_t handle, const T& item, BoxedHandleTypeTag tag) { + auto storedItem = store.get(handle); + uint64_t oldHandle = (uint64_t)storedItem->underlying; + *storedItem = item; + AutoLock l(lock); + if (oldHandle) { + reverseMap.erase(oldHandle); + } + reverseMap[(uint64_t)(item.underlying)] = handle; + } + void remove(uint64_t h) { auto item = get(h); if (item) { @@ -2286,7 +2297,6 @@ class VkDecoderGlobalState::Impl { { std::lock_guard<std::recursive_mutex> lock(mLock); auto boxed_fence = unboxed_to_boxed_non_dispatchable_VkFence(fence); - delete_VkFence(boxed_fence); set_boxed_non_dispatchable_VkFence(boxed_fence, replacement); auto& fenceInfo = mFenceInfo[replacement]; @@ -6000,7 +6010,7 @@ class VkDecoderGlobalState::Impl { void set_boxed_non_dispatchable_##type(type boxed, type underlying) { \ DispatchableHandleInfo<uint64_t> item; \ item.underlying = (uint64_t)underlying; \ - sBoxedHandleManager.addFixed((uint64_t)boxed, item, Tag_##type); \ + sBoxedHandleManager.update((uint64_t)boxed, item, Tag_##type); \ } \ type unboxed_to_boxed_non_dispatchable_##type(type unboxed) { \ AutoLock lock(sBoxedHandleManager.lock); \ 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 |