Skip to content
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

[URP][Backport] make the Vulkan RenderTexture MSAA support fallback work in the same way as the swapchain backend implementation #6509

Merged
merged 3 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [7.8.0] - 2021-07-23

### Added
- Added a supported MSAA samples count check, so the actual supported MSAA samples count value can be assigned to RenderTexture descriptors.

manuele-bonanno marked this conversation as resolved.
Show resolved Hide resolved
### Fixed
- Fixed an issue where 2D Renderer was generating garbage in editor.
- Fixed an issue where soft particles were rendered opaque on OpenGL. [case 1226288](https://issuetracker.unity3d.com/issues/urp-objects-that-are-using-soft-particles-are-rendered-opaque-when-opengl-is-used)
- Fixed multi-edit for UniversalRenderPipelineAsset.
- Fixed artifacts in Speed Tree 8 billboard LODs due to SpeedTree LOD smoothing/crossfading [case 1348407]
- Drawing order of SRPDefaultUnlit is now the same as the Built-in Render Pipeline. [case 1325883](https://issuetracker.unity3d.com/product/unity/issues/guid/1325883/)
- Fixed an issue with MSAA falling back to the incorrect value when sample count 2 is not supported on some Android GPUs.

## [7.7.0] - 2021-04-28

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,24 @@ void SortCameras(Camera[] cameras)
desc.enableRandomWrite = false;
desc.bindMS = false;
desc.useDynamicScale = camera.allowDynamicResolution;

// The way RenderTextures handle MSAA fallback when an unsupported sample count of 2 is requested (falling back to numSamples = 1), differs fom the way
// the fallback is handled when setting up the Vulkan swapchain (rounding up numSamples to 4, if supported). This caused an issue on Mali GPUs which don't support
// 2x MSAA.
// The following code makes sure that on Vulkan the MSAA unsupported fallback behaviour is consistent between RenderTextures and Swapchain.
// TODO: we should review how all backends handle MSAA fallbacks and move these implementation details in engine code.
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan)
{
// if the requested number of samples is 2, and the supported value is 1x, it means that 2x is unsupported on this GPU.
// Then we bump up the requested value to 4.
if (desc.msaaSamples == 2 && SystemInfo.GetRenderTextureSupportedMSAASampleCount(desc) == 1)
desc.msaaSamples = 4;
}

// check that the requested MSAA samples count is supported by the current platform. If it's not supported,
// replace the requested desc.msaaSamples value with the actual value the engine falls back to
desc.msaaSamples = SystemInfo.GetRenderTextureSupportedMSAASampleCount(desc);

// if the target platform doesn't support storing multisampled RTs and we are doing a separate opaque pass, using a Load load action on the subsequent passes
// will result in loading Resolved data, which on some platforms is discarded, resulting in losing the results of the previous passes.
// As a workaround we disable MSAA to make sure that the results of previous passes are stored. (fix for Case 1247423).
Expand Down