diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a3bdff3ae..52fb7e40c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,11 @@ # vim:noexpandtab: -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.8) project(PPSSPP) enable_testing() #This is supposed to work but doesn't! if(NOT ANDROID) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() @@ -323,7 +323,7 @@ if(NOT MSVC) add_definitions(-DPNG_ARM_NEON_OPT=0) if(ANDROID) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17") endif() if(CLANG) add_definitions(-Wno-nullability-completeness) @@ -378,8 +378,9 @@ if(NOT MSVC) endif() if(IOS) + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") elseif(APPLE AND NOT CMAKE_CROSSCOMPILING) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8") + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") elseif(NOT ANDROID) @@ -1561,6 +1562,8 @@ set(GPU_SOURCES GPU/Common/FragmentShaderGenerator.h GPU/Common/VertexShaderGenerator.cpp GPU/Common/VertexShaderGenerator.h + GPU/Common/GeometryShaderGenerator.cpp + GPU/Common/GeometryShaderGenerator.h GPU/Common/FramebufferManagerCommon.cpp GPU/Common/FramebufferManagerCommon.h GPU/Common/GPUDebugInterface.cpp @@ -2066,6 +2069,8 @@ endif() target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash ${GlslangLibs} ${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS}) +target_compile_features(${CoreLibName} PUBLIC cxx_std_17) + if(FFmpeg_FOUND) target_compile_definitions(${CoreLibName} PRIVATE USE_FFMPEG=1) set_target_properties(${CoreLibName} PROPERTIES NO_SYSTEM_FROM_IMPORTED true) @@ -2454,7 +2459,7 @@ if(NOT ANDROID) endif() # packaging and code signing if(IOS) - set(DEPLOYMENT_TARGET 8.0) + set(DEPLOYMENT_TARGET 11.0) file(GLOB IOSAssets ios/assets/*.png) list(REMOVE_ITEM IOSAssets ${CMAKE_CURRENT_SOURCE_DIR}/ios/assets/Default-568h@2x.png) list(REMOVE_ITEM IOSAssets ${CMAKE_CURRENT_SOURCE_DIR}/ios/assets/Default-568h@3x.png) diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index d232c01534..901006a0d9 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -153,6 +153,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -179,6 +180,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -205,6 +207,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -232,6 +235,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -264,6 +268,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -298,6 +303,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -332,6 +338,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) @@ -366,6 +373,7 @@ ws2_32.lib + /ignore:4221 %(AdditionalOptions) diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index a808386ce9..166a0ebe66 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -686,6 +686,7 @@ const char *semanticToD3D11(int semantic, UINT *index) { switch (semantic) { case SEM_POSITION: return "POSITION"; case SEM_COLOR0: *index = 0; return "COLOR"; + case SEM_COLOR1: *index = 1; return "COLOR"; case SEM_TEXCOORD0: *index = 0; return "TEXCOORD"; case SEM_TEXCOORD1: *index = 1; return "TEXCOORD"; case SEM_NORMAL: return "NORMAL"; diff --git a/Common/GPU/D3D9/thin3d_d3d9.cpp b/Common/GPU/D3D9/thin3d_d3d9.cpp index 0bc8003f1e..377a0b4050 100644 --- a/Common/GPU/D3D9/thin3d_d3d9.cpp +++ b/Common/GPU/D3D9/thin3d_d3d9.cpp @@ -945,6 +945,10 @@ static void SemanticToD3D9UsageAndIndex(int semantic, BYTE *usage, BYTE *index) case SEM_COLOR0: *usage = D3DDECLUSAGE_COLOR; break; + case SEM_COLOR1: + *usage = D3DDECLUSAGE_COLOR; + *index = 1; + break; case SEM_TEXCOORD0: *usage = D3DDECLUSAGE_TEXCOORD; break; diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index 3ecd1695c6..95e737e63a 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -1207,6 +1207,7 @@ bool OpenGLPipeline::LinkShaders() { // Bind all the common vertex data points. Mismatching ones will be ignored. semantics.push_back({ SEM_POSITION, "Position" }); semantics.push_back({ SEM_COLOR0, "Color0" }); + semantics.push_back({ SEM_COLOR1, "Color1" }); semantics.push_back({ SEM_TEXCOORD0, "TexCoord0" }); semantics.push_back({ SEM_NORMAL, "Normal" }); semantics.push_back({ SEM_TANGENT, "Tangent" }); diff --git a/Common/GPU/ShaderTranslation.cpp b/Common/GPU/ShaderTranslation.cpp index 42e540a40f..9391d1b7da 100644 --- a/Common/GPU/ShaderTranslation.cpp +++ b/Common/GPU/ShaderTranslation.cpp @@ -152,16 +152,18 @@ std::string Postprocess(std::string code, ShaderLanguage lang, ShaderStage stage return output; } +static_assert(Draw::SEM_TEXCOORD0 == 3, "Semantic shader hardcoded in glsl below."); + bool ConvertToVulkanGLSL(std::string *dest, TranslatedShaderMetadata *destMetadata, std::string src, ShaderStage stage, std::string *errorMessage) { std::stringstream out; - static struct { + static const struct { ShaderStage stage; const char *needle; const char *replacement; } replacements[] = { { ShaderStage::Vertex, "attribute vec4 a_position;", "layout(location = 0) in vec4 a_position;" }, - { ShaderStage::Vertex, "attribute vec2 a_texcoord0;", "layout(location = 2) in vec2 a_texcoord0;"}, + { ShaderStage::Vertex, "attribute vec2 a_texcoord0;", "layout(location = 3) in vec2 a_texcoord0;"}, { ShaderStage::Vertex, "varying vec2 v_position;", "layout(location = 0) out vec2 v_position;" }, { ShaderStage::Fragment, "varying vec2 v_position;", "layout(location = 0) in vec2 v_position;" }, { ShaderStage::Fragment, "texture2D(", "texture(" }, diff --git a/Common/GPU/ShaderWriter.cpp b/Common/GPU/ShaderWriter.cpp index b260d05fc9..7ca6deaeb0 100644 --- a/Common/GPU/ShaderWriter.cpp +++ b/Common/GPU/ShaderWriter.cpp @@ -53,6 +53,30 @@ static const char * const vulkan_glsl_preamble_vs = "precision highp float;\n" "\n"; +static const char * const hlsl_preamble_gs = +"#define vec2 float2\n" +"#define vec3 float3\n" +"#define vec4 float4\n" +"#define ivec2 int2\n" +"#define ivec4 int4\n" +"#define mat2 float2x2\n" +"#define mat4 float4x4\n" +"#define mat3x4 float4x3\n" // note how the conventions are backwards +"#define splat3(x) vec3(x, x, x)\n" +"#define lowp\n" +"#define mediump\n" +"#define highp\n" +"\n"; + +static const char * const vulkan_glsl_preamble_gs = +"#version 450\n" +"#extension GL_ARB_separate_shader_objects : enable\n" +"#extension GL_ARB_shading_language_420pack : enable\n" +"#define mul(x, y) ((x) * (y))\n" +"#define splat3(x) vec3(x)\n" +"precision highp float;\n" +"\n"; + static const char * const hlsl_preamble_vs = "#define vec2 float2\n" "#define vec3 float3\n" @@ -68,15 +92,17 @@ static const char * const hlsl_preamble_vs = "#define highp\n" "\n"; -static const char * const semanticNames[8] = { +static const char * const semanticNames[] = { "POSITION", "COLOR0", + "COLOR1", "TEXCOORD0", "TEXCOORD1", "NORMAL", "TANGENT", "BINORMAL", }; +static_assert(ARRAY_SIZE(semanticNames) == Draw::SEM_MAX, "Missing semantic in semanticNames"); // Unsafe. But doesn't matter, we'll use big buffers for shader gen. ShaderWriter & ShaderWriter::F(const char *format, ...) { @@ -97,6 +123,9 @@ void ShaderWriter::Preamble(const char **gl_extensions, size_t num_gl_extensions case ShaderStage::Fragment: W(vulkan_glsl_preamble_fs); break; + case ShaderStage::Geometry: + W(vulkan_glsl_preamble_gs); + break; default: break; } @@ -115,6 +144,9 @@ void ShaderWriter::Preamble(const char **gl_extensions, size_t num_gl_extensions W(hlsl_d3d11_preamble_fs); } break; + case ShaderStage::Geometry: + W(hlsl_preamble_gs); + break; default: break; } @@ -145,6 +177,11 @@ void ShaderWriter::Preamble(const char **gl_extensions, size_t num_gl_extensions } C("#define gl_VertexIndex gl_VertexID\n"); break; + case ShaderStage::Geometry: + if (lang_.gles) { + C("precision highp float;\n"); + } + break; default: break; } @@ -172,7 +209,7 @@ void ShaderWriter::BeginVSMain(Slice inputs, Slice uniform F(" vec4 pos : %s;\n", lang_.shaderLanguage == HLSL_D3D11 ? "SV_Position" : "POSITION"); C("};\n"); - C("VS_OUTPUT main( "); // 2 spaces for the D3D9 rewind + C("VS_OUTPUT main( "); // 2 spaces for the rewind if (lang_.shaderLanguage == HLSL_D3D11) { C("uint gl_VertexIndex : SV_VertexID, "); } @@ -308,6 +345,43 @@ void ShaderWriter::BeginFSMain(Slice uniforms, Slice var } } +void ShaderWriter::BeginGSMain(Slice varyings, Slice outVaryings) { + _assert_(this->stage_ == ShaderStage::Geometry); + switch (lang_.shaderLanguage) { + case HLSL_D3D11: + // Untested, but should work. + C("\nstruct GS_OUTPUT {\n"); + for (auto &varying : outVaryings) { + F(" %s %s : %s;\n", varying.type, varying.name, semanticNames[varying.semantic]); + } + F(" vec4 pos : %s;\n", lang_.shaderLanguage == HLSL_D3D11 ? "SV_Position" : "POSITION"); + C("};\n"); + C("#define EmitVertex() emit.Append(gsout)\n"); + + C("void main("); + for (auto &varying : varyings) { + F(" in %s %s : %s, ", varying.type, varying.name, semanticNames[varying.semantic]); + } + C("inout TriangleStream emit) {\n"); + C(" GS_OUTPUT gsout;\n"); + break; + case GLSL_VULKAN: + for (auto &varying : varyings) { + F("layout(location = %d) %s in %s %s[]; // %s\n", varying.index, varying.precision ? varying.precision : "", varying.type, varying.name, semanticNames[varying.semantic]); + } + for (auto &varying : outVaryings) { + F("layout(location = %d) %s out %s %s; // %s\n", varying.index, varying.precision ? varying.precision : "", varying.type, varying.name, semanticNames[varying.semantic]); + } + C("\nvoid main() {\n"); + break; + case GLSL_3xx: + C("\nvoid main() {\n"); + break; + default: + break; + } +} + void ShaderWriter::EndVSMain(Slice varyings) { _assert_(this->stage_ == ShaderStage::Vertex); switch (lang_.shaderLanguage) { @@ -349,6 +423,11 @@ void ShaderWriter::EndFSMain(const char *vec4_color_variable, FSFlags flags) { C("}\n"); } +void ShaderWriter::EndGSMain() { + _assert_(this->stage_ == ShaderStage::Geometry); + C("}\n"); +} + void ShaderWriter::HighPrecisionFloat() { if ((ShaderLanguageIsOpenGL(lang_.shaderLanguage) && lang_.gles) || lang_.shaderLanguage == GLSL_VULKAN) { C("precision highp float;\n"); diff --git a/Common/GPU/ShaderWriter.h b/Common/GPU/ShaderWriter.h index f6a04c828b..50f3bb1f0d 100644 --- a/Common/GPU/ShaderWriter.h +++ b/Common/GPU/ShaderWriter.h @@ -85,10 +85,12 @@ public: // Simple shaders with no special tricks. void BeginVSMain(Slice inputs, Slice uniforms, Slice varyings); void BeginFSMain(Slice uniforms, Slice varyings, FSFlags flags); + void BeginGSMain(Slice varyings, Slice outVaryings); // For simple shaders that output a single color, we can deal with this generically. void EndVSMain(Slice varyings); void EndFSMain(const char *vec4_color_variable, FSFlags flags); + void EndGSMain(); const ShaderLanguageDesc &Lang() const { return lang_; diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index 3b3b5124b9..c2140c5663 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -600,8 +600,7 @@ void VulkanContext::ChooseDevice(int physical_device) { deviceFeatures_.enabled.samplerAnisotropy = deviceFeatures_.available.samplerAnisotropy; deviceFeatures_.enabled.shaderClipDistance = deviceFeatures_.available.shaderClipDistance; deviceFeatures_.enabled.shaderCullDistance = deviceFeatures_.available.shaderCullDistance; - // For easy wireframe mode, someday. - deviceFeatures_.enabled.fillModeNonSolid = deviceFeatures_.available.fillModeNonSolid; + deviceFeatures_.enabled.geometryShader = deviceFeatures_.available.geometryShader; GetDeviceLayerExtensionList(nullptr, device_extension_properties_); diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.h b/Common/GPU/Vulkan/VulkanQueueRunner.h index 54430cd891..7036029149 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.h +++ b/Common/GPU/Vulkan/VulkanQueueRunner.h @@ -46,6 +46,7 @@ enum class PipelineFlags { USES_BLEND_CONSTANT = (1 << 1), USES_DEPTH_STENCIL = (1 << 2), // Reads or writes the depth or stencil buffers. USES_INPUT_ATTACHMENT = (1 << 3), + USES_GEOMETRY_SHADER = (1 << 4), }; ENUM_CLASS_BITOPS(PipelineFlags); diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 47d4d1896e..344b059bbc 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -30,30 +30,38 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR // Fill in the last part of the desc since now it's time to block. VkShaderModule vs = desc->vertexShader->BlockUntilReady(); VkShaderModule fs = desc->fragmentShader->BlockUntilReady(); + VkShaderModule gs = desc->geometryShader ? desc->geometryShader->BlockUntilReady() : VK_NULL_HANDLE; - if (!vs || !fs) { + if (!vs || !fs || (!gs && desc->geometryShader)) { ERROR_LOG(G3D, "Failed creating graphics pipeline - missing shader modules"); // We're kinda screwed here? return false; } - VkPipelineShaderStageCreateInfo ss[2]{}; + uint32_t stageCount = 2; + VkPipelineShaderStageCreateInfo ss[3]{}; ss[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; ss[0].stage = VK_SHADER_STAGE_VERTEX_BIT; ss[0].pSpecializationInfo = nullptr; ss[0].module = vs; ss[0].pName = "main"; - ss[0].flags = 0; ss[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; ss[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT; ss[1].pSpecializationInfo = nullptr; ss[1].module = fs; ss[1].pName = "main"; - ss[1].flags = 0; + if (gs) { + stageCount++; + ss[2].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + ss[2].stage = VK_SHADER_STAGE_GEOMETRY_BIT; + ss[2].pSpecializationInfo = nullptr; + ss[2].module = gs; + ss[2].pName = "main"; + } VkGraphicsPipelineCreateInfo pipe{ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO }; pipe.pStages = ss; - pipe.stageCount = 2; + pipe.stageCount = stageCount; pipe.renderPass = compatibleRenderPass; pipe.basePipelineIndex = 0; pipe.pColorBlendState = &desc->cbs; diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index 66692d99a7..7fd45e2246 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -128,6 +128,7 @@ struct VKRGraphicsPipelineDesc { // Replaced the ShaderStageInfo with promises here so we can wait for compiles to finish. Promise *vertexShader = nullptr; Promise *fragmentShader = nullptr; + Promise *geometryShader = nullptr; VkPipelineInputAssemblyStateCreateInfo inputAssembly{ VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO }; VkVertexInputAttributeDescription attrs[8]{}; diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 4fddf1252e..cf2a28ea53 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -177,9 +177,9 @@ VkShaderStageFlagBits StageToVulkan(ShaderStage stage) { case ShaderStage::Vertex: return VK_SHADER_STAGE_VERTEX_BIT; case ShaderStage::Geometry: return VK_SHADER_STAGE_GEOMETRY_BIT; case ShaderStage::Compute: return VK_SHADER_STAGE_COMPUTE_BIT; - default: case ShaderStage::Fragment: return VK_SHADER_STAGE_FRAGMENT_BIT; } + return VK_SHADER_STAGE_FRAGMENT_BIT; } // Not registering this as a resource holder, instead the pipeline is registered. It will @@ -215,8 +215,8 @@ private: }; bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, const uint8_t *data, size_t size) { - vulkan_ = vulkan; // We'll need this to free it later. + vulkan_ = vulkan; source_ = (const char *)data; std::vector spirv; std::string errorMessage; @@ -278,7 +278,6 @@ public: return buf->PushAligned(ubo_, uboSize_, vulkan->GetPhysicalDeviceProperties().properties.limits.minUniformBufferOffsetAlignment, vkbuf); } - int GetUniformLoc(const char *name); int GetUBOSize() const { return uboSize_; } @@ -847,6 +846,11 @@ VKContext::VKContext(VulkanContext *vulkan) if (majorVersion >= 32) { bugs_.Infest(Bugs::MALI_CONSTANT_LOAD_BUG); // See issue #15661 } + + // Older ARM devices have very slow geometry shaders, not worth using. At least before 15. + if (majorVersion <= 15) { + bugs_.Infest(Bugs::GEOMETRY_SHADERS_SLOW); + } } // Limited, through input attachments and self-dependencies. @@ -1309,17 +1313,6 @@ ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage la } } -int VKPipeline::GetUniformLoc(const char *name) { - int loc = -1; - - // HACK! As we only use one uniform we hardcode it. - if (!strcmp(name, "WorldViewProj")) { - return 0; - } - - return loc; -} - void VKContext::UpdateDynamicUniformBuffer(const void *ub, size_t size) { curPipeline_->SetDynamicUniformData(ub, size); } diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index acaa3dac0b..a81c38ba10 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -435,7 +435,7 @@ vec3 hsv2rgb(vec3 c) { } layout (location = 0) in vec4 pos; layout (location = 1) in vec4 inColor; -layout (location = 2) in vec2 inTexCoord; +layout (location = 3) in vec2 inTexCoord; layout (location = 0) out vec4 outColor; layout (location = 1) out vec2 outTexCoord; out gl_PerVertex { vec4 gl_Position; }; @@ -450,6 +450,8 @@ void main() { )" } }; +static_assert(SEM_TEXCOORD0 == 3, "Semantic shader hardcoded in glsl above."); + const UniformBufferDesc vsTexColBufDesc{ sizeof(VsTexColUB),{ { "WorldViewProj", 0, -1, UniformType::MATRIX4X4, 0 }, { "TintSaturation", 4, -1, UniformType::FLOAT2, 64 }, diff --git a/Common/GPU/thin3d.h b/Common/GPU/thin3d.h index ee0d50602a..c04b7119cd 100644 --- a/Common/GPU/thin3d.h +++ b/Common/GPU/thin3d.h @@ -114,6 +114,7 @@ enum BufferUsageFlag : int { enum Semantic : int { SEM_POSITION, SEM_COLOR0, + SEM_COLOR1, SEM_TEXCOORD0, SEM_TEXCOORD1, SEM_NORMAL, @@ -332,11 +333,14 @@ public: RASPBERRY_SHADER_COMP_HANG = 8, MALI_CONSTANT_LOAD_BUG = 9, SUBPASS_FEEDBACK_BROKEN = 10, + GEOMETRY_SHADERS_SLOW = 11, MAX_BUG, }; protected: uint32_t flags_ = 0; + + static_assert(sizeof(flags_) * 8 > MAX_BUG, "Ran out of space for bugs."); }; class RefCountedObject { diff --git a/Core/Config.cpp b/Core/Config.cpp index 248bcb2852..4eeca428ab 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -874,6 +874,7 @@ static ConfigSetting graphicsSettings[] = { #endif ConfigSetting("CameraDevice", &g_Config.sCameraDevice, "", true, false), ConfigSetting("VendorBugChecksEnabled", &g_Config.bVendorBugChecksEnabled, true, false, false), + ConfigSetting("UseGeometryShader", &g_Config.bUseGeometryShader, true, true, true), ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, 1, true, true), ConfigSetting("SoftwareRenderer", &g_Config.bSoftwareRendering, false, true, true), ConfigSetting("SoftwareRendererJit", &g_Config.bSoftwareRenderingJit, true, true, true), diff --git a/Core/Config.h b/Core/Config.h index 8a7f519621..65eaf74099 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -164,6 +164,7 @@ public: bool bHardwareTransform; // only used in the GLES backend bool bSoftwareSkinning; // may speed up some games bool bVendorBugChecksEnabled; + bool bUseGeometryShader; int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering int iTexFiltering; // 1 = auto , 2 = nearest , 3 = linear , 4 = auto max quality diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index bdfaea4361..1978f3bcac 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -139,7 +139,7 @@ Level3 ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib - _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) StreamingSIMDExtensions2 Precise true @@ -148,6 +148,7 @@ MultiThreadedDebug Common/DbgNew.h ProgramDatabase + stdcpp17 true @@ -157,12 +158,15 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + Level3 ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib;../ext/zstd/lib - _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_DEBUG;_LIB;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) NotSet Precise false @@ -172,6 +176,7 @@ MultiThreadedDebug Common/DbgNew.h ProgramDatabase + stdcpp17 true @@ -181,12 +186,15 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + Level3 ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\aarch64\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib - _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_DEBUG;_LIB;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) NotSet Precise false @@ -196,6 +204,7 @@ MultiThreadedDebug Common/DbgNew.h ProgramDatabase + stdcpp17 true @@ -205,12 +214,15 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + Level3 ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\arm\include;../common;..;../ext/glew;../ext/snappy;../ext/libpng17;../ext/zlib;../ext;../ext/zstd/lib - _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_DEBUG;_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_DEBUG;_LIB;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) NotSet Precise false @@ -221,6 +233,7 @@ ProgramDatabase + stdcpp17 true @@ -230,6 +243,9 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + @@ -241,12 +257,13 @@ false StreamingSIMDExtensions2 Precise - USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;%(PreprocessorDefinitions) + USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_M_IX86=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Speed MultiThreaded true false ProgramDatabase + stdcpp17 true @@ -255,6 +272,7 @@ %(AdditionalDependencies) + /ignore:4221 %(AdditionalOptions) ../Windows/git-version-gen.cmd @@ -276,11 +294,12 @@ Speed false true - USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;%(PreprocessorDefinitions) + USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;MINIUPNP_STATICLIB;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) false MultiThreaded true ProgramDatabase + stdcpp17 true @@ -292,6 +311,9 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + @@ -307,11 +329,12 @@ Speed false true - USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_LIB;NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_64=1;_LIB;NDEBUG;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) false MultiThreaded true ProgramDatabase + stdcpp17 true @@ -323,6 +346,9 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + @@ -338,11 +364,12 @@ Speed false true - USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_LIB;NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USING_WIN_UI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WITH_UPNP;WIN32;_ARCH_32=1;_LIB;NDEBUG;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) false MultiThreaded true ProgramDatabase + stdcpp17 true @@ -354,6 +381,9 @@ ../git-version.cpp;%(Outputs) Updating git-version.cpp + + /ignore:4221 %(AdditionalOptions) + @@ -568,7 +598,16 @@ - + + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\arm\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\arm\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\aarch64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\aarch64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + @@ -900,7 +939,16 @@ - + + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\arm\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\arm\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\aarch64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + ..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\aarch64\include;../common;..;../ext/native;../ext/glew;../ext/snappy;../ext/native/ext/libpng17;../ext/zlib;../ext/native/ext;../ext/armips/;../ext/armips/ext/filesystem/include/;../ext/armips/ext/tinyformat/ + diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index b215a92ab4..63e087d7a8 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include "zlib.h" @@ -1037,8 +1038,9 @@ void SymbolMap::GetLabels(std::vector &dest) { for (auto it = activeLabels.begin(); it != activeLabels.end(); it++) { LabelDefinition entry; entry.value = it->first; - entry.name = ConvertUTF8ToWString(it->second.name); - std::transform(entry.name.begin(), entry.name.end(), entry.name.begin(), ::towlower); + std::string name = it->second.name; + std::transform(name.begin(), name.end(), name.begin(), ::tolower); + entry.name = Identifier(name); dest.push_back(entry); } } diff --git a/Core/Debugger/WebSocket.cpp b/Core/Debugger/WebSocket.cpp index b71db06877..23333d5a19 100644 --- a/Core/Debugger/WebSocket.cpp +++ b/Core/Debugger/WebSocket.cpp @@ -97,6 +97,10 @@ static void UpdateConnected(int delta) { } static void WebSocketNotifyLifecycle(CoreLifecycle stage) { + // We'll likely already be locked during the reboot. + if (PSP_IsRebooting()) + return; + switch (stage) { case CoreLifecycle::STARTING: case CoreLifecycle::STOPPING: diff --git a/Core/Debugger/WebSocket/DisasmSubscriber.cpp b/Core/Debugger/WebSocket/DisasmSubscriber.cpp index 0c256ded14..5d766785a2 100644 --- a/Core/Debugger/WebSocket/DisasmSubscriber.cpp +++ b/Core/Debugger/WebSocket/DisasmSubscriber.cpp @@ -482,7 +482,7 @@ void WebSocketDisasmState::Assemble(DebuggerRequest &req) { return; if (!MIPSAsm::MipsAssembleOpcode(code.c_str(), currentDebugMIPS, address)) - return req.Fail(StringFromFormat("Could not assemble: %s", ConvertWStringToUTF8(MIPSAsm::GetAssembleError()).c_str())); + return req.Fail(StringFromFormat("Could not assemble: %s", MIPSAsm::GetAssembleError().c_str())); JsonWriter &json = req.Respond(); Reporting::NotifyDebugger(); diff --git a/Core/Debugger/WebSocket/GameBroadcaster.cpp b/Core/Debugger/WebSocket/GameBroadcaster.cpp index 3045e70fc4..c8b4039769 100644 --- a/Core/Debugger/WebSocket/GameBroadcaster.cpp +++ b/Core/Debugger/WebSocket/GameBroadcaster.cpp @@ -86,7 +86,7 @@ void GameBroadcaster::Broadcast(net::WebSocketServer *ws) { } else if (state == UISTATE_INGAME && PSP_IsInited()) { ws->Send(GameStatusEvent{"game.start"}); prevState_ = state; - } else if (state == UISTATE_MENU && !PSP_IsInited() && !PSP_IsQuitting()) { + } else if (state == UISTATE_MENU && !PSP_IsInited() && !PSP_IsQuitting() && !PSP_IsRebooting()) { ws->Send(GameStatusEvent{"game.quit"}); prevState_ = state; } diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index 8cb9fcfc69..c48f396bb7 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -49,9 +49,8 @@ void WebSocketGameReset(DebuggerRequest &req) { if (needBreak) PSP_CoreParameter().startBreak = true; - PSP_Shutdown(); std::string resetError; - if (!PSP_Init(PSP_CoreParameter(), &resetError)) { + if (!PSP_Reboot(&resetError)) { ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str()); return req.Fail("Could not reset"); } diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 5afe38e02f..c4feedd6c6 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -570,21 +570,17 @@ static int sceGeGetStack(int index, u32 stackPtr) { return gpu->GetStack(index, stackPtr); } -static u32 sceGeEdramSetAddrTranslation(int new_size) { +static u32 sceGeEdramSetAddrTranslation(u32 new_size) { bool outsideRange = new_size != 0 && (new_size < 0x200 || new_size > 0x1000); bool notPowerOfTwo = (new_size & (new_size - 1)) != 0; if (outsideRange || notPowerOfTwo) { - WARN_LOG(SCEGE, "sceGeEdramSetAddrTranslation(%i): invalid value", new_size); - return SCE_KERNEL_ERROR_INVALID_VALUE; + return hleLogWarning(SCEGE, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid value"); + } + if (!gpu) { + return hleLogError(SCEGE, -1, "GPUInterface not available"); } - DEBUG_LOG(SCEGE, "sceGeEdramSetAddrTranslation(%i)", new_size); - - // TODO: This isn't safe. EDRamWidth should be global and saved. - static int EDRamWidth = 0x400; - int last = EDRamWidth; - EDRamWidth = new_size; - return last; + return hleReportDebug(SCEGE, gpu->SetAddrTranslation(new_size)); } const HLEFunction sceGe_user[] = { @@ -599,7 +595,7 @@ const HLEFunction sceGe_user[] = { {0XA4FC06A4, &WrapU_U, "sceGeSetCallback", 'i', "p" }, {0X05DB22CE, &WrapI_U, "sceGeUnsetCallback", 'i', "x" }, {0X1F6752AD, &WrapU_V, "sceGeEdramGetSize", 'x', "" }, - {0XB77905EA, &WrapU_I, "sceGeEdramSetAddrTranslation", 'x', "i" }, + {0XB77905EA, &WrapU_U, "sceGeEdramSetAddrTranslation", 'x', "x" }, {0XDC93CFEF, &WrapU_I, "sceGeGetCmd", 'x', "i" }, {0X57C8945B, &WrapI_IU, "sceGeGetMtx", 'i', "ip" }, {0X438A385A, &WrapU_U, "sceGeSaveContext", 'x', "x" }, diff --git a/Core/MIPS/MIPSAsm.cpp b/Core/MIPS/MIPSAsm.cpp index f95d0d1fc0..1c45f14ac5 100644 --- a/Core/MIPS/MIPSAsm.cpp +++ b/Core/MIPS/MIPSAsm.cpp @@ -1,10 +1,12 @@ #include #include #include +#include #include #include "Common/CommonTypes.h" #include "ext/armips/Core/Assembler.h" +#include "ext/armips/Core/FileManager.h" #include "Common/Data/Encoding/Utf8.h" #include "Core/Debugger/SymbolMap.h" @@ -14,9 +16,9 @@ namespace MIPSAsm { - static std::wstring errorText; + static std::string errorText; -std::wstring GetAssembleError() +std::string GetAssembleError() { return errorText; } @@ -55,22 +57,21 @@ public: return true; } bool seekPhysical(int64_t physicalAddress) override { return seekVirtual(physicalAddress); } - const std::wstring &getFileName() override { return dummyWFilename_; } + const fs::path &getFileName() override { return dummyFilename_; } private: u64 address; - std::wstring dummyWFilename_; + fs::path dummyFilename_; }; -bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address) -{ - StringList errors; +bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) { + std::vector errors; - wchar_t str[64]; - swprintf(str,64,L".psp\n.org 0x%08X\n",address); + char str[64]; + snprintf(str, 64, ".psp\n.org 0x%08X\n", address); ArmipsArguments args; args.mode = ArmipsMode::MEMORY; - args.content = str + ConvertUTF8ToWString(line); + args.content = str + std::string(line); args.silent = true; args.memoryFile.reset(new PspAssemblerFile()); args.errorsResult = &errors; @@ -85,8 +86,8 @@ bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address) for (size_t i = 0; i < errors.size(); i++) { errorText += errors[i]; - if (i != errors.size()-1) - errorText += L"\n"; + if (i != errors.size() - 1) + errorText += "\n"; } return false; diff --git a/Core/MIPS/MIPSAsm.h b/Core/MIPS/MIPSAsm.h index 5693ff6c74..27bf3eef08 100644 --- a/Core/MIPS/MIPSAsm.h +++ b/Core/MIPS/MIPSAsm.h @@ -4,5 +4,5 @@ namespace MIPSAsm { bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address); - std::wstring GetAssembleError(); + std::string GetAssembleError(); } diff --git a/Core/System.cpp b/Core/System.cpp index 7f96ffb7c5..cb6fc34fa8 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -114,6 +114,7 @@ static std::string gpuBackendDevice; static volatile bool pspIsInited = false; static volatile bool pspIsIniting = false; static volatile bool pspIsQuitting = false; +static volatile bool pspIsRebooting = false; void ResetUIState() { globalUIState = UISTATE_MENU; @@ -448,6 +449,7 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) { bool success = !g_CoreParameter.fileToStart.empty(); if (!success) { Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE); + pspIsRebooting = false; // In this case, we must call shutdown since the caller won't know to. // It must've partially started since CPU_Init returned true. PSP_Shutdown(); @@ -475,6 +477,7 @@ bool PSP_InitUpdate(std::string *error_string) { } } if (!success) { + pspIsRebooting = false; PSP_Shutdown(); return true; } @@ -483,6 +486,7 @@ bool PSP_InitUpdate(std::string *error_string) { pspIsIniting = !pspIsInited; if (pspIsInited) { Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE); + pspIsRebooting = false; } return pspIsInited; } @@ -501,7 +505,11 @@ bool PSP_IsIniting() { } bool PSP_IsInited() { - return pspIsInited && !pspIsQuitting; + return pspIsInited && !pspIsQuitting && !pspIsRebooting; +} + +bool PSP_IsRebooting() { + return pspIsRebooting; } bool PSP_IsQuitting() { @@ -515,7 +523,7 @@ void PSP_Shutdown() { } // Make sure things know right away that PSP memory, etc. is going away. - pspIsQuitting = true; + pspIsQuitting = !pspIsRebooting; if (coreState == CORE_RUNNING) Core_Stop(); @@ -540,6 +548,18 @@ void PSP_Shutdown() { Core_NotifyLifecycle(CoreLifecycle::STOPPED); } +bool PSP_Reboot(std::string *error_string) { + if (!pspIsInited || pspIsQuitting) + return false; + + pspIsRebooting = true; + Core_Stop(); + Core_WaitInactive(); + PSP_Shutdown(); + std::string resetError; + return PSP_Init(PSP_CoreParameter(), error_string); +} + void PSP_BeginHostFrame() { // Reapply the graphics state of the PSP if (gpu) { diff --git a/Core/System.h b/Core/System.h index 599836e259..9a801596ab 100644 --- a/Core/System.h +++ b/Core/System.h @@ -75,8 +75,10 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string); bool PSP_InitUpdate(std::string *error_string); bool PSP_IsIniting(); bool PSP_IsInited(); +bool PSP_IsRebooting(); bool PSP_IsQuitting(); void PSP_Shutdown(); +bool PSP_Reboot(std::string *error_string); void PSP_BeginHostFrame(); void PSP_EndHostFrame(); diff --git a/Core/Util/AudioFormat.h b/Core/Util/AudioFormat.h index 8774e83546..06d53676cd 100644 --- a/Core/Util/AudioFormat.h +++ b/Core/Util/AudioFormat.h @@ -49,7 +49,7 @@ static inline s16 clamp_s16(int i) { static inline s16 ApplySampleVolume(s16 sample, int vol) { #if PPSSPP_ARCH(ARM) && !defined(_MSC_VER) - register int r; + int r; asm volatile("smulwb %0, %1, %2\n\t" \ "ssat %0, #16, %0" \ : "=r"(r) : "r"(vol), "r"(sample)); diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 8f74dd2103..cf1eb06019 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -575,7 +575,7 @@ void FramebufferManagerCommon::SetDepthFrameBuffer(bool isClearingDepth) { // Need to upload the first line of depth buffers, for Burnout Dominator lens flares. See issue #11100 and comments to #16081. // Might make this more generic and upload the whole depth buffer if we find it's needed for something. - if (newlyUsingDepth) { + if (newlyUsingDepth && draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported) { // Sanity check the depth buffer pointer. if (Memory::IsValidRange(currentRenderVfb_->z_address, currentRenderVfb_->width * 2)) { const u16 *src = (const u16 *)Memory::GetPointerUnchecked(currentRenderVfb_->z_address); @@ -1358,6 +1358,12 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { for (auto v : vfbs_) { const u32 v_addr = v->fb_address & 0x3FFFFFFF; const u32 v_size = ColorBufferByteSize(v); + + if (v->fb_format != displayFormat_ || v->fb_stride != displayStride_) { + // Displaying a buffer of the wrong format or stride is nonsense, ignore it. + continue; + } + if (addr >= v_addr && addr < v_addr + v_size) { const u32 dstBpp = BufferFormatBytesPerPixel(v->fb_format); const u32 v_offsetX = ((addr - v_addr) / dstBpp) % v->fb_stride; @@ -1623,7 +1629,9 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, dst &= 0x3FFFFFFF; src &= 0x3FFFFFFF; - // TODO: Merge the below into FindTransferFramebuffer + // TODO: Merge the below into FindTransferFramebuffer. + // Or at least this should be like the other ones, gathering possible candidates + // with the ability to list them out for debugging. VirtualFramebuffer *dstBuffer = 0; VirtualFramebuffer *srcBuffer = 0; @@ -1643,6 +1651,14 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, const u32 vfb_byteStride = vfb->fb_stride * vfb_bpp; const int vfb_byteWidth = vfb->width * vfb_bpp; + // Heuristic to try to prevent potential glitches with video playback. + if (vfb_address == dst && (size == 0x44000 && vfb_size == 0x88000 || size == 0x88000 && vfb_size == 0x44000)) { + // Not likely to be a correct color format copy for this buffer. Ignore it, there will either be RAM + // that can be displayed from, or another matching buffer with the right format if rendering is going on. + WARN_LOG_N_TIMES(notify_copy_2x, 5, G3D, "Framebuffer size %08x conspicuously not matching copy size %08x in NotifyFramebufferCopy. Ignoring.", size, vfb_size); + continue; + } + if (dst >= vfb_address && (dst + size <= vfb_address + vfb_size || dst == vfb_address)) { const u32 offset = dst - vfb_address; const u32 yOffset = offset / vfb_byteStride; diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index 09254ddf53..f584dfd576 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -213,6 +213,9 @@ public: virtual void SetCmdValue(u32 op) = 0; virtual void DispatchFlush() = 0; + virtual uint32_t SetAddrTranslation(uint32_t value) = 0; + virtual uint32_t GetAddrTranslation() = 0; + virtual bool GetCurrentSimpleVertices(int count, std::vector &vertices, std::vector &indices) { return false; } diff --git a/GPU/Common/GeometryShaderGenerator.cpp b/GPU/Common/GeometryShaderGenerator.cpp new file mode 100644 index 0000000000..b701bb547c --- /dev/null +++ b/GPU/Common/GeometryShaderGenerator.cpp @@ -0,0 +1,134 @@ +// Copyright (c) 2012- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include +#include +#include + +#include "Common/StringUtils.h" +#include "Common/GPU/OpenGL/GLFeatures.h" +#include "Common/GPU/ShaderWriter.h" +#include "Common/GPU/thin3d.h" +#include "Core/Config.h" +#include "GPU/ge_constants.h" +#include "GPU/GPUState.h" +#include "GPU/Common/ShaderId.h" +#include "GPU/Common/ShaderUniforms.h" +#include "GPU/Common/GeometryShaderGenerator.h" + +#undef WRITE + +#define WRITE(p, ...) p.F(__VA_ARGS__) + +// TODO: Could support VK_NV_geometry_shader_passthrough, though the hardware that supports +// it is already pretty fast at geometry shaders.. + + +bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLanguageDesc &compat, const Draw::Bugs bugs, std::string *errorString) { + std::vector gl_exts; + if (ShaderLanguageIsOpenGL(compat.shaderLanguage)) { + if (gl_extensions.EXT_gpu_shader4) { + gl_exts.push_back("#extension GL_EXT_gpu_shader4 : enable"); + } + } + + ShaderWriter p(buffer, compat, ShaderStage::Geometry, gl_exts.data(), gl_exts.size()); + p.C("layout(triangles) in;\n"); + p.C("layout(triangle_strip, max_vertices = 3) out;\n"); + + if (compat.shaderLanguage == GLSL_VULKAN) { + WRITE(p, "\n"); + WRITE(p, "layout (std140, set = 0, binding = 3) uniform baseVars {\n%s};\n", ub_baseStr); + } else if (compat.shaderLanguage == HLSL_D3D11) { + WRITE(p, "cbuffer base : register(b0) {\n%s};\n", ub_baseStr); + } + + std::vector varyings, outVaryings; + + if (id.Bit(GS_BIT_DO_TEXTURE)) { + varyings.push_back(VaryingDef{ "vec3", "v_texcoord", Draw::SEM_TEXCOORD0, 0, "highp" }); + outVaryings.push_back(VaryingDef{ "vec3", "v_texcoordOut", Draw::SEM_TEXCOORD0, 0, "highp" }); + } + varyings.push_back(VaryingDef{ "vec4", "v_color0", Draw::SEM_COLOR0, 1, "lowp" }); + outVaryings.push_back(VaryingDef{ "vec4", "v_color0Out", Draw::SEM_COLOR0, 1, "lowp" }); + if (id.Bit(GS_BIT_LMODE)) { + varyings.push_back(VaryingDef{ "vec3", "v_color1", Draw::SEM_COLOR1, 2, "lowp" }); + outVaryings.push_back(VaryingDef{ "vec3", "v_color1Out", Draw::SEM_COLOR1, 2, "lowp" }); + } + varyings.push_back(VaryingDef{ "float", "v_fogdepth", Draw::SEM_TEXCOORD1, 3, "highp" }); + outVaryings.push_back(VaryingDef{ "float", "v_fogdepthOut", Draw::SEM_TEXCOORD1, 3, "highp" }); + + p.BeginGSMain(varyings, outVaryings); + + // Apply culling + p.C(" bool anyInside = false;\n"); + + p.C(" for (int i = 0; i < 3; i++) {\n"); // TODO: 3 or gl_in.length()? which will be faster? + p.C(" vec4 outPos = gl_in[i].gl_Position;\n"); + p.C(" vec3 projPos = outPos.xyz / outPos.w;\n"); + p.C(" float projZ = (projPos.z - u_depthRange.z) * u_depthRange.w;\n"); + // Vertex range culling doesn't happen when Z clips, note sign of w is important. + p.C(" if (u_cullRangeMin.w <= 0.0 || projZ * outPos.w > -outPos.w) {\n"); + const char *outMin = "projPos.x < u_cullRangeMin.x || projPos.y < u_cullRangeMin.y"; + const char *outMax = "projPos.x > u_cullRangeMax.x || projPos.y > u_cullRangeMax.y"; + p.F(" if ((%s) || (%s)) {\n", outMin, outMax); + p.C(" return;\n"); // Cull! + p.C(" }\n"); + p.C(" }\n"); + p.C(" if (u_cullRangeMin.w <= 0.0) {\n"); + p.C(" if (projPos.z < u_cullRangeMin.z || projPos.z > u_cullRangeMax.z) {\n"); + // When not clamping depth, cull the triangle of Z is outside the valid range (not based on clip Z.) + p.C(" return;\n"); + p.C(" }\n"); + p.C(" } else {\n"); + p.C(" if (projPos.z >= u_cullRangeMin.z) { anyInside = true; }\n"); + p.C(" if (projPos.z <= u_cullRangeMax.z) { anyInside = true; }\n"); + p.C(" }\n"); + p.C(" } // for\n"); + + // Cull any triangle fully outside in the same direction when depth clamp enabled. + // Basically simulate cull distances. + p.C(" if (u_cullRangeMin.w > 0.0 && !anyInside) {\n"); + p.C(" return;\n"); + p.C(" }\n"); + + const char *clip0 = compat.shaderLanguage == HLSL_D3D11 ? "" : "[0]"; + + p.C(" for (int i = 0; i < 3; i++) {\n"); // TODO: 3 or gl_in.length()? which will be faster? + p.C(" vec4 outPos = gl_in[i].gl_Position;\n"); + p.C(" gl_Position = outPos;\n"); + // TODO: Not rectangles... + if (gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) { + p.C(" vec3 projPos = outPos.xyz / outPos.w;\n"); + p.C(" float projZ = (projPos.z - u_depthRange.z) * u_depthRange.w;\n"); + p.F(" gl_ClipDistance%s = projZ * outPos.w + outPos.w;\n", clip0); + } + + for (size_t i = 0; i < varyings.size(); i++) { + VaryingDef &in = varyings[i]; + VaryingDef &out = outVaryings[i]; + p.F(" %s = %s[i];\n", outVaryings[i].name, varyings[i].name); + } + // Debug - null the red channel + //p.C(" if (i == 0) v_color0Out.x = 0.0;\n"); + p.C(" EmitVertex();\n"); + p.C(" }\n"); + + p.EndGSMain(); + + return true; +} diff --git a/GPU/Common/GeometryShaderGenerator.h b/GPU/Common/GeometryShaderGenerator.h new file mode 100644 index 0000000000..9848ffde18 --- /dev/null +++ b/GPU/Common/GeometryShaderGenerator.h @@ -0,0 +1,5 @@ +#pragma once + +#include "GPU/Common/ShaderId.h" + +bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLanguageDesc &compat, const Draw::Bugs bugs, std::string *errorString); diff --git a/GPU/Common/ShaderCommon.h b/GPU/Common/ShaderCommon.h index d6dfbbc3f8..63e3116014 100644 --- a/GPU/Common/ShaderCommon.h +++ b/GPU/Common/ShaderCommon.h @@ -109,10 +109,11 @@ enum : uint64_t { DIRTY_VIEWPORTSCISSOR_STATE = 1ULL << 46, DIRTY_VERTEXSHADER_STATE = 1ULL << 47, DIRTY_FRAGMENTSHADER_STATE = 1ULL << 48, + DIRTY_GEOMETRYSHADER_STATE = 1ULL << 49, // Everything that's not uniforms. Use this after using thin3d. // TODO: Should we also add DIRTY_FRAMEBUF here? It kinda generally takes care of itself. - DIRTY_ALL_RENDER_STATE = DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS, + DIRTY_ALL_RENDER_STATE = DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS, // Note that the top 8 bits (54-63) cannot be dirtied through the commonCommandTable due to packing of other flags. diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index 6849ba759e..9c8cb3905b 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -366,3 +366,42 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip *id_out = id; } + +std::string GeometryShaderDesc(const GShaderID &id) { + std::stringstream desc; + desc << StringFromFormat("%08x:%08x ", id.d[1], id.d[0]); + if (id.Bit(GS_BIT_ENABLED)) desc << "ENABLED "; + if (id.Bit(GS_BIT_DO_TEXTURE)) desc << "TEX "; + if (id.Bit(GS_BIT_LMODE)) desc << "LMODE "; + return desc.str(); +} + +void ComputeGeometryShaderID(GShaderID *id_out, const Draw::Bugs &bugs, int prim) { + GShaderID id; + + bool vertexRangeCulling = + !gstate.isModeThrough() && gstate_c.submitType == SubmitType::DRAW; // neither hw nor sw spline/bezier. See #11692 + + // If we're not using GS culling, return a zero ID. + // Also, only use this for triangle primitives. + if (!vertexRangeCulling || !gstate_c.Supports(GPU_SUPPORTS_GS_CULLING) || (prim != GE_PRIM_TRIANGLES && prim != GE_PRIM_TRIANGLE_FAN && prim != GE_PRIM_TRIANGLE_STRIP)) { + *id_out = id; + return; + } + + id.SetBit(GS_BIT_ENABLED, true); + + if (gstate.isModeClear()) { + // No attribute bits. + } else { + bool isModeThrough = gstate.isModeThrough(); + bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough; + + id.SetBit(GS_BIT_LMODE, lmode); + if (gstate.isTextureMapEnabled()) { + id.SetBit(GS_BIT_DO_TEXTURE); + } + } + + *id_out = id; +} diff --git a/GPU/Common/ShaderId.h b/GPU/Common/ShaderId.h index b63f93739e..ec25abb4d3 100644 --- a/GPU/Common/ShaderId.h +++ b/GPU/Common/ShaderId.h @@ -104,6 +104,17 @@ static inline FShaderBit operator +(FShaderBit bit, int i) { return FShaderBit((int)bit + i); } +// Some of these bits are straight from FShaderBit, since they essentially enable attributes directly. +enum GShaderBit : uint8_t { + GS_BIT_ENABLED = 0, // If not set, we don't use a geo shader. + GS_BIT_DO_TEXTURE = 1, // presence of texcoords + GS_BIT_LMODE = 2, // presence of specular color (regular color always present) +}; + +static inline GShaderBit operator +(GShaderBit bit, int i) { + return GShaderBit((int)bit + i); +} + struct ShaderID { ShaderID() { clear(); @@ -118,6 +129,13 @@ struct ShaderID { d[i] = 0xFFFFFFFF; } } + bool is_invalid() const { + for (size_t i = 0; i < ARRAY_SIZE(d); i++) { + if (d[i] != 0xFFFFFFFF) + return false; + } + return true; + } uint32_t d[2]; bool operator < (const ShaderID &other) const { @@ -225,6 +243,31 @@ struct FShaderID : ShaderID { } }; +struct GShaderID : ShaderID { + GShaderID() : ShaderID() { + } + + explicit GShaderID(ShaderID &src) { + memcpy(d, src.d, sizeof(d)); + } + + bool Bit(GShaderBit bit) const { + return ShaderID::Bit((int)bit); + } + + int Bits(GShaderBit bit, int count) const { + return ShaderID::Bits((int)bit, count); + } + + void SetBit(GShaderBit bit, bool value = true) { + ShaderID::SetBit((int)bit, value); + } + + void SetBits(GShaderBit bit, int count, int value) { + ShaderID::SetBits((int)bit, count, value); + } +}; + namespace Draw { class Bugs; } @@ -237,3 +280,6 @@ std::string VertexShaderDesc(const VShaderID &id); struct ComputedPipelineState; void ComputeFragmentShaderID(FShaderID *id, const ComputedPipelineState &pipelineState, const Draw::Bugs &bugs); std::string FragmentShaderDesc(const FShaderID &id); + +void ComputeGeometryShaderID(GShaderID *id, const Draw::Bugs &bugs, int prim); +std::string GeometryShaderDesc(const GShaderID &id); diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index d30a82d7b8..57ea8204cc 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1250,6 +1250,7 @@ void TextureCacheCommon::LoadClut(u32 clutAddr, u32 loadBytes) { } } + // To turn off dynamic CLUT (for demonstration or testing purposes), add "false &&" to this check. if (chosenFramebuffer && chosenFramebuffer->fbo) { clutRenderAddress_ = bestClutAddress; diff --git a/GPU/Common/VertexShaderGenerator.cpp b/GPU/Common/VertexShaderGenerator.cpp index 2a71611b1e..d6f356c6d4 100644 --- a/GPU/Common/VertexShaderGenerator.cpp +++ b/GPU/Common/VertexShaderGenerator.cpp @@ -127,9 +127,6 @@ static const char * const boneWeightDecl[9] = { "layout(location = 3) in vec4 w1;\nlayout(location = 4) in vec4 w2;\n", }; -extern const char *vulkan_glsl_preamble_vs; -extern const char *hlsl_preamble_vs; - bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguageDesc &compat, Draw::Bugs bugs, uint32_t *attrMask, uint64_t *uniformMask, std::string *errorString) { *attrMask = 0; *uniformMask = 0; @@ -1302,7 +1299,7 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag WRITE(p, " if (u_cullRangeMin.w <= 0.0 || projZ * outPos.w > -outPos.w) {\n"); const char *outMin = "projPos.x < u_cullRangeMin.x || projPos.y < u_cullRangeMin.y"; const char *outMax = "projPos.x > u_cullRangeMax.x || projPos.y > u_cullRangeMax.y"; - WRITE(p, " if (%s || %s) {\n", outMin, outMax); + WRITE(p, " if ((%s) || (%s)) {\n", outMin, outMax); WRITE(p, " outPos.xyzw = u_cullRangeMax.wwww;\n"); WRITE(p, " }\n"); WRITE(p, " }\n"); diff --git a/GPU/Debugger/Playback.cpp b/GPU/Debugger/Playback.cpp index da55c9238d..0410a61c76 100644 --- a/GPU/Debugger/Playback.cpp +++ b/GPU/Debugger/Playback.cpp @@ -308,6 +308,7 @@ private: void Texture(int level, u32 ptr, u32 sz); void Framebuf(int level, u32 ptr, u32 sz); void Display(u32 ptr, u32 sz); + void EdramTrans(u32 ptr, u32 sz); u32 execMemcpyDest = 0; u32 execClutAddr = 0; @@ -328,6 +329,10 @@ private: }; void DumpExecute::SyncStall() { + if (execListBuf == 0) { + return; + } + gpu->UpdateStall(execListID, execListPos); s64 listTicks = gpu->GetListTicks(execListID); if (listTicks != -1) { @@ -620,6 +625,17 @@ void DumpExecute::Display(u32 ptr, u32 sz) { __DisplaySetFramebuf(disp->topaddr.ptr, disp->linesize, disp->pixelFormat, 0); } +void DumpExecute::EdramTrans(u32 ptr, u32 sz) { + uint32_t value; + memcpy(&value, pushbuf_.data() + ptr, 4); + + // Sync up drawing. + SyncStall(); + + if (gpu) + gpu->SetAddrTranslation(value); +} + DumpExecute::~DumpExecute() { execMemcpyDest = 0; if (execListBuf) { @@ -631,6 +647,10 @@ DumpExecute::~DumpExecute() { } bool DumpExecute::Run() { + // Start with the default value. + if (gpu) + gpu->SetAddrTranslation(0x400); + for (const Command &cmd : commands_) { switch (cmd.type) { case CommandType::INIT: @@ -673,6 +693,10 @@ bool DumpExecute::Run() { Memcpy(cmd.ptr, cmd.sz); break; + case CommandType::EDRAMTRANS: + EdramTrans(cmd.ptr, cmd.sz); + break; + case CommandType::TEXTURE0: case CommandType::TEXTURE1: case CommandType::TEXTURE2: diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index cc73992c1b..56cc164c63 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -52,6 +52,7 @@ static bool active = false; static bool nextFrame = false; static int flipLastAction = -1; static int flipFinishAt = -1; +static uint32_t lastEdramTrans = 0x400; static std::function writeCallback; static std::vector pushbuf; @@ -561,17 +562,35 @@ static void FinishRecording() { active = false; flipLastAction = gpuStats.numFlips; flipFinishAt = -1; + lastEdramTrans = 0x400; if (writeCallback) writeCallback(filename); writeCallback = nullptr; } +static void CheckEdramTrans() { + if (!gpuDebug) + return; + + uint32_t value = gpuDebug->GetAddrTranslation(); + if (value == lastEdramTrans) + return; + lastEdramTrans = value; + + FlushRegisters(); + Command cmd{CommandType::EDRAMTRANS, sizeof(value), (u32)pushbuf.size()}; + pushbuf.resize(pushbuf.size() + sizeof(value)); + memcpy(pushbuf.data() + cmd.ptr, &value, sizeof(value)); + commands.push_back(cmd); +} + void NotifyCommand(u32 pc) { if (!active) { return; } + CheckEdramTrans(); const u32 op = Memory::Read_U32(pc); const GECommand cmd = GECommand(op >> 24); @@ -624,11 +643,14 @@ void NotifyMemcpy(u32 dest, u32 src, u32 sz) { if (!active) { return; } + + CheckEdramTrans(); if (Memory::IsVRAMAddress(dest)) { FlushRegisters(); Command cmd{CommandType::MEMCPYDEST, sizeof(dest), (u32)pushbuf.size()}; pushbuf.resize(pushbuf.size() + sizeof(dest)); memcpy(pushbuf.data() + cmd.ptr, &dest, sizeof(dest)); + commands.push_back(cmd); sz = Memory::ValidSize(dest, sz); if (sz != 0) { @@ -642,6 +664,8 @@ void NotifyMemset(u32 dest, int v, u32 sz) { if (!active) { return; } + + CheckEdramTrans(); struct MemsetCommand { u32 dest; int value; @@ -656,6 +680,7 @@ void NotifyMemset(u32 dest, int v, u32 sz) { Command cmd{CommandType::MEMSET, sizeof(data), (u32)pushbuf.size()}; pushbuf.resize(pushbuf.size() + sizeof(data)); memcpy(pushbuf.data() + cmd.ptr, &data, sizeof(data)); + commands.push_back(cmd); DirtyVRAM(dest, sz, DirtyVRAMFlag::DIRTY); } } @@ -664,6 +689,8 @@ void NotifyUpload(u32 dest, u32 sz) { if (!active) { return; } + + CheckEdramTrans(); NotifyMemcpy(dest, dest, sz); if (Memory::IsVRAMAddress(dest)) DirtyVRAM(dest, sz, DirtyVRAMFlag::DIRTY); @@ -701,6 +728,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) { return; } + CheckEdramTrans(); struct DisplayBufData { PSPPointer topaddr; int linesize, pixelFormat; @@ -728,6 +756,7 @@ void NotifyBeginFrame() { if (active && HasDrawCommands() && (noDisplayAction || gpuStats.numFlips == flipFinishAt)) { NOTICE_LOG(SYSTEM, "Recording complete on frame"); + CheckEdramTrans(); struct DisplayBufData { PSPPointer topaddr; u32 linesize, pixelFormat; @@ -755,6 +784,10 @@ void NotifyBeginFrame() { } void NotifyCPU() { + if (!active) { + return; + } + DirtyAllVRAM(DirtyVRAMFlag::DIRTY); } diff --git a/GPU/Debugger/RecordFormat.h b/GPU/Debugger/RecordFormat.h index dc7abe3ec1..295273eb0f 100644 --- a/GPU/Debugger/RecordFormat.h +++ b/GPU/Debugger/RecordFormat.h @@ -50,6 +50,7 @@ enum class CommandType : u8 { MEMCPYDATA = 8, DISPLAY = 9, CLUTADDR = 10, + EDRAMTRANS = 11, TEXTURE0 = 0x10, TEXTURE1 = 0x11, diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 0480b490d7..808ce53635 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -340,6 +340,7 @@ + @@ -455,6 +456,7 @@ + diff --git a/GPU/GPU.vcxproj.filters b/GPU/GPU.vcxproj.filters index bd28a45e97..e110c20b8b 100644 --- a/GPU/GPU.vcxproj.filters +++ b/GPU/GPU.vcxproj.filters @@ -261,6 +261,9 @@ Debugger + + Common + @@ -512,6 +515,9 @@ Debugger + + Common + diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 1ff4b30b11..a44fb47572 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -87,8 +87,8 @@ const CommonCommandTableEntry commonCommandTable[] = { { GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF }, // These affect the fragment shader so need flushing. - { GE_CMD_CLEARMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_CULLRANGE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE }, - { GE_CMD_TEXTUREMAPENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE }, + { GE_CMD_CLEARMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_CULLRANGE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE }, + { GE_CMD_TEXTUREMAPENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE }, { GE_CMD_FOGENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAGMENTSHADER_STATE }, { GE_CMD_TEXMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS | DIRTY_FRAGMENTSHADER_STATE }, { GE_CMD_TEXSHADELS, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, @@ -102,7 +102,7 @@ const CommonCommandTableEntry commonCommandTable[] = { // These change the vertex shader so need flushing. { GE_CMD_REVERSENORMAL, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, - { GE_CMD_LIGHTINGENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE }, + { GE_CMD_LIGHTINGENABLE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE }, { GE_CMD_LIGHTENABLE0, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, { GE_CMD_LIGHTENABLE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, { GE_CMD_LIGHTENABLE2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, @@ -114,7 +114,7 @@ const CommonCommandTableEntry commonCommandTable[] = { { GE_CMD_MATERIALUPDATE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE }, // These change both shaders so need flushing. - { GE_CMD_LIGHTMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE }, + { GE_CMD_LIGHTMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE }, { GE_CMD_TEXFILTER, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS }, { GE_CMD_TEXWRAP, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS | DIRTY_FRAGMENTSHADER_STATE }, @@ -1280,6 +1280,15 @@ void GPUCommon::ReapplyGfxState() { // Let's just skip the transfer size stuff, it's just values. } +uint32_t GPUCommon::SetAddrTranslation(uint32_t value) { + std::swap(edramTranslation_, value); + return value; +} + +uint32_t GPUCommon::GetAddrTranslation() { + return edramTranslation_; +} + inline void GPUCommon::UpdateState(GPURunState state) { gpuState = state; if (state != GPUSTATE_RUNNING) @@ -1674,7 +1683,7 @@ void GPUCommon::Execute_VertexType(u32 op, u32 diff) { if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK)) { gstate_c.Dirty(DIRTY_UVSCALEOFFSET); if (diff & GE_VTYPE_THROUGH_MASK) - gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_CULLRANGE); + gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE | DIRTY_CULLRANGE); } } @@ -1701,7 +1710,7 @@ void GPUCommon::Execute_VertexTypeSkinning(u32 op, u32 diff) { gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); } if (diff & GE_VTYPE_THROUGH_MASK) - gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_CULLRANGE); + gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE | DIRTY_CULLRANGE); } void GPUCommon::CheckDepthUsage(VirtualFramebuffer *vfb) { @@ -2035,8 +2044,8 @@ void GPUCommon::Execute_Bezier(u32 op, u32 diff) { SetDrawType(DRAW_BEZIER, PatchPrimToPrim(surface.primType)); + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); if (drawEngineCommon_->CanUseHardwareTessellation(surface.primType)) { - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); gstate_c.submitType = SubmitType::HW_BEZIER; if (gstate_c.spline_num_points_u != surface.num_points_u) { gstate_c.Dirty(DIRTY_BEZIERSPLINE); @@ -2050,7 +2059,7 @@ void GPUCommon::Execute_Bezier(u32 op, u32 diff) { UpdateUVScaleOffset(); drawEngineCommon_->SubmitCurve(control_points, indices, surface, gstate.vertType, &bytesRead, "bezier"); - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); gstate_c.submitType = SubmitType::DRAW; // After drawing, we advance pointers - see SubmitPrim which does the same. @@ -2110,8 +2119,8 @@ void GPUCommon::Execute_Spline(u32 op, u32 diff) { SetDrawType(DRAW_SPLINE, PatchPrimToPrim(surface.primType)); + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); if (drawEngineCommon_->CanUseHardwareTessellation(surface.primType)) { - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); gstate_c.submitType = SubmitType::HW_SPLINE; if (gstate_c.spline_num_points_u != surface.num_points_u) { gstate_c.Dirty(DIRTY_BEZIERSPLINE); @@ -2125,7 +2134,7 @@ void GPUCommon::Execute_Spline(u32 op, u32 diff) { UpdateUVScaleOffset(); drawEngineCommon_->SubmitCurve(control_points, indices, surface, gstate.vertType, &bytesRead, "spline"); - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE); + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); gstate_c.submitType = SubmitType::DRAW; // After drawing, we advance pointers - see SubmitPrim which does the same. @@ -2706,7 +2715,7 @@ struct DisplayList_v2 { }; void GPUCommon::DoState(PointerWrap &p) { - auto s = p.Section("GPUCommon", 1, 5); + auto s = p.Section("GPUCommon", 1, 6); if (!s) return; @@ -2782,6 +2791,9 @@ void GPUCommon::DoState(PointerWrap &p) { if (s >= 5) { Do(p, matrixVisible.all); } + if (s >= 6) { + Do(p, edramTranslation_); + } } void GPUCommon::InterruptStart(int listid) { diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index bd03692fda..78f7b15cef 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -118,6 +118,8 @@ public: u32 Continue() override; u32 Break(int mode) override; void ReapplyGfxState() override; + uint32_t SetAddrTranslation(uint32_t value) override; + uint32_t GetAddrTranslation() override; void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override; void CopyDisplayToOutput(bool reallyDirty) override = 0; @@ -267,14 +269,14 @@ protected: void SetDrawType(DrawType type, GEPrimitiveType prim) { if (type != lastDraw_) { // We always flush when drawing splines/beziers so no need to do so here - gstate_c.Dirty(DIRTY_UVSCALEOFFSET | DIRTY_VERTEXSHADER_STATE); + gstate_c.Dirty(DIRTY_UVSCALEOFFSET | DIRTY_VERTEXSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); lastDraw_ = type; } // Prim == RECTANGLES can cause CanUseHardwareTransform to flip, so we need to dirty. // Also, culling may be affected so dirty the raster state. if (IsTrianglePrim(prim) != IsTrianglePrim(lastPrim_)) { Flush(); - gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VERTEXSHADER_STATE); + gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); lastPrim_ = prim; } } @@ -367,6 +369,8 @@ protected: uint32_t immFlags_ = 0; bool immFirstSent_ = false; + uint32_t edramTranslation_ = 0x400; + // Whe matrix data overflows, the CPU visible values wrap and bleed between matrices. // But this doesn't actually change the values used by rendering. // The CPU visible values affect the GPU when list contexts are restored. diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index 2e1bc406d4..e0c5931326 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -200,6 +200,7 @@ public: virtual int GetStack(int index, u32 stackPtr) = 0; virtual bool GetMatrix24(GEMatrixType type, u32_le *result, u32 cmdbits) = 0; virtual void ResetMatrices() = 0; + virtual uint32_t SetAddrTranslation(uint32_t value) = 0; virtual void InterruptStart(int listid) = 0; virtual void InterruptEnd(int listid) = 0; diff --git a/GPU/GPUState.h b/GPU/GPUState.h index a10cfe790e..e5d5662845 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -486,7 +486,8 @@ enum { // Free bit: 15 GPU_SUPPORTS_DEPTH_TEXTURE = FLAG_BIT(16), GPU_SUPPORTS_ACCURATE_DEPTH = FLAG_BIT(17), - // Free bits: 18-19 + GPU_SUPPORTS_GS_CULLING = FLAG_BIT(18), // Geometry shader + // Free bit: 19 GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH = FLAG_BIT(20), GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT = FLAG_BIT(21), GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT = FLAG_BIT(22), diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 633af978ef..7d1d28d07d 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -981,6 +981,9 @@ bool TransformUnit::GetCurrentSimpleVertices(int count, std::vector= 0xFFFF ? z : (float)screenPos.z; } if (gstate.vertType & GE_VTYPE_COL_MASK) { diff --git a/GPU/Software/TransformUnit.h b/GPU/Software/TransformUnit.h index b3d2e9b06d..3c022523d2 100644 --- a/GPU/Software/TransformUnit.h +++ b/GPU/Software/TransformUnit.h @@ -180,6 +180,7 @@ public: TransformUnit transformUnit; #if PPSSPP_ARCH(32BIT) +#undef new void *operator new(size_t s) { return AllocateAlignedMemory(s, 16); } diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index d086b60921..2c50795472 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -89,8 +89,6 @@ DrawEngineVulkan::DrawEngineVulkan(Draw::DrawContext *draw) decIndex = (u16 *)AllocateMemoryPages(DECODED_INDEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE); indexGen.Setup(decIndex); - - InitDeviceObjects(); } void DrawEngineVulkan::InitDeviceObjects() { @@ -114,6 +112,8 @@ void DrawEngineVulkan::InitDeviceObjects() { bindings[3].descriptorCount = 1; bindings[3].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; bindings[3].stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT; + if (gstate_c.Supports(GPU_SUPPORTS_GS_CULLING)) + bindings[3].stageFlags |= VK_SHADER_STAGE_GEOMETRY_BIT; bindings[3].binding = DRAW_BINDING_DYNUBO_BASE; bindings[4].descriptorCount = 1; bindings[4].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; @@ -581,6 +581,7 @@ void DrawEngineVulkan::DoFlush() { VulkanVertexShader *vshader = nullptr; VulkanFragmentShader *fshader = nullptr; + VulkanGeometryShader *gshader = nullptr; uint32_t ibOffset; uint32_t vbOffset; @@ -770,19 +771,19 @@ void DrawEngineVulkan::DoFlush() { sampler = nullSampler_; } - if (!lastPipeline_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE) || prim != lastPrim_) { + if (!lastPipeline_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE) || prim != lastPrim_) { if (prim != lastPrim_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE)) { ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey_, dynState_); } - shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, pipelineState_, true, useHWTessellation_, decOptions_.expandAllWeightsToFloat); // usehwtransform + shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, &gshader, pipelineState_, true, useHWTessellation_, decOptions_.expandAllWeightsToFloat); // usehwtransform if (!vshader) { // We're screwed. return; } _dbg_assert_msg_(vshader->UseHWTransform(), "Bad vshader"); - VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(renderManager, pipelineLayout_, pipelineKey_, &dec_->decFmt, vshader, fshader, true, 0); + VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(renderManager, pipelineLayout_, pipelineKey_, &dec_->decFmt, vshader, fshader, gshader, true, 0); if (!pipeline || !pipeline->pipeline) { // Already logged, let's bail out. return; @@ -901,13 +902,13 @@ void DrawEngineVulkan::DoFlush() { if (sampler == VK_NULL_HANDLE) sampler = nullSampler_; } - if (!lastPipeline_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE) || prim != lastPrim_) { + if (!lastPipeline_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE) || prim != lastPrim_) { if (prim != lastPrim_ || gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_RASTER_STATE | DIRTY_DEPTHSTENCIL_STATE)) { ConvertStateToVulkanKey(*framebufferManager_, shaderManager_, prim, pipelineKey_, dynState_); } - shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, pipelineState_, false, false, decOptions_.expandAllWeightsToFloat); // usehwtransform + shaderManager_->GetShaders(prim, lastVType_, &vshader, &fshader, &gshader, pipelineState_, false, false, decOptions_.expandAllWeightsToFloat); // usehwtransform _dbg_assert_msg_(!vshader->UseHWTransform(), "Bad vshader"); - VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(renderManager, pipelineLayout_, pipelineKey_, &dec_->decFmt, vshader, fshader, false, 0); + VulkanPipeline *pipeline = pipelineManager_->GetOrCreatePipeline(renderManager, pipelineLayout_, pipelineKey_, &dec_->decFmt, vshader, fshader, gshader, false, 0); if (!pipeline || !pipeline->pipeline) { // Already logged, let's bail out. decodedVerts_ = 0; diff --git a/GPU/Vulkan/DrawEngineVulkan.h b/GPU/Vulkan/DrawEngineVulkan.h index 50df67b136..ebf50e33b5 100644 --- a/GPU/Vulkan/DrawEngineVulkan.h +++ b/GPU/Vulkan/DrawEngineVulkan.h @@ -127,6 +127,9 @@ public: DrawEngineVulkan(Draw::DrawContext *draw); virtual ~DrawEngineVulkan(); + // We reference feature flags, so this is called after construction. + void InitDeviceObjects(); + void SetShaderManager(ShaderManagerVulkan *shaderManager) { shaderManager_ = shaderManager; } @@ -196,7 +199,6 @@ private: void ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, ShaderManagerVulkan *shaderManager, int prim, VulkanPipelineRasterStateKey &key, VulkanDynamicState &dynState); void BindShaderBlendTex(); - void InitDeviceObjects(); void DestroyDeviceObjects(); void DecodeVertsToPushBuffer(VulkanPushBuffer *push, uint32_t *bindOffset, VkBuffer *vkbuf); diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index b38201c8c5..f285af82d0 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -53,6 +53,7 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPUCommon(gfxCtx, draw), drawEngine_(draw) { gstate_c.featureFlags = CheckGPUFeatures(); + drawEngine_.InitDeviceObjects(); VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext(); @@ -231,6 +232,17 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { features |= GPU_SUPPORTS_DEPTH_CLAMP; } + // Fall back to geometry shader culling if we can't do vertex range culling. + if (enabledFeatures.geometryShader) { + const bool useGeometry = g_Config.bUseGeometryShader && !draw_->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW); + const bool vertexSupported = draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported; + if (useGeometry && (!vertexSupported || (features & GPU_SUPPORTS_VS_RANGE_CULLING) == 0)) { + // Switch to culling via the geometry shader if not fully supported in vertex. + features |= GPU_SUPPORTS_GS_CULLING; + features &= ~GPU_SUPPORTS_VS_RANGE_CULLING; + } + } + // These are VULKAN_4444_FORMAT and friends. uint32_t fmt4444 = draw_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16); uint32_t fmt1555 = draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16); @@ -566,7 +578,7 @@ std::vector GPU_Vulkan::DebugGetShaderIDs(DebugShaderType type) { return pipelineManager_->DebugGetObjectIDs(type); } else if (type == SHADER_TYPE_TEXTURE) { return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type); - } else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT) { + } else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) { return shaderManagerVulkan_->DebugGetShaderIDs(type); } else if (type == SHADER_TYPE_SAMPLER) { return textureCacheVulkan_->DebugGetSamplerIDs(); @@ -584,7 +596,7 @@ std::string GPU_Vulkan::DebugGetShaderString(std::string id, DebugShaderType typ return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType); } else if (type == SHADER_TYPE_SAMPLER) { return textureCacheVulkan_->DebugGetSamplerString(id, stringType); - } else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT) { + } else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) { return shaderManagerVulkan_->DebugGetShaderString(id, type, stringType); } else { return std::string(); diff --git a/GPU/Vulkan/PipelineManagerVulkan.cpp b/GPU/Vulkan/PipelineManagerVulkan.cpp index 2ea530d25a..3d7745b452 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.cpp +++ b/GPU/Vulkan/PipelineManagerVulkan.cpp @@ -171,7 +171,7 @@ static std::string CutFromMain(std::string str) { static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, VkPipelineCache pipelineCache, VkPipelineLayout layout, PipelineFlags pipelineFlags, const VulkanPipelineRasterStateKey &key, - const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, bool useHwTransform, u32 variantBitmask) { + const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, VulkanGeometryShader *gs, bool useHwTransform, u32 variantBitmask) { VulkanPipeline *vulkanPipeline = new VulkanPipeline(); VKRGraphicsPipelineDesc *desc = &vulkanPipeline->desc; desc->pipelineCache = pipelineCache; @@ -254,6 +254,7 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, desc->fragmentShader = fs->GetModule(); desc->vertexShader = vs->GetModule(); + desc->geometryShader = gs ? gs->GetModule() : nullptr; VkPipelineInputAssemblyStateCreateInfo &inputAssembly = desc->inputAssembly; inputAssembly.flags = 0; @@ -301,6 +302,9 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, if (useBlendConstant) { pipelineFlags |= PipelineFlags::USES_BLEND_CONSTANT; } + if (gs) { + pipelineFlags |= PipelineFlags::USES_GEOMETRY_SHADER; + } if (dss.depthTestEnable || dss.stencilTestEnable) { pipelineFlags |= PipelineFlags::USES_DEPTH_STENCIL; } @@ -308,7 +312,7 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, return vulkanPipeline; } -VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VulkanRenderManager *renderManager, VkPipelineLayout layout, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, bool useHwTransform, u32 variantBitmask) { +VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VulkanRenderManager *renderManager, VkPipelineLayout layout, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, VulkanGeometryShader *gs, bool useHwTransform, u32 variantBitmask) { if (!pipelineCache_) { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); @@ -321,6 +325,7 @@ VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VulkanRenderManager * key.useHWTransform = useHwTransform; key.vShader = vs->GetModule(); key.fShader = fs->GetModule(); + key.gShader = gs ? gs->GetModule() : VK_NULL_HANDLE; key.vtxFmtId = useHwTransform ? decFmt->id : 0; auto iter = pipelines_.Get(key); @@ -334,7 +339,7 @@ VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VulkanRenderManager * VulkanPipeline *pipeline = CreateVulkanPipeline( renderManager, pipelineCache_, layout, pipelineFlags, - rasterKey, decFmt, vs, fs, useHwTransform, variantBitmask); + rasterKey, decFmt, vs, fs, gs, useHwTransform, variantBitmask); pipelines_.Insert(key, pipeline); // Don't return placeholder null pipelines. @@ -539,6 +544,7 @@ struct StoredVulkanPipelineKey { VulkanPipelineRasterStateKey raster; VShaderID vShaderID; FShaderID fShaderID; + GShaderID gShaderID; uint32_t vtxFmtId; uint32_t variants; bool useHWTransform; // TODO: Still needed? @@ -589,7 +595,13 @@ void PipelineManagerVulkan::SaveCache(FILE *file, bool saveRawPipelineCache, Sha return; VulkanVertexShader *vshader = shaderManager->GetVertexShaderFromModule(pkey.vShader->BlockUntilReady()); VulkanFragmentShader *fshader = shaderManager->GetFragmentShaderFromModule(pkey.fShader->BlockUntilReady()); - if (!vshader || !fshader) { + VulkanGeometryShader *gshader = nullptr; + if (pkey.gShader) { + gshader = shaderManager->GetGeometryShaderFromModule(pkey.gShader->BlockUntilReady()); + if (!gshader) + failed = true; + } + if (!vshader || !fshader || failed) { failed = true; return; } @@ -598,6 +610,7 @@ void PipelineManagerVulkan::SaveCache(FILE *file, bool saveRawPipelineCache, Sha key.useHWTransform = pkey.useHWTransform; key.fShaderID = fshader->GetID(); key.vShaderID = vshader->GetID(); + key.gShaderID = gshader ? gshader->GetID() : GShaderID(); key.variants = value->GetVariantsBitmask(); if (key.useHWTransform) { // NOTE: This is not a vtype, but a decoded vertex format. @@ -702,7 +715,8 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha } VulkanVertexShader *vs = shaderManager->GetVertexShaderFromID(key.vShaderID); VulkanFragmentShader *fs = shaderManager->GetFragmentShaderFromID(key.fShaderID); - if (!vs || !fs) { + VulkanGeometryShader *gs = shaderManager->GetGeometryShaderFromID(key.gShaderID); + if (!vs || !fs || (!gs && key.gShaderID.Bit(GS_BIT_ENABLED))) { failed = true; ERROR_LOG(G3D, "Failed to find vs or fs in of pipeline %d in cache", (int)i); continue; @@ -710,7 +724,7 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha DecVtxFormat fmt; fmt.InitializeFromID(key.vtxFmtId); - VulkanPipeline *pipeline = GetOrCreatePipeline(rm, layout, key.raster, key.useHWTransform ? &fmt : 0, vs, fs, key.useHWTransform, key.variants); + VulkanPipeline *pipeline = GetOrCreatePipeline(rm, layout, key.raster, key.useHWTransform ? &fmt : 0, vs, fs, gs, key.useHWTransform, key.variants); if (!pipeline) { pipelineCreateFailCount += 1; } diff --git a/GPU/Vulkan/PipelineManagerVulkan.h b/GPU/Vulkan/PipelineManagerVulkan.h index a7dac0c30f..32e45c3faf 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.h +++ b/GPU/Vulkan/PipelineManagerVulkan.h @@ -38,6 +38,7 @@ struct VulkanPipelineKey { VKRRenderPass *renderPass; Promise *vShader; Promise *fShader; + Promise *gShader; uint32_t vtxFmtId; bool useHWTransform; @@ -60,6 +61,7 @@ struct VulkanPipeline { bool UsesBlendConstant() const { return (pipelineFlags & PipelineFlags::USES_BLEND_CONSTANT) != 0; } bool UsesDepthStencil() const { return (pipelineFlags & PipelineFlags::USES_DEPTH_STENCIL) != 0; } bool UsesInputAttachment() const { return (pipelineFlags & PipelineFlags::USES_INPUT_ATTACHMENT) != 0; } + bool UsesGeometryShader() const { return (pipelineFlags & PipelineFlags::USES_GEOMETRY_SHADER) != 0; } u32 GetVariantsBitmask() const; }; @@ -67,6 +69,7 @@ struct VulkanPipeline { class VulkanContext; class VulkanVertexShader; class VulkanFragmentShader; +class VulkanGeometryShader; class ShaderManagerVulkan; class DrawEngineCommon; @@ -76,7 +79,7 @@ public: ~PipelineManagerVulkan(); // variantMask is only used when loading pipelines from cache. - VulkanPipeline *GetOrCreatePipeline(VulkanRenderManager *renderManager, VkPipelineLayout layout, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, bool useHwTransform, u32 variantMask); + VulkanPipeline *GetOrCreatePipeline(VulkanRenderManager *renderManager, VkPipelineLayout layout, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, VulkanGeometryShader *gs, bool useHwTransform, u32 variantMask); int GetNumPipelines() const { return (int)pipelines_.size(); } void Clear(); diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index 6c39280a82..00649a6be1 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -38,6 +38,7 @@ #include "GPU/ge_constants.h" #include "GPU/Common/FragmentShaderGenerator.h" #include "GPU/Common/VertexShaderGenerator.h" +#include "GPU/Common/GeometryShaderGenerator.h" #include "GPU/Vulkan/ShaderManagerVulkan.h" #include "GPU/Vulkan/DrawEngineVulkan.h" #include "GPU/Vulkan/FramebufferManagerVulkan.h" @@ -73,14 +74,22 @@ static Promise *CompileShaderModuleAsync(VulkanContext *vulkan, VkShaderModule shaderModule = VK_NULL_HANDLE; if (success) { - success = vulkan->CreateShaderModule(spirv, &shaderModule, stage == VK_SHADER_STAGE_VERTEX_BIT ? "game_vertex" : "game_fragment"); + const char *createTag = tag ? tag->c_str() : nullptr; + if (!createTag) { + switch (stage) { + case VK_SHADER_STAGE_VERTEX_BIT: createTag = "game_vertex"; break; + case VK_SHADER_STAGE_FRAGMENT_BIT: createTag = "game_fragment"; break; + case VK_SHADER_STAGE_GEOMETRY_BIT: createTag = "game_geometry"; break; + case VK_SHADER_STAGE_COMPUTE_BIT: createTag = "game_compute"; break; + } + } + + success = vulkan->CreateShaderModule(spirv, &shaderModule, createTag); #ifdef SHADERLOG OutputDebugStringA("OK"); #endif - if (tag) { - vulkan->SetDebugName(shaderModule, VK_OBJECT_TYPE_SHADER_MODULE, tag->c_str()); + if (tag) delete tag; - } } return shaderModule; @@ -128,7 +137,7 @@ std::string VulkanFragmentShader::GetShaderString(DebugShaderStringType type) co VulkanVertexShader::VulkanVertexShader(VulkanContext *vulkan, VShaderID id, const char *code, bool useHWTransform) : vulkan_(vulkan), useHWTransform_(useHWTransform), id_(id) { source_ = code; - module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_VERTEX_BIT, source_.c_str(), new std::string(VertexShaderDesc(id).c_str())); + module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_VERTEX_BIT, source_.c_str(), new std::string(VertexShaderDesc(id))); if (!module_) { failed_ = true; } else { @@ -155,8 +164,38 @@ std::string VulkanVertexShader::GetShaderString(DebugShaderStringType type) cons } } +VulkanGeometryShader::VulkanGeometryShader(VulkanContext *vulkan, GShaderID id, const char *code) + : vulkan_(vulkan), id_(id) { + source_ = code; + module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_GEOMETRY_BIT, source_.c_str(), new std::string(GeometryShaderDesc(id).c_str())); + if (!module_) { + failed_ = true; + } else { + VERBOSE_LOG(G3D, "Compiled geometry shader:\n%s\n", (const char *)code); + } +} + +VulkanGeometryShader::~VulkanGeometryShader() { + if (module_) { + VkShaderModule shaderModule = module_->BlockUntilReady(); + vulkan_->Delete().QueueDeleteShaderModule(shaderModule); + delete module_; + } +} + +std::string VulkanGeometryShader::GetShaderString(DebugShaderStringType type) const { + switch (type) { + case SHADER_STRING_SOURCE_CODE: + return source_; + case SHADER_STRING_SHORT_DESC: + return GeometryShaderDesc(id_); + default: + return "N/A"; + } +} + ShaderManagerVulkan::ShaderManagerVulkan(Draw::DrawContext *draw) - : ShaderManagerCommon(draw), compat_(GLSL_VULKAN), fsCache_(16), vsCache_(16) { + : ShaderManagerCommon(draw), compat_(GLSL_VULKAN), fsCache_(16), vsCache_(16), gsCache_(16) { codeBuffer_ = new char[16384]; VulkanContext *vulkan = (VulkanContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT); uboAlignment_ = vulkan->GetPhysicalDeviceProperties().properties.limits.minUniformBufferOffsetAlignment; @@ -191,30 +230,37 @@ void ShaderManagerVulkan::Clear() { vsCache_.Iterate([&](const VShaderID &key, VulkanVertexShader *shader) { delete shader; }); + gsCache_.Iterate([&](const GShaderID &key, VulkanGeometryShader *shader) { + delete shader; + }); fsCache_.Clear(); vsCache_.Clear(); + gsCache_.Clear(); lastFSID_.set_invalid(); lastVSID_.set_invalid(); - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE); + lastGSID_.set_invalid(); + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); } void ShaderManagerVulkan::ClearShaders() { Clear(); DirtyShader(); - gstate_c.Dirty(DIRTY_ALL_UNIFORMS | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE); + gstate_c.Dirty(DIRTY_ALL_UNIFORMS | DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); } void ShaderManagerVulkan::DirtyShader() { // Forget the last shader ID lastFSID_.set_invalid(); lastVSID_.set_invalid(); + lastGSID_.set_invalid(); DirtyLastShader(); } void ShaderManagerVulkan::DirtyLastShader() { lastVShader_ = nullptr; lastFShader_ = nullptr; - gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE); + lastGShader_ = nullptr; + gstate_c.Dirty(DIRTY_VERTEXSHADER_STATE | DIRTY_FRAGMENTSHADER_STATE | DIRTY_GEOMETRYSHADER_STATE); } uint64_t ShaderManagerVulkan::UpdateUniforms(bool useBufferedRendering) { @@ -231,7 +277,7 @@ uint64_t ShaderManagerVulkan::UpdateUniforms(bool useBufferedRendering) { return dirty; } -void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader **vshader, VulkanFragmentShader **fshader, const ComputedPipelineState &pipelineState, bool useHWTransform, bool useHWTessellation, bool weightsAsFloat) { +void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader **vshader, VulkanFragmentShader **fshader, VulkanGeometryShader **gshader, const ComputedPipelineState &pipelineState, bool useHWTransform, bool useHWTessellation, bool weightsAsFloat) { VShaderID VSID; if (gstate_c.IsDirty(DIRTY_VERTEXSHADER_STATE)) { gstate_c.Clean(DIRTY_VERTEXSHADER_STATE); @@ -248,14 +294,28 @@ void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader FSID = lastFSID_; } + GShaderID GSID; + if (gstate_c.IsDirty(DIRTY_GEOMETRYSHADER_STATE)) { + gstate_c.Clean(DIRTY_GEOMETRYSHADER_STATE); + ComputeGeometryShaderID(&GSID, draw_->GetBugs(), prim); + } else { + GSID = lastGSID_; + } + _dbg_assert_(FSID.Bit(FS_BIT_LMODE) == VSID.Bit(VS_BIT_LMODE)); _dbg_assert_(FSID.Bit(FS_BIT_DO_TEXTURE) == VSID.Bit(VS_BIT_DO_TEXTURE)); _dbg_assert_(FSID.Bit(FS_BIT_FLATSHADE) == VSID.Bit(VS_BIT_FLATSHADE)); + if (GSID.Bit(GS_BIT_ENABLED)) { + _dbg_assert_(GSID.Bit(GS_BIT_LMODE) == VSID.Bit(VS_BIT_LMODE)); + _dbg_assert_(GSID.Bit(GS_BIT_DO_TEXTURE) == VSID.Bit(VS_BIT_DO_TEXTURE)); + } + // Just update uniforms if this is the same shader as last time. - if (lastVShader_ != nullptr && lastFShader_ != nullptr && VSID == lastVSID_ && FSID == lastFSID_) { + if (lastVShader_ != nullptr && lastFShader_ != nullptr && VSID == lastVSID_ && FSID == lastFSID_ && GSID == lastGSID_) { *vshader = lastVShader_; *fshader = lastFShader_; + *gshader = lastGShader_; _dbg_assert_msg_((*vshader)->UseHWTransform() == useHWTransform, "Bad vshader was cached"); // Already all set, no need to look up in shader maps. return; @@ -273,11 +333,9 @@ void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader vs = new VulkanVertexShader(vulkan, VSID, codeBuffer_, useHWTransform); vsCache_.Insert(VSID, vs); } - lastVSID_ = VSID; VulkanFragmentShader *fs = fsCache_.Get(FSID); if (!fs) { - // uint32_t vendorID = vulkan->GetPhysicalDeviceProperties().properties.vendorID; // Fragment shader not in cache. Let's compile it. std::string genErrorString; uint64_t uniformMask = 0; // Not used @@ -288,13 +346,32 @@ void ShaderManagerVulkan::GetShaders(int prim, u32 vertType, VulkanVertexShader fsCache_.Insert(FSID, fs); } + VulkanGeometryShader *gs; + if (GSID.Bit(GS_BIT_ENABLED)) { + gs = gsCache_.Get(GSID); + if (!gs) { + // Geometry shader not in cache. Let's compile it. + std::string genErrorString; + bool success = GenerateGeometryShader(GSID, codeBuffer_, compat_, draw_->GetBugs(), &genErrorString); + _assert_msg_(success, "GS gen error: %s", genErrorString.c_str()); + gs = new VulkanGeometryShader(vulkan, GSID, codeBuffer_); + gsCache_.Insert(GSID, gs); + } + } else { + gs = nullptr; + } + + lastVSID_ = VSID; lastFSID_ = FSID; + lastGSID_ = GSID; lastVShader_ = vs; lastFShader_ = fs; + lastGShader_ = gs; *vshader = vs; *fshader = fs; + *gshader = gs; _dbg_assert_msg_((*vshader)->UseHWTransform() == useHWTransform, "Bad vshader was computed"); } @@ -319,6 +396,15 @@ std::vector ShaderManagerVulkan::DebugGetShaderIDs(DebugShaderType }); break; } + case SHADER_TYPE_GEOMETRY: + { + gsCache_.Iterate([&](const GShaderID &id, VulkanGeometryShader *shader) { + std::string idstr; + id.ToString(&idstr); + ids.push_back(idstr); + }); + break; + } default: break; } @@ -334,12 +420,16 @@ std::string ShaderManagerVulkan::DebugGetShaderString(std::string id, DebugShade VulkanVertexShader *vs = vsCache_.Get(VShaderID(shaderId)); return vs ? vs->GetShaderString(stringType) : ""; } - case SHADER_TYPE_FRAGMENT: { VulkanFragmentShader *fs = fsCache_.Get(FShaderID(shaderId)); return fs ? fs->GetShaderString(stringType) : ""; } + case SHADER_TYPE_GEOMETRY: + { + VulkanGeometryShader *gs = gsCache_.Get(GShaderID(shaderId)); + return gs ? gs->GetShaderString(stringType) : ""; + } default: return "N/A"; } @@ -367,6 +457,17 @@ VulkanFragmentShader *ShaderManagerVulkan::GetFragmentShaderFromModule(VkShaderM return fs; } +VulkanGeometryShader *ShaderManagerVulkan::GetGeometryShaderFromModule(VkShaderModule module) { + VulkanGeometryShader *gs = nullptr; + gsCache_.Iterate([&](const GShaderID &id, VulkanGeometryShader *shader) { + Promise *p = shader->GetModule(); + VkShaderModule m = p->BlockUntilReady(); + if (m == module) + gs = shader; + }); + return gs; +} + // Shader cache. // // We simply store the IDs of the shaders used during gameplay. On next startup of @@ -376,7 +477,7 @@ VulkanFragmentShader *ShaderManagerVulkan::GetFragmentShaderFromModule(VkShaderM // instantaneous. #define CACHE_HEADER_MAGIC 0xff51f420 -#define CACHE_VERSION 28 +#define CACHE_VERSION 29 struct VulkanCacheHeader { uint32_t magic; uint32_t version; @@ -384,6 +485,7 @@ struct VulkanCacheHeader { uint32_t reserved; int numVertexShaders; int numFragmentShaders; + int numGeometryShaders; }; bool ShaderManagerVulkan::LoadCache(FILE *f) { @@ -431,6 +533,20 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { fsCache_.Insert(id, fs); } + for (int i = 0; i < header.numGeometryShaders; i++) { + GShaderID id; + if (fread(&id, sizeof(id), 1, f) != 1) { + ERROR_LOG(G3D, "Vulkan shader cache truncated"); + break; + } + std::string genErrorString; + if (!GenerateGeometryShader(id, codeBuffer_, compat_, draw_->GetBugs(), &genErrorString)) { + return false; + } + VulkanGeometryShader *gs = new VulkanGeometryShader(vulkan, id, codeBuffer_); + gsCache_.Insert(id, gs); + } + NOTICE_LOG(G3D, "Loaded %d vertex and %d fragment shaders", header.numVertexShaders, header.numFragmentShaders); return true; } @@ -443,6 +559,7 @@ void ShaderManagerVulkan::SaveCache(FILE *f) { header.reserved = 0; header.numVertexShaders = (int)vsCache_.size(); header.numFragmentShaders = (int)fsCache_.size(); + header.numGeometryShaders = (int)gsCache_.size(); bool writeFailed = fwrite(&header, sizeof(header), 1, f) != 1; vsCache_.Iterate([&](const VShaderID &id, VulkanVertexShader *vs) { writeFailed = writeFailed || fwrite(&id, sizeof(id), 1, f) != 1; @@ -450,6 +567,9 @@ void ShaderManagerVulkan::SaveCache(FILE *f) { fsCache_.Iterate([&](const FShaderID &id, VulkanFragmentShader *fs) { writeFailed = writeFailed || fwrite(&id, sizeof(id), 1, f) != 1; }); + gsCache_.Iterate([&](const GShaderID &id, VulkanGeometryShader *gs) { + writeFailed = writeFailed || fwrite(&id, sizeof(id), 1, f) != 1; + }); if (writeFailed) { ERROR_LOG(G3D, "Failed to write Vulkan shader cache, disk full?"); } else { diff --git a/GPU/Vulkan/ShaderManagerVulkan.h b/GPU/Vulkan/ShaderManagerVulkan.h index 6593a366f4..4c89f91ef5 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.h +++ b/GPU/Vulkan/ShaderManagerVulkan.h @@ -83,7 +83,27 @@ protected: VShaderID id_; }; -class VulkanPushBuffer; +class VulkanGeometryShader { +public: + VulkanGeometryShader(VulkanContext *vulkan, GShaderID id, const char *code); + ~VulkanGeometryShader(); + + const std::string &source() const { return source_; } + + bool Failed() const { return failed_; } + + std::string GetShaderString(DebugShaderStringType type) const; + Promise *GetModule() const { return module_; } + const GShaderID &GetID() { return id_; } + +protected: + Promise *module_ = nullptr; + + VulkanContext *vulkan_; + std::string source_; + bool failed_ = false; + GShaderID id_; +}; class ShaderManagerVulkan : public ShaderManagerCommon { public: @@ -93,19 +113,22 @@ public: void DeviceLost(); void DeviceRestore(Draw::DrawContext *draw); - void GetShaders(int prim, u32 vertType, VulkanVertexShader **vshader, VulkanFragmentShader **fshader, const ComputedPipelineState &pipelineState, bool useHWTransform, bool useHWTessellation, bool weightsAsFloat); + void GetShaders(int prim, u32 vertType, VulkanVertexShader **vshader, VulkanFragmentShader **fshader, VulkanGeometryShader **gshader, const ComputedPipelineState &pipelineState, bool useHWTransform, bool useHWTessellation, bool weightsAsFloat); void ClearShaders(); void DirtyShader(); void DirtyLastShader() override; int GetNumVertexShaders() const { return (int)vsCache_.size(); } int GetNumFragmentShaders() const { return (int)fsCache_.size(); } + int GetNumGeometryShaders() const { return (int)gsCache_.size(); } // Used for saving/loading the cache. Don't need to be particularly fast. VulkanVertexShader *GetVertexShaderFromID(VShaderID id) { return vsCache_.Get(id); } VulkanFragmentShader *GetFragmentShaderFromID(FShaderID id) { return fsCache_.Get(id); } + VulkanGeometryShader *GetGeometryShaderFromID(GShaderID id) { return gsCache_.Get(id); } VulkanVertexShader *GetVertexShaderFromModule(VkShaderModule module); VulkanFragmentShader *GetFragmentShaderFromModule(VkShaderModule module); + VulkanGeometryShader *GetGeometryShaderFromModule(VkShaderModule module); std::vector DebugGetShaderIDs(DebugShaderType type); std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType); @@ -143,6 +166,9 @@ private: typedef DenseHashMap VSCache; VSCache vsCache_; + typedef DenseHashMap GSCache; + GSCache gsCache_; + char *codeBuffer_; uint64_t uboAlignment_; @@ -153,7 +179,9 @@ private: VulkanFragmentShader *lastFShader_ = nullptr; VulkanVertexShader *lastVShader_ = nullptr; + VulkanGeometryShader *lastGShader_ = nullptr; FShaderID lastFSID_; VShaderID lastVSID_; + GShaderID lastGSID_; }; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index ce5bd3fada..5dea5e0921 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -1144,7 +1144,7 @@ int ShaderListScreen::ListShaders(DebugShaderType shaderType, UI::LinearLayout * using namespace UI; std::vector shaderIds_ = gpu->DebugGetShaderIDs(shaderType); int count = 0; - for (auto id : shaderIds_) { + for (const auto &id : shaderIds_) { Choice *choice = view->Add(new Choice(gpu->DebugGetShaderString(id, shaderType, SHADER_STRING_SHORT_DESC))); choice->SetTag(id); choice->OnClick.Handle(this, &ShaderListScreen::OnShaderClick); @@ -1156,7 +1156,7 @@ int ShaderListScreen::ListShaders(DebugShaderType shaderType, UI::LinearLayout * struct { DebugShaderType type; const char *name; } shaderTypes[] = { { SHADER_TYPE_VERTEX, "Vertex" }, { SHADER_TYPE_FRAGMENT, "Fragment" }, - // { SHADER_TYPE_GEOMETRY, "Geometry" }, + { SHADER_TYPE_GEOMETRY, "Geometry" }, { SHADER_TYPE_VERTEXLOADER, "VertexLoader" }, { SHADER_TYPE_PIPELINE, "Pipeline" }, { SHADER_TYPE_TEXTURE, "Texture" }, diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 7ed519f7c0..c29d8e67c6 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -224,6 +224,15 @@ bool EmuScreen::bootAllowStorage(const Path &filename) { } void EmuScreen::bootGame(const Path &filename) { + if (PSP_IsRebooting()) + return; + if (PSP_IsInited()) { + bootPending_ = false; + invalid_ = false; + bootComplete(); + return; + } + if (PSP_IsIniting()) { std::string error_string; bootPending_ = !PSP_InitUpdate(&error_string); @@ -1097,7 +1106,12 @@ void EmuScreen::update() { } void EmuScreen::checkPowerDown() { - if (coreState == CORE_POWERDOWN && !PSP_IsIniting()) { + if (PSP_IsRebooting()) { + bootPending_ = true; + invalid_ = true; + } + + if (coreState == CORE_POWERDOWN && !PSP_IsIniting() && !PSP_IsRebooting()) { if (PSP_IsInited()) { PSP_Shutdown(); } diff --git a/UI/GPUDriverTestScreen.cpp b/UI/GPUDriverTestScreen.cpp index b46fd7e42e..023b9e1def 100644 --- a/UI/GPUDriverTestScreen.cpp +++ b/UI/GPUDriverTestScreen.cpp @@ -122,7 +122,7 @@ static const std::vector vsAdrenoLogicTest = { "} myBufferVals;\n" "layout (location = 0) in vec4 pos;\n" "layout (location = 1) in vec4 inColor;\n" - "layout (location = 2) in vec2 inTexCoord;\n" + "layout (location = 3) in vec2 inTexCoord;\n" "layout (location = 0) out vec4 outColor;\n" "layout (location = 1) out highp vec2 outTexCoord;\n" "out gl_PerVertex { vec4 gl_Position; };\n" @@ -219,7 +219,7 @@ static const std::vector vsFlat = { "} myBufferVals;\n" "layout (location = 0) in vec4 pos;\n" "layout (location = 1) in vec4 inColor;\n" - "layout (location = 2) in vec2 inTexCoord;\n" + "layout (location = 3) in vec2 inTexCoord;\n" "layout (location = 0) flat out lowp vec4 outColor;\n" "layout (location = 1) out highp vec2 outTexCoord;\n" "out gl_PerVertex { vec4 gl_Position; };\n" @@ -231,6 +231,8 @@ static const std::vector vsFlat = { } }; +static_assert(Draw::SEM_TEXCOORD0 == 3, "Semantic shader hardcoded in glsl above."); + GPUDriverTestScreen::GPUDriverTestScreen() { using namespace Draw; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 486d502d4d..4d1d6c6798 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -473,6 +473,15 @@ void GameSettingsScreen::CreateViews() { inflightChoice->OnChoice.Handle(this, &GameSettingsScreen::OnInflightFramesChoice); } + if (GetGPUBackend() == GPUBackend::VULKAN) { + const bool usable = !draw->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW); + const bool vertexSupported = draw->GetDeviceCaps().clipDistanceSupported && draw->GetDeviceCaps().cullDistanceSupported; + if (usable && !vertexSupported) { + CheckBox *geometryCulling = graphicsSettings->Add(new CheckBox(&g_Config.bUseGeometryShader, gr->T("Geometry shader culling"))); + geometryCulling->SetDisabledPtr(&g_Config.bSoftwareRendering); + } + } + if (deviceType != DEVICE_TYPE_VR) { CheckBox *hwTransform = graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gr->T("Hardware Transform"))); hwTransform->SetDisabledPtr(&g_Config.bSoftwareRendering); diff --git a/UWP/Armips_UWP/Armips_UWP.vcxproj b/UWP/Armips_UWP/Armips_UWP.vcxproj index a0fcbffe0c..a836263550 100644 --- a/UWP/Armips_UWP/Armips_UWP.vcxproj +++ b/UWP/Armips_UWP/Armips_UWP.vcxproj @@ -116,41 +116,43 @@ false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ext\armips;$(ProjectDir)..\..\ext\armips\ext\filesystem\include;$(ProjectDir)..\..\ext\armips\ext\tinyformat; NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -163,6 +165,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -175,6 +179,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -187,6 +193,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -199,6 +207,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -211,6 +221,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -223,6 +235,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -235,6 +249,8 @@ NotUsing false false + stdcpp17 + _UNICODE;UNICODE;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) Console @@ -285,7 +301,6 @@ - @@ -322,25 +337,28 @@ + + + - + Create diff --git a/UWP/Armips_UWP/Armips_UWP.vcxproj.filters b/UWP/Armips_UWP/Armips_UWP.vcxproj.filters index 463cc812fe..37d23a6b09 100644 --- a/UWP/Armips_UWP/Armips_UWP.vcxproj.filters +++ b/UWP/Armips_UWP/Armips_UWP.vcxproj.filters @@ -140,7 +140,10 @@ Util - + + + + @@ -286,7 +289,6 @@ Util - diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 0777e28251..60c5d6bf8a 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -205,7 +205,8 @@ false pch.h ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -220,7 +221,8 @@ false pch.h ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -235,7 +237,8 @@ false pch.h ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -250,7 +253,8 @@ false pch.h ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -265,7 +269,8 @@ false pch.h ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -280,7 +285,8 @@ false pch.h ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -295,7 +301,8 @@ false pch.h ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -310,7 +317,8 @@ false pch.h ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -325,7 +333,8 @@ false pch.h ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + stdcpp17 Console @@ -340,7 +349,8 @@ false pch.h ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -355,7 +365,8 @@ false pch.h ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -370,7 +381,8 @@ false pch.h ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;%(PreprocessorDefinitions) + USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + stdcpp17 Console @@ -628,7 +640,20 @@ - + + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + @@ -809,7 +834,20 @@ - + + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x86/include;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/ARM64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + ../../ffmpeg/Windows10/x64/include;../../ffmpeg/WindowsInclude;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + diff --git a/UWP/GPU_UWP/GPU_UWP.vcxproj b/UWP/GPU_UWP/GPU_UWP.vcxproj index 87aac4d38b..05b7839736 100644 --- a/UWP/GPU_UWP/GPU_UWP.vcxproj +++ b/UWP/GPU_UWP/GPU_UWP.vcxproj @@ -385,6 +385,7 @@ + @@ -446,6 +447,7 @@ + diff --git a/UWP/GPU_UWP/GPU_UWP.vcxproj.filters b/UWP/GPU_UWP/GPU_UWP.vcxproj.filters index dbce632981..2296b16a16 100644 --- a/UWP/GPU_UWP/GPU_UWP.vcxproj.filters +++ b/UWP/GPU_UWP/GPU_UWP.vcxproj.filters @@ -55,6 +55,7 @@ + @@ -116,6 +117,7 @@ + diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 242fb60af5..7faf3b6f2b 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -326,7 +326,7 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText) redraw(); } else { - std::wstring error = MIPSAsm::GetAssembleError(); + std::wstring error = ConvertUTF8ToWString(MIPSAsm::GetAssembleError()); MessageBox(wnd,error.c_str(),L"Error",MB_OK); } } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index f317315e0a..42cae5cb28 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -350,6 +350,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/GPU/Common/PostShader.cpp \ $(SRC)/GPU/Common/ShaderUniforms.cpp \ $(SRC)/GPU/Common/VertexShaderGenerator.cpp \ + $(SRC)/GPU/Common/GeometryShaderGenerator.cpp \ $(SRC)/GPU/Debugger/Breakpoints.cpp \ $(SRC)/GPU/Debugger/Debugger.cpp \ $(SRC)/GPU/Debugger/GECommandTable.cpp \ @@ -584,14 +585,17 @@ LIBARMIPS_FILES := \ $(SRC)/ext/armips/Commands/CommandSequence.cpp \ $(SRC)/ext/armips/Core/ELF/ElfFile.cpp \ $(SRC)/ext/armips/Core/ELF/ElfRelocator.cpp \ + $(SRC)/ext/armips/Core/Allocations.cpp \ $(SRC)/ext/armips/Core/Assembler.cpp \ $(SRC)/ext/armips/Core/Common.cpp \ $(SRC)/ext/armips/Core/Expression.cpp \ + $(SRC)/ext/armips/Core/ExpressionFunctionHandler.cpp \ $(SRC)/ext/armips/Core/ExpressionFunctions.cpp \ $(SRC)/ext/armips/Core/FileManager.cpp \ $(SRC)/ext/armips/Core/Misc.cpp \ $(SRC)/ext/armips/Core/SymbolData.cpp \ $(SRC)/ext/armips/Core/SymbolTable.cpp \ + $(SRC)/ext/armips/Core/Types.cpp \ $(SRC)/ext/armips/Parser/DirectivesParser.cpp \ $(SRC)/ext/armips/Parser/ExpressionParser.cpp \ $(SRC)/ext/armips/Parser/Parser.cpp \ @@ -600,6 +604,7 @@ LIBARMIPS_FILES := \ $(SRC)/ext/armips/Util/CRC.cpp \ $(SRC)/ext/armips/Util/EncodingTable.cpp \ $(SRC)/ext/armips/Util/FileClasses.cpp \ + $(SRC)/ext/armips/Util/FileSystem.cpp \ $(SRC)/ext/armips/Util/Util.cpp LOCAL_MODULE := libarmips diff --git a/android/jni/Locals.mk b/android/jni/Locals.mk index f589c4f7e2..ef0d118462 100644 --- a/android/jni/Locals.mk +++ b/android/jni/Locals.mk @@ -4,7 +4,7 @@ LOCAL_CFLAGS := -DUSE_FFMPEG -DWITH_UPNP -DUSING_GLES2 -DMOBILE_DEVICE -O3 -fsigned-char -Wall -Wno-multichar -Wno-unused-variable -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS # yes, it's really CPPFLAGS for C++ # deprecated-register is generated by Android default code and causes noise. -LOCAL_CPPFLAGS := -fno-exceptions -std=gnu++11 -fno-rtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness +LOCAL_CPPFLAGS := -fexceptions -std=gnu++17 -fno-rtti -Wno-reorder -Wno-deprecated-register -Wno-nullability-completeness LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../../Common \ $(LOCAL_PATH)/../.. \ @@ -16,6 +16,9 @@ LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../../ext/libpng17 \ $(LOCAL_PATH)/../../ext/libzip \ $(LOCAL_PATH)/../../ext/zstd/lib \ + $(LOCAL_PATH)/../../ext/armips \ + $(LOCAL_PATH)/../../ext/armips/ext/filesystem/include \ + $(LOCAL_PATH)/../../ext/armips/ext/tinyformat \ $(LOCAL_PATH) LOCAL_STATIC_LIBRARIES := libzip glslang-build miniupnp-build diff --git a/assets/lang/pl_PL.ini b/assets/lang/pl_PL.ini index 4493f6db83..e963535aee 100644 --- a/assets/lang/pl_PL.ini +++ b/assets/lang/pl_PL.ini @@ -1,20 +1,20 @@ [Audio] Alternate speed volume = Alternate speed volume Audio backend = Sterownik dźwięku (wymagany restart) -Audio Error = Audio Error +Audio Error = Błąd Audio AudioBufferingForBluetooth = Bufory dźwięku dost. do Bluetooth (wolniejsze) Auto = Automatyczny -Device = Device -Disabled = Disabled +Device = Urządzenie +Disabled = Wyłączone DSound (compatible) = DSound (kompatybilny) Enable Sound = Włącz dźwięk Global volume = Głośność globalna -Microphone = Microphone -Microphone Device = Microphone device -Mute = Mute -Reverb volume = Reverb volume -Use new audio devices automatically = Use new audio devices automatically -Use global volume = Use global volume +Microphone = Mikrofon +Microphone Device = Mikrofon +Mute = Wycisz +Reverb volume = Pogłos +Use new audio devices automatically = Automatycznie używaj nowego urządzenia audio +Use global volume = Używaj głośności globalnej WASAPI (fast) = WASAPI (szybki) [Controls] @@ -27,44 +27,44 @@ AnalogLimiter Tip = Jeśli "ogranicznik analoga" jest aktywny Auto = Automatyczny Auto-centering analog stick = Autocentrowanie gałki analogowej Auto-hide buttons after seconds = Automatyczne ukrywanie przycisków po: -Auto-rotation speed = Auto-rotation speed +Auto-rotation speed = Prędkość automatycznego obracania Auto-switch = Auto-switch Base tilt position = Base tilt position Binds = Binds Button Binding = Button Binding Button Opacity = Przeźroczystość przycisków Button style = Styl przycisków -Calibrate Analog Stick = Calibrate Analog Stick +Calibrate Analog Stick = Kalibracja Gałki Analogowej Calibrate D-Pad = Kalibracja krzyżaka -Calibrated = Calibrated +Calibrated = Skalibrowany Calibration = Kalibracja Circular stick input = Circular stick input Classic = Klasyczny Confine Mouse = Zablokuj myszkę w oknie Control Mapping = Mapowanie przycisków -Custom Key Setting = Custom Key Setting -Customize = Customize +Custom Key Setting = Niestandardowe Ustawienia Klawiszy +Customize = Ustawienia Niestandardowe Customize Touch Controls = Edycja układu przycisków ekranowych... Customize tilt = Zmodyfikuj przechył... D-PAD = Krzyżak Deadzone radius = Promień martwej strefy Disable D-Pad diagonals (4-way touch) = Wył. przekątne krzyżaka (pozostaw 4 kierunki) -Disable diagonal input = Disable diagonal input -Double tap = Double tap -Enable gesture control = Enable gesture control -Enable standard shortcut keys = Enable standard shortcut keys -Gesture = Gesture -Gesture mapping = Gesture mapping +Disable diagonal input = Wyłącz wejście cyfrowe +Double tap = Dwukrotne dotknięcie +Enable gesture control = Włącz kontrolę kestami +Enable standard shortcut keys = Włącz standardowe klawisze skrótów +Gesture = Gesty +Gesture mapping = Konfiguracja gestów Glowing borders = Świecące krawędzie HapticFeedback = Wibracje Hide touch analog stick background circle = Hide touch analog stick background circle -Icon = Icon +Icon = Ikona Ignore gamepads when not focused = Ignoruj przyciski pada gdy okno nieaktywne Ignore Windows Key = Ignoruj klawisz Windows Invert Axes = Odwrócone osie Invert Tilt along X axis = Odwróć przechył wzdłuż osi X Invert Tilt along Y axis = Odwróć przechył wzdłuż osi Y -Keep this button pressed when right analog is pressed = Keep this button pressed when right analog is pressed +Keep this button pressed when right analog is pressed = Kontynuuj naciskanie tego klawisza gdy prawa Gałka Analogowa wciśnięta Keyboard = Ustawienia klawiatury L/R Trigger Buttons = Przyciski L/R Landscape = Poziomo @@ -83,12 +83,12 @@ Portrait Reversed = Odwrócone pionowo PSP Action Buttons = Klawisze akcji PSP Raw input = Raw input Repeat mode = Repeat mode -Reset to defaults = Reset to defaults +Reset to defaults = Domyślne Screen aligned to ground = Screen aligned to ground Screen at right angle to ground = Screen at right angle to ground Screen Rotation = Obrót ekranu seconds, 0 : off = sekundy, 0 = wył. -Sensitivity (scale) = Sensitivity (scale) +Sensitivity (scale) = Czułość (dostosuj) Sensitivity = Czułość Shape = Shape Show Touch Pause Menu Button = Pokaż przycisk Menu Pauzy @@ -101,7 +101,7 @@ Tilt Input Type = Typ przechyłu Tilt Sensitivity along X axis = Czułość przechyłu wzdłuż osi X Tilt Sensitivity along Y axis = Czułość przechyłu wzdłuż osi Y To Calibrate = Aby skalibrować, połóż urządzenie na płaskiej powierzchni i wciśnij "Kalibracja". -Toggle mode = Toggle mode +Toggle mode = Zmień tryb Touch Control Visibility = Kontroler dotykowy (widoczny) Use custom right analog = Use custom right analog Use Mouse Control = Włącz kontrolę myszką @@ -175,11 +175,11 @@ More Settings... = Więcej ustawień... Nearest = Najbliższe Non-Buffered Rendering = &Nie renderuj efektów z bufora (niebuforowane, szybsze) Off = Wyłącz -Open Chat = Open Chat +Open Chat = Otwórz Chat Open Directory... = Otwórz katalog... Open from MS:/PSP/GAME... = Otwórz z MS:/PSP/GAME... Open Memory Stick = Otwórz Kartę Pamięci -Open New Instance = Open new instance +Open New Instance = Otwórz nową instancję OpenGL = &OpenGL Pause = Pauza Pause When Not Focused = Pauzuj, gdy okno nieaktywne @@ -234,15 +234,15 @@ Disabled JIT functionality = Wyłącz funkcje JIT Draw Frametimes Graph = Draw frametimes graph Dump Decrypted Eboot = Zachowuj odszyfrowany EBOOT.BIN przy starcie Dump Frame GPU Commands = Zrzuć klatkę komend GPU -Enable driver bug workarounds = Enable driver bug workarounds +Enable driver bug workarounds = Uruchom obejścia błędów sterownika Enable Logging = Włącz dziennik zdarzeń debugera Enter address = Wprowadź adres FPU = FPU Framedump tests = Framedump tests Frame Profiler = Profiler klatki GPU Driver Test = Test sterownika GPU -GPU Log Profiler = GPU Log Profiler -GPU Profile = GPU profile +GPU Log Profiler = Profilowanie logów GPU +GPU Profile = Profil GPU Jit Compare = Porównywanie JIT JIT debug tools = Narzędzia debugowania JIT Language = Język @@ -260,7 +260,7 @@ Reset = Reset Reset limited logging = Reset limited logging RestoreDefaultSettings = Czy na pewno chcesz przywrócić domyślne ustawienia?\nUstawienia sterowania pozostaną niezmienione.\n\n\nNie można tego cofnąć.\nZrestartuj PPSSPP, aby zastosować zmiany. RestoreGameDefaultSettings = Czy na pewno chcesz przywrócić ustawienia specyficzne dla danych gier\npowrót do ustawień domyślnych PPSSPP? -Resume = Resume +Resume = Wznów Run CPU Tests = Uruchom testy CPU Save language ini = Zapisz plik ini języka Save new textures = Zapisz nową teksturę @@ -269,11 +269,11 @@ Show Developer Menu = Pokaż przycisk menu dewelopera Show on-screen messages = Show on-screen messages Stats = Statystyki System Information = Informacje o systemie -Texture ini file created = Texture ini file created +Texture ini file created = Stworzono plik ini Tekstury Texture Replacement = Podmiana tekstur Toggle Audio Debug = Wł./Wył. debugowanie audio Toggle Freeze = Wł./Wył. zamrożenie -Touchscreen Test = Touchscreen test +Touchscreen Test = Test ekranu dotykowego VFPU = VFPU [Dialog] @@ -283,16 +283,16 @@ Back = Powrót Cancel = Anuluj Center = Wyśrodkuj ChangingGPUBackends = Zmiana sterownika grafiki wymaga restartu PPSSPP. Zrestartować teraz? -ChangingInflightFrames = Changing graphics command buffering requires PPSSPP to restart. Restart now? -Channel: = Channel: +ChangingInflightFrames = Zmiana komend buffera grafiki wymaka restartu PPSSPP. Zrestartować teraz? +Channel: = Kanał: Choose PPSSPP save folder = Wybierz folder do zapisu stanów PPSSPP Confirm Overwrite = Czy chcesz nadpisać te dane? Confirm Save = Czy chcesz zapisać te dane? ConfirmLoad = Wczytać te dane? -ConnectingAP = Connecting to the access point.\nPlease wait... -ConnectingPleaseWait = Connecting.\nPlease wait... -ConnectionName = Connection name -Corrupted Data = Corrupted data +ConnectingAP = Łączenie do punktu dostępowego.\nProszę czekać... +ConnectingPleaseWait = Łączenie.\nProszę czekać... +ConnectionName = Nazwa Połączenia +Corrupted Data = Uszkodzone dane Delete = Usuń Delete all = Usuń wszystko Delete completed = Usuwanie zakończone. @@ -304,15 +304,15 @@ DeleteFailed = Nie można usunąć danych. Deleting = Usuwanie\nProszę czekać... Disable All = Wyłącz wszystko Dumps = Dumps -Edit = Edit +Edit = Edytuj Enable All = Włącz wszystko Enter = Dalej -Filter = Filter +Filter = Filtruj Finish = Zakończ GE Frame Dumps = GE Frame Dumps -Grid = Grid +Grid = Siatka Inactive = Nieaktywny -InternalError = An internal error has occurred. +InternalError = Występił wewnętrzny błąd aplikacji Load = Wczytaj Load completed = Ładowanie zakończone. Loading = Ładowanie\nProszę czekać... @@ -321,7 +321,7 @@ Move = Przenieś Network Connection = Połączenie sieciowe NEW DATA = NOWE DANE No = Nie -ObtainingIP = Obtaining IP address.\nPlease wait... +ObtainingIP = Uzyskiwanie adresu IP.\nProszę czekać... OK = OK Old savedata detected = Wykryto stary zapis gry Options = Opcje @@ -332,10 +332,10 @@ Save = Zapisz Save completed = Zapisywanie zakończone. Saving = Zapisywanie\nProszę czekać... SavingFailed = Nie można zapisać danych. -Search = Search +Search = Szukaj Select = Wybierz Shift = Shift -Skip = Skip +Skip = Pomiń Snap = Snap Space = Spacja SSID = SSID @@ -366,7 +366,7 @@ Error loading file = Wystąpił błąd: Error reading file = Błąd podczas odczytywania pliku. Failed initializing CPU/Memory = Failed initializing CPU or memory Failed to load executable: = Failed to load executable: -File corrupt = File corrupt +File corrupt = Uszkodzony plik Game disc read error - ISO corrupt = Nie można odczytać danych z dysku - plik ISO uszkodzony. GenericAllStartupError = PPSSPP failed to start up with any graphics backend. Try upgrading your graphics and other drivers. GenericBackendSwitchCrash = PPSSPP crashed while starting.\n\nThis usually means a graphics driver problem. Try upgrading your graphics drivers.\n\nGraphics backend has been switched: @@ -579,11 +579,11 @@ xBRZ = xBRZ Delete ZIP file = Usuń plik ZIP Install = Zainstaluj Install game from ZIP file? = Zainstalować grę z pliku ZIP? -Install textures from ZIP file? = Install textures from ZIP file? +Install textures from ZIP file? = Czy zainstalować teksturę z archiwum ZIP? Installed! = Zainstalowano! Texture pack doesn't support install = Texture pack doesn't support install Zip archive corrupt = ZIP archive corrupt -Zip file does not contain PSP software = ZIP file does not contain PSP software +Zip file does not contain PSP software = Archiwum ZIP nie zawiera aplikacji dla PSP [KeyMapping] Autoconfigure = Autokonfiguracja @@ -725,7 +725,7 @@ DataWillBeLostOnUninstall = Warning! Data will be lost when you uninstall PPSSPP DataWillStay = Data will stay even if you uninstall PPSSPP. Done! = Done! EasyUSBAccess = Easy USB access -Failed to move some files! = Failed to move some files! +Failed to move some files! = Nie udało się przenieść niektórych plików! Failed to save config = Failed to save config Free space = Free space Manually specify PSP folder = Manually specify PSP folder @@ -737,8 +737,8 @@ PPSSPP will restart after the change = PPSSPP will restart after the change Skip for now = Skip for now Starting move... = Starting move... That folder doesn't work as a memstick folder. = That folder doesn't work as a memstick folder. -USBAccessThrough = USB access through Android/data/org.ppsspp.ppsspp/files -USBAccessThroughGold = USB access through Android/data/org.ppsspp.ppssppgold/files +USBAccessThrough = Dostęp do USB poprzez Android/data/org.ppsspp.ppsspp/files +USBAccessThroughGold = Dostęþ do USB poprzez Android/data/org.ppsspp.ppssppgold/files Use App Private Data = Use App Private Data Use PSP folder at root of storage = Use PSP folder at root of storage Welcome to PPSSPP! = Welcome to PPSSPP! @@ -968,7 +968,7 @@ View Feedback = Zobacz opinie [Savedata] Date = Data -Filename = Nazwa +Filename = Nazwa pliku No screenshot = Brak obrazka None yet. Things will appear here after you save. = Na razie nic tu nie ma. Wpisy pojawią się, gdy zapiszesz grę. Nothing matching '%1' was found. = Nothing matching '%1' was found. @@ -1100,7 +1100,7 @@ Error: load undo state is from a different game = Error: load undo state is from Failed to load state for load undo. Error in the file system. = Failed to load state for load undo. Error in the file system. Floating symbols = Floating symbols Memory Stick folder = Zmień folder Karty Pamięci -Memory Stick size = Memory Stick size +Memory Stick size = Rozmiar Karty Pamięci Change Nickname = Zmień pseudonim ChangingMemstickPath = Zapisy gier, zapisy stanu i inne dane nie zostaną skopiowane do tego folderu.\n\nZmienić ścieżkę do folderu Karty Pamięci? ChangingMemstickPathInvalid = Ta ścieżka nie może zostać użyta do zapisu plików Karty Pamięci. @@ -1177,10 +1177,10 @@ Slot 4 = Slot 4 Slot 5 = Slot 5 Storage full = Dysk zapełniony Sustained performance mode = Tryb wysokiej wydajności -Theme = Theme +Theme = Motyw Time Format = Format czasu UI = Interfejs użytkownika -UI background animation = UI background animation +UI background animation = Animacja tła UI Sound = UI sound undo %c = backup %c USB = USB @@ -1202,7 +1202,7 @@ Tex2xBRZ = Tex2xBRZ Tex4xBRZ = Tex4xBRZ [Themes] -Default = Default +Default = Domyślny [UI Elements] %1 button = %1 button diff --git a/cmake/Toolchains/ios.cmake b/cmake/Toolchains/ios.cmake index 4198706e0c..45a8a219bc 100644 --- a/cmake/Toolchains/ios.cmake +++ b/cmake/Toolchains/ios.cmake @@ -12,7 +12,7 @@ # PPSSPP platform flags set(MOBILE_DEVICE ON) set(USING_GLES2 ON) -set(IPHONEOS_DEPLOYMENT_TARGET 6.0) +set(IPHONEOS_DEPLOYMENT_TARGET 11.0) add_definitions( -DGL_ETC1_RGB8_OES=0 -U__STRICT_ANSI__ @@ -27,7 +27,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") # Standard settings set(CMAKE_SYSTEM_NAME Darwin) set(CMAKE_SYSTEM_VERSION 1) -set(CMAKE_SYSTEM_PROCESSOR armv7) +set(CMAKE_SYSTEM_PROCESSOR aarch64) set(IOS ON) set(CMAKE_CROSSCOMPILING ON) set(CMAKE_MACOSX_BUNDLE YES) @@ -66,9 +66,7 @@ set(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS sup # set the architecture for iOS if(IOS_PLATFORM STREQUAL "OS") - # When ffmpeg has been rebuilt for arm64 use: - set(IOS_ARCH "armv7;arm64") - #set(IOS_ARCH "armv7") + set(IOS_ARCH "arm64") else() set(IOS_ARCH "i386;x86_64") endif() @@ -95,4 +93,3 @@ set(CMAKE_SYSTEM_FRAMEWORK_PATH # only search the iOS sdks, not the remainder of the host filesystem set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 440f3c362c..e5159c989a 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -1,4 +1,8 @@ set(ARMIPS_REGEXP OFF CACHE BOOL "" FORCE) +set(ARMIPS_LIBRARY_ONLY ON CACHE BOOL "" FORCE) +if(WIN32) + set(ARMIPS_USE_STD_FILESYSTEM ON CACHE BOOL "" FORCE) +endif() add_subdirectory(armips) if(NOT USING_GLES2) diff --git a/ext/armips b/ext/armips index 7885552b20..b4335f04fa 160000 --- a/ext/armips +++ b/ext/armips @@ -1 +1 @@ -Subproject commit 7885552b208493a6a0f21663770c446c3ba65576 +Subproject commit b4335f04fa62c1b4f7833c70fbb15505b6772274 diff --git a/ext/libarmips.vcxproj b/ext/libarmips.vcxproj index b3d288f799..c0484e63d1 100644 --- a/ext/libarmips.vcxproj +++ b/ext/libarmips.vcxproj @@ -187,88 +187,88 @@ - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)\ $(ProjectName)d $(ProjectName)d64 - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)64\ $(ProjectName)dARM64 - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)ARM64\ $(ProjectName)dARM - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)ARM\ - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)\ $(ProjectName)tests - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) $(ProjectName)tests64 _Output\ _Output\$(ProjectName)\$(Configuration)64\ - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) $(ProjectName)testsARM64 _Output\ _Output\$(ProjectName)\$(Configuration)ARM64\ - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) $(ProjectName)testsARM _Output\ _Output\$(ProjectName)\$(Configuration)ARM\ - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)\ $(ProjectName) $(ProjectName)64 - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)64\ $(ProjectName)ARM64 - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)ARM64\ $(ProjectName)ARM - .;$(IncludePath) + .;.\armips;.\armips\ext\filesystem\include;.\armips\ext\tinyformat;$(IncludePath) _Output\ _Output\$(ProjectName)\$(Configuration)ARM\ - Use Level3 - _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreadedDebug armips true ProgramDatabase + stdcpp17 Windows @@ -280,9 +280,8 @@ - Use Level3 - _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreadedDebug armips false @@ -290,6 +289,7 @@ true ProgramDatabase + stdcpp17 Windows @@ -301,9 +301,8 @@ - Use Level3 - _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreadedDebug armips false @@ -311,6 +310,7 @@ true ProgramDatabase + stdcpp17 Windows @@ -322,9 +322,8 @@ - Use Level3 - _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreadedDebug armips false @@ -332,6 +331,7 @@ true ProgramDatabase + stdcpp17 Windows @@ -341,11 +341,11 @@ - Use Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) armips + stdcpp17 Windows @@ -354,11 +354,11 @@ - Use Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) armips + stdcpp17 Windows @@ -367,11 +367,11 @@ - Use Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) armips + stdcpp17 Windows @@ -380,12 +380,12 @@ - Use Level3 Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) armips MultiThreadedDebug + stdcpp17 Windows @@ -395,16 +395,16 @@ Level3 - Use MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreaded armips true false ProgramDatabase + stdcpp17 Windows @@ -416,11 +416,10 @@ Level3 - Use MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreaded armips false @@ -428,6 +427,7 @@ true false ProgramDatabase + stdcpp17 Windows @@ -439,11 +439,10 @@ Level3 - Use MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreaded armips false @@ -451,6 +450,7 @@ true false ProgramDatabase + stdcpp17 Windows @@ -462,11 +462,10 @@ Level3 - Use MaxSpeed true true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) MultiThreaded armips false @@ -474,6 +473,7 @@ true false ProgramDatabase + stdcpp17 Windows @@ -510,38 +510,28 @@ + + + - - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - Create - + @@ -572,27 +562,30 @@ + + + - + diff --git a/ext/libarmips.vcxproj.filters b/ext/libarmips.vcxproj.filters index e1c8ef9a3a..61282421bb 100644 --- a/ext/libarmips.vcxproj.filters +++ b/ext/libarmips.vcxproj.filters @@ -132,7 +132,6 @@ Util - Core @@ -172,6 +171,18 @@ Archs\MIPS + + Core + + + Util + + + Core + + + Core + @@ -276,7 +287,6 @@ Util - Core @@ -319,5 +329,17 @@ Archs\MIPS + + Core + + + Util + + + Core + + + Core + \ No newline at end of file diff --git a/ext/vma/vk_mem_alloc.h b/ext/vma/vk_mem_alloc.h index 3dc4cc9dc8..f52dceeaf4 100644 --- a/ext/vma/vk_mem_alloc.h +++ b/ext/vma/vk_mem_alloc.h @@ -26,6 +26,18 @@ // BEGIN PPSSPP HACKS !!!!! #ifdef USE_CRT_DBG #undef new +#endif + +#if defined(__APPLE__) +#include + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_10_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0) +#define VMA_USE_STL_SHARED_MUTEX 0 +#endif +#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12) +#define VMA_USE_STL_SHARED_MUTEX 0 +#endif + #endif // END PPSSPP HACKS diff --git a/ext/zstd b/ext/zstd index 155d6a58a2..096dccbc2d 160000 --- a/ext/zstd +++ b/ext/zstd @@ -1 +1 @@ -Subproject commit 155d6a58a2a6290710194fd6367d720fca94a923 +Subproject commit 096dccbc2d89a560db0b9892c53ea0c77eff20a1 diff --git a/libretro/Makefile b/libretro/Makefile index 245d6d2267..1fd4f48632 100644 --- a/libretro/Makefile +++ b/libretro/Makefile @@ -577,7 +577,7 @@ else endif ifeq (,$(findstring msvc,$(platform))) - CXXFLAGS += -std=c++11 + CXXFLAGS += -std=c++17 endif ### Finalize ### diff --git a/libretro/Makefile.common b/libretro/Makefile.common index f08bd45633..8eed277932 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -25,6 +25,8 @@ INCFLAGS += \ $(FFMPEGINCFLAGS) \ -I$(EXTDIR)/cityhash \ -I$(EXTDIR)/armips \ + -I$(EXTDIR)/armips/ext/filesystem/include \ + -I$(EXTDIR)/armips/ext/tinyformat \ -I$(EXTDIR)/zstd/lib \ -I$(EXTDIR) \ -I$(NATIVEDIR) \ @@ -340,6 +342,7 @@ SOURCES_CXX += \ $(GPUDIR)/Debugger/Stepping.cpp \ $(GPUDIR)/Common/FragmentShaderGenerator.cpp \ $(GPUDIR)/Common/VertexShaderGenerator.cpp \ + $(GPUDIR)/Common/GeometryShaderGenerator.cpp \ $(GPUDIR)/Common/TextureCacheCommon.cpp \ $(GPUDIR)/Common/TextureScalerCommon.cpp \ $(GPUDIR)/Common/SoftwareTransformCommon.cpp \ diff --git a/pspautotests b/pspautotests index d7a55d5487..dd16bcad59 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit d7a55d5487b1fa1a688178206abaad4aea5be18a +Subproject commit dd16bcad59dbd098a66b87048184e70debb22d6f diff --git a/test.py b/test.py index e2967f06a2..0a8896b2b7 100755 --- a/test.py +++ b/test.py @@ -414,6 +414,10 @@ tests_next = [ "gpu/signals/jumps", "gpu/signals/simple", "gpu/simple/simple", + "gpu/texmtx/normals", + "gpu/texmtx/prims", + "gpu/texmtx/source", + "gpu/texmtx/uvs", "gpu/textures/size", "gpu/triangle/triangle", "gpu/vertices/texcoords", diff --git a/unittest/JitHarness.cpp b/unittest/JitHarness.cpp index 6575a1e323..c73af9733b 100644 --- a/unittest/JitHarness.cpp +++ b/unittest/JitHarness.cpp @@ -150,7 +150,7 @@ bool TestJit() { for (size_t j = 0; j < ARRAY_SIZE(lines); ++j) { p++; if (!MIPSAsm::MipsAssembleOpcode(lines[j], currentDebugMIPS, addr)) { - printf("ERROR: %ls\n", MIPSAsm::GetAssembleError().c_str()); + printf("ERROR: %s\n", MIPSAsm::GetAssembleError().c_str()); compileSuccess = false; } addr += 4; diff --git a/unittest/TestShaderGenerators.cpp b/unittest/TestShaderGenerators.cpp index 8cf73cd8b4..346fadf643 100644 --- a/unittest/TestShaderGenerators.cpp +++ b/unittest/TestShaderGenerators.cpp @@ -12,6 +12,7 @@ #include "GPU/Common/FragmentShaderGenerator.h" #include "GPU/Common/VertexShaderGenerator.h" +#include "GPU/Common/GeometryShaderGenerator.h" #include "GPU/Common/ReinterpretFramebuffer.h" #include "GPU/Common/StencilCommon.h" #include "GPU/Common/DepalettizeShaderCommon.h" @@ -39,7 +40,7 @@ bool GenerateFShader(FShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs } case ShaderLanguage::GLSL_3xx: { - ShaderLanguageDesc compat(ShaderLanguage::GLSL_1xx); + ShaderLanguageDesc compat(ShaderLanguage::GLSL_3xx); return GenerateFragmentShader(id, buffer, compat, bugs, &uniformMask, nullptr, errorString); } case ShaderLanguage::HLSL_D3D9: @@ -73,7 +74,7 @@ bool GenerateVShader(VShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs } case ShaderLanguage::GLSL_3xx: { - ShaderLanguageDesc compat(ShaderLanguage::GLSL_1xx); + ShaderLanguageDesc compat(ShaderLanguage::GLSL_3xx); return GenerateVertexShader(id, buffer, compat, bugs, &attrMask, &uniformMask, errorString); } case ShaderLanguage::HLSL_D3D9: @@ -91,18 +92,67 @@ bool GenerateVShader(VShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs } } +bool GenerateGShader(GShaderID id, char *buffer, ShaderLanguage lang, Draw::Bugs bugs, std::string *errorString) { + errorString->clear(); + + switch (lang) { + case ShaderLanguage::GLSL_VULKAN: + { + ShaderLanguageDesc compat(ShaderLanguage::GLSL_VULKAN); + return GenerateGeometryShader(id, buffer, compat, bugs, errorString); + } + /* + case ShaderLanguage::GLSL_3xx: + { + ShaderLanguageDesc compat(ShaderLanguage::GLSL_3xx); + return GenerateGeometryShader(id, buffer, compat, bugs, errorString); + } + case ShaderLanguage::HLSL_D3D11: + { + ShaderLanguageDesc compat(ShaderLanguage::HLSL_D3D11); + return GenerateGeometryShader(id, buffer, compat, bugs, errorString); + } + */ + default: + return false; + } +} + +static VkShaderStageFlagBits StageToVulkan(ShaderStage stage) { + switch (stage) { + case ShaderStage::Vertex: return VK_SHADER_STAGE_VERTEX_BIT; + case ShaderStage::Geometry: return VK_SHADER_STAGE_GEOMETRY_BIT; + case ShaderStage::Compute: return VK_SHADER_STAGE_COMPUTE_BIT; + case ShaderStage::Fragment: return VK_SHADER_STAGE_FRAGMENT_BIT; + } + return VK_SHADER_STAGE_FRAGMENT_BIT; +} + bool TestCompileShader(const char *buffer, ShaderLanguage lang, ShaderStage stage, std::string *errorMessage) { std::vector spirv; switch (lang) { #if PPSSPP_PLATFORM(WINDOWS) case ShaderLanguage::HLSL_D3D11: { - auto output = CompileShaderToBytecodeD3D11(buffer, strlen(buffer), stage == ShaderStage::Vertex ? "vs_4_0" : "ps_4_0", 0); + const char *programType = nullptr; + switch (stage) { + case ShaderStage::Vertex: programType = "vs_4_0"; break; + case ShaderStage::Fragment: programType = "ps_4_0"; break; + case ShaderStage::Geometry: programType = "gs_4_0"; break; + default: return false; + } + auto output = CompileShaderToBytecodeD3D11(buffer, strlen(buffer), programType, 0); return !output.empty(); } case ShaderLanguage::HLSL_D3D9: { - LPD3DBLOB blob = CompileShaderToByteCodeD3D9(buffer, stage == ShaderStage::Vertex ? "vs_3_0" : "ps_3_0", errorMessage); + const char *programType = nullptr; + switch (stage) { + case ShaderStage::Vertex: programType = "vs_3_0"; break; + case ShaderStage::Fragment: programType = "ps_3_0"; break; + default: return false; + } + LPD3DBLOB blob = CompileShaderToByteCodeD3D9(buffer, programType, errorMessage); if (blob) { blob->Release(); return true; @@ -113,11 +163,11 @@ bool TestCompileShader(const char *buffer, ShaderLanguage lang, ShaderStage stag #endif case ShaderLanguage::GLSL_VULKAN: - return GLSLtoSPV(stage == ShaderStage::Vertex ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT, buffer, GLSLVariant::VULKAN, spirv, errorMessage); + return GLSLtoSPV(StageToVulkan(stage), buffer, GLSLVariant::VULKAN, spirv, errorMessage); case ShaderLanguage::GLSL_1xx: - return GLSLtoSPV(stage == ShaderStage::Vertex ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT, buffer, GLSLVariant::GL140, spirv, errorMessage); + return GLSLtoSPV(StageToVulkan(stage), buffer, GLSLVariant::GL140, spirv, errorMessage); case ShaderLanguage::GLSL_3xx: - return GLSLtoSPV(stage == ShaderStage::Vertex ? VK_SHADER_STAGE_VERTEX_BIT : VK_SHADER_STAGE_FRAGMENT_BIT, buffer, GLSLVariant::GLES300, spirv, errorMessage); + return GLSLtoSPV(StageToVulkan(stage), buffer, GLSLVariant::GLES300, spirv, errorMessage); default: return false; } @@ -346,6 +396,9 @@ bool TestVertexShaders() { if (!id.Bit(VS_BIT_USE_HW_TRANSFORM)) { id.SetBit(VS_BIT_ENABLE_BONES, 0); } + if (id.Bit(VS_BIT_VERTEX_RANGE_CULLING)) { + continue; + } bool generateSuccess[numLanguages]{}; std::string genErrorString[numLanguages]; @@ -440,6 +493,63 @@ bool TestFragmentShaders() { return true; } + +bool TestGeometryShaders() { + char *buffer[numLanguages]; + + for (int i = 0; i < numLanguages; i++) { + buffer[i] = new char[65536]; + } + GMRng rng; + int successes = 0; + int count = 30; + + Draw::Bugs bugs; + + // Generate a bunch of random fragment shader IDs, try to generate shader source. + // Then compile it and check that it's ok. + for (int i = 0; i < count; i++) { + uint32_t bottom = i << 1; + GShaderID id; + id.d[0] = bottom; + id.d[1] = 0; + + id.SetBit(GS_BIT_ENABLED, true); + + bool generateSuccess[numLanguages]{}; + std::string genErrorString[numLanguages]; + + for (int j = 0; j < numLanguages; j++) { + generateSuccess[j] = GenerateGShader(id, buffer[j], languages[j], bugs, &genErrorString[j]); + if (!genErrorString[j].empty()) { + printf("%s\n", genErrorString[j].c_str()); + } + // We ignore the contents of the error string here, not even gonna try to compile if it errors. + } + + // Now that we have the strings ready for easy comparison (buffer,4 in the watch window), + // let's try to compile them. + for (int j = 0; j < numLanguages; j++) { + if (generateSuccess[j]) { + std::string errorMessage; + if (!TestCompileShader(buffer[j], languages[j], ShaderStage::Geometry, &errorMessage)) { + printf("Error compiling geometry shader:\n\n%s\n\n%s\n", LineNumberString(buffer[j]).c_str(), errorMessage.c_str()); + return false; + } + successes++; + } + } + } + + printf("%d/%d geometry shaders generated (it's normal that it's not all, there are invalid bit combos)\n", successes, count * numLanguages); + + for (int i = 0; i < numLanguages; i++) { + delete[] buffer[i]; + } + return true; +} + + bool TestShaderGenerators() { #if PPSSPP_PLATFORM(WINDOWS) LoadD3D11(); @@ -453,6 +563,10 @@ bool TestShaderGenerators() { return false; } + if (!TestGeometryShaders()) { + return false; + } + if (!TestReinterpretShaders()) { return false; }