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

Discard transparent background pixels in the fragment shader instead of a separate CPU pre-processing step #369

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

rdw-software
Copy link
Member

This reduces the loading times, at the cost of having to perform more checks on the GPU. I highly doubt GPU usage will be an issue however, whereas loading times are very painful in general.

The drawback here is that if a single texture was to be reused many times, it would incur a runtime cost for each instance, whereas pre-processing has a startup cost shared between all instances. But I doubt it's relevant here, and there's no mechanism to reuse resources currently, anyway.


Before this change:

  • Loading yuno takes about 2.1 seconds
  • Loading icecastle takes about 2.2 seconds
  • Loading pay_dun00 takes about 1.1 seconds
  • Loading schg_dun01 takes about 2.4 seconds
  • Loading prontera takes about 0.9 seconds

After this change:

  • Loading yuno takes about 1.5 seconds
  • Loading icecastle takes about 1.9 seconds
  • Loading pay_dun00 takes about 1.1 seconds
  • Loading schg_dun01 takes about 2.2 seconds
  • Loading prontera takes about 0.9 seconds

The GPU frame time might be slightly higher, but I haven't measured since GPU usage is fairly low anyway.

@rdw-software rdw-software changed the title Replace CPU texture pre-processing with shader logic Discard transparent background pixels in the fragment shader instead of a separate CPU pre-processing step Feb 6, 2024
This reduces the loading times, at the cost of having to perform more checks on the GPU. I highly doubt GPU usage will be an issue however, whereas loading times are very painful in general.

The drawback here is that if a single texture was to be reused many times, it would incur a runtime cost for each instance, whereas pre-processing has a startup cost shared between all instances. But I doubt it's relevant here, and there's no mechanism to reuse resources currently, anyway.

Update Renderer.spec.lua
@rdw-software rdw-software force-pushed the gpu-transparency-color branch from 5ad965e to 3020229 Compare February 6, 2024 15:35
@rdw-software rdw-software merged commit 9aa1583 into main Feb 6, 2024
6 checks passed
@rdw-software rdw-software deleted the gpu-transparency-color branch February 6, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant