More misc cleanup

This commit is contained in:
Henrik Rydgård
2025-05-14 10:04:22 +02:00
parent 8ed898c5e6
commit 4e0b6ac3ec
7 changed files with 39 additions and 22 deletions
+4 -1
View File
@@ -289,7 +289,10 @@ void sleep_precise(double seconds) {
LARGE_INTEGER due;
due.QuadPart = -(sleepTicks > maxTicks ? maxTicks : sleepTicks);
// Note: SetWaitableTimerEx is not available on Vista.
SetWaitableTimer(Timer, &due, 0, NULL, NULL, FALSE);
if (!SetWaitableTimer(Timer, &due, 0, NULL, NULL, FALSE)) {
_dbg_assert_(false);
break;
}
WaitForSingleObject(Timer, INFINITE);
QueryPerformanceCounter(&qpc);
}
+2 -2
View File
@@ -360,11 +360,11 @@ u32 sceKernelDevkitVersion()
}
u32 sceKernelRegisterKprintfHandler() {
return hleLogError(Log::sceKernel, 0, "UNIMPL");
return hleLogWarning(Log::sceKernel, 0, "UNIMPL");
}
int sceKernelRegisterDefaultExceptionHandler() {
return hleLogError(Log::sceKernel, 0, "UNIMPL");
return hleLogWarning(Log::sceKernel, 0, "UNIMPL");
}
void sceKernelSetGPO(u32 ledBits) {
+9 -7
View File
@@ -582,19 +582,21 @@ bool PSP_InitStart(const CoreParameter &coreParam) {
}
BootState PSP_InitUpdate(std::string *error_string) {
if (g_bootState == BootState::Booting || g_bootState == BootState::Off) {
const BootState bootState = g_bootState;
if (bootState == BootState::Booting || bootState == BootState::Off) {
// Nothing to do right now.
_dbg_assert_(g_bootState == BootState::Booting || !g_loadingThread.joinable());
return g_bootState;
_dbg_assert_(bootState == BootState::Booting || !g_loadingThread.joinable());
return bootState;
}
_dbg_assert_(g_bootState == BootState::Complete || g_bootState == BootState::Failed);
_dbg_assert_(bootState == BootState::Complete || bootState == BootState::Failed);
// Since we load on a background thread, wait for startup to complete.
_assert_msg_(g_loadingThread.joinable(), "bootstate: %d", (int)g_bootState);
_assert_msg_(g_loadingThread.joinable(), "bootstate: %d", (int)bootState);
g_loadingThread.join();
if (g_bootState == BootState::Failed) {
if (bootState == BootState::Failed) {
// Failed! (Note: PSP_Shutdown was already called on the loader thread).
Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE);
*error_string = g_CoreParameter.errorString;
@@ -627,7 +629,7 @@ BootState PSP_InitUpdate(std::string *error_string) {
Core_NotifyLifecycle(CoreLifecycle::START_COMPLETE);
// The thread should have set it at this point.
_dbg_assert_(g_bootState == BootState::Complete);
_dbg_assert_(bootState == BootState::Complete);
return BootState::Complete;
}
+1 -1
View File
@@ -107,7 +107,7 @@ void DecVtxFormat::InitializeFromID(uint32_t id) {
void GetIndexBounds(const void *inds, int count, u32 vertType, u16 *indexLowerBound, u16 *indexUpperBound) {
// Find index bounds. Could cache this in display lists.
// Also, this could be greatly sped up with SSE2/NEON, although rarely a bottleneck, and some compilers
// autovectorize this just fine.
// autovectorize this just fine. (Though, it should be noted, MSVC generates really crap code here...).
u32 idx = vertType & GE_VTYPE_IDX_MASK;
if (idx == GE_VTYPE_IDX_16BIT) {
uint16_t upperBound = 0;
+21 -2
View File
@@ -362,7 +362,7 @@ void GPUStateCache::DoState(PointerWrap &p) {
gstate_c.Dirty(DIRTY_CULL_PLANES);
}
static const char *const gpuUseFlagNames[32] = {
static const char *const g_gpuUseFlagNames[32] = {
"GPU_USE_DUALSOURCE_BLEND",
"GPU_USE_LIGHT_UBERSHADER",
"GPU_USE_FRAGMENT_TEST_CACHE",
@@ -399,8 +399,27 @@ static const char *const gpuUseFlagNames[32] = {
const char *GpuUseFlagToString(int useFlag) {
if ((u32)useFlag < 32) {
return gpuUseFlagNames[useFlag];
return g_gpuUseFlagNames[useFlag];
} else {
return "N/A";
}
}
bool GPUStateCache::SetUseFlags(const u32 newFlags) {
if (newFlags != useFlags_) {
if (useFlags_ != 0 && newFlags != 0) {
INFO_LOG(Log::G3D, "Shader useflags changed from %08x to %08x:", useFlags_, newFlags);
for (int i = 0; i < 32; i++) {
const int mask = 1 << i;
bool oldVal = (useFlags_ & mask) != 0;
bool newVal = (newFlags & mask) != 0;
if (oldVal != newVal) {
INFO_LOG(Log::G3D, "%s changed from %d to %d", g_gpuUseFlagNames[i], (int)oldVal, (int)newVal);
}
}
useFlagsChanged = true;
}
useFlags_ = newFlags;
}
return useFlagsChanged;
}
+1 -7
View File
@@ -578,13 +578,7 @@ struct GPUStateCache {
Dirty(DIRTY_UVSCALEOFFSET);
}
}
void SetUseFlags(u32 newFlags) {
if (newFlags != useFlags_) {
if (useFlags_ != 0)
useFlagsChanged = true;
useFlags_ = newFlags;
}
}
bool SetUseFlags(u32 newFlags);
// When checking for a single flag, use Use()/UseAll().
u32 GetUseFlags() const {
+1 -2
View File
@@ -833,7 +833,6 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa
rm->NudgeCompilerThread();
NOTICE_LOG(Log::G3D, "Recreated Vulkan pipeline cache (%d pipelines, %d failed).", (int)size, pipelineCreateFailCount);
// We just ignore any failures.
// The rest of the work is async, we can't know here if it'll succeed.
return true;
}