Skip to content

Commit 0433695

Browse files
committed
Minor cleanup
1 parent f0e5365 commit 0433695

File tree

5 files changed

+28
-30
lines changed

5 files changed

+28
-30
lines changed

sources/engine/Stride.Engine/Rendering/Compositing/ForwardRenderer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public partial class ForwardRenderer : SceneRendererBase, ISharedRenderer
115115
/// </summary>
116116
/// <remarks>
117117
/// This is needed by some effects such as particles soft edges.
118-
///
118+
///
119119
/// On recent platforms that can bind depth buffer as read-only (<see cref="GraphicsDeviceFeatures.HasDepthAsReadOnlyRT"/>), depth buffer will be used as is. Otherwise, a copy will be generated.
120120
/// </remarks>
121121
[DefaultValue(true)]
@@ -789,10 +789,10 @@ private Texture ResolveDepthAsSRV(RenderDrawContext context)
789789

790790
foreach (var renderFeature in context.RenderContext.RenderSystem.RenderFeatures)
791791
{
792-
if (!(renderFeature is RootEffectRenderFeature))
792+
if (renderFeature is not RootEffectRenderFeature rootEffectRenderFeature)
793793
continue;
794794

795-
var depthLogicalKey = ((RootEffectRenderFeature)renderFeature).CreateViewLogicalGroup("Depth");
795+
var depthLogicalKey = rootEffectRenderFeature.CreateViewLogicalGroup("Depth");
796796
var viewFeature = renderView.Features[renderFeature.Index];
797797

798798
// Copy ViewProjection to PerFrame cbuffer
@@ -809,7 +809,8 @@ private Texture ResolveDepthAsSRV(RenderDrawContext context)
809809
}
810810
}
811811

812-
context.CommandList.SetRenderTargets(null, context.CommandList.RenderTargetCount, context.CommandList.RenderTargets);
812+
context.CommandList.SetRenderTargets(depthStencilView: null,
813+
context.CommandList.RenderTargetCount, context.CommandList.RenderTargets);
813814

814815
var depthStencilROCached = context.Resolver.GetDepthStencilAsRenderTarget(depthStencil, this.depthStencilROCached);
815816
if (depthStencilROCached != this.depthStencilROCached)

sources/engine/Stride.Graphics/Direct3D/GraphicsDeviceFeatures.Direct3D.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bool CheckComputeShadersSupport()
107107
if (result.IsFailure)
108108
return false;
109109

110-
return hwOptions.ComputeShadersPlusRawAndStructuredBuffersViaShader4X != 0;
110+
return hwOptions.ComputeShadersPlusRawAndStructuredBuffersViaShader4X;
111111
}
112112

113113
/// <summary>
@@ -123,7 +123,7 @@ bool CheckDoubleOpsInShadersSupport()
123123
if (result.IsFailure)
124124
return false;
125125

126-
return doubles.DoublePrecisionFloatShaderOps != 0;
126+
return doubles.DoublePrecisionFloatShaderOps;
127127
}
128128

129129
/// <summary>
@@ -142,8 +142,8 @@ void CheckThreadingSupport(out bool supportsConcurrentResources, out bool suppor
142142
}
143143
else
144144
{
145-
supportsConcurrentResources = featureDataThreading.DriverConcurrentCreates != 0;
146-
supportsCommandLists = featureDataThreading.DriverCommandLists != 0;
145+
supportsConcurrentResources = featureDataThreading.DriverConcurrentCreates;
146+
supportsCommandLists = featureDataThreading.DriverCommandLists;
147147
}
148148
}
149149

