UnitTest: Correct vertex and jit tests.

We now convert texcoords to floats.
This commit is contained in:
Unknown W. Brackets 2017-05-06 18:45:04 -07:00
parent 032e21b707
commit 6b3944d329
5 changed files with 18 additions and 13 deletions

View File

@ -89,8 +89,10 @@ bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address)
args.silent = true; args.silent = true;
args.memoryFile = &file; args.memoryFile = &file;
args.errorsResult = &errors; args.errorsResult = &errors;
g_symbolMap->GetLabels(args.labels); if (g_symbolMap) {
g_symbolMap->GetLabels(args.labels);
}
errorText = L""; errorText = L"";
if (!runArmips(args)) if (!runArmips(args))

View File

@ -376,7 +376,7 @@ public:
curIBufferOffset_ = offset; curIBufferOffset_ = offset;
} }
void UpdateDynamicUniformBuffer(const void *ub, size_t size); void UpdateDynamicUniformBuffer(const void *ub, size_t size) override;
// TODO: Add more sophisticated draws. // TODO: Add more sophisticated draws.
void Draw(int vertexCount, int offset) override; void Draw(int vertexCount, int offset) override;
@ -1320,4 +1320,4 @@ void VKContext::HandleEvent(Event ev, int width, int height, void *param1, void
// Noop // Noop
} }
} // namespace Draw } // namespace Draw

View File

@ -29,7 +29,7 @@ public:
void UpdateMemView() override {} void UpdateMemView() override {}
void UpdateDisassembly() override {} void UpdateDisassembly() override {}
void SetDebugMode(bool mode) { } void SetDebugMode(bool mode) override { }
void SetGraphicsCore(GPUCore core) { gpuCore_ = core; } void SetGraphicsCore(GPUCore core) { gpuCore_ = core; }
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override {return false;} bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override {return false;}
@ -73,4 +73,4 @@ public:
protected: protected:
std::string debugOutputBuffer_; std::string debugOutputBuffer_;
GPUCore gpuCore_; GPUCore gpuCore_;
}; };

View File

@ -91,8 +91,8 @@ static void DestroyJitHarness() {
// Clear our custom module out to be safe. // Clear our custom module out to be safe.
HLEShutdown(); HLEShutdown();
CoreTiming::Shutdown(); CoreTiming::Shutdown();
Memory::Shutdown();
mipsr4k.Shutdown(); mipsr4k.Shutdown();
Memory::Shutdown();
coreState = CORE_POWERDOWN; coreState = CORE_POWERDOWN;
currentMIPS = nullptr; currentMIPS = nullptr;
} }

View File

@ -36,6 +36,10 @@ public:
cache_ = new VertexDecoderJitCache(); cache_ = new VertexDecoderJitCache();
g_Config.bVertexDecoderJit = true; g_Config.bVertexDecoderJit = true;
// Required for jit to be enabled.
g_Config.iCpuCore = (int)CPUCore::JIT;
gstate_c.uv.uScale = 1.0f;
gstate_c.uv.vScale = 1.0f;
} }
~VertexDecoderTestHarness() { ~VertexDecoderTestHarness() {
delete src_; delete src_;
@ -297,8 +301,7 @@ static bool TestVertex8() {
for (int jit = 0; jit <= 1; ++jit) { for (int jit = 0; jit <= 1; ++jit) {
dec.Execute(vtype, 0, jit == 1); dec.Execute(vtype, 0, jit == 1);
dec.Assert8("TestVertex8-TC", 127, 128); dec.AssertFloat("TestVertex8-TC", 127.0f / 128.0f, 1.0f);
dec.Skip(2);
dec.Assert8("TestVertex8-Nrm", 127, 0, 128); dec.Assert8("TestVertex8-Nrm", 127, 0, 128);
dec.Skip(1); dec.Skip(1);
dec.AssertFloat("TestVertex8-Pos", 127.0f / 128.0f, 0.0f, -1.0f); dec.AssertFloat("TestVertex8-Pos", 127.0f / 128.0f, 0.0f, -1.0f);
@ -317,7 +320,7 @@ static bool TestVertex16() {
for (int jit = 0; jit <= 1; ++jit) { for (int jit = 0; jit <= 1; ++jit) {
dec.Execute(vtype, 0, jit == 1); dec.Execute(vtype, 0, jit == 1);
dec.Assert16("TestVertex16-TC", 32767, 32768); dec.AssertFloat("TestVertex16-TC", 32767.0f / 32768.0f, 1.0f);
dec.Assert16("TestVertex16-Nrm", 32767, 0, 32768); dec.Assert16("TestVertex16-Nrm", 32767, 0, 32768);
dec.Skip(2); dec.Skip(2);
dec.AssertFloat("TestVertex16-Pos", 32767.0f / 32768.0f, 0.0f, -1.0f); dec.AssertFloat("TestVertex16-Pos", 32767.0f / 32768.0f, 0.0f, -1.0f);
@ -354,8 +357,8 @@ static bool TestVertex8Through() {
for (int jit = 0; jit <= 1; ++jit) { for (int jit = 0; jit <= 1; ++jit) {
dec.Execute(vtype, 0, jit == 1); dec.Execute(vtype, 0, jit == 1);
dec.Assert8("TestVertex8Through-TC", 127, 128); // Note: this is correct, even in through.
dec.Skip(2); dec.AssertFloat("TestVertex8Through-TC", 127.0f / 128.0f, 1.0f);
dec.Assert8("TestVertex8Through-Nrm", 127, 0, 128); dec.Assert8("TestVertex8Through-Nrm", 127, 0, 128);
// Ignoring Pos since s8 through isn't really an option. // Ignoring Pos since s8 through isn't really an option.
} }
@ -373,7 +376,7 @@ static bool TestVertex16Through() {
for (int jit = 0; jit <= 1; ++jit) { for (int jit = 0; jit <= 1; ++jit) {
dec.Execute(vtype, 0, jit == 1); dec.Execute(vtype, 0, jit == 1);
dec.Assert16("TestVertex16Through-TC", 32767, 32768); dec.AssertFloat("TestVertex16Through-TC", 32767.0f, 32768.0f);
dec.Assert16("TestVertex16Through-Nrm", 32767, 0, 32768); dec.Assert16("TestVertex16Through-Nrm", 32767, 0, 32768);
dec.Skip(2); dec.Skip(2);
dec.AssertFloat("TestVertex16Through-Pos", 32767.0f, 0.0f, 32768.0f); dec.AssertFloat("TestVertex16Through-Pos", 32767.0f, 0.0f, 32768.0f);