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

GPU Hardware Texture Compression #5495

Closed
iampremo opened this issue Apr 15, 2024 · 6 comments
Closed

GPU Hardware Texture Compression #5495

iampremo opened this issue Apr 15, 2024 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Milestone

Comments

@iampremo
Copy link
Member

iampremo commented Apr 15, 2024

Texture Compression is a way of reducing the memory and bandwidth used for storing and rendering textures on GPU devices. Different methods of texture compression are used on different hardware families - so there is not a simple one solution fits all target platforms, and because each of them are lossy how good they look differs from algorithm to algorithm.

We have added support for Texture Compression at compile and runtime (currently no IDE support for visualising this). The UX is very limited just now and it has an impact on build times, but it can improve memory footprint and rendering can be significantly speeded up (we have seen a 10x improvement on some platforms).

Compression happens at compile time and the type of compression (and quality ) are controlled via parameters added to the texture group (so everything has to be placed into a group to control compression).

Compression tools are common and we will be providing a github repo with the project required to setup the tools and all the information required to implement the feature.

On desktop platforms we support Block based textures - https://en.wikipedia.org/wiki/S3_Texture_Compression
On mobile platforms we support ASTC - https://en.wikipedia.org/wiki/Adaptive_scalable_texture_compression
On console platforms we support the local compression methods.

NOTE: Hardware textures are smaller in VRAM but they may be larger than PNG files so the on-disk size may get larger (but runtime VRAM will be smaller and rendering speed will be better)

@iampremo iampremo converted this from a draft issue Apr 15, 2024
@iampremo iampremo added the feature request New feature (or a request for one) label Apr 15, 2024
@iampremo iampremo moved this from Triage to In Progress in Team Workload Apr 15, 2024
@iampremo iampremo moved this to In Beta in GameMaker Roadmap Apr 15, 2024
@rwkay rwkay added this to the 2024.4 milestone Apr 15, 2024
@FoxyOfJungle
Copy link

This is huge! can't wait 😍

It's very interesting that it's per texture group... it means I can put a texture quality option in the game...

@tinkerer-red
Copy link

I have some small concern about that, it says that the textures are compressed at compile time, how ever I'm curious if this acts like yyc compiles where some texture sheets are cached or if this recompresses the texture sheet ever time you compile.

@gnysek
Copy link
Contributor

gnysek commented Apr 18, 2024

I suspect this might use post_textures.bat, but manual doesn't precise if TexturesDir contains only changed textures, or all. Aaand there's chance that for this solution, they have added some new variables which are passed to .bat/.sh scripts.

Seems we need to wait for repository with extension for compression to see it in action.

@jackerley
Copy link

Sample project now public at https://github.com/YoYoGames/GM-GPUTextureCompression

@github-project-automation github-project-automation bot moved this from In Progress to Done in Team Workload Apr 19, 2024
@gurpreetsinghmatharoo gurpreetsinghmatharoo added the documentation Improvements or additions to documentation are required by this issue label Apr 23, 2024
@YYBartT YYBartT self-assigned this Apr 24, 2024
@GameDevTosh
Copy link

Unsure if this is a bug, but, on adding the exe's from the example project to my project and running it, it would NOT run due to the main folder my projects are in having spaces in the name. Saving the project to a folder with no spaces allows it to run.

Image

With that said, it works really well. For anyone interested, here's a comparison picture:

Image

Here is a pic without compression and vram usage:

Image

As you can see here, ram usage doubles, but vram (memory used in gpu z) is reduced by over 400MB in a visual novel type game with lots of HD texture pages:

Image

But this is really the only way that was suggested to me to check vram usage, so I can't really say its completely accurate. A proper way to check the vram usage inside Gamemaker would be great, if it's possible, when this is properly implemented.

YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Apr 29, 2024
YoYoGames/GameMaker-Bugs#5495

* Updated existing screenshot and added new ones
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Apr 29, 2024
YoYoGames/GameMaker-Bugs#5495

* Updated screenshots and added new settings on "Texture Groups" page
* Added a section on "Texture Compression" on the "Textures" page (under GML Code Reference):
  * Explanation of standard compression and GPU texture compression
  * Short description of block compression
  * Comparison image for visual comparison
  * Added a "warning" note for YoYoGames/GameMaker-Bugs#5604
* Added "prefetch to avoid performance hit" to texture_prefetch function page
* Some small changes on related pages
@YYBartT
Copy link

YYBartT commented Apr 29, 2024

Documented the new settings for texture groups and added a general section on texture compression (both standard and GPU texture compression) on the Textures page. Linked the extension and added a short description of block compression.

@YYBartT YYBartT moved this from Done to Ready for QA in Team Workload Apr 29, 2024
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue Apr 30, 2024
YoYoGames/GameMaker-Bugs#5495

