Merge pull request #20565 from hrydgard/fix-unittest

Try to fix the unittest on Windows
This commit is contained in:
Henrik Rydgård committed 2025-07-09 16:29:53 +02:00
1 parent c3c814175c
commit 297c6e23a8
5 files changed
+14 -8

No files matched your search

+4 -1
View File
@@ -281,7 +281,10 @@ inline OpArg MRegSum(X64Reg base, X64Reg offset)
template <typename T>
inline bool Accessible(const T *t1, const T *t2) {
ptrdiff_t diff = (const uint8_t *)t1 - (const uint8_t *)t2;
return diff > -0x7FFFFFE0 && diff < 0x7FFFFFE0;
if (diff < 0) {
diff = -diff;
}
return diff < (ptrdiff_t)0x7FFFFFE0;
}
template <typename T>
+3 -3
View File
@@ -28,7 +28,7 @@ std::vector<uint8_t> CompileShaderToBytecodeD3D11(const char *code, size_t codeS
HRESULT result = ptr_D3DCompile(code, codeSize, nullptr, nullptr, nullptr, "main", target, flags, 0, &compiledCode, &errorMsgs);
std::string errors;
if (errorMsgs) {
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize());
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize() > 1 ? (errorMsgs->GetBufferSize() - 1) : 0);
std::string numberedCode = LineNumberString(code);
if (SUCCEEDED(result)) {
std::vector<std::string_view> lines;
@@ -45,9 +45,9 @@ std::vector<uint8_t> CompileShaderToBytecodeD3D11(const char *code, size_t codeS
}
} else {
ERROR_LOG(Log::G3D, "%s: %s\n\n%s", "errors", errors.c_str(), numberedCode.c_str());
OutputDebugStringA(errors.c_str());
OutputDebugStringA(numberedCode.c_str());
}
OutputDebugStringA(errors.c_str());
OutputDebugStringA(numberedCode.c_str());
}
if (compiledCode) {
// Success!
+1 -1
View File
@@ -149,7 +149,7 @@ RegCache::Reg PixelJitCache::GetColorOff(const PixelFuncID &id) {
// Now add the pointer for the color buffer.
if (loadDepthOff) {
_assert_(Accessible(&fb.data, &depthbuf.data));
_assert_msg_(Accessible(&fb.data, &depthbuf.data), "fb.data and depthbuf.data too far apart: %p %p (fb=%08x d=%08x)", fb.data, depthbuf.data, gstate.getFrameBufAddress(), gstate.getDepthBufAddress());
depthTemp = regCache_.Alloc(RegCache::GEN_DEPTH_OFF);
if (RipAccessible(&fb.data) && RipAccessible(&depthbuf.data)) {
MOV(PTRBITS, R(argYReg), M(&fb.data));
+1 -1
View File
@@ -1029,7 +1029,7 @@ void SoftGPU::Execute_FramebufPtr(u32 op, u32 diff) {
// We assume fb.data won't change while we're drawing.
if (diff) {
drawEngine_->transformUnit.Flush(this, "framebuf");
fb.data = Memory::GetPointerWrite(gstate.getFrameBufAddress());
fb.data = Memory::GetPointerWriteUnchecked(gstate.getFrameBufAddress());
}
}
+5 -2
View File
@@ -55,6 +55,7 @@
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Buffer.h"
#include "Common/File/Path.h"
#include "Common/Log/LogManager.h"
#include "Common/Math/SIMDHeaders.h"
#include "Common/Math/CrossSIMD.h"
// Get some more instructions for testing
@@ -1311,6 +1312,7 @@ int main(int argc, const char *argv[]) {
cpu_info.bVFPv3 = true;
cpu_info.bVFPv4 = true;
g_Config.bEnableLogging = true;
g_logManager.DisableOutput(LogOutput::DebugString); // not really needed
bool allTests = false;
TestFunc testFunc = nullptr;
@@ -1329,7 +1331,8 @@ int main(int argc, const char *argv[]) {
if (allTests) {
int passes = 0;
int fails = 0;
for (auto f : availableTests) {
for (const auto &f : availableTests) {
printf("\n**** Running test %s ****\n", f.name);
if (f.func()) {
++passes;
} else {
@@ -1344,7 +1347,7 @@ int main(int argc, const char *argv[]) {
printf("%d tests failed!\n", fails);
return 2;
}
} else if (testFunc == nullptr) {
} else if (!testFunc) {
fprintf(stderr, "You may select a test to run by passing an argument, either \"all\" or one or more of the below.\n");
fprintf(stderr, "\n");
fprintf(stderr, "Available tests:\n");