sources/engine/Stride.Graphics/Direct3D12/GraphicsDevice.Direct3D12.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,20 +312,20 @@ private void InitializePlatformDevice(GraphicsProfile[] graphicsProfiles, Device
312312

313313
if (result.IsSuccess && infoQueue is not null)
314314
{
315-
var disabledMessages = stackalloc Silk.NET.Direct3D12.MessageID[]
315+
var disabledMessages = stackalloc MessageID[]
316316
{
317317
// This happens when render target or depth stencil clear value is different
318318
// than the provided ones during resource allocation.
319-
Silk.NET.Direct3D12.MessageID.CleardepthstencilviewMismatchingclearvalue,
320-
Silk.NET.Direct3D12.MessageID.ClearrendertargetviewMismatchingclearvalue,
319+
MessageID.CleardepthstencilviewMismatchingclearvalue,
320+
MessageID.ClearrendertargetviewMismatchingclearvalue,
321321

322322
// This occurs when there are uninitialized descriptors in a descriptor table,
323323
// even when a shader does not access the missing descriptors.
324-
Silk.NET.Direct3D12.MessageID.InvalidDescriptorHandle,
324+
MessageID.InvalidDescriptorHandle,
325325

326326
// These happen when capturing with VS diagnostics
327-
Silk.NET.Direct3D12.MessageID.MapInvalidNullrange,
328-
Silk.NET.Direct3D12.MessageID.UnmapInvalidNullrange
327+
MessageID.MapInvalidNullrange,
328+
MessageID.UnmapInvalidNullrange
329329
};
330330

331331
// Disable irrelevant debug layer warnings

sources/engine/Stride.Graphics/GraphicsDeviceFeatures.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
// THE SOFTWARE.
2323

24-
using System;
25-
using System.Collections.Generic;
26-
2724
namespace Stride.Graphics
2825
{
2926
/// <summary>
@@ -113,12 +110,11 @@ public FeaturesPerFormat this[PixelFormat dxgiFormat]
113110
/// </summary>
114111
public struct FeaturesPerFormat
115112
{
116-
//internal FeaturesPerFormat(PixelFormat format, MultisampleCount maximumMultisampleCount, ComputeShaderFormatSupport computeShaderFormatSupport, FormatSupport formatSupport)
117-
internal FeaturesPerFormat(PixelFormat format, MultisampleCount maximumMultisampleCount, FormatSupport formatSupport)
113+
internal FeaturesPerFormat(PixelFormat format, MultisampleCount maximumMultisampleCount, ComputeShaderFormatSupport computeShaderFormatSupport, FormatSupport formatSupport)
118114
{
119115
Format = format;
120-
this.MultisampleCountMax = maximumMultisampleCount;
121-
//ComputeShaderFormatSupport = computeShaderFormatSupport;
116+
MultisampleCountMax = maximumMultisampleCount;
117+
ComputeShaderFormatSupport = computeShaderFormatSupport;
122118
FormatSupport = formatSupport;
123119
}
124120

@@ -135,23 +131,24 @@ internal FeaturesPerFormat(PixelFormat format, MultisampleCount maximumMultisamp
135131
/// <summary>
136132
/// Gets the unordered resource support options for a compute shader resource.
137133
/// </summary>
138-
//public readonly ComputeShaderFormatSupport ComputeShaderFormatSupport;
134+
public readonly ComputeShaderFormatSupport ComputeShaderFormatSupport;
139135

140136
/// <summary>
141137
/// Support of a given format on the installed video device.
142138
/// </summary>
143139
public readonly FormatSupport FormatSupport;
144140

145-
public override string ToString()
141+
142+
/// <inheritdoc/>
143+
public override readonly string ToString()
146144
{
147-
//return string.Format("Format: {0}, MultisampleCountMax: {1}, ComputeShaderFormatSupport: {2}, FormatSupport: {3}", Format, this.MSAALevelMax, ComputeShaderFormatSupport, FormatSupport);
148-
return string.Format("Format: {0}, MultisampleCountMax: {1}, FormatSupport: {2}", Format, this.MultisampleCountMax, FormatSupport);
145+
return $"Format: {Format}, MultisampleCountMax: {MultisampleCountMax}, ComputeShaderFormatSupport: {ComputeShaderFormatSupport}, FormatSupport: {FormatSupport}";
149146
}
150147
}
151148

152149
public override string ToString()
153150
{
154-
return string.Format("Level: {0}, HasComputeShaders: {1}, HasDoublePrecision: {2}, HasMultiThreadingConcurrentResources: {3}, HasDriverCommandLists: {4}", RequestedProfile, HasComputeShaders, HasDoublePrecision, HasMultiThreadingConcurrentResources, this.HasDriverCommandLists);
151+
return $"Level: {RequestedProfile}, HasComputeShaders: {HasComputeShaders}, HasDoublePrecision: {HasDoublePrecision}, HasMultiThreadingConcurrentResources: {HasMultiThreadingConcurrentResources}, HasDriverCommandLists: {HasDriverCommandLists}";
155152
}
156153
}
157154
}

sources/engine/Stride.Graphics/GraphicsResourceUsage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ public enum GraphicsResourceUsage
1313
/// <summary>
1414
/// A resource that requires read and write access by the GPU. This is likely to be the most common usage choice.
1515
/// </summary>
16-
Default = unchecked((int)0),
16+
Default = 0,
1717

1818
/// <summary>
1919
/// A resource that can only be read by the GPU. It cannot be written by the GPU, and cannot be accessed at all by the CPU. This type of resource must be initialized when it is created, since it cannot be changed after creation.
2020
/// </summary>
21-
Immutable = unchecked((int)1),
21+
Immutable = 1,
2222

2323
/// <summary>
2424
/// A resource that is accessible by both the GPU (read only) and the CPU (write only). A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame. To update a dynamic resource, use a <strong>Map</strong> method.
2525
/// </summary>
26-
Dynamic = unchecked((int)2),
26+
Dynamic = 2,
2727

2828
/// <summary>
2929
/// A resource that supports data transfer (copy) from the GPU to the CPU.
3030
/// </summary>
31-
Staging = unchecked((int)3),
31+
Staging = 3
3232
}
3333
}

0 commit comments

Comments
 (0)