| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…te with blend state management
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting. Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughGBuffer fragment shader now samples into textureColor, discards fragments with textureColor.a < 0.05, and computes albedo from textureColor.rgb * material.diffuse.rgb. Graphics code now uses per-format/per-target blend states via ColorTargetState additions and removes a previous RMLUI special-case. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem🚥 Pre-merge checks | ✅ 2 | ❌ 1 ❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches 🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)src/plugin/graphic/src/resource/Shader.hpp (1)68-85: ⚠️ Potential issue | 🟠 Major
RMLUI premultiplied alpha blend is lost due to descriptor not setting blend state.
The local blendState configured for RMLUI_RENDER_PASS_SHADER (lines 68–78) is unused because line 84 always applies &format.getBlendState() from the descriptor. Since RmluiRenderPass::CreateShader() never calls .setBlendState() on the descriptor's ColorTargetState, it defaults to wgpu::Default instead of the required premultiplied alpha settings (srcFactor=One, dstFactor=OneMinusSrcAlpha).
Fix by setting the blend state in the descriptor:
Suggested fix (set blend state in RMLUI descriptor)auto colorOutput = Graphic::Utils::ColorTargetState("END_RENDER_TEXTURE").setFormat(wgpu::TextureFormat::BGRA8UnormSrgb); + wgpu::BlendState premultipliedAlpha(wgpu::Default); + premultipliedAlpha.color.srcFactor = wgpu::BlendFactor::One; + premultipliedAlpha.color.dstFactor = wgpu::BlendFactor::OneMinusSrcAlpha; + premultipliedAlpha.color.operation = wgpu::BlendOperation::Add; + premultipliedAlpha.alpha.srcFactor = wgpu::BlendFactor::One; + premultipliedAlpha.alpha.dstFactor = wgpu::BlendFactor::OneMinusSrcAlpha; + premultipliedAlpha.alpha.operation = wgpu::BlendOperation::Add; + colorOutput.setBlendState(premultipliedAlpha);Then remove the now-unused local blendState override from Shader.hpp.
In `@src/plugin/default-pipeline/src/resource/pass/GBuffer.hpp`: - Around line 98-103: The shader currently discards low-alpha fragments but then forces output.alpha to 1.0, breaking premultiplied blending; update the write to output.albedo to preserve the sampled alpha and premultiply RGB by that alpha (use textureColor and material.diffuse): e.g. compute premultipliedRGB = textureColor.rgb * material.diffuse.rgb * textureColor.a and set output.albedo = vec4(premultipliedRGB, textureColor.a) (or multiply textureColor.a by material.diffuse.a if your material encodes alpha), ensuring you keep the existing discard and textureSample usage.
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agentsIn `@src/plugin/graphic/src/resource/Shader.hpp`: - Line 68: The local variable declaration `wgpu::BlendState blendState(wgpu::Default);` in Shader.hpp is dead code after the refactor that now uses `format.getBlendState()`; remove this unused `blendState` declaration so there are no unused locals in the function (ensure no other references to `blendState` remain and rely on `format.getBlendState()` where needed).
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This pull request introduces improvements to the G-buffer rendering pipeline, focusing on alpha transparency handling and blending. The main changes ensure that fragments with low alpha are discarded and that the albedo output supports alpha blending. Additionally, the blend state management is refactored for better configurability and clarity.
Alpha transparency and blending improvements:
Blend state management refactoring:
Summary by CodeRabbit