diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e8992b23f..8fac30bc8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1265,6 +1265,8 @@ set(GPU_SOURCES GPU/Common/ShaderUniforms.h GPU/Common/ShaderCommon.cpp GPU/Common/ShaderCommon.h + GPU/Common/ShaderTranslation.cpp + GPU/Common/ShaderTranslation.h GPU/Common/SplineCommon.cpp GPU/Common/SplineCommon.h GPU/Common/StencilCommon.cpp diff --git a/GPU/Common/ShaderTranslation.cpp b/GPU/Common/ShaderTranslation.cpp index 399910f18c..1a50efbaba 100644 --- a/GPU/Common/ShaderTranslation.cpp +++ b/GPU/Common/ShaderTranslation.cpp @@ -17,8 +17,6 @@ #include "ppsspp_config.h" -#if !defined(ANDROID) - #include #include #include @@ -34,6 +32,8 @@ #include "ShaderTranslation.h" #include "ext/glslang/SPIRV/GlslangToSpv.h" #include "thin3d/thin3d.h" + +#if !defined(ANDROID) #include "ext/SPIRV-Cross/spirv.hpp" #include "ext/SPIRV-Cross/spirv_common.hpp" #include "ext/SPIRV-Cross/spirv_cross.hpp" @@ -41,6 +41,7 @@ #ifdef _WIN32 #include "ext/SPIRV-Cross/spirv_hlsl.hpp" #endif +#endif extern void init_resources(TBuiltInResource &Resources); @@ -58,12 +59,12 @@ static EShLanguage GetLanguage(const Draw::ShaderStage stage) { void ShaderTranslationInit() { // TODO: We have TLS issues on UWP -#if !PPSSPP_PLATFORM(UWP) +#if !PPSSPP_PLATFORM(UWP) && !defined(ANDROID) glslang::InitializeProcess(); #endif } void ShaderTranslationShutdown() { -#if !PPSSPP_PLATFORM(UWP) +#if !PPSSPP_PLATFORM(UWP) && !defined(ANDROID) glslang::FinalizeProcess(); #endif } @@ -189,12 +190,16 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, TranslatedShade if (srcLang != GLSL_300 && srcLang != GLSL_140) return false; - if (srcLang == GLSL_140 || srcLang == GLSL_300 && destLang == GLSL_VULKAN) { + if ((srcLang == GLSL_140 || srcLang == GLSL_300) && destLang == GLSL_VULKAN) { // Let's just mess about at the string level, no need to recompile. bool result = ConvertToVulkanGLSL(dest, destMetadata, src, stage, errorMessage); return result; } +#if defined(ANDROID) + return false; +#else + #if PPSSPP_PLATFORM(UWP) return false; #endif @@ -304,6 +309,5 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, TranslatedShade default: return false; } -} - #endif +} diff --git a/GPU/Common/ShaderTranslation.h b/GPU/Common/ShaderTranslation.h index f382f4694a..5985623661 100644 --- a/GPU/Common/ShaderTranslation.h +++ b/GPU/Common/ShaderTranslation.h @@ -21,8 +21,6 @@ #include "GPU/Common/ShaderCommon.h" #include "thin3d/thin3d.h" -#ifndef ANDROID - struct TranslatedShaderMetadata { }; @@ -31,5 +29,3 @@ void ShaderTranslationInit(); void ShaderTranslationShutdown(); bool TranslateShader(std::string *dst, ShaderLanguage destLang, TranslatedShaderMetadata *destMetadata, std::string src, ShaderLanguage srcLang, Draw::ShaderStage stage, std::string *errorMessage); - -#endif \ No newline at end of file diff --git a/GPU/Vulkan/FramebufferVulkan.cpp b/GPU/Vulkan/FramebufferVulkan.cpp index 4f2653f75d..81fc286a22 100644 --- a/GPU/Vulkan/FramebufferVulkan.cpp +++ b/GPU/Vulkan/FramebufferVulkan.cpp @@ -640,11 +640,9 @@ void FramebufferManagerVulkan::Resized() { void FramebufferManagerVulkan::CompilePostShader() { if (postVs_) { vulkan_->Delete().QueueDeleteShaderModule(postVs_); - postVs_ = nullptr; } if (postFs_) { vulkan_->Delete().QueueDeleteShaderModule(postFs_); - postFs_ = nullptr; } const ShaderInfo *shaderInfo = nullptr; diff --git a/android/jni/Android.mk b/android/jni/Android.mk index f0f3c0ab12..252d8cffae 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -223,6 +223,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/GPU/Common/TextureCacheCommon.cpp.arm \ $(SRC)/GPU/Common/TextureScalerCommon.cpp.arm \ $(SRC)/GPU/Common/ShaderCommon.cpp \ + $(SRC)/GPU/Common/ShaderTranslation.cpp \ $(SRC)/GPU/Common/StencilCommon.cpp \ $(SRC)/GPU/Common/SplineCommon.cpp.arm \ $(SRC)/GPU/Common/DrawEngineCommon.cpp.arm \