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

Add tests for texture decompressors #5053

Open
gdkchan opened this issue May 22, 2023 · 9 comments
Open

Add tests for texture decompressors #5053

gdkchan opened this issue May 22, 2023 · 9 comments
Labels
enhancement New feature or request good first issue This issue would be a great starting point for someone new to the project. gpu Related to Ryujinx.Graphics

Comments

@gdkchan
Copy link
Member

gdkchan commented May 22, 2023

We currently have 3 texture decompressors on the Ryujinx.Graphics.Texture project:

  • ASTC decompressor.
  • BC 1-7 decompressor.
  • ETC2 decompressor.

Right now we don't have tests for any of them. We should have tests to ensure that their output match those of the reference decoders for each compression algorithm. Part of the work is also fixing any issue that might potentially be found on them.

It is fine do implement tests for each decoder on separate PRs, or do them all in a single PR.
Using the same test images that the reference implementation uses if possible is desirable, as those are more likely to trigger all the different modes on the compression. For ASTC, we should ensure we are testing all the block sizes (or at least, more than just 4x4).

Having those tests would prevent issues like #4890. It also makes things easier to people trying to optimize the decoders in the future, as they have an easy way to ensure it is still functioning properly.

@gdkchan gdkchan added enhancement New feature or request gpu Related to Ryujinx.Graphics good first issue This issue would be a great starting point for someone new to the project. labels May 22, 2023
@mmdurrant
Copy link
Contributor

I'm gonna take a look @ this but before I do wanted to comment / collaborate with anyone that's already invested time/energy.

@mmdurrant
Copy link
Contributor

https://github.com/ARM-software/astc-encoder/tree/main/Test/Images has some refernece images but we need to make sure the licensing is such that we can use them, else we'll probably need to create our own?

@d-najd
Copy link

d-najd commented Sep 24, 2023

I'm gonna take a look @ this but before I do wanted to comment / collaborate with anyone that's already invested time/energy.

I am looking into this PR and would be happy to collaborate if you are still interested.

@mmdurrant
Copy link
Contributor

The failures of some of the tests perplex me - I don't understand enough about the compression algorithms to completely understand why they're failing. I haven't touched the code in months but here's my branch.

https://github.com/mmdurrant/Ryujinx/tree/mmdurrant/texture-tests

If you'd like to communicate about it in other channels - you can reach me via email at my github handle @ gmail.com.

@d-najd
Copy link

d-najd commented Sep 24, 2023

The failures of some of the tests perplex me - I don't understand enough about the compression algorithms to completely understand why they're failing. I haven't touched the code in months but here's my branch.

Same here unfortunately, although looking at the code for BC7 decoder/encoder it looks fairly simple (hopefully), and the pr says that test for each decompressor can be separate pr.

If you'd like to communicate about it in other channels - you can reach me via email at my github handle @ gmail.com.

what about discord? my handle is Deltashot#2560

@Michael-Dimitrov
Copy link

Hey, not sure if anyone is looking at this anymore (@d-najd and @mmdurrant pls notify me if you still would want to collaborate on this). I took a look at mmdurrants branch with the code for the ASTC tests, and he has some test cases in there already, some of them are failing in his branch but after cloning his branch and just regenerating the .astc and .astc.rgba files I was able to get all 14 test cases passing now.

@mmdurrant
Copy link
Contributor

Can you please include the methodology you used to generate the .rgba files? I think that's where I was erring.

A few points:

  • I started w/ the ASTC tests because I knew they'd be the hardest. The other tests should be easier.
  • My goal was encapsulating the varying encode/decode compression/decompression algorithms such that we could re-use the same test suite with the different algorithms.
  • It was my first pass at the problem and could probably use some cleanup.

I'm on Mountain Time - I saw you emailed me so I'll respond w/ Discord details if you wanna collaborate.

@mmdurrant
Copy link
Contributor

@Michael-Dimitrov can you PR the fixed images into my branch? We can work together on getting the code cleaned up and getting this same suite tweaked to work with the BC suites/etc.

Maybe doctor'd up since we're both MD hahah

@Michael-Dimitrov
Copy link

I can create a PR in a moment, regarding the way I generated them - I'm not sure what the issue was with the original files, but I just followed your comments in AstcDecoderTests.cs, and reran the tests. I used the same MoreRocks.png as the source file. The only real difference I can think of is that instead of using the astcenc-sse2.exe in your branch, I had to download a different binary since I am on linux (https://github.com/ARM-software/astc-encoder/releases), still it should be the same encoder I'm using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue This issue would be a great starting point for someone new to the project. gpu Related to Ryujinx.Graphics
Projects
None yet
Development

No branches or pull requests

5 participants
@mmdurrant @gdkchan @Michael-Dimitrov @d-najd and others