-
Notifications
You must be signed in to change notification settings - Fork 366
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
Premultiply the alpha on the GPU #2190
Conversation
Premultiplying on the GPU saves us A LOT of cpu. But texture filtering must happen AFTER premultiplying, which means we need to do texture filtering in software on the shader.
@@ -51,6 +50,9 @@ struct UniformBuffer { | |||
|
|||
minification_filter: u32, | |||
magnification_filter: u32, | |||
|
|||
/// Boolean: decode 0-1 sRGB gamma to linear space before filtering? | |||
decode_srgb: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wgsl has a (32bit large) bool
type, why not use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried to find spec on when a bool is regarded as true, now not sure if it can be in a uniform buffer. Did you try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOPE
[2023-05-24T15:47:35Z ERROR re_renderer::error_tracker] WGPU error tick_nr=1 description=Validation Error
Caused by:
In Device::create_shader_module
Shader validation error:
┌─ :86:1
│
86 │ var<uniform> rect_info: UniformBuffer;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ naga::GlobalVariable [1]
Global variable [1] 'rect_info' is invalid
Alignment requirements for address space Uniform are not met by [16]
The type is not host-shareable
* Premultiply the alpha on the GPU Premultiplying on the GPU saves us A LOT of cpu. But texture filtering must happen AFTER premultiplying, which means we need to do texture filtering in software on the shader. * Add a TODO * Cleanup * Docfix
What
Premultiplying on the GPU saves us A LOT of CPU time when loading e.g. a png. But texture filtering must happen AFTER premultiplying, which means we need to do texture filtering in software on the shader.
Checklist
PR Build Summary: https://build.rerun.io/pr/2190