Only make render target 2D textures layered if needed (#2646)

* Only make render target 2D textures layered if needed

* Shader cache version bump

* Ensure topology is updated on channel swap
This commit is contained in:
gdkchan 2021-09-28 20:55:12 -03:00 committed by GitHub
parent 312be74861
commit fd7567a6b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 16 deletions

View file

@ -244,11 +244,18 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
/// <param name="memoryManager">GPU memory manager where the texture is mapped</param>
/// <param name="colorState">Color buffer texture to find or create</param>
/// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
/// <returns>The texture</returns>
public Texture FindOrCreateTexture(MemoryManager memoryManager, RtColorState colorState, int samplesInX, int samplesInY, Size sizeHint)
public Texture FindOrCreateTexture(
MemoryManager memoryManager,
RtColorState colorState,
bool layered,
int samplesInX,
int samplesInY,
Size sizeHint)
{
bool isLinear = colorState.MemoryLayout.UnpackIsLinear();
@ -263,13 +270,13 @@ namespace Ryujinx.Graphics.Gpu.Image
}
else if ((samplesInX | samplesInY) != 1)
{
target = colorState.Depth > 1
target = colorState.Depth > 1 && layered
? Target.Texture2DMultisampleArray
: Target.Texture2DMultisample;
}
else
{
target = colorState.Depth > 1
target = colorState.Depth > 1 && layered
? Target.Texture2DArray
: Target.Texture2D;
}