* Moved texture compression to its own page, under Texture Groups
* Added "Texture Compression" as a new section on the Texture Groups page
* Added to TOC
YYBartT added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 2, 2024
gurpreetsinghmatharoo added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 6, 2024
* develop: (62 commits)
  docs(feature): GPU texture compression YoYoGames/GameMaker-Bugs#5495
  docs(feature): Review PR #117
  docs(feature): GPU texture compression YoYoGames/GameMaker-Bugs#5495
  docs(general): Fix gamepad axis and button constant links YoYoGames/GameMaker-Bugs#5134
  docs(general): Fix code in example of asset_get_index
  docs(general): debug_event note on memory usage YoYoGames/GameMaker-Bugs#5649
  docs(feature): GPU Hardware Texture Compression YoYoGames/GameMaker-Bugs#5495
  docs(general): Made it clearer that bbox values are +1 from sprite bbox, linked to on bbox_ var pages YoYoGames/GameMaker-Bugs#5101
  docs(general): Manual overview page for "Surfaces" doesn't mention freeing them after use YoYoGames/GameMaker-Bugs#5622
  docs(feature): Manual page for "wallpaper_set_config()" contains spelling error in code example YoYoGames/GameMaker-Bugs#5621
  docs(general): Document that static variables cannot be defined conditionally YoYoGames/GameMaker-Bugs#4449
  docs(general): Description error for ds_queue_tail() YoYoGames/GameMaker-Bugs#5500
  docs(general): Draw Sprite sub-image mistake fix YoYoGames/GameMaker-Bugs#5565
  docs(general): mentioned Ctrl + Comma and Ctrl + Period for workspace overview navigation on macOS YoYoGames/GameMaker-Bugs#5595
  docs(general): updated shortcuts CSS style, workspace navigation dirs set to 4 YoYoGames/GameMaker-Bugs#5595
  final fix
  fixes for pushing to s3
  fixes for pushing to s3
  fixes for pushing to s3
  adding some logging
  ...
@cameron-home cameron-home moved this from Ready for QA to Verified in Team Workload May 7, 2024
gurpreetsinghmatharoo added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 9, 2024
* develop:
  docs(feature): GPU texture compression YoYoGames/GameMaker-Bugs#5495
  docs(feature): Review PR #117
  docs(feature): GPU texture compression YoYoGames/GameMaker-Bugs#5495
  docs(feature): GPU Hardware Texture Compression YoYoGames/GameMaker-Bugs#5495
  docs(general): mentioned Ctrl + Comma and Ctrl + Period for workspace overview navigation on macOS YoYoGames/GameMaker-Bugs#5595
  docs(general): updated shortcuts CSS style, workspace navigation dirs set to 4 YoYoGames/GameMaker-Bugs#5595
  fixes for preset for main builds
  modifying batch file to work for main branch
  modifying batch file to work for main branch
  modifying batch file to work for main branch
  modifying batch file to work for main branch
  Update build_robohelp_gh.bat
gurpreetsinghmatharoo added a commit to YoYoGames/GameMaker-Manual that referenced this issue May 9, 2024
* develop.bart:
  docs(feature): added documentation for physics_raycast YoYoGames/GameMaker-Bugs#2762
  docs(feature): documented gamepad_enumerate YoYoGames/GameMaker-Bugs#5329
  docs(feature): skeleton_animation_clear optional parameters YoYoGames/GameMaker-Bugs#1570
  docs(feature): documented dbg_view_exists and dbg_section_exists YoYoGames/GameMaker-Bugs#4931
  docs(feature): documented dbg_view_exists and dbg_section_exists YoYoGames/GameMaker-Bugs#4931
  docs(feature): YoYoGames/GameMaker-Bugs#1570
  docs(general): mentioned that any attached files are uploaded privately
  docs(feature): smaller custom format screenshot YoYoGames/GameMaker-Bugs#5495
  docs(feature): documented the new dbg_text_separator function YoYoGames/GameMaker-Bugs#4998
  docs(feature): Switch to the docking branch of imgui YoYoGames/GameMaker-Bugs#4905
  docs(general): document OS and audio device limitations when using audio YoYoGames/GameMaker-Bugs#5580
  docs(feature): Add an option to specify "step" in the ImGUI slider control YoYoGames/GameMaker-Bugs#2971

# Conflicts:
#	Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Audio/audio_sound_length.htm
#	Manual/contents/GameMaker_Language/GML_Reference/Debugging/dbg_slider.htm
#	Manual/contents/GameMaker_Language/GML_Reference/Debugging/dbg_slider_int.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation are required by this issue feature request New feature (or a request for one)
Projects
Status: Done
Status: Verified
Development

No branches or pull requests

9 participants