[GPU] Align linear color target pitch like linear textures (#1063)
This commit is contained in:
parent
47d4c07a8d
commit
289f090b50
|
|
@ -230,7 +230,9 @@ public static partial class ImageRequestBuilders
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pitch = width;
|
// A linear color buffer uses the same 256-byte row alignment as a linear texture of the same memory;
|
||||||
|
// an unaligned pitch made the target and a later texture view of it two different cached images.
|
||||||
|
pitch = TileGeometry.TexturePitch(transferFormat, width, GuestTileMode.Linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
var mipSpans = new TileLevelSpan[TiledSurfaceLayout.MaxLevels];
|
var mipSpans = new TileLevelSpan[TiledSurfaceLayout.MaxLevels];
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,21 @@ public sealed class ImageRequestBuildersTests : IClassFixture<HeadlessVulkanFixt
|
||||||
Assert.Equal(0u, ImageRequestBuilders.SampleCount(4));
|
Assert.Equal(0u, ImageRequestBuilders.SampleCount(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ColorTarget_LinearTargetPitchMatchesTheLinearTexturePitch()
|
||||||
|
{
|
||||||
|
var target = ImageRequestBuilders.ColorTarget(RegisterWords.Color(Base, 816, 604), 0xF, 0, false);
|
||||||
|
var texture = ImageRequestBuilders.Texture(RegisterWords.Texture(Base, GuestPixelFormat.Bits8_8_8_8UNorm, 816, 604), Sampled2D);
|
||||||
|
|
||||||
|
Assert.NotNull(target);
|
||||||
|
var description = target.Value.Request.Description;
|
||||||
|
Assert.Equal(new Extent3D(816, 604, 1), description.Extent);
|
||||||
|
Assert.Equal(832u, description.Pitch);
|
||||||
|
Assert.Equal(832UL * 604 * 4, description.Data.Size);
|
||||||
|
Assert.Equal(texture.Request.Description.Pitch, description.Pitch);
|
||||||
|
Assert.Equal(texture.Request.Description.Data.Size, description.Data.Size);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Texture_LinearTwoDimensionalFromDescriptor()
|
public void Texture_LinearTwoDimensionalFromDescriptor()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue