-
-
Notifications
You must be signed in to change notification settings - Fork 231
Remove the default pixel format, fix rendering of grayscale PNGs #2573
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
base: wip-v3
Are you sure you want to change the base?
Conversation
@j-jorge |
@aismann It takes forever to compile the thousands targets. I think there are too many things in the headers, thus too many header dependencies, and too many functions end up in the object files. For example, both constructors of If you do source code generation then try to create small headers and include as few as possible to reduce the time of incremental rebuilds. Stay away from axmol.h :) And if you can, try to enable unity builds. |
Turning the PR to draft to fix the CI issues and resolve the texture conversion. |
5c46dc8
to
6fee890
Compare
According to https://semver.org/#semantic-versioning-200, this PR should merge to branch |
In auto test mode, cpp-tests will save a capture of the scene in the directory whose path is given by environment variable AXMOL_AUTOTEST_CAPTURE_DIR, if such a path is provided.
f11d70b
to
786e13a
Compare
@halx99 The branch is now rebased on wip-v3. |
This is a following of #2230 and #2234. The goal is to display gray+alpha PNGs as gray+alpha sprites, instead of the bogus greenish rendering we have currently.
First commit
Add AXMOL_AUTOTEST_CAPTURE_DIR for cpp-tests. In auto test mode, cpp-tests will save a capture of the scene for each test, in the directory whose path is given by environment variable AXMOL_AUTOTEST_CAPTURE_DIR, if such a path is provided.
This is useful to create an overall view of cpp-tests and check if the introduced changes have an unexpected effect. It would be better if there was no randomness in the tests.
Second commit
Check the value of AXMOL_START_AUTOTEST, ignore it if zero. The mere existence of the variable was enough to enable autotest mode. I've changed the behavior to prevent autotest if the variable is set to zero.
Third commit
Remove the default pixel format from Texture2D (i.e.
Texture2D::g_defaultAlphaPixelFormat
). The textures have the format of the input file unless the user asks for a specific format, in which case the texture will be converted on the fly.Fourth commit
Handle gray+alpha PNG images as gray+alpha sprites. This also remove the conversion from R8 and RG8 to RGBA8 when AX_GLES_PROFILE is not defined (e.g. a Linux build). A shader has been added for these formats and is automatically selected by
ax::Sprite
.Notes
lowp
precision in the shaders, but also pointed that all shaders usehighp
and should be updated too. I decided to keephighp
to stay consistent with existing code.AX_USE_METAL
is defined, including the bogus RG8 -> RGBA8 that produce green textures for gray+alpha png. I would need confirmation that it can safely be removed.Before / after
Captures on the dev branch on the left, and the result of this PR on the right.
The main issue that caused all these changes: the top-left and bottom-left sprites are now displayed as expected.

Some variations in PVR tests, including a fix for greenish rendering.










The pixel format conversions still have some ugly green rendering but R8 and RG8 seem okay.





For these ones I don't know if it is expected.




