diff -Nru kodi-visualization-shadertoy-1.2.3/appveyor.yml kodi-visualization-shadertoy-2.3.0/appveyor.yml --- kodi-visualization-shadertoy-1.2.3/appveyor.yml 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/appveyor.yml 2015-05-23 07:24:22.000000000 +0000 @@ -12,22 +12,24 @@ matrix: - GENERATOR: "Visual Studio 15" CONFIG: Release + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION="10.0.17763.0" - GENERATOR: "Visual Studio 15 Win64" CONFIG: Release + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION="10.0.17763.0" - GENERATOR: "Visual Studio 15 Win64" CONFIG: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" - GENERATOR: "Visual Studio 15 ARM" CONFIG: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" build_script: - cd .. - - git clone --branch Leia --depth=1 https://github.com/xbmc/xbmc.git + - git clone --branch master --depth=1 https://github.com/xbmc/xbmc.git - cd %app_id% - mkdir build - cd build - mkdir -p definition\%app_id% - echo %app_id% %APPVEYOR_BUILD_FOLDER% %APPVEYOR_REPO_COMMIT% > definition\%app_id%\%app_id%.txt - - cmake -T host=x64 -G "%GENERATOR%" %WINSTORE% -DADDONS_TO_BUILD=%app_id% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDONS_DEFINITION_DIR=%APPVEYOR_BUILD_FOLDER%/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons + - cmake -T host=x64 -G "%GENERATOR%" %CMAKE_DEFINES% -DADDONS_TO_BUILD=%app_id% -DCMAKE_BUILD_TYPE=%CONFIG% -DADDONS_DEFINITION_DIR=%APPVEYOR_BUILD_FOLDER%/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../xbmc/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons - cmake --build . --config %CONFIG% --target %app_id% diff -Nru kodi-visualization-shadertoy-1.2.3/azure-pipelines.yml kodi-visualization-shadertoy-2.3.0/azure-pipelines.yml --- kodi-visualization-shadertoy-1.2.3/azure-pipelines.yml 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/azure-pipelines.yml 2015-05-23 07:24:22.000000000 +0000 @@ -4,7 +4,7 @@ trigger: branches: include: - - Leia + - Matrix - releases/* paths: include: @@ -24,20 +24,22 @@ GENERATOR: "Visual Studio 15 2017" ARCHITECTURE: Win32 CONFIGURATION: Release + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION="10.0.17763.0" Win64: GENERATOR: "Visual Studio 15 2017" ARCHITECTURE: x64 CONFIGURATION: Release + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION="10.0.17763.0" Win64-UWP: GENERATOR: "Visual Studio 15 2017" ARCHITECTURE: x64 CONFIGURATION: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" ARM64-UWP: GENERATOR: "Visual Studio 15 2017" ARCHITECTURE: ARM64 CONFIGURATION: Release - WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.16299.0" + CMAKE_DEFINES: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.17763.0" workspace: clean: all @@ -46,7 +48,7 @@ - script: | cd .. - git clone --branch Leia --depth=1 https://github.com/xbmc/xbmc.git kodi + git clone --branch master --depth=1 https://github.com/xbmc/xbmc.git kodi cd $(Build.SourcesDirectory) mkdir build cd build @@ -57,7 +59,7 @@ - task: CMake@1 inputs: workingDirectory: 'build' - cmakeArgs: '-T host=x64 -G "$(GENERATOR)" -A $(ARCHITECTURE) $(WINSTORE) -DADDONS_TO_BUILD=$(app_id) -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -DADDONS_DEFINITION_DIR=$(Pipeline.Workspace)/$(app_id)/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/cmake/addons' + cmakeArgs: '-T host=x64 -G "$(GENERATOR)" -A $(ARCHITECTURE) $(CMAKE_DEFINES) -DADDONS_TO_BUILD=$(app_id) -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -DADDONS_DEFINITION_DIR=$(Pipeline.Workspace)/$(app_id)/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/cmake/addons' - task: CMake@1 inputs: diff -Nru kodi-visualization-shadertoy-1.2.3/CMakeLists.txt kodi-visualization-shadertoy-2.3.0/CMakeLists.txt --- kodi-visualization-shadertoy-1.2.3/CMakeLists.txt 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/CMakeLists.txt 2015-05-23 07:24:22.000000000 +0000 @@ -4,52 +4,38 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) find_package(Kodi REQUIRED) -find_package(p8-platform REQUIRED) find_package(glm REQUIRED) add_subdirectory(lib/kissfft) -if(NOT WIN32) - if(APP_RENDER_SYSTEM STREQUAL "gl" OR NOT APP_RENDER_SYSTEM) - find_package(OpenGl REQUIRED) - set(DEPLIBS ${OPENGL_LIBRARIES}) - set(includes ${OPENGL_INCLUDE_DIR}) - add_definitions(${OPENGL_DEFINITIONS}) - else() - find_package(OpenGLES REQUIRED) - set(DEPLIBS ${OPENGLES_LIBRARIES}) - set(includes ${OPENGLES_INCLUDE_DIR}) - add_definitions(${OPENGLES_DEFINITIONS}) - endif() - - include_directories(${GLM_INCLUDE_DIR} - ${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways - ${PROJECT_SOURCE_DIR}/lib) - - if(${CORE_SYSTEM_NAME} STREQUAL "osx" OR - ${CORE_SYSTEM_NAME} STREQUAL "ios" OR - ${CORE_SYSTEM_NAME} STREQUAL "darwin_embedded") - list(APPEND DEPLIBS "-framework CoreVideo") - endif() - - set(SHADERTOY_SOURCES src/lodepng.cpp - src/main.cpp) - - set(SHADERTOY_HEADERS src/lodepng.h - src/main.h) -elseif(WIN32) - include_directories(${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways (becomes done in future) - ${p8-platform_INCLUDE_DIRS} - ${PROJECT_SOURCE_DIR}/lib/kissfft - ${CMAKE_INCLUDE_PATH}) - - set(SHADERTOY_SOURCES src/WICTextureLoader.cpp - src/maindx.cpp) +if(NOT WIN32 AND (APP_RENDER_SYSTEM STREQUAL "gl" OR NOT APP_RENDER_SYSTEM)) + find_package(OpenGl REQUIRED) + set(DEPLIBS ${OPENGL_LIBRARIES}) + set(includes ${OPENGL_INCLUDE_DIR}) + add_definitions(${OPENGL_DEFINITIONS}) +else() + find_package(OpenGLES REQUIRED) + set(DEPLIBS ${OPENGLES_LIBRARIES}) + set(includes ${OPENGLES_INCLUDE_DIR}) + add_definitions(${OPENGLES_DEFINITIONS}) +endif() - set(SHADERTOY_HEADERS src/lodepng.h - src/WICTextureLoader.h) +include_directories(${GLM_INCLUDE_DIR} + ${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways + ${PROJECT_SOURCE_DIR}/lib) + +if(CORE_SYSTEM_NAME STREQUAL osx OR + CORE_SYSTEM_NAME STREQUAL ios OR + CORE_SYSTEM_NAME STREQUAL darwin_embedded) + list(APPEND DEPLIBS "-framework CoreVideo") endif() +set(SHADERTOY_SOURCES src/lodepng.cpp + src/main.cpp) + +set(SHADERTOY_HEADERS src/lodepng.h + src/main.h) + list(APPEND DEPLIBS kissfft) build_addon(visualization.shadertoy SHADERTOY DEPLIBS) diff -Nru kodi-visualization-shadertoy-1.2.3/debian/changelog kodi-visualization-shadertoy-2.3.0/debian/changelog --- kodi-visualization-shadertoy-1.2.3/debian/changelog 2020-07-29 06:48:09.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/changelog 2015-05-23 07:24:22.000000000 +0000 @@ -1,36 +1,7 @@ -kodi-visualization-shadertoy (1.2.3-2~focal) focal; urgency=low +kodi-visualization-shadertoy (2.3.0-1~focal) focal; urgency=low [ xbmc ] * autogenerated dummy changelog - [ wsnipex ] - * [B]1.2.3[/B] - Update Debian package creation - Remove not needed - "virtual" on windows related code - Update glm on depends to version - 0.9.9.5 - Add screenshots and fanart images to see what it brings - - Update description text - Use reduced size always if calculation is - lower as screen size - Prevent some shaders on GLES (can freeze on - weak systems) [B]1.2.2[/B] - Fix debian packaging [B]1.2.1[/B] - - On code override GL_RED (if not present) with GL_LUMINANCE (needed - on older GLES versions) - AppVeyor: Use Visual Studio 2017 & add - WindowsStore [B]1.2.0[/B] - Update build system version and cleanup - - Bring in GL 4.0 support - Update shader files with a revised copy - to a new OpenGL-related folder - Remove old for Windows not - supported shader files [B]1.1.9[/B] - Save last used preset - [B]1.1.8[/B] - Kodi to addon interface changes - Update debian - control [B]1.1.7[/B] - Change to automatic depends set on addon.xml - [B]1.1.6[/B] - Removed never used addon interface functions - Fix of - Windows 64 bit build [B]1.1.5[/B] - Fix OpenGL for Apple - [B]1.1.4[/B] - Fix order matters. gles needs the extension first in - shaders [B]1.1.3[/B] - Drop not used OpenGL EW [B]1.1.2[/B] - Fix - do not prepend gles precision directives to gl shaders [B]1.1.1[/B] - - Fix iterate by reference - Fix debian packaging [B]1.1.0[/B] - - Rename addon.xml to addon.xml.in and bring it up to par with other - add-ons [B]1.0.6[/B] - Add 2D led spectrum visualizer (remix) - - Add electric pulse visualizer - Store presets in a struct - Fix - addon.xml for windows - Add Dancing Metalights - Add spectrometer - - Add audio eclipse - Support GLES2 - Improve fractalland performance - - [osx] add missing linkage to CoreVideo.framework - Change include - paths after split of kodi-platform - Added new icon. Thx ronie - [B]0.0.1[/B] - Initial import + -- nobody Sat, 23 May 2015 08:24:22 +0100 - -- wsnipex Wed, 29 Jul 2020 06:48:09 +0000 diff -Nru kodi-visualization-shadertoy-1.2.3/debian/changelog.tmp kodi-visualization-shadertoy-2.3.0/debian/changelog.tmp --- kodi-visualization-shadertoy-1.2.3/debian/changelog.tmp 2020-07-29 06:48:06.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/changelog.tmp 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -kodi-visualization-shadertoy (1.2.3-2~#DIST#) #DIST#; urgency=low - - [ xbmc ] - * autogenerated dummy changelog - - -- nobody Sat, 23 May 2015 08:24:22 +0100 - diff -Nru kodi-visualization-shadertoy-1.2.3/debian/control kodi-visualization-shadertoy-2.3.0/debian/control --- kodi-visualization-shadertoy-1.2.3/debian/control 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/control 2015-05-23 07:24:22.000000000 +0000 @@ -1,11 +1,11 @@ Source: kodi-visualization-shadertoy Priority: extra Maintainer: Nobody -Build-Depends: debhelper (>= 9.0.0), cmake, kodi-addon-dev, libglm-dev, libp8-platform-dev, +Build-Depends: debhelper (>= 9.0.0), cmake, kodi-addon-dev, libglm-dev, libgles2-mesa-dev [arm64 armhf], libgl1-mesa-dev [i386 amd64] Standards-Version: 4.1.2 Section: libs -Homepage: http://kodi.tv +Homepage: https://kodi.tv Package: kodi-visualization-shadertoy Section: libs diff -Nru kodi-visualization-shadertoy-1.2.3/debian/kodi-visualization-shadertoy.install kodi-visualization-shadertoy-2.3.0/debian/kodi-visualization-shadertoy.install --- kodi-visualization-shadertoy-1.2.3/debian/kodi-visualization-shadertoy.install 2020-07-29 06:48:06.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/kodi-visualization-shadertoy.install 2015-05-23 07:24:22.000000000 +0000 @@ -1,2 +1,2 @@ -usr/lib -usr/share +usr/lib/* +usr/share/* diff -Nru kodi-visualization-shadertoy-1.2.3/debian/rules kodi-visualization-shadertoy-2.3.0/debian/rules --- kodi-visualization-shadertoy-1.2.3/debian/rules 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/rules 2015-05-23 07:24:22.000000000 +0000 @@ -10,10 +10,10 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1 -DUSE_LTO=1 -DCMAKE_INSTALL_PREFIX=/usr + dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=1 -DUSE_LTO=1 override_dh_installdocs: dh_installdocs --link-doc=kodi-visualization-shadertoy diff -Nru kodi-visualization-shadertoy-1.2.3/debian/source/options kodi-visualization-shadertoy-2.3.0/debian/source/options --- kodi-visualization-shadertoy-1.2.3/debian/source/options 2020-07-29 06:48:09.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/debian/source/options 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -extend-diff-ignore = "(^|/)(azure-pipelines.yml|README.md)$" diff -Nru kodi-visualization-shadertoy-1.2.3/depends/windows/angle/0001-fix-uwp.patch kodi-visualization-shadertoy-2.3.0/depends/windows/angle/0001-fix-uwp.patch --- kodi-visualization-shadertoy-1.2.3/depends/windows/angle/0001-fix-uwp.patch 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/depends/windows/angle/0001-fix-uwp.patch 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,263 @@ +diff --git a/commit.h b/commit.h +new file mode 100644 +index 0000000..654e023 +--- /dev/null ++++ b/commit.h +@@ -0,0 +1,3 @@ ++#define ANGLE_COMMIT_HASH "invalid-hash" ++#define ANGLE_COMMIT_HASH_SIZE 12 ++#define ANGLE_COMMIT_DATE "invalid-date" +diff --git a/src/common/system_utils_win.cpp b/src/common/system_utils_win.cpp +index 7db4485..04b6a85 100644 +--- a/src/common/system_utils_win.cpp ++++ b/src/common/system_utils_win.cpp +@@ -37,6 +37,7 @@ const char *GetSharedLibraryExtension() + + Optional GetCWD() + { ++#ifndef ANGLE_ENABLE_WINDOWS_STORE + std::array pathBuf; + DWORD result = GetCurrentDirectoryA(static_cast(pathBuf.size()), pathBuf.data()); + if (result == 0) +@@ -44,11 +45,18 @@ Optional GetCWD() + return Optional::Invalid(); + } + return std::string(pathBuf.data()); ++#else ++ return std::string(); ++#endif + } + + bool SetCWD(const char *dirName) + { ++#ifndef ANGLE_ENABLE_WINDOWS_STORE + return (SetCurrentDirectoryA(dirName) == TRUE); ++#else ++ return false; ++#endif + } + + bool UnsetEnvironmentVar(const char *variableName) +@@ -86,12 +94,14 @@ class Win32Library : public Library + public: + Win32Library(const char *libraryName) + { ++#ifndef ANGLE_ENABLE_WINDOWS_STORE + char buffer[MAX_PATH]; + int ret = snprintf(buffer, MAX_PATH, "%s.%s", libraryName, GetSharedLibraryExtension()); + if (ret > 0 && ret < MAX_PATH) + { + mModule = LoadLibraryA(buffer); + } ++#endif + } + + ~Win32Library() override +diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp +index 2a8d022..36f1f25 100644 +--- a/src/libANGLE/renderer/d3d/RendererD3D.cpp ++++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp +@@ -229,7 +229,9 @@ GLenum DefaultGLErrorCode(HRESULT hr) + { + switch (hr) + { ++#ifdef ANGLE_ENABLE_D3D9 + case D3DERR_OUTOFVIDEOMEMORY: ++#endif + case E_OUTOFMEMORY: + return GL_OUT_OF_MEMORY; + default: +diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +index 9b67ac4..20584e3 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp ++++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +@@ -1192,11 +1192,13 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions + // All D3D feature levels support robust resource init + outExtensions->robustResourceInitialization = true; + ++#ifndef ANGLE_ENABLE_WINDOWS_STORE + // Compositor Native Window capabilies require WinVer >= 1803 + if (CompositorNativeWindow11::IsSupportedWinRelease()) + { + outExtensions->windowsUIComposition = true; + } ++#endif + } + + angle::Result Renderer11::flush(Context11 *context11) +@@ -1270,7 +1272,11 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window, + const egl::Config *config, + const egl::AttributeMap &attribs) const + { +- auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window); ++#ifdef ANGLE_ENABLE_WINDOWS_STORE ++ (void)attribs; ++ return new NativeWindow11WinRT(window, config->alphaSize > 0); ++#else ++ auto useWinUiComp = window != nullptr && !isValidNativeWindow(window); + + if (useWinUiComp) + { +@@ -1278,15 +1284,11 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window, + } + else + { +-#ifdef ANGLE_ENABLE_WINDOWS_STORE +- UNUSED_VARIABLE(attribs); +- return new NativeWindow11WinRT(window, config->alphaSize > 0); +-#else + return new NativeWindow11Win32( + window, config->alphaSize > 0, + attribs.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE); +-#endif + } ++#endif + } + + egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration, +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp +index cb2f279..99b615c 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp +@@ -145,6 +145,7 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) + { + if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 || +@@ -158,7 +159,7 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, + swapChainDesc.Height = height; + swapChainDesc.Format = format; + swapChainDesc.Stereo = FALSE; +- swapChainDesc.SampleDesc.Count = 1; ++ swapChainDesc.SampleDesc.Count = samples; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = + DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER; +@@ -213,10 +214,10 @@ HRESULT GetCoreWindowSizeInPixels(const ComPtr displayProperties; ++ ComPtr displayProperties; + + if (SUCCEEDED(GetActivationFactory( +- HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), ++ HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(), + displayProperties.GetAddressOf()))) + { + float dpi = 96.0f; +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h +index ae57cfb..3262d0a 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h +@@ -35,7 +35,8 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, + DXGI_FORMAT format, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) override; + + protected: +@@ -49,7 +50,7 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, + ComPtr> mPropertyMap; + }; + +-[uuid(7F924F66 - EBAE - 40E5 - A10B - B8F35E245190)] class CoreWindowSizeChangedHandler ++[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)] class CoreWindowSizeChangedHandler + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags, + IWindowSizeChangedEventHandler> +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h +index 708e8a2..9bfa4c4 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h +@@ -53,6 +53,7 @@ class InspectableNativeWindow + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) = 0; + + bool getClientRect(RECT *rect) +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp +index 8972ca2..571955d 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp +@@ -88,6 +88,7 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device, + DXGI_FORMAT format, + UINT width, + UINT height, ++ UINT samples, + IDXGISwapChain **swapChain) + { + if (mImpl) +@@ -95,7 +96,7 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device, + IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject(factory); + IDXGISwapChain1 *swapChain1 = nullptr; + HRESULT result = +- mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, &swapChain1); ++ mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, samples, &swapChain1); + SafeRelease(factory2); + *swapChain = static_cast(swapChain1); + return result; +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h +index eac5b21..92c3121 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h +@@ -34,6 +34,7 @@ class NativeWindow11WinRT : public NativeWindow11 + DXGI_FORMAT format, + UINT width, + UINT height, ++ UINT samples, + IDXGISwapChain **swapChain) override; + + void commitChange() override; +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp +index af0beb6..2fc32f1 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp +@@ -247,6 +247,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) + { + if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 || +@@ -260,7 +261,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, + swapChainDesc.Height = height; + swapChainDesc.Format = format; + swapChainDesc.Stereo = FALSE; +- swapChainDesc.SampleDesc.Count = 1; ++ swapChainDesc.SampleDesc.Count = samples; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = + DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER; +diff --git a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h +index 09642ee..7fc13da 100644 +--- a/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h ++++ b/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h +@@ -28,6 +28,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, + unsigned int width, + unsigned int height, + bool containsAlpha, ++ unsigned int samples, + IDXGISwapChain1 **swapChain) override; + + protected: +@@ -43,7 +44,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, + ComPtr mSwapChain; + }; + +-[uuid(8ACBD974 - 8187 - 4508 - AD80 - AEC77F93CF36)] class SwapChainPanelSizeChangedHandler ++[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)] class SwapChainPanelSizeChangedHandler + : public Microsoft::WRL::RuntimeClass< + Microsoft::WRL::RuntimeClassFlags, + ABI::Windows::UI::Xaml::ISizeChangedEventHandler> +-- +2.20.1.windows.1 + diff -Nru kodi-visualization-shadertoy-1.2.3/depends/windows/angle/angle.sha256 kodi-visualization-shadertoy-2.3.0/depends/windows/angle/angle.sha256 --- kodi-visualization-shadertoy-1.2.3/depends/windows/angle/angle.sha256 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/depends/windows/angle/angle.sha256 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1 @@ +28836135bd7549c01d7d07ae5a0a0956096f2c63355cf243ef306b2213bd91ae diff -Nru kodi-visualization-shadertoy-1.2.3/depends/windows/angle/angle.txt kodi-visualization-shadertoy-2.3.0/depends/windows/angle/angle.txt --- kodi-visualization-shadertoy-1.2.3/depends/windows/angle/angle.txt 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/depends/windows/angle/angle.txt 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1 @@ +angle https://github.com/google/angle/archive/chromium/3712.tar.gz diff -Nru kodi-visualization-shadertoy-1.2.3/depends/windows/angle/CMakeLists.txt kodi-visualization-shadertoy-2.3.0/depends/windows/angle/CMakeLists.txt --- kodi-visualization-shadertoy-1.2.3/depends/windows/angle/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/depends/windows/angle/CMakeLists.txt 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,359 @@ +cmake_minimum_required(VERSION 3.8) +project(angle) + +message(STATUS "Used CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Used CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") +message(STATUS "Used CMAKE_HOST_SYSTEM_VERSION: ${CMAKE_HOST_SYSTEM_VERSION}") + +if(CMAKE_SYSTEM_VERSION VERSION_LESS 10.0.16299.0) + message(FATAL_ERROR "Minimal Windows system version must be: 10.0.16299.0") +endif() + +# Force package name to kodi, e.g. BUILD_KODI_ADDON not defined on addon depends build! +if(NOT PACKAGE_NAME) + set(PACKAGE_NAME "kodi") +endif() + +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) + cmake_policy(SET CMP0076 NEW) +endif() + +option(ANGLE_ENABLE_NULL "Enable null renderer" OFF) +# windows options +option(ANGLE_ENABLE_D3D9 "Enable support D3D9 renderer (Windows desktop only)" OFF) +option(ANGLE_ENABLE_WGL "Enable support OpenGL renderer on Windows" OFF) + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + add_definitions(-DANGLE_IS_32_BIT_CPU) +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_definitions(-DANGLE_IS_64_BIT_CPU) +else() + message(FATAL_ERROR "Unknown current CPU bit size: ${CMAKE_SIZEOF_VOID_P}") +endif() + +if(WIN32 AND NOT WINDOWS_STORE) + set(WINDOWS_DESKTOP TRUE) +else() + set(WINDOWS_DESKTOP FALSE) +endif() +if (WINDOWS_DESKTOP OR WINDOWS_STORE) + set(IS_WIN 1) + set(WINDOWS_ANY TRUE) +else() + set(WINDOWS_ANY FALSE) +endif() + +if(UNIX AND NOT APPLE) + set(LINUX TRUE) +else() + set(LINUX FALSE) +endif() + +if(CMAKE_BUILD_TYPE MATCHES DEBUG) + set(IS_DEBUG TRUE) +else() + set(IS_DEBUG FALSE) +endif() + +if(WINDOWS_ANY) + add_compile_options(/d2guard4 /Wv:18 /guard:cf) +else() + add_compile_options(-std=c++17 -fPIC) +endif() + +if(APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework IOSurface -framework QuartzCore -framework CoreGraphics") +endif() + +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") +set(CMAKE_STATIC_LIBRARY_PREFIX "") +set(CMAKE_DEBUG_POSTFIX "_dbg") + +# if BUILD_SHARED_LIBS is undefined comes it to a cmake build error, set it as default to 0. +if(NOT DEFINED BUILD_SHARED_LIBS) + set(BUILD_SHARED_LIBS 0) +endif() + +add_definitions( + -D_CRT_SECURE_NO_DEPRECATE + -D_SCL_SECURE_NO_WARNINGS + -D_HAS_EXCEPTIONS=0 + -DNOMINMAX + -DANGLE_STANDALONE_BUILD) +if(IS_DEBUG) + add_definitions(-DANGLE_ENABLE_DEBUG_ANNOTATIONS) +endif() +if(DCHECK_ALWAYS_ON) + add_definitions(-DANGLE_ENABLE_RELEASE_ASSERTS) +endif() + +# Shared library function visibility +if(IS_WIN) + set(ANGLE_GL_VISIBILITY_CONFIG GL_APICALL= + GL_API=) +else() + set(ANGLE_GL_VISIBILITY_CONFIG GL_APICALL=__attribute__((visibility(\"default\"))) + GL_API=__attribute__((visibility(\"default\")))) +endif() + +# This config controls export definitions on ANGLE API calls. +set(ANGLE_STATIC_DEFINES ANGLE_EXPORT= + ANGLE_UTIL_EXPORT= + EGLAPI= + GL_APICALL= + GL_API=) + +set(GL_PROTOTYPES GL_GLES_PROTOTYPES=1 + EGL_EGL_PROTOTYPES=1 + GL_GLEXT_PROTOTYPES + EGL_EGLEXT_PROTOTYPES + HAS_ANGLE) + +########## +# Generate required commit.h file +set(COMMIT_H + "#define ANGLE_COMMIT_HASH \"invalid-hash\"\n" + "#define ANGLE_COMMIT_HASH_SIZE 12\n" + "#define ANGLE_COMMIT_DATE \"invalid-date\"\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/include/id/commit.h ${COMMIT_H}) +include_directories(include ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/src/common/third_party/base + ${CMAKE_CURRENT_BINARY_DIR}/include) + +########## +# Load angle source list by translating *.gni's to cmake format +set(GNI_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/compiler.gni + ${CMAKE_CURRENT_SOURCE_DIR}/src/libGLESv2.gni + ${CMAKE_CURRENT_SOURCE_DIR}/src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni + ${CMAKE_CURRENT_SOURCE_DIR}/util/util.gni) + +set(ANGLE_SOURCE_FILES "") +foreach(file ${GNI_FILES}) + get_filename_component(fullpath "${file}" ABSOLUTE) + get_filename_component(file "${file}" NAME_WE) + + file(READ ${fullpath} CONTENT_GNI) + string(REGEX REPLACE "([0-9a-z_]+)([^a-z]+)([*^\=)])" "set(\\1 XXXYYY \\1 ZZZ" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "is_win" "IS_WIN" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "is_linux" "IS_LINUX" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "is_android" "IS_ANDROID" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "is_fuchsia" "IS_FUCHSIA" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "is_mac" "IS_MAC" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "||" "OR" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "}" "endif()" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE " {" "" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "\"," "" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "\"" "" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE " [" "" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "]" ")" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE " ZZZ" "}" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "YYY " "{" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE "XXX" "$" CONTENT_GNI ${CONTENT_GNI}) + if(CMAKE_VERSION VERSION_LESS 3.13) + string(REPLACE " src/" " \${CMAKE_CURRENT_SOURCE_DIR}/src/" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE " include/" " \${CMAKE_CURRENT_SOURCE_DIR}/include/" CONTENT_GNI ${CONTENT_GNI}) + string(REPLACE " util/" " \${CMAKE_CURRENT_SOURCE_DIR}/util/" CONTENT_GNI ${CONTENT_GNI}) + endif() + file(WRITE ${CMAKE_BINARY_DIR}/angleSourceList-${file}.cmake ${CONTENT_GNI}) + list(APPEND ANGLE_SOURCE_FILES ${CMAKE_BINARY_DIR}/angleSourceList-${file}.cmake) +endforeach() + +foreach(file ${ANGLE_SOURCE_FILES}) + include(${file}) +endforeach() + +########## +# angle::angle_system_utils +add_library(angle_system_utils OBJECT ${angle_system_utils_sources}) +add_library(angle::system_utils ALIAS angle_system_utils) + +########## +# angle::xxhash +add_library(angle_xxhash OBJECT ${xxhash_sources}) +add_library(angle::xxhash ALIAS angle_xxhash) + +########## +# angle::common +add_library(angle_common OBJECT ${libangle_common_sources} + ${libangle_includes} + ${CMAKE_SOURCE_DIR}/src/common/version.h) +add_library(angle::common ALIAS angle_common) + +########## +# angle::image_util +add_library(angle_image_util OBJECT ${libangle_image_util_sources}) +add_library(angle::image_util ALIAS angle_image_util) + +########## +# angle::preprocessor +add_library(angle_preprocessor OBJECT ${angle_preprocessor_sources}) +add_library(angle::preprocessor ALIAS angle_preprocessor) + +########## +# angle::translator +add_library(angle_translator OBJECT ${angle_translator_sources} + ${angle_translator_essl_sources} + ${angle_translator_glsl_sources} + ${angle_translator_hlsl_sources}) +target_compile_definitions(angle_translator PUBLIC ANGLE_ENABLE_ESSL + ANGLE_ENABLE_GLSL + ANGLE_ENABLE_HLSL) +add_library(angle::translator ALIAS angle_translator) + +########## +# libANGLE + +## OpenGL Renderer +if((WINDOWS_DESKTOP AND ANGLE_ENABLE_WGL) OR LINUX OR APPLE) + add_library(angle_renderer_opengl INTERFACE) + if(WINDOWS_DESKTOP) + target_sources(angle_renderer_opengl INTERFACE $ + $) + elseif(APPLE) + target_sources(angle_renderer_opengl INTERFACE $ + $) + elseif(LINUX) + target_sources(angle_renderer_opengl INTERFACE $ + $) + endif() + + target_compile_definitions(angle_renderer_opengl INTERFACE ANGLE_ENABLE_OPENGL) + add_library(angle::renderer::opengl ALIAS angle_renderer_opengl) +endif() + +# D3D Renderers +if(WINDOWS_ANY) + ## WinRT D3D Renderer + if(WINDOWS_STORE) + add_library(angle_renderer_winrt INTERFACE) + target_sources(angle_renderer_winrt INTERFACE $) + target_link_libraries(angle_renderer_winrt INTERFACE d3dcompiler.lib) + add_library(angle::renderer::winrt ALIAS angle_renderer_winrt) + endif() + + ## Win32/d3d9 D3D Renderer + if(WINDOWS_DESKTOP AND ANGLE_ENABLE_D3D9) + add_library(angle_renderer_win32 INTERFACE) + target_sources(angle_renderer_win32 INTERFACE $ + $) + target_compile_definitions(angle_renderer_win32 INTERFACE ANGLE_ENABLE_D3D9) + target_link_libraries(angle_renderer_win32 INTERFACE d3d9.lib) + add_library(angle::renderer::win32 ALIAS angle_renderer_win32) + list(APPEND ANGLE_DEPEND_LIBRARIES d3d9.lib) + endif() + + ## D3D11 Base renderer + add_library(angle_renderer_d3d INTERFACE) + target_sources(angle_renderer_d3d INTERFACE $ + $ + $) + if(WINDOWS_DESKTOP) + target_sources(angle_renderer_d3d INTERFACE $) + endif() + target_compile_definitions(angle_renderer_d3d INTERFACE + ANGLE_ENABLE_D3D11 + "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" + ) + target_link_libraries(angle_renderer_d3d INTERFACE d3d11.lib dxguid.lib) + add_library(angle::renderer::d3d ALIAS angle_renderer_d3d) + list(APPEND ANGLE_DEPEND_LIBRARIES d3d11.lib dxguid.lib) +endif() + +## Core libANGLE library +if(LINUX OR APPLE) + set(LIBANGLE_RENDERER_PLATFORM + $ + ) +elseif(WINDOWS_STORE) + set(LIBANGLE_RENDERER_PLATFORM + $ + $ + ) +elseif(WINDOWS_DESKTOP) + set(LIBANGLE_RENDERER_PLATFORM + $ + $<$:$> + $<$:$> + gdi32 + ) +else() + set(LIBANGLE_RENDERER_PLATFORM ) +endif() + +if(ANGLE_ENABLE_NULL) + add_library(angle_renderer_null INTERFACE) + target_sources(angle_renderer_null INTERFACE $ + $) + add_library(angle::renderer::null ALIAS angle_renderer_null) + list(APPEND LIBANGLE_RENDERER_PLATFORM $) +endif() + +add_library(libANGLE INTERFACE) +target_sources(libANGLE INTERFACE $ + $ + $ + $ + $ + $ + $) +target_link_libraries(libANGLE INTERFACE ${LIBANGLE_RENDERER_PLATFORM}) +target_include_directories(libANGLE INTERFACE $) +target_compile_definitions(libANGLE INTERFACE LIBANGLE_IMPLEMENTATION + $<$:ANGLE_ENABLE_NULL> + $<$:ANGLE_USE_X11>) +add_library(angle::libANGLE ALIAS libANGLE) + +########## +# libGLESv2 +add_library(libGLESv2 ${libglesv2_sources} + ${libangle_includes} + ${CMAKE_CURRENT_SOURCE_DIR}/src/libGLESv2/libGLESv2_autogen.def) +target_link_libraries(libGLESv2 PRIVATE $ + ${ANGLE_DEPEND_LIBRARIES}) +if(BUILD_SHARED_LIBS) + target_compile_definitions(libGLESv2 PRIVATE LIBGLESV2_IMPLEMENTATION + ${GL_PROTOTYPES} + ${ANGLE_GL_VISIBILITY_CONFIG}) +else() + target_compile_definitions(libGLESv2 PRIVATE LIBGLESV2_IMPLEMENTATION + ${GL_PROTOTYPES} + PUBLIC ${ANGLE_STATIC_DEFINES}) +endif() +target_include_directories(libGLESv2 PUBLIC $) +target_compile_definitions(libGLESv2 PUBLIC $) + +########## +# libEGL +add_library(libEGL ${libegl_sources} + ${libangle_includes} + $<$:${CMAKE_CURRENT_SOURCE_DIR}/src/libEGL/libEGL.def>) +target_link_libraries(libEGL PUBLIC libGLESv2) +target_include_directories(libEGL PUBLIC $) + +########## +# Angle installation +set_target_properties(libGLESv2 PROPERTIES PREFIX "") +set_target_properties(libEGL PROPERTIES PREFIX "") + +install(TARGETS libGLESv2 + libEGL + EXPORT ANGLEExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(EXPORT ANGLEExport + FILE ${PACKAGE_NAME}-angle-config.cmake + NAMESPACE ${PACKAGE_NAME}::angle:: + DESTINATION share/${PACKAGE_NAME}-angle) + +if(NOT DISABLE_INSTALL_HEADERS) + install(DIRECTORY include/ + DESTINATION include + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.inc" + PATTERN "GLSLANG" EXCLUDE + PATTERN "export.h" EXCLUDE) +endif() diff -Nru kodi-visualization-shadertoy-1.2.3/depends/windows/angle/flags.txt kodi-visualization-shadertoy-2.3.0/depends/windows/angle/flags.txt --- kodi-visualization-shadertoy-1.2.3/depends/windows/angle/flags.txt 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/depends/windows/angle/flags.txt 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1 @@ +-DCMAKE_SYSTEM_VERSION=10.0.17763.0 diff -Nru kodi-visualization-shadertoy-1.2.3/Findglm.cmake kodi-visualization-shadertoy-2.3.0/Findglm.cmake --- kodi-visualization-shadertoy-1.2.3/Findglm.cmake 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/Findglm.cmake 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,25 @@ +#.rst: +# Findglm +# ------------ +# Finds the OpenGL Mathematics (GLM) as a header only C++ mathematics library. +# +# This will define the following variables: +# +# GLM_FOUND - system has OpenGLES +# GLM_INCLUDE_DIR - the OpenGLES include directory +# +# Note: Install was removed from GLM on version 0.9.9.6. + +find_package(PkgConfig) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_GLM glm QUIET) +endif() + +find_path(GLM_INCLUDE_DIR glm.hpp + PATHS ${PC_GLM_INCLUDEDIR} + PATH_SUFFIXES glm) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(glm REQUIRED_VARS GLM_INCLUDE_DIR) + +mark_as_advanced(GLM_INCLUDE_DIR) diff -Nru kodi-visualization-shadertoy-1.2.3/FindOpenGLES.cmake kodi-visualization-shadertoy-2.3.0/FindOpenGLES.cmake --- kodi-visualization-shadertoy-1.2.3/FindOpenGLES.cmake 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/FindOpenGLES.cmake 2015-05-23 07:24:22.000000000 +0000 @@ -10,47 +10,60 @@ # OPENGLES_LIBRARIES - the OpenGLES libraries # OPENGLES_DEFINITIONS - the OpenGLES definitions # - -if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) - set(_brcmprefix brcm) -endif() - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_OPENGLES ${_brcmprefix}glesv2 QUIET) -endif() - -if(NOT CORE_SYSTEM_NAME STREQUAL ios AND - NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded) - find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h - PATHS ${PC_OPENGLES_INCLUDEDIR}) - find_library(OPENGLES_gl_LIBRARY NAMES ${_brcmprefix}GLESv2 - PATHS ${PC_OPENGLES_LIBDIR}) +# Note: +# On Windows with angle the *_INCLUDE_DIRS and +# *_DEFINITIONS are undefined, but are set +# global by the kodi-angle package. + +if(WIN32) + # defined here and not on addon to have it free of OS related 'if' + # and this file as standard for addons where need it + find_package(kodi-angle REQUIRED) + set(OPENGLES_LIBRARIES kodi::angle::libGLESv2 kodi::angle::libEGL) + set(OPENGLES_FOUND ${kodi-angle_FOUND}) + set(OPENGLES_DEFINITIONS -DHAS_GLES=3) else() - find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES - PATHS ${CMAKE_OSX_SYSROOT}/System/Library - PATH_SUFFIXES Frameworks - NO_DEFAULT_PATH) - set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers) -endif() + if(CORE_PLATFORM_NAME_LC STREQUAL rbpi) + set(_brcmprefix brcm) + endif() -find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_OPENGLES ${_brcmprefix}glesv2 QUIET) + endif() -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(OpenGLES - REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_INCLUDE_DIR) - -find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h - PATHS ${PC_OPENGLES_INCLUDEDIR}) - -if(OPENGLES_FOUND) - set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY}) - if(OPENGLES3_INCLUDE_DIR) - set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR} ${OPENGLES3_INCLUDE_DIR}) - set(OPENGLES_DEFINITIONS -DHAS_GLES=3) - mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES3_INCLUDE_DIR OPENGLES_gl_LIBRARY) + if(NOT CORE_SYSTEM_NAME STREQUAL ios AND + NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded) + find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h + PATHS ${PC_OPENGLES_INCLUDEDIR}) + find_library(OPENGLES_gl_LIBRARY NAMES ${_brcmprefix}GLESv2 + PATHS ${PC_OPENGLES_LIBDIR}) else() - set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR}) - set(OPENGLES_DEFINITIONS -DHAS_GLES=2) - mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY) + find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + PATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) + set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers) + endif() + + find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(OpenGLES + REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_INCLUDE_DIR) + + find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h + PATHS ${PC_OPENGLES_INCLUDEDIR}) + + if(OPENGLES_FOUND) + set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY}) + if(OPENGLES3_INCLUDE_DIR) + set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR} ${OPENGLES3_INCLUDE_DIR}) + set(OPENGLES_DEFINITIONS -DHAS_GLES=3) + mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES3_INCLUDE_DIR OPENGLES_gl_LIBRARY) + else() + set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR}) + set(OPENGLES_DEFINITIONS -DHAS_GLES=2) + mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY) + endif() endif() endif() diff -Nru kodi-visualization-shadertoy-1.2.3/Jenkinsfile kodi-visualization-shadertoy-2.3.0/Jenkinsfile --- kodi-visualization-shadertoy-1.2.3/Jenkinsfile 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/Jenkinsfile 2015-05-23 07:24:22.000000000 +0000 @@ -1 +1 @@ -buildPlugin(version: "Leia", platforms: ['android-armv7', 'android-aarch64', 'windows-i686', 'windows-x86_64']) +buildPlugin(version: "Matrix") diff -Nru kodi-visualization-shadertoy-1.2.3/lib/kodi/gui/gl/GL.h kodi-visualization-shadertoy-2.3.0/lib/kodi/gui/gl/GL.h --- kodi-visualization-shadertoy-1.2.3/lib/kodi/gui/gl/GL.h 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/lib/kodi/gui/gl/GL.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -//============================================================================== -/// -/// \defgroup cpp_kodi_gui_gl OpenGL helpers -/// \ingroup cpp_kodi_gui -/// \brief Auxiliary functions for Open GL -/// -/// This group includes help for definitions, functions, and classes for -/// OpenGL. -/// -/// To use OpenGL for your system, add the \ref GL.h "#include ". -/// -/// -///----------------------------------------------------------------------------- -/// -/// The \ref HAS_GL is declared if Open GL is required and \ref HAS_GLES if Open GL -/// Embedded Systems (ES) is required, with ES the version is additionally given -/// in the definition, this can be "2" or "3". -/// -/// -///----------------------------------------------------------------------------- -/// -/// Following \ref GL_TYPE_STRING define can be used, for example, to manage -/// different folders for GL and GLES and make the selection easier. -/// This are on OpenGL "GL" and on Open GL|ES "GLES". -/// -/// **Example:** -/// ~~~~~~~~~~~~~~~~~{.cpp} -/// kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/frag.glsl"); -/// ~~~~~~~~~~~~~~~~~ -/// -/// -///---------------------------------------------------------------------------- -/// -/// In addition, \ref BUFFER_OFFSET is declared in it which can be used to give an -/// offset on the array to GL. -/// -/// **Example:** -/// ~~~~~~~~~~~~~~~~~{.cpp} -/// const struct PackedVertex { -/// float position[3]; // Position x, y, z -/// float color[4]; // Color r, g, b, a -/// } vertices[3] = { -/// { { -0.5f, -0.5f, 0.0f }, { 1.0f, 0.0f, 0.0f, 1.0f } }, -/// { { 0.5f, -0.5f, 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } }, -/// { { 0.0f, 0.5f, 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } } -/// }; -/// -/// glVertexAttribPointer(m_aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, position))); -/// glEnableVertexAttribArray(m_aPosition); -/// -/// glVertexAttribPointer(m_aColor, 4, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, color))); -/// glEnableVertexAttribArray(m_aColor); -/// ~~~~~~~~~~~~~~~~~ - -#if HAS_GL - #define GL_TYPE_STRING "GL" - // always define GL_GLEXT_PROTOTYPES before include gl headers - #if !defined(GL_GLEXT_PROTOTYPES) - #define GL_GLEXT_PROTOTYPES - #endif - #if defined(TARGET_LINUX) - #include - #include - #elif defined(TARGET_FREEBSD) - #include - #elif defined(TARGET_DARWIN) - #include - #include - #elif defined(WIN32) - #error Use of GL under Windows is not possible - #endif -#elif HAS_GLES >= 2 - #define GL_TYPE_STRING "GLES" - #if defined(WIN32) - #if defined(HAS_ANGLE) - #include - #else - #error Use of GLES only be available under Windows by the use of angle - #endif - #elif defined(TARGET_DARWIN) - #if HAS_GLES == 3 - #include - #include - #else - #include - #include - #endif - #else - #if HAS_GLES == 3 - #include - #include - #else - #include - #include - #endif - #endif -#endif - -#ifndef BUFFER_OFFSET -#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) -#endif diff -Nru kodi-visualization-shadertoy-1.2.3/lib/kodi/gui/gl/Shader.h kodi-visualization-shadertoy-2.3.0/lib/kodi/gui/gl/Shader.h --- kodi-visualization-shadertoy-1.2.3/lib/kodi/gui/gl/Shader.h 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/lib/kodi/gui/gl/Shader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,594 +0,0 @@ -/* - * Copyright (C) 2005-2019 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "GL.h" - -#include -#include -#include - -#include -#include - -#define LOG_SIZE 1024 -#define GLchar char - -namespace kodi -{ -namespace gui -{ -namespace gl -{ - -//======================================================================== -/// CShader - base class -class ATTRIBUTE_HIDDEN CShader -{ -public: - CShader() = default; - virtual ~CShader() = default; - virtual bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") = 0; - virtual void Free() = 0; - virtual GLuint Handle() = 0; - - bool LoadSource(const std::string& file) - { - char buffer[16384]; - - kodi::vfs::CFile source; - if (!source.OpenFile(file)) - { - kodi::Log(ADDON_LOG_ERROR, "CShader::%s: Failed to open file '%s'", __FUNCTION__, file.c_str()); - return false; - } - size_t len = source.Read(buffer, sizeof(buffer)); - m_source.assign(buffer); - m_source[len] = 0; - source.Close(); - return true; - } - - bool OK() const { return m_compiled; } - -protected: - std::string m_source; - std::string m_lastLog; - bool m_compiled = false; -}; -//------------------------------------------------------------------------ - -//======================================================================== -/// CVertexShader -class ATTRIBUTE_HIDDEN CVertexShader : public CShader -{ -public: - CVertexShader() = default; - ~CVertexShader() override { Free(); } - - void Free() override - { - if (m_vertexShader) - glDeleteShader(m_vertexShader); - m_vertexShader = 0; - } - - bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") override - { - GLint params[4]; - - Free(); - - m_vertexShader = glCreateShader(GL_VERTEX_SHADER); - - GLsizei count = 0; - const char *sources[3]; - if (!extraBegin.empty()) - sources[count++] = extraBegin.c_str(); - if (!m_source.empty()) - sources[count++] = m_source.c_str(); - if (!extraEnd.empty()) - sources[count++] = extraEnd.c_str(); - - glShaderSource(m_vertexShader, count, sources, nullptr); - glCompileShader(m_vertexShader); - glGetShaderiv(m_vertexShader, GL_COMPILE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CVertexShader::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CVertexShader::%s: %s\n", __FUNCTION__, log); - m_lastLog = log; - m_compiled = false; - } - else - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_vertexShader, LOG_SIZE, nullptr, log); - m_lastLog = log; - m_compiled = true; - } - return m_compiled; - } - - GLuint Handle() override { return m_vertexShader; } - -protected: - GLuint m_vertexShader = 0; -}; -//------------------------------------------------------------------------ - -//======================================================================== -/// CPixelShader -class ATTRIBUTE_HIDDEN CPixelShader : public CShader -{ -public: - CPixelShader() = default; - ~CPixelShader() { Free(); } - void Free() override - { - if (m_pixelShader) - glDeleteShader(m_pixelShader); - m_pixelShader = 0; - } - - bool Compile(const std::string& extraBegin = "", - const std::string& extraEnd = "") override - { - GLint params[4]; - - Free(); - - m_pixelShader = glCreateShader(GL_FRAGMENT_SHADER); - - GLsizei count = 0; - const char *sources[3]; - if (!extraBegin.empty()) - sources[count++] = extraBegin.c_str(); - if (!m_source.empty()) - sources[count++] = m_source.c_str(); - if (!extraEnd.empty()) - sources[count++] = extraEnd.c_str(); - - glShaderSource(m_pixelShader, count, sources, 0); - glCompileShader(m_pixelShader); - glGetShaderiv(m_pixelShader, GL_COMPILE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CPixelShader::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CPixelShader::%s: %s\n", __FUNCTION__, log); - m_lastLog = log; - m_compiled = false; - } - else - { - GLchar log[LOG_SIZE]; - glGetShaderInfoLog(m_pixelShader, LOG_SIZE, nullptr, log); - m_lastLog = log; - m_compiled = true; - } - return m_compiled; - } - - GLuint Handle() override { return m_pixelShader; } - -protected: - GLuint m_pixelShader = 0; -}; -//------------------------------------------------------------------------ - -//============================================================================ -/// -/// \defgroup cpp_kodi_gui_gl_CShaderProgram GL Shader Program -/// \ingroup cpp_kodi_gui_gl -/// @brief \cpp_class{ kodi::gui::gl::CShaderProgram } -/// **Class to manage an OpenGL shader program** -/// -/// With this class the used GL shader code can be defined on the GPU and -/// its variables can be managed between CPU and GPU. -/// -/// It has the header \ref Shader.h "#include " -/// be included to enjoy it. -/// -/// ---------------------------------------------------------------------------- -/// -/// Example: -/// -/// ~~~~~~~~~~~~~{.cpp} -/// -/// #include -/// ... -/// -/// class ATTRIBUTE_HIDDEN CExample -/// : ..., -/// public kodi::gui::gl::CShaderProgram -/// { -/// public: -/// CExample() = default; -/// -/// bool Start(); -/// void Render(); -/// -/// // override functions for kodi::gui::gl::CShaderProgram -/// void OnCompiledAndLinked() override; -/// bool OnEnabled() override; -/// -/// private: -/// ... -/// GLint m_aPosition = -1; -/// GLint m_aColor = -1; -/// }; -/// -/// bool CExample::Start() -/// { -/// // Define shaders and load -/// std::string fraqShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.frag"); -/// std::string vertShader = kodi::GetAddonPath("resources/shaders/" GL_TYPE_STRING "/glsl.vert"); -/// if (!LoadShaderFiles(vertShader, fraqShader) || !CompileAndLink()) -/// return false; -/// -/// ... -/// return true; -/// } -/// -/// ... -/// -/// void CExample::Render() -/// { -/// ... -/// -/// EnableShader(); -/// ... -/// DO WORK -/// ... -/// DisableShader(); -/// } -/// -/// void CExample::OnCompiledAndLinked() -/// { -/// ... -/// DO YOUR WORK HERE FOR WHAT IS ONE TIME REQUIRED DURING COMPILE OF SHADER, E.G.: -/// -/// m_aPosition = glGetAttribLocation(ProgramHandle(), "a_position"); -/// m_aColor = glGetAttribLocation(ProgramHandle(), "a_color"); -/// } -/// -/// bool OnEnabled() override -/// { -/// ... -/// DO YOUR WORK HERE FOR WHAT REQUIRED DURING ENABLE OF SHADER -/// ... -/// return true; -/// } -/// -/// ADDONCREATOR(CExample); -/// ~~~~~~~~~~~~~ -/// - -//======================================================================== -/// CShaderProgram -class ATTRIBUTE_HIDDEN CShaderProgram -{ -public: - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Construct a new shader - /// - /// Load must be done later with \ref LoadShaderFiles. - /// - CShaderProgram() = default; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Construct a new shader and load defined shader files - /// - /// @param[in] vert Path to used GL vertext shader - /// @param[in] frag Path to used GL fragment shader - /// - CShaderProgram(const std::string& vert, const std::string& frag) - { - LoadShaderFiles(vert, frag); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Destructor - /// - virtual ~CShaderProgram() - { - ShaderFree(); - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To load manually the needed shader files - /// - /// @param[in] vert Path to used GL vertext shader - /// @param[in] frag Path to used GL fragment shader - /// - /// - /// @note The use of the files is optional, but it must either be passed over - /// here or via \ref CompileAndLink, or both of the source code. - /// - bool LoadShaderFiles(const std::string& vert, const std::string& frag) - { - if (!kodi::vfs::FileExists(vert) || !m_pVP.LoadSource(vert)) - { - kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, vert.c_str()); - return false; - } - - if (!kodi::vfs::FileExists(frag) || !m_pFP.LoadSource(frag)) - { - kodi::Log(ADDON_LOG_ERROR, "%s: Failed to load '%s'", __func__, frag.c_str()); - return false; - } - - return true; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To compile and link the shader to the GL interface - /// - /// Optionally, additional source code can be transferred here, or it can be - /// used independently without any files - /// - /// @param[in] vertexExtraBegin [opt] To additionally add vextex source - /// code to the beginning of the loaded file - /// source code - /// @param[in] vertexExtraEnd [opt] To additionally add vextex source - /// code to the end of the loaded file - /// source code - /// @param[in] fragmentExtraBegin [opt] To additionally add fragment source - /// code to the beginning of the loaded file - /// source code - /// @param[in] fragmentExtraEnd [opt] To additionally add fragment source - /// code to the end of the loaded file - /// source code - /// @return true if compile was successed - /// - /// - /// @note In the case of a compile error, it will be written once into the Kodi - /// log and in addition to the console output to quickly detect the errors when - /// writing the damage. - /// - /// - bool CompileAndLink(const std::string& vertexExtraBegin = "", - const std::string& vertexExtraEnd = "", - const std::string& fragmentExtraBegin = "", - const std::string& fragmentExtraEnd = "") - { - GLint params[4]; - - // free resources - ShaderFree(); - m_ok = false; - - // compiled vertex shader - if (!m_pVP.Compile(vertexExtraBegin, vertexExtraEnd)) - { - kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling vertex shader"); - return false; - } - - // compile pixel shader - if (!m_pFP.Compile(fragmentExtraBegin, fragmentExtraEnd)) - { - m_pVP.Free(); - kodi::Log(ADDON_LOG_ERROR, "GL: Error compiling fragment shader"); - return false; - } - - // create program object - m_shaderProgram = glCreateProgram(); - if (!m_shaderProgram) - { - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: Failed to create GL program", __FUNCTION__); - ShaderFree(); - return false; - } - - // attach the vertex shader - glAttachShader(m_shaderProgram, m_pVP.Handle()); - glAttachShader(m_shaderProgram, m_pFP.Handle()); - - // link the program - glLinkProgram(m_shaderProgram); - glGetProgramiv(m_shaderProgram, GL_LINK_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log); - ShaderFree(); - return false; - } - - m_validated = false; - m_ok = true; - OnCompiledAndLinked(); - return true; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To activate the shader and use it on the GPU - /// - /// @return true if enable was successfull done - /// - /// - /// @note During this call, the \ref OnEnabled stored in the child is also - /// called - /// - bool EnableShader() - { - if (ShaderOK()) - { - glUseProgram(m_shaderProgram); - if (OnEnabled()) - { - if (!m_validated) - { - // validate the program - GLint params[4]; - glValidateProgram(m_shaderProgram); - glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params); - if (params[0] != GL_TRUE) - { - GLchar log[LOG_SIZE]; - glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log); - kodi::Log(ADDON_LOG_ERROR, "CShaderProgram::%s: %s", __FUNCTION__, log); - fprintf(stderr, "CShaderProgram::%s: %s\n", __FUNCTION__, log); - } - m_validated = true; - } - return true; - } - else - { - glUseProgram(0); - return false; - } - return true; - } - return false; - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To deactivate the shader use on the GPU - /// - void DisableShader() - { - if (ShaderOK()) - { - glUseProgram(0); - OnDisabled(); - } - } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Used to check if shader has been loaded before. - /// - /// @return true if enable was successfull done - /// - /// @note The CompileAndLink call sets these values - /// - ATTRIBUTE_FORCEINLINE bool ShaderOK() const { return m_ok; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To get the vertex shader class used by Kodi at the addon - /// - /// @return pointer to vertex shader class - /// - ATTRIBUTE_FORCEINLINE CVertexShader& VertexShader() { return m_pVP; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief To get the fragment shader class used by Kodi at the addon - /// - /// @return pointer to fragment shader class - /// - ATTRIBUTE_FORCEINLINE CPixelShader& PixelShader() { return m_pFP; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief Used to get the definition created in the OpenGL itself - /// - /// @return GLuint of GL shader program handler - /// - ATTRIBUTE_FORCEINLINE GLuint ProgramHandle() { return m_shaderProgram; } - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \defgroup cpp_kodi_gui_gl_CShaderProgram_child Child Functions - /// \ingroup cpp_kodi_gui_gl_CShaderProgram - /// @brief \cpp_class{ kodi::gui::gl::CShaderProgram child functions } - /// - /// Functions that are added by parent in the child - //@{ - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Mandatory child function to set the necessary CPU to GPU data - /// - virtual void OnCompiledAndLinked() {}; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Optional function to exchange data between CPU and GPU while - /// activating the shader - /// - /// @return true if enable was successfull done - /// - virtual bool OnEnabled() { return true; }; - //-------------------------------------------------------------------------- - - //========================================================================== - /// - /// \ingroup cpp_kodi_gui_gl_CShaderProgram_child - /// @brief Optional child function that may have to be performed when - /// switching off the shader - virtual void OnDisabled() {}; - //-------------------------------------------------------------------------- - //@} - -private: - void ShaderFree() - { - if (m_shaderProgram) - glDeleteProgram(m_shaderProgram); - m_shaderProgram = 0; - m_ok = false; - } - - CVertexShader m_pVP; - CPixelShader m_pFP; - GLuint m_shaderProgram = 0; - bool m_ok = false; - bool m_validated = false; -}; -//------------------------------------------------------------------------ - -} /* namespace gl */ -} /* namespace gui */ -} /* namespace kodi */ diff -Nru kodi-visualization-shadertoy-1.2.3/LICENSE.md kodi-visualization-shadertoy-2.3.0/LICENSE.md --- kodi-visualization-shadertoy-1.2.3/LICENSE.md 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/LICENSE.md 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,264 @@ +The GNU General Public License, Version 2, June 1991 (GPLv2) +============================================================ + +> Copyright (C) 1989, 1991 Free Software Foundation, Inc. +> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + + +Preamble +-------- + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to most +of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software is +covered by the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for this service if you wish), +that you receive source code or can get it if you want it, that you can change +the software or use pieces of it in new free programs; and that you know you can +do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny +you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of the +software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must give the recipients all the rights that you have. You must make +sure that they, too, receive or can get the source code. And you must show them +these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer +you this license which gives you legal permission to copy, distribute and/or +modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If the +software is modified by someone else and passed on, we want its recipients to +know that what they have is not the original, so that any problems introduced by +others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish +to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's free +use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + + +Terms And Conditions For Copying, Distribution And Modification +--------------------------------------------------------------- + +**0.** This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms of +this General Public License. The "Program", below, refers to any such program or +work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is included without +limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by +this License; they are outside its scope. The act of running the Program is not +restricted, and the output from the Program is covered only if its contents +constitute a work based on the Program (independent of having been made by +running the Program). Whether that is true depends on what the Program does. + +**1.** You may copy and distribute verbatim copies of the Program's source code +as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and give any other recipients of the Program +a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at +your option offer warranty protection in exchange for a fee. + +**2.** You may modify your copy or copies of the Program or any portion of it, +thus forming a work based on the Program, and copy and distribute such +modifications or work under the terms of Section 1 above, provided that you also +meet all of these conditions: + +* **a)** You must cause the modified files to carry prominent notices stating + that you changed the files and the date of any change. + +* **b)** You must cause any work that you distribute or publish, that in whole + or in part contains or is derived from the Program or any part thereof, to + be licensed as a whole at no charge to all third parties under the terms of + this License. + +* **c)** If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use in the + most ordinary way, to print or display an announcement including an + appropriate copyright notice and a notice that there is no warranty (or + else, saying that you provide a warranty) and that users may redistribute + the program under these conditions, and telling the user how to view a copy + of this License. (Exception: if the Program itself is interactive but does + not normally print such an announcement, your work based on the Program is + not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, and +its terms, do not apply to those sections when you distribute them as separate +works. But when you distribute the same sections as part of a whole which is a +work based on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the entire whole, +and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on the +Program. + +In addition, mere aggregation of another work not based on the Program with the +Program (or with a work based on the Program) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + +**3.** You may copy and distribute the Program (or a work based on it, under +Section 2) in object code or executable form under the terms of Sections 1 and 2 +above provided that you also do one of the following: + +* **a)** Accompany it with the complete corresponding machine-readable source + code, which must be distributed under the terms of Sections 1 and 2 above on + a medium customarily used for software interchange; or, + +* **b)** Accompany it with a written offer, valid for at least three years, to + give any third party, for a charge no more than your cost of physically + performing source distribution, a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of Sections 1 + and 2 above on a medium customarily used for software interchange; or, + +* **c)** Accompany it with the information you received as to the offer to + distribute corresponding source code. (This alternative is allowed only for + noncommercial distribution and only if you received the program in object + code or executable form with such an offer, in accord with Subsection b + above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all the +source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +If distribution of executable or object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the source code +from the same place counts as distribution of the source code, even though third +parties are not compelled to copy the source along with the object code. + +**4.** You may not copy, modify, sublicense, or distribute the Program except as +expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, or +rights, from you under this License will not have their licenses terminated so +long as such parties remain in full compliance. + +**5.** You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Program or its derivative works. These actions are prohibited by law if you do +not accept this License. Therefore, by modifying or distributing the Program (or +any work based on the Program), you indicate your acceptance of this License to +do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +**6.** Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these terms and +conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties to this License. + +**7.** If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), conditions +are imposed on you (whether by court order, agreement or otherwise) that +contradict the conditions of this License, they do not excuse you from the +conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Program at all. +For example, if a patent license would not permit royalty-free redistribution of +the Program by all those who receive copies directly or indirectly through you, +then the only way you could satisfy both it and this License would be to refrain +entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and the +section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system, which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +**8.** If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In such +case, this License incorporates the limitation as if written in the body of this +License. + +**9.** The Free Software Foundation may publish revised and/or new versions of +the General Public License from time to time. Such new versions will be similar +in spirit to the present version, but may differ in detail to address new +problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Program does not specify a version number of this License, you may choose any +version ever published by the Free Software Foundation. + +**10.** If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status of +all derivatives of our free software and of promoting the sharing and reuse of +software generally. + + +No Warranty +----------- + +**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR +INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA +BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER +OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. diff -Nru kodi-visualization-shadertoy-1.2.3/README.md kodi-visualization-shadertoy-2.3.0/README.md --- kodi-visualization-shadertoy-1.2.3/README.md 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/README.md 2015-05-23 07:24:22.000000000 +0000 @@ -2,11 +2,13 @@ This is a [Kodi](https://kodi.tv) visualization addon. -[![Build Status](https://travis-ci.org/xbmc/visualization.shadertoy.svg?branch=master)](https://travis-ci.org/xbmc/visualization.shadertoy) -[![Build Status](https://dev.azure.com/teamkodi/binary-addons/_apis/build/status/xbmc.visualization.shadertoy?branchName=Leia)](https://dev.azure.com/teamkodi/binary-addons/_build/latest?definitionId=34&branchName=Leia) - +[![License: GPL-2.0-or-later](https://img.shields.io/badge/License-GPL%20v2+-blue.svg)](LICENSE.md) +[![Build Status](https://travis-ci.org/xbmc/visualization.shadertoy.svg?branch=Matrix)](https://travis-ci.org/xbmc/visualization.shadertoy/branches) +[![Build Status](https://dev.azure.com/teamkodi/binary-addons/_apis/build/status/xbmc.visualization.shadertoy?branchName=Matrix)](https://dev.azure.com/teamkodi/binary-addons/_build/latest?definitionId=34&branchName=Matrix) +[![Build Status](https://jenkins.kodi.tv/view/Addons/job/xbmc/job/visualization.shadertoy/job/Matrix/badge/icon)](https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Fvisualization.shadertoy/branches/) + -![screenshot](https://raw.githubusercontent.com/xbmc/visualization.shadertoy/Leia/visualization.shadertoy/resources/screenshot-01.jpg) +![screenshot](https://raw.githubusercontent.com/xbmc/visualization.shadertoy/Matrix/visualization.shadertoy/resources/screenshot-01.jpg) ## Build instructions @@ -19,8 +21,8 @@ The following instructions assume you will have built Kodi already in the `kodi-build` directory suggested by the README. -1. `git clone --branch Leia https://github.com/xbmc/xbmc.git` -2. `git clone --branch Leia https://github.com/xbmc/visualization.shadertoy.git` +1. `git clone --branch master https://github.com/xbmc/xbmc.git` +2. `git clone --branch Matrix https://github.com/xbmc/visualization.shadertoy.git` 3. `cd visualization.shadertoy && mkdir build && cd build` 4. `cmake -DADDONS_TO_BUILD=visualization.shadertoy -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/kodi-build/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons` 5. `make` diff -Nru kodi-visualization-shadertoy-1.2.3/src/main.cpp kodi-visualization-shadertoy-2.3.0/src/main.cpp --- kodi-visualization-shadertoy-1.2.3/src/main.cpp 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/src/main.cpp 2015-05-23 07:24:22.000000000 +0000 @@ -1,21 +1,8 @@ /* - * Copyright (C) 2005-2019 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kodi; see the file COPYING. If not, see - * . + * Copyright (C) 2005-2020 Team Kodi (https://kodi.tv) * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSE.md for more information. */ #include "main.h" @@ -201,7 +188,11 @@ m_magnitudeBuffer(new float[NUM_BANDS]()), m_pcm(new float[AUDIO_BUFFER]()) { - m_currentPreset = kodi::GetSettingInt("lastpresetidx"); + m_settingsUseOwnshader = kodi::GetSettingBoolean("ownshader"); + if (m_settingsUseOwnshader) + m_currentPreset = -1; + else + m_currentPreset = kodi::GetSettingInt("lastpresetidx"); } CVisualizationShadertoy::~CVisualizationShadertoy() @@ -312,33 +303,45 @@ //----------------------------------------------------------------------------- bool CVisualizationShadertoy::NextPreset() { - m_currentPreset = (m_currentPreset + 1) % g_presets.size(); - Launch(m_currentPreset); - kodi::SetSettingInt("lastpresetidx", m_currentPreset); + if (!m_settingsUseOwnshader) + { + m_currentPreset = (m_currentPreset + 1) % g_presets.size(); + Launch(m_currentPreset); + kodi::SetSettingInt("lastpresetidx", m_currentPreset); + } return true; } bool CVisualizationShadertoy::PrevPreset() { - m_currentPreset = (m_currentPreset - 1) % g_presets.size(); - Launch(m_currentPreset); - kodi::SetSettingInt("lastpresetidx", m_currentPreset); + if (!m_settingsUseOwnshader) + { + m_currentPreset = (m_currentPreset - 1) % g_presets.size(); + Launch(m_currentPreset); + kodi::SetSettingInt("lastpresetidx", m_currentPreset); + } return true; } bool CVisualizationShadertoy::LoadPreset(int select) { - m_currentPreset = select % g_presets.size(); - Launch(m_currentPreset); - kodi::SetSettingInt("lastpresetidx", m_currentPreset); + if (!m_settingsUseOwnshader) + { + m_currentPreset = select % g_presets.size(); + Launch(m_currentPreset); + kodi::SetSettingInt("lastpresetidx", m_currentPreset); + } return true; } bool CVisualizationShadertoy::RandomPreset() { - m_currentPreset = (int)((std::rand() / (float)RAND_MAX) * g_presets.size()); - Launch(m_currentPreset); - kodi::SetSettingInt("lastpresetidx", m_currentPreset); + if (!m_settingsUseOwnshader) + { + m_currentPreset = (int)((std::rand() / (float)RAND_MAX) * g_presets.size()); + Launch(m_currentPreset); + kodi::SetSettingInt("lastpresetidx", m_currentPreset); + } return true; } @@ -347,8 +350,11 @@ //----------------------------------------------------------------------------- bool CVisualizationShadertoy::GetPresets(std::vector& presets) { - for (auto preset : g_presets) - presets.push_back(preset.name); + if (!m_settingsUseOwnshader) + { + for (auto preset : g_presets) + presets.push_back(preset.name); + } return true; } @@ -378,7 +384,7 @@ { for (int i = 0; i < 4; i++) { - if (g_presets[m_currentPreset].channel[i] == 99) + if (m_shaderTextures[i].audio) { glActiveTexture(GL_TEXTURE0 + i); glBindTexture(GL_TEXTURE_2D, m_channelTextures[i]); @@ -486,15 +492,58 @@ #endif UnloadTextures(); + + if (preset < 0) + { + m_usedShaderFile = kodi::GetSettingString("shader"); + m_shaderTextures[0].audio = kodi::GetSettingBoolean("texture0-sound"); + m_shaderTextures[0].texture = kodi::GetSettingString("texture0"); + m_shaderTextures[1].audio = kodi::GetSettingBoolean("texture1-sound"); + m_shaderTextures[1].texture = kodi::GetSettingString("texture1"); + m_shaderTextures[2].audio = kodi::GetSettingBoolean("texture2-sound"); + m_shaderTextures[2].texture = kodi::GetSettingString("texture2"); + m_shaderTextures[3].audio = kodi::GetSettingBoolean("texture3-sound"); + m_shaderTextures[3].texture = kodi::GetSettingString("texture3"); + } + else + { + m_usedShaderFile = kodi::GetAddonPath("resources/shaders/" + g_presets[preset].file); + for (int i = 0; i < 4; i++) + { + if (g_presets[preset].channel[i] >= 0 && g_presets[preset].channel[i] < g_fileTextures.size()) + { + m_shaderTextures[i].texture = kodi::GetAddonPath("resources/" + g_fileTextures[g_presets[preset].channel[i]]); + } + else if (g_presets[preset].channel[i] == 99) // framebuffer + { + m_shaderTextures[i].audio = true; + } + else + { + m_shaderTextures[i].texture = ""; + m_shaderTextures[i].audio = false; + } + } + } + for (int i = 0; i < 4; i++) { - if (g_presets[preset].channel[i] >= 0) - m_channelTextures[i] = LoadTexture(g_presets[preset].channel[i]); + if (m_shaderTextures[i].audio) + { + m_channelTextures[i] = CreateTexture(GL_RED, NUM_BANDS, 2, m_audioData); + } + else if (!m_shaderTextures[i].texture.empty()) + { + GLint format = GL_RGBA; + GLint scaling = GL_LINEAR; + GLint repeat = GL_REPEAT; + m_channelTextures[i] = CreateTexture(m_shaderTextures[i].texture, format, scaling, repeat); + } } const int size1 = 256, size2=512; - double t1 = MeasurePerformance(preset, size1); - double t2 = MeasurePerformance(preset, size2); + double t1 = MeasurePerformance(m_usedShaderFile, size1); + double t2 = MeasurePerformance(m_usedShaderFile, size2); double expected_fps = 40.0; // time per pixel for rendering fragment shader @@ -514,23 +563,7 @@ printf("expected fps=%f, pixels=%f %dx%d (A:%f B:%f t1:%.1f t2:%.1f)\n", expected_fps, pixels, m_state.fbwidth, m_state.fbheight, A, B, t1, t2); #endif - LoadPreset(preset, kodi::GetAddonPath("resources/shaders/" + g_presets[preset].file)); -} - -GLint CVisualizationShadertoy::LoadTexture(int number) -{ - if (number >= 0 && number < g_fileTextures.size()) - { - GLint format = GL_RGBA; - GLint scaling = GL_LINEAR; - GLint repeat = GL_REPEAT; - return CreateTexture(kodi::GetAddonPath("resources/" + g_fileTextures[number]), format, scaling, repeat); - } - else if (number == 99) // framebuffer - { - return CreateTexture(GL_RED, NUM_BANDS, 2, m_audioData); - } - return 0; + LoadPreset(m_usedShaderFile); } void CVisualizationShadertoy::UnloadTextures() @@ -545,7 +578,7 @@ } } -void CVisualizationShadertoy::LoadPreset(int preset, const std::string& shaderPath) +void CVisualizationShadertoy::LoadPreset(const std::string& shaderPath) { UnloadPreset(); std::string vertShadertoyShader = kodi::GetAddonPath("resources/shaders/main_shadertoy_" GL_TYPE_STRING ".vert.glsl"); @@ -590,6 +623,8 @@ glGenTextures(1, &m_state.framebuffer_texture); glBindTexture(GL_TEXTURE_2D, m_state.framebuffer_texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_state.fbwidth, m_state.fbheight, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -704,7 +739,7 @@ int CVisualizationShadertoy::DetermineBitsPrecision() { m_state.fbwidth = 32, m_state.fbheight = 26*10; - LoadPreset(0, kodi::GetAddonPath("resources/shaders/main_test.frag.glsl")); + LoadPreset(kodi::GetAddonPath("resources/shaders/main_test.frag.glsl")); RenderTo(m_shadertoyShader.ProgramHandle(), m_state.effect_fb); glFinish(); @@ -726,11 +761,11 @@ return bits; } -double CVisualizationShadertoy::MeasurePerformance(int preset, int size) +double CVisualizationShadertoy::MeasurePerformance(const std::string& shaderPath, int size) { int iterations = -1; m_state.fbwidth = m_state.fbheight = size; - LoadPreset(preset, kodi::GetAddonPath("resources/shaders/" + g_presets[preset].file)); + LoadPreset(shaderPath); int64_t end, start; do diff -Nru kodi-visualization-shadertoy-1.2.3/src/maindx.cpp kodi-visualization-shadertoy-2.3.0/src/maindx.cpp --- kodi-visualization-shadertoy-1.2.3/src/maindx.cpp 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/src/maindx.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1024 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#pragma comment(lib, "d3dcompiler.lib") - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kiss_fft.h" -#include "WICTextureLoader.h" - -#define SAFE_RELEASE(p) do { if(p) { (p)->Release(); (p)=nullptr; } } while (0) -#define ALIGN(x, a) (((x)+(a)-1)&~((a)-1)) -#define SHADER_SOURCE(...) #__VA_ARGS__ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#define SMOOTHING_TIME_CONSTANT (0.8) -#define MIN_DECIBELS (-100.0) -#define MAX_DECIBELS (-30.0) - -#define AUDIO_BUFFER (1024) -#define NUM_BANDS (AUDIO_BUFFER / 2) - -using namespace DirectX; - -typedef enum ShaderType { - VERTEX_SHADER, - PIXEL_SHADER -}; - -struct Preset { - std::string name; - std::string file; - int channel[4]; -}; - -struct MYVERTEX { - float x, y, z; - float u, v; -}; - -struct Params { - XMFLOAT3 iResolution; - float iGlobalTime; - XMFLOAT4 iChannelTime; - XMFLOAT4 iMouse; - XMFLOAT4 iDate; - float iSampleRate; - XMFLOAT3 iChannelResolution[4]; -}; - -const std::vector g_presets = -{ - {"2D LED Spectrum by un1versal", "2Dspectrum.frag.glsl", 99, -1, -1, -1}, - {"Audio Reaktive by choard1895", "audioreaktive.frag.glsl", 99, -1, -1, -1}, - {"AudioVisual by Passion", "audiovisual.frag.glsl", 99, -1, -1, -1}, - {"Beating Circles by Phoenix72", "beatingcircles.frag.glsl", 99, -1, -1, -1}, - {"BPM by iq", "bpm.frag.glsl", 99, -1, -1, -1}, - {"The Disco Tunnel by poljere", "discotunnel.frag.glsl", 2, 14, 99, -1}, - {"Polar Beats by sauj123", "polarbeats.frag.glsl", 99, -1, -1, -1}, - {"Sound Flower by iq", "soundflower.frag.glsl", 99, -1, -1, -1}, - {"Sound sinus wave by Eitraz", "soundsinuswave.frag.glsl", 99, -1, -1, -1}, - {"symmetrical sound visualiser by thelinked","symmetricalsound.frag.glsl", 99, -1, -1, -1}, - {"Twisted Rings by poljere", "twistedrings.frag.glsl", 99, -1, -1, -1}, - {"Undulant Spectre by mafik", "undulantspectre.frag.glsl", 99, -1, -1, -1}, - {"Waves Remix by ADOB", "wavesremix.frag.glsl", 99, -1, -1, -1}, -}; -const char *g_fileTextures[] = { - "tex00.png", - "tex01.png", - "tex02.png", - "tex03.png", - "tex04.png", - "tex05.png", - "tex06.png", - "tex07.png", - "tex08.png", - "tex09.png", - "tex10.png", - "tex11.png", - "tex12.png", - "tex14.png", - "tex15.png", - "tex16.png" -}; - -std::string g_pathPresets; -int g_numberPresets = g_presets.size(); -int g_currentPreset = 0; -int g_numberTextures = ARRAYSIZE(g_fileTextures); -bool initialized = false; -bool needsUpload = true; - -// directx related vars -ID3D11Device* g_pDevice = nullptr; -ID3D11DeviceContext* g_pContext = nullptr; -ID3D11InputLayout* g_pInputLayout = nullptr; -ID3D11Buffer* g_pCBParams = nullptr; -ID3D11Buffer* g_pVBuffer = nullptr; -ID3D11VertexShader* g_pVShader = nullptr; -ID3D11PixelShader* g_pPShader = nullptr; -ID3D11ShaderResourceView* iChannelView[4] = { nullptr, nullptr, nullptr, nullptr }; -ID3D11SamplerState* iChannelSampler[4] = { nullptr, nullptr, nullptr, nullptr }; -ID3D11Texture2D* pAudioTexture = nullptr; -ID3D11ShaderResourceView* pAudioView = nullptr; -ID3D11ShaderResourceView* pNoiseView = nullptr; -ID3D11ShaderResourceView* pBackBuffer = nullptr; -ID3D11SamplerState* pNoiseSampler = nullptr; -ID3D11SamplerState* pAudioSampler = nullptr; -Params cbParams; - -// kiss related vars -kiss_fft_cfg cfg; -float *pcm = NULL; -float *magnitude_buffer = NULL; -byte *audio_data = NULL; -int samplesPerSec = 0; -int width = 0; -int height = 0; - -void LogTrack(VisTrack *track) { - std::cout << "Track = {" << std::endl - << "\t title: " << track->title << std::endl - << "\t artist: " << track->artist << std::endl - << "\t album: " << track->album << std::endl - << "\t albumArtist: " << track->albumArtist << std::endl - << "\t genre: " << track->genre << std::endl - << "\t comment: " << track->comment << std::endl - << "\t lyrics: " << track->lyrics << std::endl - << "\t trackNumber: " << track->trackNumber << std::endl - << "\t discNumber: " << track->discNumber << std::endl - << "\t duration: " << track->duration << std::endl - << "\t year: " << track->year << std::endl - << "\t rating: " << track->rating << std::endl - << "}" << std::endl; -} - -void LogAction(const char *message) { -} - -void LogActionString(const char *message, const char *param) { -} - -float blackmanWindow(float in, size_t i, size_t length) { - double alpha = 0.16; - double a0 = 0.5 * (1.0 - alpha); - double a1 = 0.5; - double a2 = 0.5 * alpha; - - float x = (float)i / (float)length; - return in * (a0 - a1 * cos(2.0 * M_PI * x) + a2 * cos(4.0 * M_PI * x)); -} - -void smoothingOverTime(float *outputBuffer, float *lastOutputBuffer, kiss_fft_cpx *inputBuffer, size_t length, float smoothingTimeConstant, unsigned int fftSize) { - for (size_t i = 0; i < length; i++) { - kiss_fft_cpx c = inputBuffer[i]; - float magnitude = sqrt(c.r * c.r + c.i * c.i) / (float)fftSize; - outputBuffer[i] = smoothingTimeConstant * lastOutputBuffer[i] + (1.0 - smoothingTimeConstant) * magnitude; - } -} - -float linearToDecibels(float linear) { - if (!linear) - return -1000; - return 20 * log10f(linear); -} - -HRESULT createTexture(DXGI_FORMAT format, unsigned int w, unsigned int h, const void * data, size_t size, ID3D11Texture2D** ppTexture, ID3D11ShaderResourceView** ppView = nullptr) -{ - ID3D11Texture2D* texture = nullptr; - CD3D11_TEXTURE2D_DESC texDesc(format, w, h, 1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - D3D11_SUBRESOURCE_DATA srData = { data, size }; - - HRESULT hr = g_pDevice->CreateTexture2D(&texDesc, data ? &srData : nullptr, &texture); - if (SUCCEEDED(hr) && texture != nullptr) - { - if (ppView != nullptr) - { - CD3D11_SHADER_RESOURCE_VIEW_DESC srvDesc(texture, D3D11_SRV_DIMENSION_TEXTURE2D); - hr = g_pDevice->CreateShaderResourceView(texture, &srvDesc, ppView); - if (FAILED(hr)) - { - texture->Release(); - return hr; - } - } - if (ppTexture != nullptr) - *ppTexture = texture; - } - - return hr; -} - -HRESULT createTexture(const char *file, DXGI_FORMAT internalFormat, D3D11_FILTER scaling, D3D11_TEXTURE_ADDRESS_MODE address, - ID3D11Texture2D** ppTexture, ID3D11ShaderResourceView** ppView = nullptr, ID3D11SamplerState** ppSState = nullptr) -{ - std::ostringstream ss; - ss << g_pathPresets << "/resources/" << file; - std::string fullPath = ss.str(); - - const size_t cSize = fullPath.length() + 1; - std::wstring wfile(cSize, L'#'); - mbstowcs(&wfile[0], fullPath.c_str(), cSize); - - HRESULT hr = CreateWICTextureFromFile(g_pDevice, wfile.c_str(), reinterpret_cast(ppTexture), ppView); - if (FAILED(hr)) - return hr; - - if (ppSState != nullptr) - { - D3D11_SAMPLER_DESC sampDesc; - ZeroMemory(&sampDesc, sizeof(D3D11_SAMPLER_DESC)); - sampDesc.Filter = scaling; - sampDesc.AddressU = address; - sampDesc.AddressV = address; - sampDesc.AddressW = address; - sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - sampDesc.MinLOD = 0; - sampDesc.MaxLOD = D3D11_FLOAT32_MAX; - hr = g_pDevice->CreateSamplerState(&sampDesc, ppSState); - } - - if (FAILED(hr)) - { - if (ppTexture != nullptr) - SAFE_RELEASE(*ppTexture); - if (ppView != nullptr) - SAFE_RELEASE(*ppView); - } - - return hr; -} - -HRESULT compileShader(ShaderType shaderType, const char *shader, size_t srcSize, ID3DBlob** ppBlob) -{ - ID3DBlob *pErrors = nullptr; - HRESULT hr; - - hr = D3DCompile(shader, srcSize, nullptr, nullptr, nullptr, "main", - shaderType == PIXEL_SHADER ? "ps_4_0_level_9_3" : "vs_4_0_level_9_1", - 0, 0, ppBlob, &pErrors); - - if (FAILED(hr)) - { - // TODO log errors - } - - SAFE_RELEASE(pErrors); - return hr; -} - -const std::string vsSource = SHADER_SOURCE( - void main(in float4 pos : POSITION, in float2 uv : TEXCOORD0, - out float2 outUV : TEXCOORD0, out float4 outPos : SV_POSITION) - { - outPos = pos; - outUV = uv; - } -); - -std::string fsHeader = SHADER_SOURCE( -#define vec2 float2\n -#define vec3 float3\n -#define vec4 float4\n -#define mat2 float2x2\n -#define mat3 float3x3\n -#define mat4 float4x4\n -#define fract frac\n - float atan(float y, float x) -{ - if (x == 0 && y == 0) x = 1; // Avoid producing a NaN - return atan2(y, x); -} -float mod(float x, float y) -{ - return x - y * floor(x / y); -} -float2 mod(float2 x, float2 y) -{ - return x - y * floor(x / y); -} -float2 mod(float2 x, float y) -{ - return x - y * floor(x / y); -} -float3 mod(float3 x, float3 y) -{ - return x - y * floor(x / y); -} -float3 mod(float3 x, float y) -{ - return x - y * floor(x / y); -} -float4 mod(float4 x, float4 y) -{ - return x - y * floor(x / y); -} -float4 mod(float4 x, float y) -{ - return x - y * floor(x / y); -} -float3 mix(float3 x, float3 y, float a) -{ - return x*(1 - a) + y*a; -} -float mix(float x, float y, float a) -{ - return x*(1 - a) + y*a; -} -float mix(float x, float y, bool a) -{ - return a ? y : x; -} -float2 mix(float2 x, float2 y, bool2 a) -{ - return a ? y : x; -} -float3 mix(float3 x, float3 y, bool3 a) -{ - return a ? y : x; -} -float4 mix(float4 x, float4 y, bool4 a) -{ - return a ? y : x; -} -cbuffer cbParams : register(b0) -{ - float3 iResolution; - float iGlobalTime; - float iChannelTime[4]; - float4 iMouse; - float4 iDate; - float iSampleRate; - float3 iChannelResolution[4]; -}; -Texture2D iChannel0 : register(t0); -Texture2D iChannel1 : register(t1); -Texture2D iChannel2 : register(t2); -Texture2D iChannel3 : register(t3); -SamplerState iChannel0Samp : register(s0); -SamplerState iChannel1Samp : register(s1); -SamplerState iChannel2Samp : register(s2); -SamplerState iChannel3Samp : register(s3); -\n#define texture2D(x, uv) (##x##.Sample(##x##Samp, uv))\n -); - -std::string fsFooter = SHADER_SOURCE( - void main(in float2 uv : TEXCOORD0, out float4 color : SV_TARGET) -{ - float2 fragCoord = uv; - fragCoord.x *= (iResolution.x - 0.5); - fragCoord.y *= (iResolution.y - 0.5); - mainImage(color, fragCoord); - color.w = 1.0; -} -); - -float fCubicInterpolate(float y0, float y1, float y2, float y3, float t) -{ - float a0, a1, a2, a3, t2; - - t2 = t*t; - a0 = y3 - y2 - y0 + y1; - a1 = y0 - y1 - a0; - a2 = y2 - y0; - a3 = y1; - - return(a0*t*t2 + a1*t2 + a2*t + a3); -} - -DWORD dwCubicInterpolate(DWORD y0, DWORD y1, DWORD y2, DWORD y3, float t) -{ - // performs cubic interpolation on a D3DCOLOR value. - DWORD ret = 0; - DWORD shift = 0; - for (int i = 0; i<4; i++) - { - float f = fCubicInterpolate( - ((y0 >> shift) & 0xFF) / 255.0f, - ((y1 >> shift) & 0xFF) / 255.0f, - ((y2 >> shift) & 0xFF) / 255.0f, - ((y3 >> shift) & 0xFF) / 255.0f, - t - ); - if (f<0) - f = 0; - if (f>1) - f = 1; - ret |= ((DWORD)(f * 255)) << shift; - shift += 8; - } - return ret; -} - -HRESULT dxInit(ID3D11DeviceContext* pContex) -{ - HRESULT hr = S_OK; - g_pContext = pContex; - g_pContext->GetDevice(&g_pDevice); - - ID3DBlob* vs = nullptr; - if (SUCCEEDED(compileShader(VERTEX_SHADER, vsSource.c_str(), vsSource.size(), &vs))) - { - hr = g_pDevice->CreateVertexShader(vs->GetBufferPointer(), vs->GetBufferSize(), nullptr, &g_pVShader); - if (SUCCEEDED(hr)) - { - D3D11_INPUT_ELEMENT_DESC layout[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - hr = g_pDevice->CreateInputLayout(layout, ARRAYSIZE(layout), vs->GetBufferPointer(), vs->GetBufferSize(), &g_pInputLayout); - } - SAFE_RELEASE(vs); - } - - if (FAILED(hr)) - return hr; - - MYVERTEX verts[] = - { - { -1.0f, -1.0f, 0.0f, 0.0f, 0.0f }, - { -1.0f, 1.0f, 0.0f, 0.0f, 1.0f }, - { 1.0f, -1.0f, 0.0f, 1.0f, 0.0f }, - { 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }, - }; - CD3D11_BUFFER_DESC bDesc(sizeof(MYVERTEX) * 4, D3D11_BIND_VERTEX_BUFFER, D3D11_USAGE_IMMUTABLE); - D3D11_SUBRESOURCE_DATA srData = { verts }; - if (FAILED(hr = g_pDevice->CreateBuffer(&bDesc, &srData, &g_pVBuffer))) - return hr; - - bDesc.ByteWidth = ALIGN(sizeof(Params), 16); - bDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bDesc.Usage = D3D11_USAGE_DYNAMIC; - bDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - srData.pSysMem = &cbParams; - if (FAILED(hr = g_pDevice->CreateBuffer(&bDesc, &srData, &g_pCBParams))) - return hr; - - // create audio buffer - createTexture(DXGI_FORMAT_R8_UNORM, NUM_BANDS, 2, nullptr, 0, &pAudioTexture, &pAudioView); - - D3D11_SAMPLER_DESC sampDesc; - ZeroMemory(&sampDesc, sizeof(D3D11_SAMPLER_DESC)); - sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; - sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; - sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - sampDesc.MinLOD = 0; - sampDesc.MaxLOD = D3D11_FLOAT32_MAX; - g_pDevice->CreateSamplerState(&sampDesc, &pAudioSampler); - - sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; - sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; - sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - g_pDevice->CreateSamplerState(&sampDesc, &pNoiseSampler); - - ID3D11DeviceContext* pCtx = nullptr; - g_pDevice->GetImmediateContext(&pCtx); - - // create noise buffer - ID3D11Texture2D* pNoise = nullptr; - int size = 256, zoom_factor = 1; - createTexture(DXGI_FORMAT_B8G8R8A8_UNORM, size, size, nullptr, 0, &pNoise, &pNoiseView); - - // generate noise data (from MilkDrop) - if (pNoise) - { - D3D11_MAPPED_SUBRESOURCE r; - if (FAILED(hr = pCtx->Map(pNoise, 0, D3D11_MAP_WRITE_DISCARD, 0, &r))) - { - SAFE_RELEASE(pCtx); - return hr; - } - - // write to the bits... - DWORD* dst = (DWORD*)r.pData; - int dwords_per_line = r.RowPitch / sizeof(DWORD); - int RANGE = 256; - for (int y = 0; y 1) - { - // first go ACROSS, blending cubically on X, but only on the main lines. - DWORD* dst = (DWORD*)r.pData; - for (int y = 0; yUnmap(pNoise, 0); - pNoise->Release(); - } - - // create back buffer - ID3D11RenderTargetView* pRTView = nullptr; - g_pContext->OMGetRenderTargets(1, &pRTView, nullptr); - if (pRTView != nullptr) - { - ID3D11Resource* pResource = nullptr; - pRTView->GetResource(&pResource); - pRTView->Release(); - - if (pResource == nullptr) - return E_FAIL; - - ID3D11Texture2D* pRTTexture = nullptr; - hr = pResource->QueryInterface(__uuidof(ID3D11Texture2D), reinterpret_cast(&pRTTexture)); - if (FAILED(hr)) - { - pResource->Release(); - return hr; - } - - D3D11_TEXTURE2D_DESC texDesc; - pRTTexture->GetDesc(&texDesc); - texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - pRTTexture->Release(); - - ID3D11Texture2D* pCopyTexture = nullptr; - hr = g_pDevice->CreateTexture2D(&texDesc, nullptr, &pCopyTexture); - if (FAILED(hr)) - { - pResource->Release(); - return hr; - } - - pCtx->CopyResource(pCopyTexture, pResource); - pResource->Release(); - - CD3D11_SHADER_RESOURCE_VIEW_DESC srvDesc(pCopyTexture, D3D11_SRV_DIMENSION_TEXTURE2D); - hr = g_pDevice->CreateShaderResourceView(pCopyTexture, &srvDesc, &pBackBuffer); - - pCopyTexture->Release(); - } - - SAFE_RELEASE(pCtx); - - return hr; -} - - -void unloadPreset() -{ - SAFE_RELEASE(g_pPShader); - for (size_t i = 0; i < 4; i++) - { - SAFE_RELEASE(iChannelSampler[i]); - SAFE_RELEASE(iChannelView[i]); - } -} - -HRESULT createShader(const std::string &file, ID3D11PixelShader** ppPShader) -{ - HRESULT hr; - std::ostringstream ss; - ss << g_pathPresets << "/resources/" << file; - std::string fullPath = ss.str(); - - FILE* f; - f = fopen(fullPath.c_str(), "r"); - if (f != NULL) - { - std::string source; - fseek(f, 0, SEEK_END); - source.resize(ftell(f)); - fseek(f, 0, SEEK_SET); - size_t read = fread(&source[0], 1, source.size(), f); - // CRLF is replaced with LF by fread - source.resize(read); - fclose(f); - - std::ostringstream ss; - ss << fsHeader << "\n" << source << "\n" << fsFooter; - std::string fsSource = ss.str(); - - ID3DBlob* pPSBlob = nullptr; - hr = compileShader(PIXEL_SHADER, fsSource.c_str(), fsSource.size(), &pPSBlob); - if (SUCCEEDED(hr) && pPSBlob != nullptr) - hr = g_pDevice->CreatePixelShader(pPSBlob->GetBufferPointer(), pPSBlob->GetBufferSize(), nullptr, ppPShader); - - SAFE_RELEASE(pPSBlob); - } - else - return E_FAIL; - - return hr; -} - -HRESULT loadTexture(int number, ID3D11Texture2D** ppTexture, ID3D11ShaderResourceView** ppView = nullptr, ID3D11SamplerState** ppSState = nullptr) -{ - if (number == 99) // audio - { - if (ppView != nullptr) - { - *ppView = pAudioView; - pAudioView->AddRef(); - } - if (ppSState != nullptr) - { - *ppSState = pAudioSampler; - pAudioSampler->AddRef(); - } - return S_OK; - } - - if (number == 98) // noise - { - if (ppView != nullptr) - { - *ppView = pNoiseView; - pNoiseView->AddRef(); - } - if (ppSState != nullptr) - { - *ppSState = pNoiseSampler; - pNoiseSampler->AddRef(); - } - return S_OK; - } - - if (number == 97) // back buffer - { - if (ppView != nullptr) - { - *ppView = pBackBuffer; - pBackBuffer->AddRef(); - } - if (ppSState != nullptr) - { - *ppSState = pNoiseSampler; - pNoiseSampler->AddRef(); - } - return S_OK; - } - - // texture - if (number >= 0 && number < g_numberTextures) - { - D3D11_FILTER scaling = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - D3D11_TEXTURE_ADDRESS_MODE address = D3D11_TEXTURE_ADDRESS_CLAMP; - return createTexture(g_fileTextures[number], DXGI_FORMAT_B8G8R8A8_UNORM, scaling, address, ppTexture, ppView, ppSState); - } - - return E_FAIL; -} - -void loadPreset(int number) -{ - if (number >= 0 && number < g_numberPresets) - { - g_currentPreset = number; - - unloadPreset(); - if (FAILED(createShader(g_presets[g_currentPreset].file, &g_pPShader))) - { - // TODO fallback to default - } - - for (size_t i = 0; i < 4; i++) - { - loadTexture(g_presets[g_currentPreset].channel[i], nullptr, &iChannelView[i], &iChannelSampler[i]); - } - } -} - -class CVisualizationShadertoy - : public kodi::addon::CAddonBase - , public kodi::addon::CInstanceVisualization -{ -public: - ~CVisualizationShadertoy() override; - - ADDON_STATUS Create() override; - - bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) override; - void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) override; - void Render() override; - bool GetPresets(std::vector& presets) override; - int GetActivePreset() override; - bool PrevPreset() override; - bool NextPreset() override; - bool LoadPreset(int select) override; - bool RandomPreset() override; -}; - -//-- Render ------------------------------------------------------------------- -// Called once per frame. Do all rendering here. -//----------------------------------------------------------------------------- -void CVisualizationShadertoy::Render() -{ - if (initialized) - { - if (needsUpload) - { - D3D11_MAPPED_SUBRESOURCE res = {}; - if (SUCCEEDED(g_pContext->Map(pAudioTexture, 0, D3D11_MAP_WRITE_DISCARD, 0, &res))) - { - memcpy(res.pData, audio_data, AUDIO_BUFFER); - g_pContext->Unmap(pAudioTexture, 0); - } - } - - g_pContext->VSSetShader(g_pVShader, nullptr, 0); - g_pContext->PSSetShader(g_pPShader, nullptr, 0); - g_pContext->PSSetShaderResources(0, ARRAYSIZE(iChannelView), iChannelView); - - float t = (float)P8PLATFORM::GetTimeMs() / 1000.0f; - time_t now = time(NULL); - tm *ltm = localtime(&now); - float year = 1900 + ltm->tm_year; - float month = ltm->tm_mon; - float day = ltm->tm_mday; - float sec = (ltm->tm_hour * 60 * 60) + (ltm->tm_min * 60) + ltm->tm_sec; - - cbParams.iResolution = XMFLOAT3((float)width, (float)height, (float)width / (float)height); - cbParams.iGlobalTime = t; - cbParams.iSampleRate = samplesPerSec; - cbParams.iChannelTime = XMFLOAT4(t, t, t, t); - cbParams.iDate = XMFLOAT4(year, month, day, sec); - - D3D11_MAPPED_SUBRESOURCE res = {}; - if (SUCCEEDED(g_pContext->Map(g_pCBParams, 0, D3D11_MAP_WRITE_DISCARD, 0, &res))) - { - memcpy(res.pData, &cbParams, sizeof(Params)); - g_pContext->Unmap(g_pCBParams, 0); - } - g_pContext->PSSetConstantBuffers(0, 1, &g_pCBParams); - g_pContext->PSSetSamplers(0, ARRAYSIZE(iChannelSampler), iChannelSampler); - - g_pContext->IASetInputLayout(g_pInputLayout); - g_pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - UINT strides = sizeof(MYVERTEX), offsets = 0; - g_pContext->IASetVertexBuffers(0, 1, &g_pVBuffer, &strides, &offsets); - - g_pContext->Draw(4, 0); - - g_pContext->PSSetShader(nullptr, nullptr, 0); - g_pContext->VSSetShader(nullptr, nullptr, 0); - } -} - -bool CVisualizationShadertoy::Start(int channels, int _samplesPerSec, int bitsPerSample, std::string songName) -{ - samplesPerSec = _samplesPerSec; - return true; -} - -void Mix(float *destination, const float *source, size_t frames, size_t channels) -{ - size_t length = frames * channels; - for (unsigned int i = 0; i < length; i += channels) { - float v = 0.0f; - for (size_t j = 0; j < channels; j++) { - v += source[i + j]; - } - - destination[(i / 2)] = v / (float)channels; - } -} - -void WriteToBuffer(const float *input, size_t length, size_t channels) -{ - size_t frames = length / channels; - - if (frames >= AUDIO_BUFFER) { - size_t offset = frames - AUDIO_BUFFER; - - Mix(pcm, input + offset, AUDIO_BUFFER, channels); - } else { - size_t keep = AUDIO_BUFFER - frames; - memcpy(pcm, pcm + frames, keep * sizeof(float)); - - Mix(pcm + keep, input, frames, channels); - } -} - -void CVisualizationShadertoy::AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength) -{ - WriteToBuffer(pAudioData, iAudioDataLength, 2); - - kiss_fft_cpx in[AUDIO_BUFFER], out[AUDIO_BUFFER]; - for (unsigned int i = 0; i < AUDIO_BUFFER; i++) { - in[i].r = blackmanWindow(pcm[i], i, AUDIO_BUFFER); - in[i].i = 0; - } - - kiss_fft(cfg, in, out); - - out[0].i = 0; - - smoothingOverTime(magnitude_buffer, magnitude_buffer, out, NUM_BANDS, SMOOTHING_TIME_CONSTANT, AUDIO_BUFFER); - - const double rangeScaleFactor = MAX_DECIBELS == MIN_DECIBELS ? 1 : (1.0 / (MAX_DECIBELS - MIN_DECIBELS)); - for (unsigned int i = 0; i < NUM_BANDS; i++) { - float linearValue = magnitude_buffer[i]; - double dbMag = !linearValue ? MIN_DECIBELS : linearToDecibels(linearValue); - double scaledValue = UCHAR_MAX * (dbMag - MIN_DECIBELS) * rangeScaleFactor; - - audio_data[i] = (byte) std::max(std::min((int)scaledValue, UCHAR_MAX), 0); - } - - for (unsigned int i = 0; i < NUM_BANDS; i++) { - float v = (pcm[i] + 1.0f) * 128.0f; - audio_data[i + NUM_BANDS] = (byte) std::max(std::min((int)v, UCHAR_MAX), 0); - } - - needsUpload = true; -} - -bool CVisualizationShadertoy::NextPreset() -{ - LogAction("VIS_ACTION_NEXT_PRESET"); - loadPreset((g_currentPreset + 1) % g_numberPresets); - kodi::SetSettingInt("lastpresetidx", g_currentPreset); - return true; -} - -bool CVisualizationShadertoy::PrevPreset() -{ - LogAction("VIS_ACTION_PREV_PRESET"); - loadPreset((g_currentPreset - 1) % g_numberPresets); - kodi::SetSettingInt("lastpresetidx", g_currentPreset); - return true; -} - -bool CVisualizationShadertoy::LoadPreset(int select) -{ - LogAction("VIS_ACTION_LOAD_PRESET"); - loadPreset(select); - kodi::SetSettingInt("lastpresetidx", g_currentPreset); - return true; -} - -bool CVisualizationShadertoy::RandomPreset() -{ - LogAction("VIS_ACTION_RANDOM_PRESET"); - loadPreset((int)((std::rand() / (float)RAND_MAX) * g_numberPresets)); - kodi::SetSettingInt("lastpresetidx", g_currentPreset); - return true; -} - -//-- GetPresets --------------------------------------------------------------- -// Return a list of presets to XBMC for display -//----------------------------------------------------------------------------- -bool CVisualizationShadertoy::GetPresets(std::vector& presets) -{ - for (auto preset : g_presets) - presets.push_back(preset.name); - return true; -} - -//-- GetPreset ---------------------------------------------------------------- -// Return the index of the current playing preset -//----------------------------------------------------------------------------- -int CVisualizationShadertoy::GetActivePreset() -{ - return g_currentPreset; -} - -//-- Create ------------------------------------------------------------------- -// Called on load. Addon should fully initalize or return error status -//----------------------------------------------------------------------------- -ADDON_STATUS CVisualizationShadertoy::Create() -{ - g_pathPresets = Presets(); - width = Width(); - height = Height(); - - audio_data = new byte[AUDIO_BUFFER](); - magnitude_buffer = new float[NUM_BANDS](); - pcm = new float[AUDIO_BUFFER](); - - cfg = kiss_fft_alloc(AUDIO_BUFFER, 0, NULL, NULL); - - if (S_OK != dxInit(reinterpret_cast(Device()))) - { - return ADDON_STATUS_PERMANENT_FAILURE; - } - - if (!initialized) - { - g_currentPreset = kodi::GetSettingInt("lastpresetidx"); - loadPreset(g_currentPreset); - initialized = true; - } - - return ADDON_STATUS_OK; -} - -//-- Destroy ------------------------------------------------------------------ -// Do everything before unload of this add-on -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -CVisualizationShadertoy::~CVisualizationShadertoy() -{ - unloadPreset(); - - SAFE_RELEASE(pAudioView); - SAFE_RELEASE(pAudioTexture); - SAFE_RELEASE(pNoiseView); - SAFE_RELEASE(pBackBuffer); - SAFE_RELEASE(pNoiseSampler); - SAFE_RELEASE(pAudioSampler); - - if (audio_data) { - delete [] audio_data; - audio_data = NULL; - } - - if (magnitude_buffer) { - delete [] magnitude_buffer; - magnitude_buffer = NULL; - } - - if (pcm) { - delete [] pcm; - pcm = NULL; - } - - if (cfg) { - free(cfg); - cfg = 0; - } - - SAFE_RELEASE(g_pInputLayout); - SAFE_RELEASE(g_pCBParams); - SAFE_RELEASE(g_pVBuffer); - SAFE_RELEASE(g_pVShader); - SAFE_RELEASE(g_pDevice); - - initialized = false; -} - -ADDONCREATOR(CVisualizationShadertoy) // Don't touch this! diff -Nru kodi-visualization-shadertoy-1.2.3/src/main.h kodi-visualization-shadertoy-2.3.0/src/main.h --- kodi-visualization-shadertoy-1.2.3/src/main.h 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/src/main.h 2015-05-23 07:24:22.000000000 +0000 @@ -1,21 +1,8 @@ /* - * Copyright (C) 2005-2019 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Kodi; see the file COPYING. If not, see - * . + * Copyright (C) 2005-2020 Team Kodi (https://kodi.tv) * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSE.md for more information. */ #pragma once @@ -52,9 +39,8 @@ void Mix(float* destination, const float* source, size_t frames, size_t channels); void WriteToBuffer(const float* input, size_t length, size_t channels); void Launch(int preset); - void LoadPreset(int preset, const std::string& shaderPath); + void LoadPreset(const std::string& shaderPath); void UnloadPreset(); - GLint LoadTexture(int number); void UnloadTextures(); GLuint CreateTexture(GLint format, unsigned int w, unsigned int h, const GLvoid* data); GLuint CreateTexture(const GLvoid* data, GLint format, unsigned int w, unsigned int h, GLint internalFormat, GLint scaling, GLint repeat); @@ -63,7 +49,7 @@ void SmoothingOverTime(float* outputBuffer, float* lastOutputBuffer, kiss_fft_cpx* inputBuffer, size_t length, float smoothingTimeConstant, unsigned int fftSize); float LinearToDecibels(float linear); int DetermineBitsPrecision(); - double MeasurePerformance(int preset, int size); + double MeasurePerformance(const std::string& shaderPath, int size); kiss_fft_cfg m_kissCfg; GLubyte* m_audioData; @@ -101,4 +87,12 @@ GLuint uScale; int fbwidth, fbheight; } m_state; + + bool m_settingsUseOwnshader = false; + std::string m_usedShaderFile; + struct ShaderPath + { + bool audio = false; + std::string texture; + } m_shaderTextures[4]; }; diff -Nru kodi-visualization-shadertoy-1.2.3/src/WICTextureLoader.cpp kodi-visualization-shadertoy-2.3.0/src/WICTextureLoader.cpp --- kodi-visualization-shadertoy-1.2.3/src/WICTextureLoader.cpp 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/src/WICTextureLoader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,945 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: WICTextureLoader.cpp -// -// Function for loading a WIC image and creating a Direct3D 11 runtime texture for it -// (auto-generating mipmaps if possible) -// -// Note: Assumes application has already called CoInitializeEx -// -// Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for -// auto-gen mipmap support. -// -// Note these functions are useful for images created as simple 2D textures. For -// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. -// For a full-featured DDS file reader, writer, and texture processing pipeline see -// the 'Texconv' sample and the 'DirectXTex' library. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// http://go.microsoft.com/fwlink/?LinkId=248926 -// http://go.microsoft.com/fwlink/?LinkId=248929 -//-------------------------------------------------------------------------------------- - -// We could load multi-frame images (TIFF/GIF) into a texture array. -// For now, we just load the first frame (note: DirectXTex supports multi-frame images) - -#include -#include - -// VS 2010's stdint.h conflicts with intsafe.h -#pragma warning(push) -#pragma warning(disable : 4005) -#include -#include -#pragma warning(pop) - -#include - -#include - -#include "WICTextureLoader.h" - -#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) -#pragma comment(lib,"dxguid.lib") -#endif - -using Microsoft::WRL::ComPtr; - -//-------------------------------------------------------------------------------------- - -template -inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char (&name)[TNameLength]) -{ -#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) - resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name); -#else - UNREFERENCED_PARAMETER(resource); - UNREFERENCED_PARAMETER(name); -#endif -} - -//------------------------------------------------------------------------------------- -// WIC Pixel Format Translation Data -//------------------------------------------------------------------------------------- -struct WICTranslate -{ - GUID wic; - DXGI_FORMAT format; -}; - -static WICTranslate g_WICFormats[] = -{ - { GUID_WICPixelFormat128bppRGBAFloat, DXGI_FORMAT_R32G32B32A32_FLOAT }, - - { GUID_WICPixelFormat64bppRGBAHalf, DXGI_FORMAT_R16G16B16A16_FLOAT }, - { GUID_WICPixelFormat64bppRGBA, DXGI_FORMAT_R16G16B16A16_UNORM }, - - { GUID_WICPixelFormat32bppRGBA, DXGI_FORMAT_R8G8B8A8_UNORM }, - { GUID_WICPixelFormat32bppBGRA, DXGI_FORMAT_B8G8R8A8_UNORM }, // DXGI 1.1 - { GUID_WICPixelFormat32bppBGR, DXGI_FORMAT_B8G8R8X8_UNORM }, // DXGI 1.1 - - { GUID_WICPixelFormat32bppRGBA1010102XR, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM }, // DXGI 1.1 - { GUID_WICPixelFormat32bppRGBA1010102, DXGI_FORMAT_R10G10B10A2_UNORM }, - - { GUID_WICPixelFormat16bppBGRA5551, DXGI_FORMAT_B5G5R5A1_UNORM }, - { GUID_WICPixelFormat16bppBGR565, DXGI_FORMAT_B5G6R5_UNORM }, - - { GUID_WICPixelFormat32bppGrayFloat, DXGI_FORMAT_R32_FLOAT }, - { GUID_WICPixelFormat16bppGrayHalf, DXGI_FORMAT_R16_FLOAT }, - { GUID_WICPixelFormat16bppGray, DXGI_FORMAT_R16_UNORM }, - { GUID_WICPixelFormat8bppGray, DXGI_FORMAT_R8_UNORM }, - - { GUID_WICPixelFormat8bppAlpha, DXGI_FORMAT_A8_UNORM }, -}; - -//------------------------------------------------------------------------------------- -// WIC Pixel Format nearest conversion table -//------------------------------------------------------------------------------------- - -struct WICConvert -{ - GUID source; - GUID target; -}; - -static WICConvert g_WICConvert[] = -{ - // Note target GUID in this conversion table must be one of those directly supported formats (above). - - { GUID_WICPixelFormatBlackWhite, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - - { GUID_WICPixelFormat1bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat2bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat4bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat8bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - - { GUID_WICPixelFormat2bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - { GUID_WICPixelFormat4bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - - { GUID_WICPixelFormat16bppGrayFixedPoint, GUID_WICPixelFormat16bppGrayHalf }, // DXGI_FORMAT_R16_FLOAT - { GUID_WICPixelFormat32bppGrayFixedPoint, GUID_WICPixelFormat32bppGrayFloat }, // DXGI_FORMAT_R32_FLOAT - - { GUID_WICPixelFormat16bppBGR555, GUID_WICPixelFormat16bppBGRA5551 }, // DXGI_FORMAT_B5G5R5A1_UNORM - - { GUID_WICPixelFormat32bppBGR101010, GUID_WICPixelFormat32bppRGBA1010102 }, // DXGI_FORMAT_R10G10B10A2_UNORM - - { GUID_WICPixelFormat24bppBGR, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat24bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - - { GUID_WICPixelFormat48bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat48bppBGR, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat64bppBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat64bppPRGBA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat64bppPBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - - { GUID_WICPixelFormat48bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat48bppBGRFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat64bppRGBAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat64bppBGRAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat64bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat64bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat48bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - - { GUID_WICPixelFormat128bppPRGBAFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT - { GUID_WICPixelFormat128bppRGBFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT - { GUID_WICPixelFormat128bppRGBAFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT - { GUID_WICPixelFormat128bppRGBFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT - { GUID_WICPixelFormat32bppRGBE, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT - - { GUID_WICPixelFormat32bppCMYK, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat64bppCMYK, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat40bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat80bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - { GUID_WICPixelFormat32bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat64bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat64bppPRGBAHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT -#endif - - // We don't support n-channel formats -}; - -static bool g_WIC2 = false; - -//-------------------------------------------------------------------------------------- -static IWICImagingFactory* _GetWIC() -{ - static IWICImagingFactory* s_Factory = nullptr; - - if ( s_Factory ) - return s_Factory; - -#if(_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - HRESULT hr = CoCreateInstance( - CLSID_WICImagingFactory2, - nullptr, - CLSCTX_INPROC_SERVER, - __uuidof(IWICImagingFactory2), - (LPVOID*)&s_Factory - ); - - if ( SUCCEEDED(hr) ) - { - // WIC2 is available on Windows 8 and Windows 7 SP1 with KB 2670838 installed - g_WIC2 = true; - } - else - { - hr = CoCreateInstance( - CLSID_WICImagingFactory1, - nullptr, - CLSCTX_INPROC_SERVER, - __uuidof(IWICImagingFactory), - (LPVOID*)&s_Factory - ); - - if ( FAILED(hr) ) - { - s_Factory = nullptr; - return nullptr; - } - } -#else - HRESULT hr = CoCreateInstance( - CLSID_WICImagingFactory, - nullptr, - CLSCTX_INPROC_SERVER, - __uuidof(IWICImagingFactory), - (LPVOID*)&s_Factory - ); - - if ( FAILED(hr) ) - { - s_Factory = nullptr; - return nullptr; - } -#endif - - return s_Factory; -} - -//--------------------------------------------------------------------------------- -static DXGI_FORMAT _WICToDXGI( const GUID& guid ) -{ - for( size_t i=0; i < _countof(g_WICFormats); ++i ) - { - if ( memcmp( &g_WICFormats[i].wic, &guid, sizeof(GUID) ) == 0 ) - return g_WICFormats[i].format; - } - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - if ( g_WIC2 ) - { - if ( memcmp( &GUID_WICPixelFormat96bppRGBFloat, &guid, sizeof(GUID) ) == 0 ) - return DXGI_FORMAT_R32G32B32_FLOAT; - } -#endif - - return DXGI_FORMAT_UNKNOWN; -} - -//--------------------------------------------------------------------------------- -static size_t _WICBitsPerPixel( REFGUID targetGuid ) -{ - IWICImagingFactory* pWIC = _GetWIC(); - if ( !pWIC ) - return 0; - - ComPtr cinfo; - if ( FAILED( pWIC->CreateComponentInfo( targetGuid, cinfo.GetAddressOf() ) ) ) - return 0; - - WICComponentType type; - if ( FAILED( cinfo->GetComponentType( &type ) ) ) - return 0; - - if ( type != WICPixelFormat ) - return 0; - - ComPtr pfinfo; - if ( FAILED( cinfo.As( &pfinfo ) ) ) - return 0; - - UINT bpp; - if ( FAILED( pfinfo->GetBitsPerPixel( &bpp ) ) ) - return 0; - - return bpp; -} - - -//-------------------------------------------------------------------------------------- -static DXGI_FORMAT MakeSRGB( _In_ DXGI_FORMAT format ) -{ - switch( format ) - { - case DXGI_FORMAT_R8G8B8A8_UNORM: - return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - - case DXGI_FORMAT_BC1_UNORM: - return DXGI_FORMAT_BC1_UNORM_SRGB; - - case DXGI_FORMAT_BC2_UNORM: - return DXGI_FORMAT_BC2_UNORM_SRGB; - - case DXGI_FORMAT_BC3_UNORM: - return DXGI_FORMAT_BC3_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8A8_UNORM: - return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; - - case DXGI_FORMAT_B8G8R8X8_UNORM: - return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; - - case DXGI_FORMAT_BC7_UNORM: - return DXGI_FORMAT_BC7_UNORM_SRGB; - - default: - return format; - } -} - - -//--------------------------------------------------------------------------------- -static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice, - _In_opt_ ID3D11DeviceContext* d3dContext, - _In_ IWICBitmapFrameDecode *frame, - _In_ size_t maxsize, - _In_ D3D11_USAGE usage, - _In_ unsigned int bindFlags, - _In_ unsigned int cpuAccessFlags, - _In_ unsigned int miscFlags, - _In_ bool forceSRGB, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView ) -{ - UINT width, height; - HRESULT hr = frame->GetSize( &width, &height ); - if ( FAILED(hr) ) - return hr; - - assert( width > 0 && height > 0 ); - - if ( !maxsize ) - { - // This is a bit conservative because the hardware could support larger textures than - // the Feature Level defined minimums, but doing it this way is much easier and more - // performant for WIC than the 'fail and retry' model used by DDSTextureLoader - - switch( d3dDevice->GetFeatureLevel() ) - { - case D3D_FEATURE_LEVEL_9_1: - case D3D_FEATURE_LEVEL_9_2: - maxsize = 2048 /*D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; - break; - - case D3D_FEATURE_LEVEL_9_3: - maxsize = 4096 /*D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; - break; - - case D3D_FEATURE_LEVEL_10_0: - case D3D_FEATURE_LEVEL_10_1: - maxsize = 8192 /*D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION*/; - break; - - default: - maxsize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; - break; - } - } - - assert( maxsize > 0 ); - - UINT twidth, theight; - if ( width > maxsize || height > maxsize ) - { - float ar = static_cast(height) / static_cast(width); - if ( width > height ) - { - twidth = static_cast( maxsize ); - theight = static_cast( static_cast(maxsize) * ar ); - } - else - { - theight = static_cast( maxsize ); - twidth = static_cast( static_cast(maxsize) / ar ); - } - assert( twidth <= maxsize && theight <= maxsize ); - } - else - { - twidth = width; - theight = height; - } - - // Determine format - WICPixelFormatGUID pixelFormat; - hr = frame->GetPixelFormat( &pixelFormat ); - if ( FAILED(hr) ) - return hr; - - WICPixelFormatGUID convertGUID; - memcpy( &convertGUID, &pixelFormat, sizeof(WICPixelFormatGUID) ); - - size_t bpp = 0; - - DXGI_FORMAT format = _WICToDXGI( pixelFormat ); - if ( format == DXGI_FORMAT_UNKNOWN ) - { - if ( memcmp( &GUID_WICPixelFormat96bppRGBFixedPoint, &pixelFormat, sizeof(WICPixelFormatGUID) ) == 0 ) - { -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - if ( g_WIC2 ) - { - memcpy( &convertGUID, &GUID_WICPixelFormat96bppRGBFloat, sizeof(WICPixelFormatGUID) ); - format = DXGI_FORMAT_R32G32B32_FLOAT; - } - else -#endif - { - memcpy( &convertGUID, &GUID_WICPixelFormat128bppRGBAFloat, sizeof(WICPixelFormatGUID) ); - format = DXGI_FORMAT_R32G32B32A32_FLOAT; - } - } - else - { - for( size_t i=0; i < _countof(g_WICConvert); ++i ) - { - if ( memcmp( &g_WICConvert[i].source, &pixelFormat, sizeof(WICPixelFormatGUID) ) == 0 ) - { - memcpy( &convertGUID, &g_WICConvert[i].target, sizeof(WICPixelFormatGUID) ); - - format = _WICToDXGI( g_WICConvert[i].target ); - assert( format != DXGI_FORMAT_UNKNOWN ); - bpp = _WICBitsPerPixel( convertGUID ); - break; - } - } - } - - if ( format == DXGI_FORMAT_UNKNOWN ) - return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); - } - else - { - bpp = _WICBitsPerPixel( pixelFormat ); - } - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - if ( (format == DXGI_FORMAT_R32G32B32_FLOAT) && d3dContext != 0 && textureView != 0 ) - { - // Special case test for optional device support for autogen mipchains for R32G32B32_FLOAT - UINT fmtSupport = 0; - hr = d3dDevice->CheckFormatSupport( DXGI_FORMAT_R32G32B32_FLOAT, &fmtSupport ); - if ( FAILED(hr) || !( fmtSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN ) ) - { - // Use R32G32B32A32_FLOAT instead which is required for Feature Level 10.0 and up - memcpy( &convertGUID, &GUID_WICPixelFormat128bppRGBAFloat, sizeof(WICPixelFormatGUID) ); - format = DXGI_FORMAT_R32G32B32A32_FLOAT; - bpp = 128; - } - } -#endif - - if ( !bpp ) - return E_FAIL; - - // Handle sRGB formats - if ( forceSRGB ) - { - format = MakeSRGB( format ); - } - else - { - ComPtr metareader; - if ( SUCCEEDED( frame->GetMetadataQueryReader( metareader.GetAddressOf() ) ) ) - { - GUID containerFormat; - if ( SUCCEEDED( metareader->GetContainerFormat( &containerFormat ) ) ) - { - // Check for sRGB colorspace metadata - bool sRGB = false; - - PROPVARIANT value; - PropVariantInit( &value ); - - if ( memcmp( &containerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 ) - { - // Check for sRGB chunk - if ( SUCCEEDED( metareader->GetMetadataByName( L"/sRGB/RenderingIntent", &value ) ) && value.vt == VT_UI1 ) - { - sRGB = true; - } - } - else if ( SUCCEEDED( metareader->GetMetadataByName( L"System.Image.ColorSpace", &value ) ) && value.vt == VT_UI2 && value.uiVal == 1 ) - { - sRGB = true; - } - - PropVariantClear( &value ); - - if ( sRGB ) - format = MakeSRGB( format ); - } - } - } - - // Verify our target format is supported by the current device - // (handles WDDM 1.0 or WDDM 1.1 device driver cases as well as DirectX 11.0 Runtime without 16bpp format support) - UINT support = 0; - hr = d3dDevice->CheckFormatSupport( format, &support ); - if ( FAILED(hr) || !(support & D3D11_FORMAT_SUPPORT_TEXTURE2D) ) - { - // Fallback to RGBA 32-bit format which is supported by all devices - memcpy( &convertGUID, &GUID_WICPixelFormat32bppRGBA, sizeof(WICPixelFormatGUID) ); - format = DXGI_FORMAT_R8G8B8A8_UNORM; - bpp = 32; - } - - // Allocate temporary memory for image - size_t rowPitch = ( twidth * bpp + 7 ) / 8; - size_t imageSize = rowPitch * theight; - - std::unique_ptr temp( new (std::nothrow) uint8_t[ imageSize ] ); - if (!temp) - return E_OUTOFMEMORY; - - // Load image data - if ( memcmp( &convertGUID, &pixelFormat, sizeof(GUID) ) == 0 - && twidth == width - && theight == height ) - { - // No format conversion or resize needed - hr = frame->CopyPixels( 0, static_cast( rowPitch ), static_cast( imageSize ), temp.get() ); - if ( FAILED(hr) ) - return hr; - } - else if ( twidth != width || theight != height ) - { - // Resize - IWICImagingFactory* pWIC = _GetWIC(); - if ( !pWIC ) - return E_NOINTERFACE; - - ComPtr scaler; - hr = pWIC->CreateBitmapScaler( scaler.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - hr = scaler->Initialize( frame, twidth, theight, WICBitmapInterpolationModeFant ); - if ( FAILED(hr) ) - return hr; - - WICPixelFormatGUID pfScaler; - hr = scaler->GetPixelFormat( &pfScaler ); - if ( FAILED(hr) ) - return hr; - - if ( memcmp( &convertGUID, &pfScaler, sizeof(GUID) ) == 0 ) - { - // No format conversion needed - hr = scaler->CopyPixels( 0, static_cast( rowPitch ), static_cast( imageSize ), temp.get() ); - if ( FAILED(hr) ) - return hr; - } - else - { - ComPtr FC; - hr = pWIC->CreateFormatConverter( FC.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - BOOL canConvert = FALSE; - hr = FC->CanConvert( pfScaler, convertGUID, &canConvert ); - if ( FAILED(hr) || !canConvert ) - { - return E_UNEXPECTED; - } - - hr = FC->Initialize( scaler.Get(), convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom ); - if ( FAILED(hr) ) - return hr; - - hr = FC->CopyPixels( 0, static_cast( rowPitch ), static_cast( imageSize ), temp.get() ); - if ( FAILED(hr) ) - return hr; - } - } - else - { - // Format conversion but no resize - IWICImagingFactory* pWIC = _GetWIC(); - if ( !pWIC ) - return E_NOINTERFACE; - - ComPtr FC; - hr = pWIC->CreateFormatConverter( FC.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - BOOL canConvert = FALSE; - hr = FC->CanConvert( pixelFormat, convertGUID, &canConvert ); - if ( FAILED(hr) || !canConvert ) - { - return E_UNEXPECTED; - } - - hr = FC->Initialize( frame, convertGUID, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom ); - if ( FAILED(hr) ) - return hr; - - hr = FC->CopyPixels( 0, static_cast( rowPitch ), static_cast( imageSize ), temp.get() ); - if ( FAILED(hr) ) - return hr; - } - - // See if format is supported for auto-gen mipmaps (varies by feature level) - bool autogen = false; - if ( d3dContext != 0 && textureView != 0 ) // Must have context and shader-view to auto generate mipmaps - { - UINT fmtSupport = 0; - hr = d3dDevice->CheckFormatSupport( format, &fmtSupport ); - if ( SUCCEEDED(hr) && ( fmtSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN ) ) - { - autogen = true; - } - } - - // Create texture - D3D11_TEXTURE2D_DESC desc; - desc.Width = twidth; - desc.Height = theight; - desc.MipLevels = (autogen) ? 0 : 1; - desc.ArraySize = 1; - desc.Format = format; - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = 0; - desc.Usage = usage; - desc.CPUAccessFlags = cpuAccessFlags; - - if ( autogen ) - { - desc.BindFlags = bindFlags | D3D11_BIND_RENDER_TARGET; - desc.MiscFlags = miscFlags | D3D11_RESOURCE_MISC_GENERATE_MIPS; - } - else - { - desc.BindFlags = bindFlags; - desc.MiscFlags = miscFlags; - } - - D3D11_SUBRESOURCE_DATA initData; - initData.pSysMem = temp.get(); - initData.SysMemPitch = static_cast( rowPitch ); - initData.SysMemSlicePitch = static_cast( imageSize ); - - ID3D11Texture2D* tex = nullptr; - hr = d3dDevice->CreateTexture2D( &desc, (autogen) ? nullptr : &initData, &tex ); - if ( SUCCEEDED(hr) && tex != 0 ) - { - if (textureView != 0) - { - D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc; - memset( &SRVDesc, 0, sizeof( SRVDesc ) ); - SRVDesc.Format = desc.Format; - - SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; - SRVDesc.Texture2D.MipLevels = (autogen) ? -1 : 1; - - hr = d3dDevice->CreateShaderResourceView( tex, &SRVDesc, textureView ); - if ( FAILED(hr) ) - { - tex->Release(); - return hr; - } - - if ( autogen ) - { - assert( d3dContext != 0 ); - d3dContext->UpdateSubresource( tex, 0, nullptr, temp.get(), static_cast(rowPitch), static_cast(imageSize) ); - d3dContext->GenerateMips( *textureView ); - } - } - - if (texture != 0) - { - *texture = tex; - } - else - { - SetDebugObjectName(tex, "WICTextureLoader"); - tex->Release(); - } - } - - return hr; -} - -//-------------------------------------------------------------------------------------- -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromMemory( ID3D11Device* d3dDevice, - const uint8_t* wicData, - size_t wicDataSize, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView, - size_t maxsize ) -{ - return CreateWICTextureFromMemoryEx( d3dDevice, nullptr, wicData, wicDataSize, maxsize, - D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromMemory( ID3D11Device* d3dDevice, - ID3D11DeviceContext* d3dContext, - const uint8_t* wicData, - size_t wicDataSize, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView, - size_t maxsize ) -{ - return CreateWICTextureFromMemoryEx( d3dDevice, d3dContext, wicData, wicDataSize, maxsize, - D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D11Device* d3dDevice, - const uint8_t* wicData, - size_t wicDataSize, - size_t maxsize, - D3D11_USAGE usage, - unsigned int bindFlags, - unsigned int cpuAccessFlags, - unsigned int miscFlags, - bool forceSRGB, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView ) -{ - return CreateWICTextureFromMemoryEx( d3dDevice, nullptr, wicData, wicDataSize, maxsize, - usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromMemoryEx( ID3D11Device* d3dDevice, - ID3D11DeviceContext* d3dContext, - const uint8_t* wicData, - size_t wicDataSize, - size_t maxsize, - D3D11_USAGE usage, - unsigned int bindFlags, - unsigned int cpuAccessFlags, - unsigned int miscFlags, - bool forceSRGB, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView ) -{ - if ( texture ) - { - *texture = nullptr; - } - if ( textureView ) - { - *textureView = nullptr; - } - - if (!d3dDevice || !wicData || (!texture && !textureView)) - return E_INVALIDARG; - - if ( !wicDataSize ) - return E_FAIL; - -#ifdef _M_AMD64 - if ( wicDataSize > 0xFFFFFFFF ) - return HRESULT_FROM_WIN32( ERROR_FILE_TOO_LARGE ); -#endif - - IWICImagingFactory* pWIC = _GetWIC(); - if ( !pWIC ) - return E_NOINTERFACE; - - // Create input stream for memory - ComPtr stream; - HRESULT hr = pWIC->CreateStream( stream.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - hr = stream->InitializeFromMemory( const_cast( wicData ), static_cast( wicDataSize ) ); - if ( FAILED(hr) ) - return hr; - - // Initialize WIC - ComPtr decoder; - hr = pWIC->CreateDecoderFromStream( stream.Get(), 0, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - ComPtr frame; - hr = decoder->GetFrame( 0, frame.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - hr = CreateTextureFromWIC( d3dDevice, d3dContext, frame.Get(), maxsize, - usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB, - texture, textureView ); - if ( FAILED(hr)) - return hr; - - if (texture != 0 && *texture != 0) - { - SetDebugObjectName(*texture, "WICTextureLoader"); - } - - if (textureView != 0 && *textureView != 0) - { - SetDebugObjectName(*textureView, "WICTextureLoader"); - } - - return hr; -} - -//-------------------------------------------------------------------------------------- -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromFile( ID3D11Device* d3dDevice, - const wchar_t* fileName, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView, - size_t maxsize ) -{ - return CreateWICTextureFromFileEx( d3dDevice, nullptr, fileName, maxsize, - D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromFile( ID3D11Device* d3dDevice, - ID3D11DeviceContext* d3dContext, - const wchar_t* fileName, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView, - size_t maxsize ) -{ - return CreateWICTextureFromFileEx( d3dDevice, d3dContext, fileName, maxsize, - D3D11_USAGE_DEFAULT, D3D11_BIND_SHADER_RESOURCE, 0, 0, false, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice, - const wchar_t* fileName, - size_t maxsize, - D3D11_USAGE usage, - unsigned int bindFlags, - unsigned int cpuAccessFlags, - unsigned int miscFlags, - bool forceSRGB, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView ) -{ - return CreateWICTextureFromFileEx( d3dDevice, nullptr, fileName, maxsize, - usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB, - texture, textureView ); -} - -_Use_decl_annotations_ -HRESULT DirectX::CreateWICTextureFromFileEx( ID3D11Device* d3dDevice, - ID3D11DeviceContext* d3dContext, - const wchar_t* fileName, - size_t maxsize, - D3D11_USAGE usage, - unsigned int bindFlags, - unsigned int cpuAccessFlags, - unsigned int miscFlags, - bool forceSRGB, - ID3D11Resource** texture, - ID3D11ShaderResourceView** textureView ) -{ - if ( texture ) - { - *texture = nullptr; - } - if ( textureView ) - { - *textureView = nullptr; - } - - if (!d3dDevice || !fileName || (!texture && !textureView)) - return E_INVALIDARG; - - IWICImagingFactory* pWIC = _GetWIC(); - if ( !pWIC ) - return E_NOINTERFACE; - - // Initialize WIC - ComPtr decoder; - HRESULT hr = pWIC->CreateDecoderFromFilename( fileName, 0, GENERIC_READ, WICDecodeMetadataCacheOnDemand, decoder.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - ComPtr frame; - hr = decoder->GetFrame( 0, frame.GetAddressOf() ); - if ( FAILED(hr) ) - return hr; - - hr = CreateTextureFromWIC( d3dDevice, d3dContext, frame.Get(), maxsize, - usage, bindFlags, cpuAccessFlags, miscFlags, forceSRGB, - texture, textureView ); - -#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) - if ( SUCCEEDED(hr) ) - { - if (texture != 0 || textureView != 0) - { - CHAR strFileA[MAX_PATH]; - int result = WideCharToMultiByte( CP_ACP, - WC_NO_BEST_FIT_CHARS, - fileName, - -1, - strFileA, - MAX_PATH, - nullptr, - FALSE - ); - if ( result > 0 ) - { - const CHAR* pstrName = strrchr( strFileA, '\\' ); - if (!pstrName) - { - pstrName = strFileA; - } - else - { - pstrName++; - } - - if (texture != 0 && *texture != 0) - { - (*texture)->SetPrivateData( WKPDID_D3DDebugObjectName, - static_cast( strnlen_s(pstrName, MAX_PATH) ), - pstrName - ); - } - - if (textureView != 0 && *textureView != 0 ) - { - (*textureView)->SetPrivateData( WKPDID_D3DDebugObjectName, - static_cast( strnlen_s(pstrName, MAX_PATH) ), - pstrName - ); - } - } - } - } -#endif - - return hr; -} diff -Nru kodi-visualization-shadertoy-1.2.3/src/WICTextureLoader.h kodi-visualization-shadertoy-2.3.0/src/WICTextureLoader.h --- kodi-visualization-shadertoy-1.2.3/src/WICTextureLoader.h 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/src/WICTextureLoader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -//-------------------------------------------------------------------------------------- -// File: WICTextureLoader.h -// -// Function for loading a WIC image and creating a Direct3D 11 runtime texture for it -// (auto-generating mipmaps if possible) -// -// Note: Assumes application has already called CoInitializeEx -// -// Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for -// auto-gen mipmap support. -// -// Note these functions are useful for images created as simple 2D textures. For -// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. -// For a full-featured DDS file reader, writer, and texture processing pipeline see -// the 'Texconv' sample and the 'DirectXTex' library. -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// http://go.microsoft.com/fwlink/?LinkId=248926 -// http://go.microsoft.com/fwlink/?LinkId=248929 -//-------------------------------------------------------------------------------------- - -#ifdef _MSC_VER -#pragma once -#endif - -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (_WIN32_WINNT <= _WIN32_WINNT_WIN8) -#error WIC is not supported on Windows Phone 8.0 -#endif - -#include - -#pragma warning(push) -#pragma warning(disable : 4005) -#include -#pragma warning(pop) - -#if defined(_MSC_VER) && (_MSC_VER<1610) && !defined(_In_reads_) -#define _In_reads_(exp) -#define _Out_writes_(exp) -#define _In_reads_bytes_(exp) -#endif - -#ifndef _Use_decl_annotations_ -#define _Use_decl_annotations_ -#endif - -namespace DirectX -{ - // Standard version - HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice, - _In_reads_bytes_(wicDataSize) const uint8_t* wicData, - _In_ size_t wicDataSize, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0 - ); - - HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, - _In_z_ const wchar_t* szFileName, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0 - ); - - // Standard version with optional auto-gen mipmap support - HRESULT CreateWICTextureFromMemory( _In_ ID3D11Device* d3dDevice, - _In_opt_ ID3D11DeviceContext* d3dContext, - _In_reads_bytes_(wicDataSize) const uint8_t* wicData, - _In_ size_t wicDataSize, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0 - ); - - HRESULT CreateWICTextureFromFile( _In_ ID3D11Device* d3dDevice, - _In_opt_ ID3D11DeviceContext* d3dContext, - _In_z_ const wchar_t* szFileName, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView, - _In_ size_t maxsize = 0 - ); - - // Extended version - HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, - _In_reads_bytes_(wicDataSize) const uint8_t* wicData, - _In_ size_t wicDataSize, - _In_ size_t maxsize, - _In_ D3D11_USAGE usage, - _In_ unsigned int bindFlags, - _In_ unsigned int cpuAccessFlags, - _In_ unsigned int miscFlags, - _In_ bool forceSRGB, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView - ); - - HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, - _In_z_ const wchar_t* szFileName, - _In_ size_t maxsize, - _In_ D3D11_USAGE usage, - _In_ unsigned int bindFlags, - _In_ unsigned int cpuAccessFlags, - _In_ unsigned int miscFlags, - _In_ bool forceSRGB, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView - ); - - // Extended version with optional auto-gen mipmap support - HRESULT CreateWICTextureFromMemoryEx( _In_ ID3D11Device* d3dDevice, - _In_opt_ ID3D11DeviceContext* d3dContext, - _In_reads_bytes_(wicDataSize) const uint8_t* wicData, - _In_ size_t wicDataSize, - _In_ size_t maxsize, - _In_ D3D11_USAGE usage, - _In_ unsigned int bindFlags, - _In_ unsigned int cpuAccessFlags, - _In_ unsigned int miscFlags, - _In_ bool forceSRGB, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView - ); - - HRESULT CreateWICTextureFromFileEx( _In_ ID3D11Device* d3dDevice, - _In_opt_ ID3D11DeviceContext* d3dContext, - _In_z_ const wchar_t* szFileName, - _In_ size_t maxsize, - _In_ D3D11_USAGE usage, - _In_ unsigned int bindFlags, - _In_ unsigned int cpuAccessFlags, - _In_ unsigned int miscFlags, - _In_ bool forceSRGB, - _Out_opt_ ID3D11Resource** texture, - _Out_opt_ ID3D11ShaderResourceView** textureView - ); -} \ No newline at end of file diff -Nru kodi-visualization-shadertoy-1.2.3/.travis.yml kodi-visualization-shadertoy-2.3.0/.travis.yml --- kodi-visualization-shadertoy-1.2.3/.travis.yml 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/.travis.yml 2015-05-23 07:24:22.000000000 +0000 @@ -1,16 +1,12 @@ language: cpp -# -# Define the build matrix -# -# Travis defaults to building on Ubuntu Trusty when building on -# Linux. We need Xenial in order to get up to date versions of -# cmake and g++. -# env: global: - app_id=visualization.shadertoy +# +# Define the build matrix +# matrix: include: - os: linux @@ -21,25 +17,38 @@ dist: xenial sudo: required compiler: clang + - os: linux + dist: bionic + sudo: required + compiler: gcc + env: DEBIAN_BUILD=true + - os: linux + dist: focal + sudo: required + compiler: gcc + env: DEBIAN_BUILD=true - os: osx - osx_image: xcode9 - - os: osx - osx_image: xcode9.4 + osx_image: xcode10.2 before_install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libgl1-mesa-dev; fi + - if [[ $DEBIAN_BUILD == true ]]; then sudo add-apt-repository -y ppa:team-xbmc/xbmc-nightly; fi + - if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get install fakeroot; fi + - if [[ $DEBIAN_BUILD != true ]] && [[ $TRAVIS_OS_NAME == linux ]]; then sudo apt-get install -y libgl1-mesa-dev; fi # # The addon source is automatically checked out in $TRAVIS_BUILD_DIR, # we'll put the Kodi source on the same level # before_script: - - cd $TRAVIS_BUILD_DIR/.. - - git clone --branch Leia --depth=1 https://github.com/xbmc/xbmc.git - - cd ${app_id} && mkdir build && cd build - - mkdir -p definition/${app_id} - - echo ${app_id} $TRAVIS_BUILD_DIR $TRAVIS_COMMIT > definition/${app_id}/${app_id}.txt - - cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DADDONS_DEFINITION_DIR=$TRAVIS_BUILD_DIR/build/definition -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/cmake/addons + - if [[ $DEBIAN_BUILD != true ]]; then cd $TRAVIS_BUILD_DIR/..; fi + - if [[ $DEBIAN_BUILD != true ]]; then git clone --branch master --depth=1 https://github.com/xbmc/xbmc.git; fi + - if [[ $DEBIAN_BUILD != true ]]; then cd ${app_id} && mkdir build && cd build; fi + - if [[ $DEBIAN_BUILD != true ]]; then mkdir -p definition/${app_id}; fi + - if [[ $DEBIAN_BUILD != true ]]; then echo ${app_id} $TRAVIS_BUILD_DIR $TRAVIS_COMMIT > definition/${app_id}/${app_id}.txt; fi + - if [[ $DEBIAN_BUILD != true ]]; then cmake -DADDONS_TO_BUILD=${app_id} -DADDON_SRC_PREFIX=$TRAVIS_BUILD_DIR/.. -DADDONS_DEFINITION_DIR=$TRAVIS_BUILD_DIR/build/definition -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/../xbmc/addons -DPACKAGE_ZIP=1 $TRAVIS_BUILD_DIR/../xbmc/cmake/addons; fi + - if [[ $DEBIAN_BUILD == true ]]; then wget https://raw.githubusercontent.com/xbmc/xbmc/master/xbmc/addons/kodi-dev-kit/tools/debian-addon-package-test.sh && chmod +x ./debian-addon-package-test.sh; fi + - if [[ $DEBIAN_BUILD == true ]]; then sudo apt-get build-dep $TRAVIS_BUILD_DIR; fi -script: make +script: + - if [[ $DEBIAN_BUILD != true ]]; then make; fi + - if [[ $DEBIAN_BUILD == true ]]; then ./debian-addon-package-test.sh $TRAVIS_BUILD_DIR; fi diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/addon.xml.in kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/addon.xml.in --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/addon.xml.in 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/addon.xml.in 2015-05-23 07:24:22.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ @@ -9,9 +9,13 @@ point="xbmc.player.musicviz" library_@PLATFORM@="@LIBRARY_FILENAME@"/> - Visualisations from Shadertoy - This music visualization is based on Shadertoy based GPU programs. + Visualisierungen von Shadertoy + Visualizations from Shadertoy + Diese Musikvisualisierung basiert auf Shadertoy-basierten GPU-Programmen. + This music visualization is based on Shadertoy based GPU programs. @PLATFORM@ + GPL-2.0-or-later + https://github.com/xbmc/visualization.shadertoy resources/icon.png resources/fanart.jpg diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/changelog.txt kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/changelog.txt --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/changelog.txt 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/changelog.txt 2015-05-23 07:24:22.000000000 +0000 @@ -1,18 +1,41 @@ -[B]1.2.3[/B] +[B]2.3.0[/B] +- Matrix API change GUI API 5.15.0 + +[B]2.2.1[/B] +- Fix standalone build with newer glm versions (>= 0.9.9.6) + +[B]2.2.0[/B] +- Matrix API change visualizations +- Improve debian build code +- Add german translations +- Add debian build tests to Travis CI + +[B]2.1.1[/B] +- Clamp framebuffer texture to avoid edge pixels bleeding +- Add source URL to addon.xml + +[B]2.1.0[/B] +- Matrix API change inputstream API 2.3.1 +- Matrix APi change Global API 1.2.0 + +[B]2.0.2[/B] +- Allow on new addon settings to set own Shadertoy file - Update Debian package creation -- Remove not needed "virtual" on windows related code -- Update glm on depends to version 0.9.9.5 -- Add screenshots and fanart images to see what it brings -- Update description text +- Update glm on depends to version 0.9.9.4 - Use reduced size always if calculation is lower as screen size - Prevent some shaders on GLES (can freeze on weak systems) +- Add textureLod fallback on GLES (needed on some shadertoys) +- Cleanup CMakeLists.txt +- Update addon Readme +- Kodi visualization API change -[B]1.2.2[/B] +[B]2.0.1[/B] - Fix debian packaging -[B]1.2.1[/B] -- On code override GL_RED (if not present) with GL_LUMINANCE (needed on older GLES versions) -- AppVeyor: Use Visual Studio 2017 & add WindowsStore +[B]2.0.0[/B] +- Allow complete support via Angle to Windows +- Add screenshots and fanart images to see what it brings +- Update description text [B]1.2.0[/B] - Update build system version and cleanup @@ -20,6 +43,9 @@ - Update shader files with a revised copy to a new OpenGL-related folder - Remove old for Windows not supported shader files +[B]1.1.10[/B] +- Fix correct buffer size after file read + [B]1.1.9[/B] - Save last used preset diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/2Dspectrum.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/2Dspectrum.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/2Dspectrum.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/2Dspectrum.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -2D LED Spectrum - Visualiser - https://www.shadertoy.com/view/Mlj3WV# -Based on Led Spectrum Analiser by: simesgreen - 27th February, 2013 - https://www.shadertoy.com/view/Msl3zr -2D LED Spectrum by: uNiversal - 27th May, 2015 -Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. -*/ - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - // create pixel coordinates - vec2 uv = fragCoord.xy / iResolution.xy; - - // quantize coordinates - const float bands = 30.0; - const float segs = 40.0; - vec2 p; - p.x = floor(uv.x*bands)/bands; - p.y = floor(uv.y*segs)/segs; - - // read frequency data from first row of texture - float fft = texture2D( iChannel0, vec2(p.x,0.0) ).x; - - // led color - vec3 color = mix(vec3(0.0, 2.0, 0.0), vec3(2.0, 0.0, 0.0), sqrt(uv.y)); - - // mask for bar graph - float mask = (p.y < fft) ? 1.0 : 0.1; - - // led shape - vec2 d = fract((uv - p)*vec2(bands, segs)) - 0.5; - float led = smoothstep(0.5, 0.35, abs(d.x)) * - smoothstep(0.5, 0.35, abs(d.y)); - vec3 ledColor = led*color*mask; - - // output final color - fragColor = vec4(ledColor, 1.0); -} diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/audioreaktive.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/audioreaktive.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/audioreaktive.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/audioreaktive.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,197 +0,0 @@ -// Taken from https://www.shadertoy.com/view/XssGRj - -//This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. - -//Made ALT_MODE default -//Added x-distortion, noise overlay to ALT_MODE - -//uncomment for a more intense color scheme suited for ourpithyator, etc -//comment for a calmer color scheme suited for 8 bit mentality, etc -#define ALT_MODE - -//up to your taste. Might go well with ALT_MODE? -//If you comment gamma but leave contrast you'll get a solarized effect. -//#define POST_PROC - - -#define BEAT_POINT 0.3 - - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - //screenspace mapping - vec2 uv = fragCoord.xy / iResolution.xy; - - vec3 final_color, bg_color, wave_color; - - //establish a reasonable beat estimation - float beat = texture2D(iChannel0, vec2(BEAT_POINT, 0.0)).x; - beat = beat * beat; - - //sun.x is desaturation. (-1.0 - 1.0) is good - //sun.y is hue-related (keep around 0.2 - 1.0) - //sun.z is contrast-related (keep around 0.7 - 1.0) - //base values are -0.64, 0.96, 0.99 - vec3 sun = vec3(-0.64, 0.96, 0.99); - - //forget static shading. let's get dynamic! - sun.x = -0.8 + beat*1.5; - sun.y = 0.7 + 0.3 * cos(uv.x*6.0+20.0*(uv.y-0.5)*(beat-0.2) + iGlobalTime); - sun.z = 0.9 + 0.1 * cos(iGlobalTime); - - //crazy intense dubstep-ize the colors - #ifdef ALT_MODE - sun.x = -cos(iGlobalTime); - sun.y = 0.7 + 0.3 * cos(uv.x*6.0+20.0*(uv.y-0.5)*(beat-0.2) + iGlobalTime); - sun.z = 0.85 + 0.35 * cos(iGlobalTime); - #endif - - sun.xy = 0.5 + 0.5 * sun.xy; - sun = normalize(sun); - - //waveform at x-coord - float hwf = texture2D(iChannel0, vec2(uv.x,1.0)).x; - float vwf = texture2D(iChannel0, vec2(uv.y,1.0)).x; - - #ifdef ALT_MODE - float noise = texture2D(iChannel0, vec2(vwf,1.0)).x; - float distort = (vwf - 0.5) * beat * beat * beat; - - //distort and wrap, triangle mod - uv.x = abs(uv.x + distort); - if (uv.x > 1.0) uv.x = 2.0 - uv.x; - #endif - - - //four distortion patterns - float coord1 = sin(uv.x + hwf) - cos(uv.y); - float coord2 = sin(1.0 - uv.x + hwf) - sin(uv.y * 3.0); - //float coord3 = cos(uv.x+sin(0.2*iGlobalTime)) - sin(2.5*uv.y - wf); - float coord4 = mix(coord1, coord2,hwf); - float coord5 = mix(coord1, coord2, beat); - - float coorda = mix(coord1, coord2, 0.5 + 0.5 *sin(iGlobalTime*0.7)); - float coordb = mix(coord5, coord4, 0.5 + 0.5 *sin(iGlobalTime*0.5)); - - //mix distortions based on time - float coord = mix(coorda, coordb, 0.5 + 0.5 *sin(iGlobalTime*0.3)); - - //distort the spectrum image using the above coords - float j = (texture2D(iChannel0, vec2(abs(coord),0.0)).x - 0.5) * 2.0; - - //greyscale -> color with a lot of dot products - float fac1 = dot(vec3(uv.x,uv.y,j),sun); - float fac2 = dot(vec3(uv.y,j,uv.x),sun); - float fac3 = dot(vec3(j,uv.x,uv.y),sun); - bg_color = vec3(fac1,fac2,fac3); - - - //extract some info about wave shape - float w1 = texture2D(iChannel0, vec2(0.1,0.0)).x; - float w2 = texture2D(iChannel0, vec2(0.2,0.0)).x; - float w3 = texture2D(iChannel0, vec2(0.4,0.0)).x; - float w4 = texture2D(iChannel0, vec2(0.8,0.0)).x; - - //save screenspace for later - vec2 ouv = uv; - - - float wave_width = 0.0; - float wave_amp = 0.0; - - //rescale to aspect-aware [-1, 1] - uv = -1.0 + 2.0 * uv; - uv.y *= iResolution.y/iResolution.x; - - #ifdef ALT_MODE - //bend-spin-stretch the coord system based on wave shape - float theta = (w1 - w2 + w3 - w4) * 3.14; - uv = mul(uv, mat2(cos(theta * 0.2),-sin(theta * 0.3),sin(theta * 0.5),cos(theta * 0.7))); - #endif - - //for polar calculations - float rad = length(uv) - 0.3; - - float h; - - //slightly based on Waves by bonniem - for(float i = 0.0; i < 10.0; i++) { - //build a simple trig series based on wave shape - //note that waves are in rectangular coords - h = sin(uv.x*8.0+iGlobalTime)*0.2*w1+ - sin(uv.x*16.0-2.0*iGlobalTime)*0.2*w2 + - sin(uv.x*32.0+3.0*iGlobalTime)*0.2*w3 + - sin(uv.x*64.0-4.0*iGlobalTime)*0.2*w4; - rad += h * 0.4; - //find the wave section's width in polar coords - wave_width = abs(1.0 / (100.0 * rad)); - wave_amp += wave_width; - } - - //color waves based on sonar shape and screen position - wave_color = vec3(0.2 + w2*1.5, 0.1 + w4*2.0 + uv.y*0.1, 0.1 + w3*2.0+uv.x*0.1); - - #ifdef ALT_MODE - //fade with beat - wave_amp *= beat * 3.0; - #endif - - //modulate with waveform. doesn't do much. - wave_amp *= hwf*2.0; - - - //fade bg in from 0 to 5 sec - final_color = bg_color*smoothstep(0.0,5.0,iChannelTime[0]); - final_color += 0.12*wave_color*wave_amp; - - //postproc code from iq :) - #ifdef POST_PROC - //gamma. remove this for a solarized look - final_color = pow( clamp( final_color, 0.0, 1.0 ), vec3(1.7,1.7,1.7) ); - - //contrast - final_color = final_color*0.3 + 0.7*final_color*final_color*(3.0-2.0*final_color); - #endif - - //vignette - final_color *= 0.5 + 0.5*pow( 16.0*ouv.x*ouv.y*(1.0-ouv.x)*(1.0-ouv.y), 0.2); - - #ifdef ALT_MODE -// final_color = mix(final_color, vec3(noise,noise,noise), distort * 10.0); - final_color += vec3(noise,noise,noise) * distort * 10.0; - #endif - - fragColor = vec4(final_color, 1.0); -} -/* -split into vwf and hwf -use vwf to self-modulate a texture for distort phase -distort uv of beginning with vwf -text! -simple float arrays for each line, stored at half or less res -use +1 for words, -1 for outline, inbet for glow effect -eg 0.0, 0.1, 0.3, 0.5, 0.9, -1.0, -1.0, 1.0, 1.0... -use timecodes of channel to get a time offset for text anim, -a text centre, and a lyric file. -*/ - -/* -Lean out in the window, take a look and see -Metal moons are dreaming both of you and me -Staring in the sky they are for days and weeks -Painting cubes and ribbons like in demoscene - -Circuit-bent, eight-bit made, but how is your heart? -pixel pelt, low-fi brain, that makes you so smart -beeps and voice, glitch and noise, you're not a machine any more - -Coding every minute, coding every bit -parties you can visit, people you can meet -turn on your computer, make a brand new beat -dance it like a human with your robot feet - -What is high definition for -when you still play on Commodore? - -Any more -*/ diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/audiovisual.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/audiovisual.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/audiovisual.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/audiovisual.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -// Taken from https://www.shadertoy.com/view/MsBSzw# - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - vec2 p = (fragCoord.xy-.5*iResolution.xy)/min(iResolution.x,iResolution.y); - vec3 c = vec3(0.0,0.0,0.0); - vec2 uv = fragCoord.xy / iResolution.xy; - float wave = texture2D( iChannel0, vec2(uv.x,0.75) ).x; - - float time = 0.0; - float alpha = 2.*3.14/20.* (iGlobalTime*.9); - float cs = cos(iGlobalTime*.5); - float sn = sin(iGlobalTime*.3); - float sn2 = sin(iGlobalTime); - float sm=smoothstep( 0.0, 0.15, abs(wave - uv.y)); - for(int i = 1; i<10; i++) - { - time += alpha; - float x = sin(time)*1.8*sm; - float y = sin(.5*time)*0.5*sm; - vec2 o = .4*vec2(x*cs,y*sn); - float red = fract(time); - float green = 1.-red; - c+=0.016/(length(p-o))*vec3(red,green,sn2); - } - fragColor = vec4(c,1.0); -} -//2014 - Passion -//References - https://www.shadertoy.com/view/Xds3Rr -// - tokyodemofest.jp/2014/7lines/index.html - - diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/beatingcircles.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/beatingcircles.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/beatingcircles.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/beatingcircles.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -// Taken from https://www.shadertoy.com/view/4d23Ww - -static const float Pi = 3.14159; -static float beat = 0.; - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - float ct = iGlobalTime; - float beat = 0.3*texture2D(iChannel0,vec2(0.4,0.0)).x; - float scale = iResolution.y / 50.0; - float ring = 20.0; - float radius = iResolution.x*1.0; - float gap = scale*.5; - vec2 pos = fragCoord.xy - iResolution.xy*.5; - - float d = length(pos); - - // Create the wiggle - d += beat*2.0*(sin(pos.y*0.25/scale+iGlobalTime*cos(ct))*sin(pos.x*0.25/scale+iGlobalTime*.5*cos(ct)))*scale*5.0; - - // Compute the distance to the closest ring - float v = mod(d + radius/(ring*2.0), radius/ring); - v = abs(v - radius/(ring*2.0)); - - v = clamp(v-gap, 0.0, 1.0); - - d /= radius; - vec3 m = fract((d-1.0)*vec3(ring*-.5, -ring, ring*.25)*0.5); - - fragColor = vec4(m*v, 1.0); -} diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/bpm.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/bpm.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/bpm.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/bpm.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -// Taken from https://www.shadertoy.com/view/ldB3D1 - -// Created by inigo quilez - iq/2013 -// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. - -// An example showing the use of iChannelData[] in order to synchronize an aimation - -#define BPM 128.0 - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - vec2 uv = -1.0+2.0*fragCoord.xy / iResolution.xy; - uv.x *= iResolution.x/iResolution.y; - - vec3 col = vec3(0.0,0.0,0.0); - - float h = fract( 0.25 + 0.5*iChannelTime[0]*BPM/60.0 ); - float f = 1.0-smoothstep( 0.0, 1.0, h ); - f *= smoothstep( 4.5, 4.51, iChannelTime[0] ); - float r = length(uv-0.0) + 0.2*cos(25.0*h)*exp(-4.0*h); - f = pow(f,0.5)*(1.0-smoothstep( 0.5, 0.55, r) ); - float rn = r/0.55; - col = mix( col, vec3(0.4+1.5*rn,0.1+rn*rn,0.50)*rn, f ); - - - col = mix( col, vec3(1.0,1.0,1.0), smoothstep( 0.0, 3.0, iChannelTime[0] )*exp( -1.00*max(0.0,iChannelTime[0]- 2.5)) ); - col = mix( col, vec3(1.0,1.0,1.0), smoothstep( 16.0, 18.0, iChannelTime[0] )*exp( -0.75*max(0.0,iChannelTime[0]-19.0)) ); - - fragColor = vec4(col,1.0); -} diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/discotunnel.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/discotunnel.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/discotunnel.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/discotunnel.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -// Taken from https://www.shadertoy.com/view/lsBSRR - -float tex(vec2 uv, float s) -{ - float col; - float ntiles = 10.0; - - // Calculate the shape of the LEDs - vec2 r = mod(uv * ntiles, 1.0) - vec2(0.5); - col = 1.0 - dot(r, r); - - // Add some light to the tunnel - vec4 n = texture2D(iChannel1, floor(uv * ntiles) / ntiles); - col *= mod(n.r * n.g * n.b * s + iGlobalTime * 0.1 + clamp(s, 0.0, 0.6), 1.0); - return clamp(col, 0.0, 1.0); -} - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - vec2 uv = fragCoord.xy / iResolution.xy; - vec2 uv1 = uv * 2.0 - 1.0; - - uv1.x *= iResolution.x / iResolution.y; - - // Calculate new UV coordinates - vec2 center = vec2(0.0, 0.0) + - vec2(0.075*(0.5 + 0.5 * sin(iGlobalTime*4.0)), - 0.05*(0.5 + 0.5 * sin(iGlobalTime*0.01 + 1.7))); - vec2 p = uv1 - center; - float r = length(p); - float a = atan(p.y, p.x) * 3.0 / 3.14; - vec2 uv2= vec2(1.0 / r + iGlobalTime*0.25, a); - - // Read the sound texture - float sound = texture2D(iChannel2, vec2(0.01, 1.0 - r)).r; - sound = pow(sound, 1.5); - - // Calculate the colors - vec3 c1 = vec3(0.02, 0.1, 0.02); - vec3 c2 = mix( vec3(1.0, 0.6, 0.6), vec3(0.6, 0.6, 1.0), vec3(0.5 + 0.5 * sin(iGlobalTime*0.1))); - vec3 c = mix(c1, c2, r); - vec3 coltunnel = sound * c * tex(uv2, sound) + ( 0.15 * texture2D(iChannel0, uv2).rgb); - vec3 colback = vec3(0.05,0.05,0.05); - - // Mix the colors - fragColor = vec4(r * coltunnel + (1.0 - r) * colback, 1.0); -} - diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/language/resource.language.de_de/strings.po kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/language/resource.language.de_de/strings.po --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/language/resource.language.de_de/strings.po 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/language/resource.language.de_de/strings.po 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,117 @@ +# Kodi Media Center language file +# Addon Name: Visualization Shadertoy +# Addon id: visualization.shadertoy +# Addon Provider: Team Kodi +msgid "" +msgstr "" +"Project-Id-Version: KODI Addons\n" +"Report-Msgid-Bugs-To: https://github.com/xbmc/visualization.shadertoy/issues\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kodi Translation Team\n" +"Language-Team: German (Germany) (https://www.transifex.com/teamxbmc/kodi-addons/language/de_DE/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de_DE\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30000" +msgid "General" +msgstr "Allgemein" + +msgctxt "#30001" +msgid "iChannel 0" +msgstr "iChannel 0" + +msgctxt "#30002" +msgid "iChannel 1" +msgstr "iChannel 1" + +msgctxt "#30003" +msgid "iChannel 2" +msgstr "iChannel 2" + +msgctxt "#30004" +msgid "iChannel 3" +msgstr "iChannel 3" + +msgctxt "#30010" +msgid "Choose one yourself" +msgstr "Wähle selbst einen aus" + +msgctxt "#30011" +msgid "Use your own shadertoy. Attention: Some shaders are not supported by some GPU's in performance!" +msgstr "Verwenden Sie Ihr eigenes Shadertoy. Achtung: Einige Shader werden von einigen GPUs in ihrer Leistung nicht unterstützt!" + +msgctxt "#30012" +msgid "Shadertoy file" +msgstr "Shadertoy-Datei" + +msgctxt "#30013" +msgid "Shader as *.glsl" +msgstr "Shader als *.glsl" + +msgctxt "#30014" +msgid "Channel 0 as audio" +msgstr "Kanal 0 als Audio" + +msgctxt "#30015" +msgid "Use audio stream data on channel 0" +msgstr "Verwenden Sie Audio-Stream-Daten auf Kanal 0" + +msgctxt "#30016" +msgid "Channel 0 texture image" +msgstr "Texturbild für Kanal 0" + +msgctxt "#30017" +msgid "Channel 0 as *.png" +msgstr "Kanal 0 als *.png" + +msgctxt "#30018" +msgid "Channel 1 as audio" +msgstr "Kanal 1 als Audio" + +msgctxt "#30019" +msgid "Use audio stream data on channel 1" +msgstr "Verwenden Sie Audio-Stream-Daten auf Kanal 1" + +msgctxt "#30020" +msgid "Channel 1 texture image" +msgstr "Texturbild für Kanal 1" + +msgctxt "#30021" +msgid "Channel 1 as *.png" +msgstr "Kanal 1 als *.png" + +msgctxt "#30022" +msgid "Channel 2 as audio" +msgstr "Kanal 2 als Audio" + +msgctxt "#30023" +msgid "Use audio stream data on channel 2" +msgstr "Verwenden Sie Audio-Stream-Daten auf Kanal 2" + +msgctxt "#30024" +msgid "Channel 2 texture image" +msgstr "Texturbild für Kanal 2" + +msgctxt "#30025" +msgid "Channel 2 as *.png" +msgstr "Kanal 2 als *.png" + +msgctxt "#30026" +msgid "Channel 3 as audio" +msgstr "Kanal 3 als Audio" + +msgctxt "#30027" +msgid "Use audio stream data on channel 3" +msgstr "Verwenden Sie Audio-Stream-Daten auf Kanal 3" + +msgctxt "#30028" +msgid "Channel 3 texture image" +msgstr "Texturbild für Kanal 3" + +msgctxt "#30029" +msgid "Channel 3 as *.png" +msgstr "Kanal 3 als *.png" diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/language/resource.language.en_gb/strings.po kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/language/resource.language.en_gb/strings.po --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/language/resource.language.en_gb/strings.po 1970-01-01 00:00:00.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/language/resource.language.en_gb/strings.po 2015-05-23 07:24:22.000000000 +0000 @@ -0,0 +1,117 @@ +# Kodi Media Center language file +# Addon Name: Visualization Shadertoy +# Addon id: visualization.shadertoy +# Addon Provider: Team Kodi +msgid "" +msgstr "" +"Project-Id-Version: KODI Addons\n" +"Report-Msgid-Bugs-To: https://github.com/xbmc/visualization.shadertoy/issues\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kodi Translation Team\n" +"Language-Team: English (United Kingdom) (https://www.transifex.com/teamxbmc/kodi-addons/language/en_GB/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en_GB\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30000" +msgid "General" +msgstr "" + +msgctxt "#30001" +msgid "iChannel 0" +msgstr "" + +msgctxt "#30002" +msgid "iChannel 1" +msgstr "" + +msgctxt "#30003" +msgid "iChannel 2" +msgstr "" + +msgctxt "#30004" +msgid "iChannel 3" +msgstr "" + +msgctxt "#30010" +msgid "Choose one yourself" +msgstr "" + +msgctxt "#30011" +msgid "Use your own shadertoy. Attention: Some shaders are not supported by some GPU's in performance!" +msgstr "" + +msgctxt "#30012" +msgid "Shadertoy file" +msgstr "" + +msgctxt "#30013" +msgid "Shader as *.glsl" +msgstr "" + +msgctxt "#30014" +msgid "Channel 0 as audio" +msgstr "" + +msgctxt "#30015" +msgid "Use audio stream data on channel 0" +msgstr "" + +msgctxt "#30016" +msgid "Channel 0 texture image" +msgstr "" + +msgctxt "#30017" +msgid "Channel 0 as *.png" +msgstr "" + +msgctxt "#30018" +msgid "Channel 1 as audio" +msgstr "" + +msgctxt "#30019" +msgid "Use audio stream data on channel 1" +msgstr "" + +msgctxt "#30020" +msgid "Channel 1 texture image" +msgstr "" + +msgctxt "#30021" +msgid "Channel 1 as *.png" +msgstr "" + +msgctxt "#30022" +msgid "Channel 2 as audio" +msgstr "" + +msgctxt "#30023" +msgid "Use audio stream data on channel 2" +msgstr "" + +msgctxt "#30024" +msgid "Channel 2 texture image" +msgstr "" + +msgctxt "#30025" +msgid "Channel 2 as *.png" +msgstr "" + +msgctxt "#30026" +msgid "Channel 3 as audio" +msgstr "" + +msgctxt "#30027" +msgid "Use audio stream data on channel 3" +msgstr "" + +msgctxt "#30028" +msgid "Channel 3 texture image" +msgstr "" + +msgctxt "#30029" +msgid "Channel 3 as *.png" +msgstr "" diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/polarbeats.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/polarbeats.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/polarbeats.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/polarbeats.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -// Taken from https://www.shadertoy.com/view/4dBXRz# - -#define FILTER -#define LIGHT_SOURCE -#define GLOW - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - // aspect ratio - float a = iResolution.x/iResolution.y; - - // position of screen - // dom x = [0.0, 1.0] - // dom y = [0.0, 1.0] - // origin is at bottom left corner - vec2 uv = fragCoord.xy / iResolution.xy; - - // multiply aspect ratio to remove distortions - uv.x *= a; - - // align polar graph to center of screen - vec2 q = uv - vec2(0.5*a, 0.5); - - // fft values, look at the bars at the bottom of the screen - float fft = texture2D(iChannel0, vec2(0.0, 0.)).x; - float fft2 = texture2D(iChannel0, vec2(1., 0.)).x; - float fft3 = texture2D(iChannel0, vec2(0.5, 0.)).x; - - // theta value - float t = atan(q.y, q.x); - - // time from start of song - float ts = iChannelTime[0]; - - // the main polar graph, r = ... - float r = pow(fft*2.-0.5, 2.)*cos(6.*t + (fft2*1.5 + ts)*5.) + 2.0 + pow(fft, 2.); - r *= fft/12. + 0.04; - - vec2 p = q; - #ifdef FILTER - p.x += sin(q.y*5000.)/100.; - p.y += cos(q.x*5000.)/100.; - #endif - - - // bg - float bg = smoothstep(r, r + fft*0.02 + 0.01, length(p)); - vec3 col = vec3(bg,bg,bg); - #ifdef GLOW - col *= 1.*smoothstep(0., r + fft*0.2, length(q)); - #endif - - col.r = clamp(col.r, 0.0, 1.0); - col.g = clamp(col.g, 0.0, 1.0); - col.b = clamp(col.b, 0.0, 1.0); - - // fg - vec3 col2 = 1.0 - col; - - // bg - // radial gradient - col -= 0.5*smoothstep(0.0, 2., length(q/(fft + 0.5))); - - #ifdef LIGHT_SOURCE - // give a more red warm light colour - col.g *= 0.97; - col.b *= 0.97; - - // cool lighting effect - col += uv.y/16.; - #endif - - #ifdef FILTER - col += sin(50.*q.y - ts*3.)*(fft*0.5+0.5)*0.05 - 0.1*(fft*0.3+0.5)*abs(-2.*q.x*sin(q.y*1000. - ts*5.)); - #endif // FILTER - - // fg - // colour of polar graph - col2 *= vec3(0.0, 0.9, 0.9); - // radial gradient for polar graph. - // removing this will change the polar graph to a solid colour - col2 *= length(q)*0.5 + 0.85; - - // add fg to bg - col += col2; - - // volia! - fragColor = vec4(col,1.0); -} diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/settings.xml kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/settings.xml --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/settings.xml 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/settings.xml 2015-05-23 07:24:22.000000000 +0000 @@ -1,4 +1,131 @@  - - + +
+ + + + false + 0 + + + + false + + + + + + true + + + true + *.glsl + + + 30012 + + + + + + + + true + + + true + + + + + + true + false + + + true + *.png + + + 30016 + + + + + + + + false + + + true + + + + + + true + false + + + true + *.png + + + 30020 + + + + + + + + false + + + true + + + + + + true + false + + + true + *.png + + + 30024 + + + + + + + + false + + + true + + + + + + true + false + + + true + *.png + + + 30028 + + + + +
diff -Nru kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/soundflower.frag.glsl kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/soundflower.frag.glsl --- kodi-visualization-shadertoy-1.2.3/visualization.shadertoy/resources/soundflower.frag.glsl 2020-07-29 06:38:21.000000000 +0000 +++ kodi-visualization-shadertoy-2.3.0/visualization.shadertoy/resources/soundflower.frag.glsl 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -// Taken from https://www.shadertoy.com/view/Msf3Dn# - -// Created by inigo quilez - iq/2013 -// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. - -void mainImage( out vec4 fragColor, in vec2 fragCoord ) -{ - vec2 uv = -1.0+2.0*fragCoord.xy/iResolution.xy; - uv.x *= iResolution.x/iResolution.y; - - float r = length( uv ); - float a = atan( uv.x, uv.y ); - - float w = texture2D( iChannel0, vec2( abs(a)/6.28,1.0) ).x; - - float t = 3.0*sqrt(abs(w-0.5)); - - float f = 0.0; - if( r 0.5) - { - uv -= 0.5; - uv *= 2.; - } - else - { - uv *= 2.; - uv = 1. - uv; - } - - float fft = texture2D( iChannel0, vec2(uv.x,0.25) ).x; - float dr = length(uv); - float radius = 1.8; - - vec3 col = vec3(0.,0.,0.); - if( abs(uv.y)