mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-30 21:31:57 +08:00
shader: add compact f16 arithmetic and compare lowering (#840)
Co-authored-by: Foued Attar <attar.foued@gmail.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2026 SharpEmu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace SharpEmu.ShaderCompiler.Metal.Tests;
|
||||
|
||||
public sealed class MslFloat16ArithmeticTests
|
||||
{
|
||||
[Fact]
|
||||
public void CompactFloat16ArithmeticUsesHalfOperandsAndPreservesRegisterShape()
|
||||
{
|
||||
var fixture = new Gen5ComputeFixture(
|
||||
"compact-f16-arithmetic",
|
||||
[
|
||||
0x64000501,
|
||||
0x66060B04,
|
||||
0x680C1107,
|
||||
0x6A12170A,
|
||||
0x72181D0D,
|
||||
0x741E2310,
|
||||
0xBF810000,
|
||||
],
|
||||
StoreScalarResourceBase: 0,
|
||||
StoreBackingBytes: 0);
|
||||
|
||||
var shader = Gen5ComputeFixtures.CompileOrThrow(fixture);
|
||||
|
||||
Assert.Contains("as_type<half>", shader.Source, StringComparison.Ordinal);
|
||||
Assert.Contains("fmin(", shader.Source, StringComparison.Ordinal);
|
||||
Assert.Contains("fmax(", shader.Source, StringComparison.Ordinal);
|
||||
Assert.Contains("& 0xFFFF0000u", shader.Source, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user