Search Issue Tracker

Fixed in 2021.2.X

Votes

3

Found in

2020.2.0b11

2020.2.1f1

2021.1

2021.2

Issue ID

1308132

Regression

Yes

Using CopyTexture on textures with different MSAA sample counts throws an error

Texture

-

How to reproduce:
1. Open the attached "1308132.zip" project
2. Enter the Play Mode
3. Check the Game View

Expected results: the Game View window is green
Actual results: the Game View window is red and there is an error in the Console

Reproducible with: 2020.2.0b11, 2020.2.3f1, 2021.1.0b4, 2021.2.0a3
Not reproducible with: 2019.4.19f1, 2020.1.17f1, 2020.2.0b10
Could not test with: 2018.4.31f1 (project not downgradable)

Note:
-The error thrown is CopyTexture called with mismatching sample count per pixel (src 2 dst 1). UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

  1. Resolution Note (fix version 2021.2):

    Fixed in 2021.2.0a11

Comments (2)

  1. Shii

    Apr 23, 2021 09:10

    Backport to 2020.3 please?

  2. Petur-Aldin

    Feb 02, 2021 15:53

    I've managed to work around this problem by making a native plugin that directly calls the glCopyImageSubData function that Unity should be calling on Android, circumventing Graphics.CopyTexture. That also allowed me to copy more than one layer in a texture array in one call by using srcDepth, which Graphics.CopyTexture doesn't expose for some reason.

    I think what Graphics.CopyTexture isn't considering when it's throwing that error is the fact that MSAA gets resolved immediately on mobile tiled renderers, so even though the RenderTextures in Unity are labelled as multi sampled, it isn't stored that way in memory and they can be copied without issue.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.