Skip to content

Support MSAA: multisampled textures and resolve targets - #627

Merged
stanoddly merged 1 commit into
mainfrom
msaa-support
Oct 9, 2026
Merged

stanoddly merged 1 commit into
mainfrom
msaa-support

Conversation

@botoddly

@botoddly botoddly commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #626.

Changes

  • GpuDevice.CreateTexture, CreateColorTargetTexture and CreateDepthBufferTexture take an optional SampleCount. GpuDevice.IsSampleCountSupported checks a count for a format. A multisampled texture can only be a color or depth-stencil target, so CreateColorTargetTexture drops the sampler usage for it, and CreateDepthBufferTexture throws with sampler: true.
  • Texture has SampleCount and Usage. Memory stats count every sample. SubmitAndDownloadTexture refuses a multisampled texture.
  • RenderPassBuilder.AddColorTarget(texture, resolveTexture[, settings]) names the texture a color target resolves into. CommandBuffer.CreateRenderPass takes an optional span of resolve textures.
  • Building a pass throws when the attachments' sample counts differ, when a store operation and its resolve texture disagree, when a resolve texture breaks SDL's rules (one sample, the target's format and size, ColorTarget usage), and when a depth-stencil buffer's store operation resolves.
  • GraphicsPipelineBuilder.Build() throws for a sample count the device does not support with a target format. RenderPass.BindGraphicsPipeline throws when the pipeline's sample count differs from the pass's.
  • SampleCount moved to its own file.
  • New docs/multisampling.md, linked from AGENTS.md, render-pass-flow.md and pipeline-configuration.md. It covers what each backend supports and the matching depth-stencil buffer.
  • New Pixely.Tutorials.Multisampling draws a triangle with 4 samples and resolves it into the swapchain texture.

Known limits

Testing

  • Pixely.Tests (469) and Pixely.Ui.Tests (490) pass.
  • Headless with GPU validation on Vulkan (radv): the Multisampling tutorial's edges show the 1/4, 2/4 and 3/4 coverage shades, with no validation errors. Triangle, StencilBuffer, DepthOnly, ImageLoading and TextureArray still run cleanly.
  • Not run on Direct3D 12, Metal or WebGPU.

@stanoddly
stanoddly enabled auto-merge (squash) October 9, 2026 12:13
@stanoddly
stanoddly merged commit 9fc9c40 into main Oct 9, 2026
3 checks passed
@stanoddly
stanoddly deleted the msaa-support branch October 9, 2026 12:14
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

📦 Development package Pixely 0.0.116 is available.

Workflow run (attempt 1)

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Development package validation passed on all platforms.

Workflow run (attempt 1)

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.

Support MSAA: create multisampled textures and resolve them in a render pass

2 participants