Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Relax strict pixel match tests in test_src_alpha_sdl2_blitter by allowing a small delta#3494

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ankith26 merged 4 commits intopygame:mainfromTemmie3754:main
Oct 16, 2022

Conversation

@Temmie3754
Copy link
Contributor

Resolves the small issue in a test raised by#3097
Allows for a delta of up to 2 which resolves all errors presented in the original problem.

Copy link
Contributor

@ankith26ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR! 🎉 🎈

Left a minor review

Copy link
Contributor

@ankith26ankith26 left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM! 🎉 😎

(There is a minor CI fail in here, could you please runblack on the python file you changed in this PR to fix the formatting?)

@Temmie3754
Copy link
ContributorAuthor

Formatting should hopefully be correct finally

@Starbuck5
Copy link
Contributor

The source of this problem is very mysterious. I think it's SIMD related, but why? SIMD doesn't do approximation, it just does acceleration.

I don't think the solution is to just add a delta to the test. I would prefer it to test that the result is EXACTLY X or Y, rather than testing whether it's within 4 of X.

@ankith26
Copy link
Contributor

I am of the view that as long as something blitting related does not change much visually, it shouldn't be considered a break.
The underlying formula is an implementation detail, especially while using the SDL blitter, we should not treat things as a break when they make minor changes on their side. So to me having a delta makes sense, but I don't mind changing the exact number specified in the delta

@Starbuck5
Copy link
Contributor

Blitting should be 100% deterministic. Input A goes to output B, every time, 100% accurate. The fact that it isn't (on the SDL2 blitter) is extremely unsettling.

I believe our current situation is that Input A goes to output B or output C, based on SDL version / architecture. Therefore I'd like to test the output against B and C, and only fail if it is neither.

I don't want it to drift again without our noticing, and that's what a delta does.

@Temmie3754
Copy link
ContributorAuthor

Alright I'll look into changing the implementation to use fixed outputs as specified by the original error but I will need someone else who has those architectures to test that it resolves the issue.

@ankith26
Copy link
Contributor

Blitting should be 100% deterministic. Input A goes to output B, every time, 100% accurate. The fact that it isn't (on the SDL2 blitter) is extremely unsettling.

Blitting should be deterministic for a given SDL version? yes. Theexact same on all platforms across all SDL versions of the past and future? Probably too much to ask, even if desirable. SDL can make algorithmic changes, and since the exact algorithm is not a documented API detail, I don't see why they shouldn't be making tiny changes to it if it helps with performance, even though the exact pixel colours change a tiny bit. I can understand if there's a big change that has visual affect, it could be considered a breaking change.

If I had to guess, I'd say this PR changed thingslibsdl-org/SDL#5430 (I tested on windows 2.24.1) but I'm not very sure. Atleast I didn't find anything else blit related that changed.

I don't want it to drift again without our noticing, and that's what a delta does.

I'm saying we shouldn't care of minor drifts. I can't tell the difference between(255, 10, 100) and(253, 12, 98) when they are in the same image side by side. Visually I can't see the line of separation and it looks all pink to me, even though I'm sure the lines technically there. Am I colour blind? Probably not 😄

I also don't want to add the maintenance burden of having to keep updating our tests everytime SDL does a minor change like now. pygame users who resort to using the SDL blitter are the same target group of people who care about performance and not exact match with the pygame blitter.

@Temmie3754
Copy link
ContributorAuthor

Created an implementation that checks if its either the normal outputs or the ones provided in the original issue, just need to come to a decision on which version would be a better choice now. Can view the differences here in the meantimehttps://github.com/Temmie3754/pygame/tree/surface-test-fixes.

Copy link
Contributor

@MyreMylarMyreMylar left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I mentioned this on the discord too but I am generally in favour of this change for the SDL2 alpha blitter tests. This isn't the first time, or even the second time that the SDL formula has changed slightly - in fact these changes are the whole reason we ended up creating the default pygame alpha blitter. Ultimately these tests failing is outside of our control as we can't stop SDL slightly tweaking their alpha blitting formula.

For most users, they will never use the SDL2 alpha blitter as you have to go and seek it out and specifically flag to use it, and for those that do so a tiny colour discrepancy (likely less than 0.5%) between SDL versions on some platforms when alpha blitting - that is not normally visually noticeable will be unlikely to cause issues.

I do think we should create a second issue to update the docs for theBLEND_ALPHA_SDL2 in 2.1.4 after all the performance changes around the alpha blitters that are floating around have made it in. I suspect the original description of being 'sometimes faster' will be increasingly inaccurate by that point - especially if we have full AVX2 acceleration on the pygame alpha blitters. Then at that point we can also add a note in the docs that the SDL2 blitting formula differs between different versions of SDL.

ankith26 reacted with rocket emoji
@ankith26
Copy link
Contributor

I'll merge it in now, it's a non-risky change and as said before should better future-proof this test. If the need arises in the future, we can consider a stricter but more-maintenance-ey test then.
Definitely the docs aroundBLEND_ALPHA_SDL2 needs updating to reflect the latest pygame blitter improvements, and the inter-SDL-version minor differences, but as MyreMylar says that can happen in a future PR, lets get this one in 🥳

@illumeillume added the bug labelOct 29, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@MyreMylarMyreMylarMyreMylar approved these changes

@ankith26ankith26ankith26 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

bugSDL2Surfacepygame.Surfaceteststests (module)

Projects

None yet

Milestone

2.1.3

Development

Successfully merging this pull request may close these issues.

test_src_alpha_sdl2_blitter should not test for exact pixel perfect match (and instead allow a small delta)

5 participants

@Temmie3754@Starbuck5@ankith26@MyreMylar@illume

[8]ページ先頭

©2009-2025 Movatter.jp