# MSAA troubles with SDL3\_GPU

**URL:** <https://discourse.libsdl.org/t/msaa-troubles-with-sdl3-gpu/61882>\
**Category:** SDL Development\
**Created:** [August 10, 2025, 11:47pm UTC](https://discourse.libsdl.org/t/msaa-troubles-with-sdl3-gpu/61882 "2025-08-10T23:47:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VoxelTek](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/voxeltek/32/5909_2.png) [@VoxelTek](https://discourse.libsdl.org/u/VoxelTek)\
**Post date:** [August 10, 2025, 11:47pm UTC](https://discourse.libsdl.org/t/msaa-troubles-with-sdl3-gpu/61882/1 "2025-08-10T23:47:27Z")

</div>

Hey! I’m one of the people working on [`isle-portable`](https://github.com/isledecomp/isle-portable/), which utilises the new SDL\_GPU feature introduced with SDL3. We have it set up as one of the possible 3D renderers to use, alongside OpenGL (and ES), and a software renderer. The OpenGL renderers currently have support for MSAA, however, the SDL\_GPU renderer currently does not. I have been attempting to implement it, however I have largely been unsuccessful. There appears to be little documentation on the topic, unfortunately, and what I have found has not been successful.

As part of the render process, we create a `SDL_GPUGraphicsPipelineCreateInfo`, which has `multisample_state`. I created a `SDL_GPUMultisampleState` and set the `sample_count` there, and then set `multisample_state` to this `SDL_GPUMultisampleState`. While this “worked”, any `sample_count` values other than `SDL_GPU_SAMPLECOUNT_1` result in broken visuals.

 ![Screenshot_20250811_084118](https://discourse.libsdl.org/uploads/default/original/2X/2/272c606d57e547de3061d36b8798ae8f0bda41ae.png)

I admit, I don’t completely understand the rendering code, however we do create several `SDL_GPUTextureCreateInfo` objects, each of which contains a `sample_count`. However, changing `textureInfo.sample_count` in `Direct3DRMSDL3GPURenderer::Resize` to a value other than `SDL_GPU_SAMPLECOUNT_1` results in flickering visuals when the window is resized, and does not actually result in antialiasing.

Any help on this matter would be greatly appreciated!

Kind regards,  
@VoxelTek

---

<div class="post-metadata">

**Author:** ![sjr](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sjr/32/5749_2.png) [@sjr](https://discourse.libsdl.org/u/sjr)\
**Post date:** [August 11, 2025, 5:17pm UTC](https://discourse.libsdl.org/t/msaa-troubles-with-sdl3-gpu/61882/2 "2025-08-11T17:17:45Z")

</div>

For textures, the sample count only needs to be higher than 1 if it’s being used as a render target and you’re using MSAA. I assume it needs to match the sample count in your graphics pipeline.

You need an MSAA resolve texture with a sample count of 1, and you have to specify it in your [`SDL_GPUColorTargetInfo`](https://wiki.libsdl.org/SDL3/SDL_GPUColorTargetInfo) as the `resolve_texture` when creating your render pass (make sure you also set the store op to `SDL_GPU_STOREOP_RESOLVE`).

Don’t set the swapchain texture as your color target texture. Use a render target texture with the same sample count as your graphics pipeline, and specify _that_ as your color target for your render pass.

When your render pass is complete, you need to blit the resolve texture to your swapchain texture.

Look at `TriangleMSAA.c` in the [SDL GPU examples](https://github.com/TheSpydog/SDL_gpu_examples)

---

<div class="post-metadata">

**Author:** ![archee303](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/archee303/32/4291_2.png) [@archee303](https://discourse.libsdl.org/u/archee303)\
**Post date:** [February 28, 2026, 3:45pm UTC](https://discourse.libsdl.org/t/msaa-troubles-with-sdl3-gpu/61882/3 "2026-02-28T15:45:23Z")

</div>

Are you sure you need to create two textures for AA?  
In my testing (Vulkan backend) it works just fine by creating one MSAA texture, and specifying the swapchain as the resolve target, improvin performance on cheap phones.  
If the intermediate resolve target is required on some backends, there should be a property to query this.
