Add and use InvalidOperationExceptionExtensions.ThrowIf

このコミットが含まれているのは:
Sergio Pedri committed 2023-02-25 17:42:11 +01:00
1 親 e4c7b5161c
コミット e27fb13a01
6ファイル変更
+51 -55

検索条件に一致するファイルはありません

+2 -8
ファイルの表示
@@ -38,10 +38,7 @@ internal struct ShaderBytecodeLoader : IBytecodeLoader
/// <inheritdoc/>
public unsafe void LoadDynamicBytecode(IntPtr handle)
{
if (this.cachedShader is not null)
{
ThrowHelper.ThrowInvalidOperationException("The shader has already been initialized.");
}
default(InvalidOperationException).ThrowIf(this.cachedShader is not null);
if (handle == IntPtr.Zero)
{
@@ -55,10 +52,7 @@ internal struct ShaderBytecodeLoader : IBytecodeLoader
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void LoadEmbeddedBytecode(ReadOnlySpan<byte> bytecode)
{
if (this.cachedShader is not null)
{
ThrowHelper.ThrowInvalidOperationException("The shader has already been initialized.");
}
default(InvalidOperationException).ThrowIf(this.cachedShader is not null);
this.cachedShader = new ICachedShader.Embedded(bytecode);
}