diff --git a/cmake/ports/hifi-deps/CONTROL b/cmake/ports/hifi-deps/CONTROL index 2441de9002..4cf952ccf0 100644 --- a/cmake/ports/hifi-deps/CONTROL +++ b/cmake/ports/hifi-deps/CONTROL @@ -1,4 +1,4 @@ Source: hifi-deps -Version: 0.1 +Version: 0.3 Description: Collected dependencies for High Fidelity applications Build-Depends: bullet3, draco, etc2comp, glm, nvtt, openexr (!android), openssl (windows), tbb (!android&!osx), zlib, webrtc (!android) diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py index 7bb261faa0..ebecca6226 100644 --- a/hifi_vcpkg.py +++ b/hifi_vcpkg.py @@ -265,7 +265,7 @@ endif() if platform.system() == 'Windows': url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-windows3.tar.gz' elif platform.system() == 'Darwin': - url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos3.tar.gz' + url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz?versionId=bLAgnoJ8IMKpqv8NFDcAu8hsyQy3Rwwz' elif platform.system() == 'Linux': if platform.linux_distribution()[1][:3] == '16.': url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-16.04-with-symbols.tar.gz' diff --git a/tests-manual/qml/qml/MacQml.qml b/tests-manual/qml/qml/MacQml.qml index bb7e3a0dff..14749bb826 100644 --- a/tests-manual/qml/qml/MacQml.qml +++ b/tests-manual/qml/qml/MacQml.qml @@ -61,17 +61,21 @@ Item { Rectangle { width: 5 height: 5 - color: "red" - ColorAnimation on color { loops: Animation.Infinite; from: "red"; to: "yellow"; duration: 1000 } + color: "blue" + ColorAnimation on color { loops: Animation.Infinite; from: "blue"; to: "yellow"; duration: 1000 } } - WebEngineView { id: root - url: "https://google.com/" - x: 6; y: 6; - width: parent.width * 0.8 - height: parent.height * 0.8 + url: "https://www.webrtc-experiment.com/Pluginfree-Screen-Sharing/#19583796789766627" +// url: "https://vimeo.com/108650530" +// url: "https://www.youtube.com/watch?v=7EWQOeQf32U&autoplay=1&loop=1" +// x: 6; y: 6; + anchors.fill: parent +// width: parent.width * 0.8 +// height: parent.height * 0.8 } + + } diff --git a/tests-manual/qml/src/MacQml.cpp b/tests-manual/qml/src/MacQml.cpp index 9c5f91041e..aa732b7209 100644 --- a/tests-manual/qml/src/MacQml.cpp +++ b/tests-manual/qml/src/MacQml.cpp @@ -39,7 +39,7 @@ void MacQml::init() { _surface->load(url, callback); _surface->resize(_window->size()); _surface->resume(); - + _window->installEventFilter(_surface.get()); } void MacQml::draw() { diff --git a/tests-manual/qml/src/MacQml.h b/tests-manual/qml/src/MacQml.h index 50f71cb72e..b46349440e 100644 --- a/tests-manual/qml/src/MacQml.h +++ b/tests-manual/qml/src/MacQml.h @@ -9,7 +9,7 @@ public: QmlPtr _surface; GLuint _fbo{ 0 }; - MacQml(const QWindow* window) : Parent(window) {} + MacQml(QWindow* window) : Parent(window) {} void update() override; void init() override; void draw() override; diff --git a/tests-manual/qml/src/StressWeb.h b/tests-manual/qml/src/StressWeb.h index a68e34d0c1..eb4aa80ba0 100644 --- a/tests-manual/qml/src/StressWeb.h +++ b/tests-manual/qml/src/StressWeb.h @@ -24,7 +24,7 @@ public: std::array, DIVISIONS_X> _surfaces; GLuint _fbo{ 0 }; - StressWeb(const QWindow* window) : Parent(window) {} + StressWeb(QWindow* window) : Parent(window) {} static QString getSourceUrl(bool video); void buildSurface(QmlInfo& qmlInfo, bool video); void destroySurface(QmlInfo& qmlInfo); diff --git a/tests-manual/qml/src/TestCase.h b/tests-manual/qml/src/TestCase.h index 191eecb408..084e306bb5 100644 --- a/tests-manual/qml/src/TestCase.h +++ b/tests-manual/qml/src/TestCase.h @@ -8,8 +8,8 @@ class TestCase { public: using QmlPtr = QSharedPointer; - using Builder = std::function; - TestCase(const QWindow* window) : _window(window) {} + using Builder = std::function; + TestCase(QWindow* window) : _window(window) {} virtual void init(); virtual void destroy(); virtual void update(); @@ -18,6 +18,6 @@ public: protected: QOpenGLFunctions_4_1_Core _glf; - const QWindow* _window; + QWindow* _window; std::function _discardLamdba; }; diff --git a/tests-manual/qml/src/main.cpp b/tests-manual/qml/src/main.cpp index 1d98ebf8c8..f2229f138f 100644 --- a/tests-manual/qml/src/main.cpp +++ b/tests-manual/qml/src/main.cpp @@ -205,12 +205,22 @@ void TestWindow::resizeEvent(QResizeEvent* ev) { int main(int argc, char** argv) { +#ifdef Q_OS_MAC auto format = getDefaultOpenGLSurfaceFormat(); - format.setVersion(4, 1); + // Deal with some weirdness in the chromium context sharing on Mac. + // The primary share context needs to be 3.2, so that the Chromium will + // succeed in it's creation of it's command stub contexts. + format.setVersion(3, 2); + // This appears to resolve the issues with corrupted fonts on OSX. No + // idea why. + qputenv("QT_ENABLE_GLYPH_CACHE_WORKAROUND", "true"); + // https://i.kym-cdn.com/entries/icons/original/000/008/342/ihave.jpg QSurfaceFormat::setDefaultFormat(format); +#endif + QGuiApplication app(argc, argv); - TestCase::Builder builder = [](const QWindow* window)->TestCase*{ return new MacQml(window); }; + TestCase::Builder builder = [](QWindow* window)->TestCase*{ return new MacQml(window); }; TestWindow window(builder); return app.exec(); } diff --git a/tools/qt-builder/README.md b/tools/qt-builder/README.md index 956dda4534..59db078aa9 100644 --- a/tools/qt-builder/README.md +++ b/tools/qt-builder/README.md @@ -1,8 +1,10 @@ # General This document describes the process to build Qt 5.12.3. -Note that there are three patches. The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this. -The second patch is to OpenSL ES audio. -The third is a patch to QScriptEngine to prevent crashes in QScriptEnginePrivate::reportAdditionalMemoryCost, during garbage collection. See https://bugreports.qt.io/browse/QTBUG-76176 +Note that there are several patches. +* The first (to qfloat16.h) is needed to compile QT 5.12.3 on Visual Studio 2017 due to a bug in Visual Studio (*bitset* will not compile. Note that there is a change in CMakeLists.txt to support this. +* The second patch is to OpenSL ES audio and allow audio echo cancelllation on Android. +* The third is a patch to QScriptEngine to prevent crashes in QScriptEnginePrivate::reportAdditionalMemoryCost, during garbage collection. See https://bugreports.qt.io/browse/QTBUG-76176 +* The fourth is a patch which fixes video playback on WebEngineViews on mac. See https://bugreports.qt.io/browse/QTBUG-70967 ## Requirements ### Windows 1. Visual Studio 2017 @@ -222,6 +224,7 @@ git clone --recursive git://code.qt.io/qt/qt5.git -b 5.12.3 --single-branch `cd qt5` `git apply --ignore-space-change --ignore-whitespace patches/aec.patch` `git apply --ignore-space-change --ignore-whitespace patches/qtscript-crash-fix.patch` +`git apply --ignore-space-change --ignore-whitespace patches/mac-web-video.patch` `cd ..` #### Configuring `mkdir qt5-install` diff --git a/tools/qt-builder/patches/mac-web-video.patch b/tools/qt-builder/patches/mac-web-video.patch new file mode 100644 index 0000000000..2ea81ce18b --- /dev/null +++ b/tools/qt-builder/patches/mac-web-video.patch @@ -0,0 +1,247 @@ +Submodule qtwebengine contains modified content +diff --git a/qtwebengine/src/core/stream_video_node.cpp b/qtwebengine/src/core/stream_video_node.cpp +index 29922f86..baa39d3b 100644 +--- a/qtwebengine/src/core/stream_video_node.cpp ++++ b/qtwebengine/src/core/stream_video_node.cpp +@@ -62,38 +62,45 @@ protected: + const char *vertexShader() const override { + // Keep in sync with cc::VertexShaderVideoTransform + static const char *shader = +- "attribute highp vec4 a_position;\n" +- "attribute mediump vec2 a_texCoord;\n" +- "uniform highp mat4 matrix;\n" +- "uniform highp mat4 texMatrix;\n" +- "varying mediump vec2 v_texCoord;\n" +- "void main() {\n" +- " gl_Position = matrix * a_position;\n" +- " v_texCoord = vec4(texMatrix * vec4(a_texCoord.x, 1.0 - a_texCoord.y, 0.0, 1.0)).xy;\n" +- "}"; ++ R"SHADER(#version 150 core ++in vec4 a_position; ++in vec2 a_texCoord; ++uniform mat4 matrix; ++uniform mat4 texMatrix; ++out vec2 v_texCoord; ++void main() { ++ gl_Position = matrix * a_position; ++ v_texCoord = vec4(texMatrix * vec4(a_texCoord.x, 1.0 - a_texCoord.y, 0.0, 1.0)).xy; ++} ++ )SHADER"; + return shader; + } + + const char *fragmentShader() const override { + // Keep in sync with cc::FragmentShaderRGBATexAlpha + static const char *shaderExternal = +- "#extension GL_OES_EGL_image_external : require\n" +- "varying mediump vec2 v_texCoord;\n" +- "uniform samplerExternalOES s_texture;\n" +- "uniform lowp float alpha;\n" +- "void main() {\n" +- " lowp vec4 texColor = texture2D(s_texture, v_texCoord);\n" +- " gl_FragColor = texColor * alpha;\n" +- "}"; ++ R"SHADER(#version 150 core ++#extension GL_OES_EGL_image_external : require ++in vec2 v_texCoord; ++uniform samplerExternalOES s_texture; ++uniform float alpha; ++out vec4 fragColor; ++void main() { ++ vec4 texColor = texture(s_texture, v_texCoord); ++ fragColor = texColor * alpha; ++} ++ )SHADER"; + static const char *shader2DRect = +- "#extension GL_ARB_texture_rectangle : require\n" +- "varying mediump vec2 v_texCoord;\n" +- "uniform sampler2DRect s_texture;\n" +- "uniform lowp float alpha;\n" +- "void main() {\n" +- " lowp vec4 texColor = texture2DRect(s_texture, v_texCoord);\n" +- " gl_FragColor = texColor * alpha;\n" +- "}"; ++ R"SHADER(#version 150 core ++in vec2 v_texCoord; ++uniform sampler2D s_texture; ++uniform float alpha; ++out vec4 fragColor; ++void main() { ++ vec4 texColor = texture(s_texture, v_texCoord); ++ fragColor = texColor * alpha; ++} ++ )SHADER"; + if (m_target == ExternalTarget) + return shaderExternal; + else +diff --git a/qtwebengine/src/core/yuv_video_node.cpp b/qtwebengine/src/core/yuv_video_node.cpp +index 4a436d95..dc4b6ff9 100644 +--- a/qtwebengine/src/core/yuv_video_node.cpp ++++ b/qtwebengine/src/core/yuv_video_node.cpp +@@ -59,39 +59,41 @@ public: + YUVVideoMaterialShader(const gfx::ColorSpace &colorSpace) + { + static const char *shaderHead = +- "varying mediump vec2 v_yaTexCoord;\n" +- "varying mediump vec2 v_uvTexCoord;\n" +- "uniform sampler2D y_texture;\n" +- "uniform sampler2D u_texture;\n" +- "uniform sampler2D v_texture;\n" +- "uniform mediump float alpha;\n" +- "uniform mediump vec4 ya_clamp_rect;\n" +- "uniform mediump vec4 uv_clamp_rect;\n"; +- static const char *shader = +- "void main() {\n" +- " mediump vec2 ya_clamped =\n" +- " max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord));\n" +- " mediump float y_raw = texture2D(y_texture, ya_clamped).x;\n" +- " mediump vec2 uv_clamped =\n" +- " max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord));\n" +- " mediump float u_unsigned = texture2D(u_texture, uv_clamped).x;\n" +- " mediump float v_unsigned = texture2D(v_texture, uv_clamped).x;\n" +- " mediump vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned);\n" +- " mediump vec3 rgb = DoColorConversion(yuv);\n" +- " gl_FragColor = vec4(rgb, 1.0) * alpha;\n" +- "}"; ++ R"SHADER(#version 150 core ++in vec2 v_yaTexCoord; ++in vec2 v_uvTexCoord; ++uniform sampler2D y_texture; ++uniform sampler2D u_texture; ++uniform sampler2D v_texture; ++uniform float alpha; ++uniform vec4 ya_clamp_rect; ++uniform vec4 uv_clamp_rect; ++out vec4 fragColor; ++ )SHADER"; ++ ++ static const char *shader = R"SHADER( ++void main() { ++ vec2 ya_clamped = ++ max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord)); ++ float y_raw = texture(y_texture, ya_clamped).x; ++ vec2 uv_clamped = ++ max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord)); ++ float u_unsigned = texture(u_texture, uv_clamped).x; ++ float v_unsigned = texture(v_texture, uv_clamped).x; ++ vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned); ++ vec3 rgb = DoColorConversion(yuv); ++ fragColor = vec4(rgb, 1.0) * alpha; ++} ++ )SHADER"; ++ + // Invalid or unspecified color spaces should be treated as REC709. + gfx::ColorSpace src = colorSpace.IsValid() ? colorSpace : gfx::ColorSpace::CreateREC709(); + gfx::ColorSpace dst = gfx::ColorSpace::CreateSRGB(); + std::unique_ptr transform = + gfx::ColorTransform::NewColorTransform(src, dst, gfx::ColorTransform::Intent::INTENT_PERCEPTUAL); + +- QByteArray header(shaderHead); +- if (QOpenGLContext::currentContext()->isOpenGLES()) +- header = QByteArray("precision mediump float;\n") + header; +- + m_csShader = QByteArray::fromStdString(transform->GetShaderSource()); +- m_fragmentShader = header + m_csShader + QByteArray(shader); ++ m_fragmentShader = QByteArray(shaderHead) + m_csShader + QByteArray(shader); + } + void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; + +@@ -108,20 +110,22 @@ protected: + const char *vertexShader() const override { + // Keep in sync with logic in VertexShader in components/viz/service/display/shader.cc + const char *shader = +- "attribute highp vec4 a_position;\n" +- "attribute mediump vec2 a_texCoord;\n" +- "uniform highp mat4 matrix;\n" +- "varying mediump vec2 v_yaTexCoord;\n" +- "varying mediump vec2 v_uvTexCoord;\n" +- "uniform mediump vec2 yaTexScale;\n" +- "uniform mediump vec2 yaTexOffset;\n" +- "uniform mediump vec2 uvTexScale;\n" +- "uniform mediump vec2 uvTexOffset;\n" +- "void main() {\n" +- " gl_Position = matrix * a_position;\n" +- " v_yaTexCoord = a_texCoord * yaTexScale + yaTexOffset;\n" +- " v_uvTexCoord = a_texCoord * uvTexScale + uvTexOffset;\n" +- "}"; ++ R"SHADER(#version 150 core ++in vec4 a_position; ++in vec2 a_texCoord; ++uniform mat4 matrix; ++out vec2 v_yaTexCoord; ++out vec2 v_uvTexCoord; ++uniform vec2 yaTexScale; ++uniform vec2 yaTexOffset; ++uniform vec2 uvTexScale; ++uniform vec2 uvTexOffset; ++void main() { ++ gl_Position = matrix * a_position; ++ v_yaTexCoord = a_texCoord * yaTexScale + yaTexOffset; ++ v_uvTexCoord = a_texCoord * uvTexScale + uvTexOffset; ++} ++ )SHADER"; + return shader; + } + +@@ -168,33 +172,35 @@ public: + YUVAVideoMaterialShader(const gfx::ColorSpace &colorSpace) : YUVVideoMaterialShader(colorSpace) + { + static const char *shaderHead = +- "varying mediump vec2 v_yaTexCoord;\n" +- "varying mediump vec2 v_uvTexCoord;\n" +- "uniform sampler2D y_texture;\n" +- "uniform sampler2D u_texture;\n" +- "uniform sampler2D v_texture;\n" +- "uniform sampler2D a_texture;\n" +- "uniform mediump float alpha;\n" +- "uniform mediump vec4 ya_clamp_rect;\n" +- "uniform mediump vec4 uv_clamp_rect;\n"; ++ R"SHADER(#version 150 core ++in vec2 v_yaTexCoord; ++in vec2 v_uvTexCoord; ++uniform sampler2D y_texture; ++uniform sampler2D u_texture; ++uniform sampler2D v_texture; ++uniform sampler2D a_texture; ++uniform float alpha; ++uniform vec4 ya_clamp_rect; ++uniform vec4 uv_clamp_rect; ++out vec4 fragColor; ++ )SHADER"; + static const char *shader = +- "void main() {\n" +- " mediump vec2 ya_clamped =\n" +- " max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord));\n" +- " mediump float y_raw = texture2D(y_texture, ya_clamped).x;\n" +- " mediump vec2 uv_clamped =\n" +- " max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord));\n" +- " mediump float u_unsigned = texture2D(u_texture, uv_clamped).x;\n" +- " mediump float v_unsigned = texture2D(v_texture, uv_clamped).x;\n" +- " mediump float a_raw = texture2D(a_texture, ya_clamped).x;\n" +- " mediump vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned);\n" +- " mediump vec3 rgb = DoColorConversion(yuv);\n" +- " gl_FragColor = vec4(rgb, 1.0) * (alpha * a_raw);\n" +- "}"; +- QByteArray header(shaderHead); +- if (QOpenGLContext::currentContext()->isOpenGLES()) +- header = QByteArray("precision mediump float;\n") + header; +- m_fragmentShader = header + m_csShader + QByteArray(shader); ++ R"SHADER( ++void main() { ++ vec2 ya_clamped = ++ max(ya_clamp_rect.xy, min(ya_clamp_rect.zw, v_yaTexCoord)); ++ float y_raw = texture(y_texture, ya_clamped).x; ++ vec2 uv_clamped = ++ max(uv_clamp_rect.xy, min(uv_clamp_rect.zw, v_uvTexCoord)); ++ float u_unsigned = texture(u_texture, uv_clamped).x; ++ float v_unsigned = texture(v_texture, uv_clamped).x; ++ float a_raw = texture(a_texture, ya_clamped).x; ++ vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned); ++ vec3 rgb = DoColorConversion(yuv); ++ fragColor = vec4(rgb, 1.0) * (alpha * a_raw); ++} ++ )SHADER"; ++ m_fragmentShader = QByteArray(shaderHead) + m_csShader + QByteArray(shader); + } + void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; +