Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/render-pass-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ new RenderPassBuilder(commandBuffer)
**ColorTargetSettings options:**
- `Clear` - Clear the target before rendering
- `Load` - Keep existing contents
- Others may exist for different load/store operations
- Other combinations: `new ColorTargetSettings { LoadOperation = ..., StoreOperation = ..., ClearColorValue = ... }`

Add multiple color targets for deferred rendering (G-buffer). A pass takes at most 8 color targets, SDL's limit.

Expand Down
4 changes: 1 addition & 3 deletions src/Pixely.Ui/UiRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ internal sealed class UiRenderer<TRenderContext> : IRenderer<TRenderContext>, ID
ClearColorValue = LinearColors.Transparent
};

private static readonly ColorTargetSettings _loadColorTargetSettings = new() { LoadOperation = LoadOperation.Load };

private static readonly Matrix4x4 _presentViewProjection =
Matrix4x4.CreateOrthographicOffCenterLeftHanded(0, 1, 1, 0, 0, 1);

Expand Down Expand Up @@ -287,7 +285,7 @@ private static void ClearTarget(CommandBuffer commandBuffer, Texture target)

private void Present(CommandBuffer commandBuffer, Texture target, Texture retainedTexture, Matrix4x4 world)
{
ColorTargetSettings settings = _clearTarget ? ColorTargetSettings.Clear : _loadColorTargetSettings;
ColorTargetSettings settings = _clearTarget ? ColorTargetSettings.Clear : ColorTargetSettings.Load;

using RenderPass presentPass = new RenderPassBuilder(commandBuffer)
.AddColorTarget(target, settings)
Expand Down
1 change: 1 addition & 0 deletions src/Pixely/Gpu/ColorTargetSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class ColorTargetSettings
public LoadOperation LoadOperation { get; init; } = LoadOperation.Clear;
public StoreOperation StoreOperation { get; init; } = StoreOperation.Store;
public static readonly ColorTargetSettings Clear = new();
public static readonly ColorTargetSettings Load = new() { LoadOperation = LoadOperation.Load };
}