Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct some reversed dependencies, minor other cleanup #16662

Merged
merged 6 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,6 @@ set(GPU_SOURCES
GPU/Common/TextureScalerCommon.h
GPU/Common/PostShader.cpp
GPU/Common/PostShader.h
GPU/Common/SplineCommon.h
GPU/Debugger/Breakpoints.cpp
GPU/Debugger/Breakpoints.h
GPU/Debugger/Debugger.cpp
Expand Down Expand Up @@ -1661,7 +1660,6 @@ set(GPU_SOURCES
GPU/Software/SoftGpu.h
GPU/Software/TransformUnit.cpp
GPU/Software/TransformUnit.h
GPU/ge_constants.h
)

# 'ppsspp_jni' on ANDROID, 'Core' everywhere else
Expand Down
15 changes: 5 additions & 10 deletions Common/File/PathBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,20 @@
#include "Common/Log.h"
#include "Common/Thread/ThreadUtil.h"

#include "Core/Config.h"
#include "Core/System.h"

#if PPSSPP_PLATFORM(ANDROID)
#include "android/jni/app-android.h"
#include "android/jni/AndroidContentURI.h"
#endif

bool LoadRemoteFileList(const Path &url, bool *cancel, std::vector<File::FileInfo> &files) {
bool LoadRemoteFileList(const Path &url, const std::string &userAgent, bool *cancel, std::vector<File::FileInfo> &files) {
_dbg_assert_(url.Type() == PathType::HTTP);

http::Client http;
Buffer result;
int code = 500;
std::vector<std::string> responseHeaders;

http.SetUserAgent(StringFromFormat("PPSSPP/%s", PPSSPP_GIT_VERSION));
http.SetUserAgent(userAgent);

Url baseURL(url.ToString());
if (!baseURL.Valid()) {
Expand Down Expand Up @@ -159,7 +156,7 @@ void PathBrowser::HandlePath() {
if (lastPath.Type() == PathType::HTTP) {
guard.unlock();
results.clear();
success = LoadRemoteFileList(lastPath, &pendingCancel_, results);
success = LoadRemoteFileList(lastPath, userAgent_, &pendingCancel_, results);
guard.lock();
} else if (lastPath.empty()) {
results.clear();
Expand Down Expand Up @@ -196,10 +193,8 @@ bool PathBrowser::IsListingReady() {
std::string PathBrowser::GetFriendlyPath() const {
std::string str = GetPath().ToVisualString();
// Show relative to memstick root if there.
std::string root = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT).ToVisualString();

if (startsWith(str, root)) {
return std::string("ms:") + str.substr(root.size());
if (startsWith(str, aliasMatch_)) {
return aliasDisplay_ + str.substr(aliasMatch_.size());
}

#if PPSSPP_PLATFORM(LINUX) || PPSSPP_PLATFORM(MAC)
Expand Down
11 changes: 11 additions & 0 deletions Common/File/PathBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ class PathBrowser {
}
std::string GetFriendlyPath() const;

void SetUserAgent(const std::string &s) {
userAgent_ = s;
}
void SetRootAlias(const std::string &alias, const std::string &longValue) {
aliasDisplay_ = alias;
aliasMatch_ = longValue;
}

bool empty() const {
return path_.empty();
}
Expand All @@ -45,6 +53,9 @@ class PathBrowser {

Path path_;
Path pendingPath_;
std::string userAgent_;
std::string aliasDisplay_;
std::string aliasMatch_;
std::vector<File::FileInfo> pendingFiles_;
std::condition_variable pendingCond_;
std::mutex pendingLock_;
Expand Down
2 changes: 1 addition & 1 deletion Common/GPU/OpenGL/GLQueueRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include "Common/VR/PPSSPPVR.h"

#include "Common/Log.h"
#include "Common/LogReporting.h"
#include "Common/MemoryUtil.h"
#include "Common/StringUtils.h"
#include "Common/Data/Convert/SmallDataConvert.h"

#include "Core/Reporting.h"
#include "GLQueueRunner.h"
#include "GLRenderManager.h"
#include "DataFormatGL.h"
Expand Down
2 changes: 1 addition & 1 deletion Common/GPU/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void ShaderLanguageDesc::Init(ShaderLanguage lang) {
}
}

void init_resources(TBuiltInResource &Resources) {
void InitShaderResources(TBuiltInResource &Resources) {
Resources.maxLights = 32;
Resources.maxClipPlanes = 6;
Resources.maxTextureUnits = 32;
Expand Down
3 changes: 3 additions & 0 deletions Common/GPU/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include "Common/Common.h"

struct TBuiltInResource;
void InitShaderResources(TBuiltInResource &Resources);

// GLSL_1xx and GLSL_3xx each cover a lot of sub variants. All the little quirks
// that differ are covered in ShaderLanguageDesc.
// Defined as a bitmask so stuff like GetSupportedShaderLanguages can return combinations.
Expand Down
5 changes: 2 additions & 3 deletions Common/GPU/ShaderTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "Common/GPU/ShaderTranslation.h"
#include "ext/glslang/SPIRV/GlslangToSpv.h"
#include "Common/GPU/thin3d.h"
#include "Common/GPU/Shader.h"
#include "Common/GPU/OpenGL/GLFeatures.h"

#include "ext/SPIRV-Cross/spirv.hpp"
Expand All @@ -51,8 +52,6 @@
#include "ext/SPIRV-Cross/spirv_hlsl.hpp"
#endif

extern void init_resources(TBuiltInResource &Resources);

static EShLanguage GetShLanguageFromStage(const ShaderStage stage) {
switch (stage) {
case ShaderStage::Vertex: return EShLangVertex;
Expand Down Expand Up @@ -241,7 +240,7 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, const ShaderLan
const char *shaderStrings[1]{};

TBuiltInResource Resources{};
init_resources(Resources);
InitShaderResources(Resources);

// Don't enable SPIR-V and Vulkan rules when parsing GLSL. Our postshaders are written in oldschool GLES 2.0.
EShMessages messages = EShMessages::EShMsgDefault;
Expand Down
2 changes: 0 additions & 2 deletions Common/GPU/ShaderWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <cstring>

#include "Common/GPU/Shader.h"
#include "GPU/ge_constants.h"
#include "GPU/GPUCommon.h"
#include "Common/Data/Collections/Slice.h"

#include "Common/GPU/thin3d.h"
Expand Down
5 changes: 2 additions & 3 deletions Common/GPU/Vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
#include "Common/System/System.h"
#include "Common/System/Display.h"
#include "Common/Log.h"
#include "Common/GPU/Shader.h"
#include "Common/GPU/Vulkan/VulkanContext.h"
#include "Common/GPU/Vulkan/VulkanDebug.h"
#include "GPU/Common/ShaderCommon.h"
#include "Common/StringUtils.h"
#include "Core/Config.h"

#ifdef USE_CRT_DBG
#undef new
Expand Down Expand Up @@ -1317,7 +1316,7 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *sourceCode,
glslang::TProgram program;
const char *shaderStrings[1];
TBuiltInResource Resources{};
init_resources(Resources);
InitShaderResources(Resources);

int defaultVersion = 0;
EShMessages messages;
Expand Down
10 changes: 7 additions & 3 deletions Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#include "Common/GPU/Vulkan/VulkanMemory.h"
#include "Common/Thread/Promise.h"

#include "Core/Config.h"

#include "Common/GPU/Vulkan/VulkanLoader.h"

// We support a frame-global descriptor set, which can be optionally used by other code,
Expand Down Expand Up @@ -385,6 +383,7 @@ class VKContext : public DrawContext {
~VKContext();

void DebugAnnotate(const char *annotation) override;
void SetDebugFlags(DebugFlags flags) override;

const DeviceCaps &GetDeviceCaps() const override {
return caps_;
Expand Down Expand Up @@ -529,6 +528,7 @@ class VKContext : public DrawContext {
AutoRef<VKFramebuffer> curFramebuffer_;

VkDevice device_;
DebugFlags debugFlags_ = DebugFlags::NONE;

enum {
MAX_FRAME_COMMAND_BUFFERS = 256,
Expand Down Expand Up @@ -1018,7 +1018,7 @@ VKContext::~VKContext() {

void VKContext::BeginFrame() {
// TODO: Bad dependency on g_Config here!
renderManager_.BeginFrame(g_Config.bShowGpuProfile, g_Config.bGpuLogProfiler);
renderManager_.BeginFrame(debugFlags_ & DebugFlags::PROFILE_TIMESTAMPS, debugFlags_ & DebugFlags::PROFILE_SCOPES);

FrameData &frame = frame_[vulkan_->GetCurFrame()];
push_ = frame.pushBuffer;
Expand Down Expand Up @@ -1763,4 +1763,8 @@ void VKContext::DebugAnnotate(const char *annotation) {
renderManager_.DebugAnnotate(annotation);
}

void VKContext::SetDebugFlags(DebugFlags flags) {
debugFlags_ = flags;
}

} // namespace Draw
8 changes: 8 additions & 0 deletions Common/GPU/thin3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,13 @@ enum class TextureBindFlags {
};
ENUM_CLASS_BITOPS(TextureBindFlags);

enum class DebugFlags {
NONE = 0,
PROFILE_TIMESTAMPS = 1,
PROFILE_SCOPES = 2,
};
ENUM_CLASS_BITOPS(DebugFlags);

class DrawContext {
public:
virtual ~DrawContext();
Expand All @@ -655,6 +662,7 @@ class DrawContext {
virtual void SetErrorCallback(ErrorCallbackFn callback, void *userdata) {}

virtual void DebugAnnotate(const char *annotation) {}
virtual void SetDebugFlags(DebugFlags flags) {}

// Partial pipeline state, used to create pipelines. (in practice, in d3d11 they'll use the native state objects directly).
// TODO: Possibly ditch these and just put the descs directly in PipelineDesc since only D3D11 benefits.
Expand Down
2 changes: 1 addition & 1 deletion Common/Net/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Client : public net::Connection {
dataTimeout_ = t;
}

void SetUserAgent(const std::string &&value) {
void SetUserAgent(const std::string &value) {
userAgent_ = value;
}

Expand Down
8 changes: 5 additions & 3 deletions Common/UI/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <algorithm>

#include "Core/Config.h"
#include "Common/System/Display.h"
#include "Common/System/System.h"
#include "Common/UI/UI.h"
Expand Down Expand Up @@ -62,11 +61,14 @@ void UIContext::BeginFrame() {
}
uidrawbufferTop_->SetCurZ(0.0f);
uidrawbuffer_->SetCurZ(0.0f);
uidrawbuffer_->SetTintSaturation(g_Config.fUITint, g_Config.fUISaturation);
uidrawbufferTop_->SetTintSaturation(g_Config.fUITint, g_Config.fUISaturation);
ActivateTopScissor();
}

void UIContext::SetTintSaturation(float tint, float sat) {
uidrawbuffer_->SetTintSaturation(tint, sat);
uidrawbufferTop_->SetTintSaturation(tint, sat);
}

void UIContext::Begin() {
BeginPipeline(ui_pipeline_, sampler_);
}
Expand Down
2 changes: 2 additions & 0 deletions Common/UI/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class UIContext {
// Utility methods
TextDrawer *Text() const { return textDrawer_; }

void SetTintSaturation(float tint, float sat);

void SetFontStyle(const UI::FontStyle &style);
const UI::FontStyle &GetFontStyle() { return *fontStyle_; }
void SetFontScale(float scaleX, float scaleY);
Expand Down
2 changes: 0 additions & 2 deletions Core/CoreTiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "Core/Config.h"
#include "Core/HLE/sceKernelThread.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Reporting.h"

static const int initialHz = 222000000;
int CPU_HZ = 222000000;
Expand Down Expand Up @@ -606,7 +605,6 @@ void Advance() {

if (!first) {
// This should never happen in PPSSPP.
// WARN_LOG_REPORT(TIME, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");
if (slicelength < 10000) {
slicelength += 10000;
currentMIPS->downcount += 10000;
Expand Down
1 change: 0 additions & 1 deletion Core/CwCheat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Rough and ready CwCheats implementation, disabled by default.
// Will not enable by default until the TOOD:s have been addressed.

#pragma once

Expand Down
6 changes: 3 additions & 3 deletions Core/HLE/ReplaceTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ static int Hook_kumonohatateni_download_frame() {
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "kumonohatateni_download_frame");
}
}
return 0;
}

Expand All @@ -1027,7 +1027,7 @@ static int Hook_otomenoheihou_download_frame() {
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformReadbackToMemory(fb_address, 0x00088000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00088000, "otomenoheihou_download_frame");
}
}
return 0;
}

Expand All @@ -1054,7 +1054,7 @@ static int Hook_toheart2_download_frame() {
if (Memory::IsVRAMAddress(fb_address)) {
gpu->PerformReadbackToMemory(fb_address, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, fb_address, 0x00044000, "toheart2_download_frame");
}
}
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/sceIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ static u32 sceIoSetAsyncCallback(int id, u32 clbckId, u32 clbckArg)
static u32 sceIoOpenAsync(const char *filename, int flags, int mode) {
hleEatCycles(18000);

// TOOD: Use an internal method so as not to pollute the log?
// TODO: Use an internal method so as not to pollute the log?
// Intentionally does not work when interrupts disabled.
if (!__KernelIsDispatchEnabled())
sceKernelResumeDispatchThread(1);
Expand Down
1 change: 0 additions & 1 deletion Core/HLE/sceKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#include "sceKernelMutex.h"
#include "sceKernelMbx.h"
#include "sceKernelMsgPipe.h"
#include "sceKernelInterrupt.h"
#include "sceKernelSemaphore.h"
#include "sceKernelEventFlag.h"
#include "sceKernelVTimer.h"
Expand Down
4 changes: 2 additions & 2 deletions Core/HLE/sceKernelMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void __KernelFplEndCallback(SceUID threadID, SceUID prevCallbackId)
{
auto result = HLEKernel::WaitEndCallback<FPL, WAITTYPE_FPL, FplWaitingThread>(threadID, prevCallbackId, fplWaitTimer, __KernelUnlockFplForThread);
if (result == HLEKernel::WAIT_CB_RESUMED_WAIT)
DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB: Resuming mbx wait from callback");
DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFplCB: Resuming mbx wait from callback");
}

static bool __FplThreadSortPriority(FplWaitingThread thread1, FplWaitingThread thread2)
Expand Down Expand Up @@ -1452,7 +1452,7 @@ void __KernelVplEndCallback(SceUID threadID, SceUID prevCallbackId)
{
auto result = HLEKernel::WaitEndCallback<VPL, WAITTYPE_VPL, VplWaitingThread>(threadID, prevCallbackId, vplWaitTimer, __KernelUnlockVplForThread);
if (result == HLEKernel::WAIT_CB_RESUMED_WAIT)
DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB: Resuming mbx wait from callback");
DEBUG_LOG(SCEKERNEL, "sceKernelAllocateVplCB: Resuming mbx wait from callback");
}

static bool __VplThreadSortPriority(VplWaitingThread thread1, VplWaitingThread thread2)
Expand Down
1 change: 0 additions & 1 deletion Core/MemMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "Core/MIPS/JitCommon/JitBlockCache.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Common/Thread/ParallelLoop.h"
#include "UI/OnScreenDisplay.h"

namespace Memory {

Expand Down
2 changes: 1 addition & 1 deletion Core/MemMapFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.

#include "Common/CommonTypes.h"
#include "Common/LogReporting.h"

#include "Core/Core.h"
#include "Core/MemMap.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/Host.h"
#include "Core/Reporting.h"

#include "Core/MIPS/MIPS.h"

Expand Down
Loading