mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-09-14 05:55:43 +00:00
misc: chore: Use explicit types in GPU, Device, and Host1x projects
This commit is contained in:
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Gpu.Engine.Threed.Blender;
|
||||
using Ryujinx.Graphics.Gpu.Engine.Types;
|
||||
using Ryujinx.Graphics.Gpu.Image;
|
||||
using Ryujinx.Graphics.Gpu.Memory;
|
||||
using Ryujinx.Graphics.Gpu.Shader;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using Ryujinx.Graphics.Texture;
|
||||
@@ -463,8 +464,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <param name="singleUse">If this is not -1, it indicates that only the given indexed target will be used.</param>
|
||||
public void UpdateRenderTargetState(RenderTargetUpdateFlags updateFlags, int singleUse = -1)
|
||||
{
|
||||
var memoryManager = _channel.MemoryManager;
|
||||
var rtControl = _state.State.RtControl;
|
||||
MemoryManager memoryManager = _channel.MemoryManager;
|
||||
RtControl rtControl = _state.State.RtControl;
|
||||
|
||||
bool useControl = updateFlags.HasFlag(RenderTargetUpdateFlags.UseControl);
|
||||
bool layered = updateFlags.HasFlag(RenderTargetUpdateFlags.Layered);
|
||||
@@ -473,12 +474,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
|
||||
|
||||
var msaaMode = _state.State.RtMsaaMode;
|
||||
TextureMsaaMode msaaMode = _state.State.RtMsaaMode;
|
||||
|
||||
int samplesInX = msaaMode.SamplesInX();
|
||||
int samplesInY = msaaMode.SamplesInY();
|
||||
|
||||
var scissor = _state.State.ScreenScissorState;
|
||||
ScreenScissorState scissor = _state.State.ScreenScissorState;
|
||||
Size sizeHint = new((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
|
||||
|
||||
int clipRegionWidth = int.MaxValue;
|
||||
@@ -491,7 +492,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
int rtIndex = useControl ? rtControl.UnpackPermutationIndex(index) : index;
|
||||
|
||||
var colorState = _state.State.RtColorState[rtIndex];
|
||||
RtColorState colorState = _state.State.RtColorState[rtIndex];
|
||||
|
||||
if (index >= count || !IsRtEnabled(colorState) || (singleColor && index != singleUse))
|
||||
{
|
||||
@@ -541,8 +542,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
if (dsEnable && updateFlags.HasFlag(RenderTargetUpdateFlags.UpdateDepthStencil))
|
||||
{
|
||||
var dsState = _state.State.RtDepthStencilState;
|
||||
var dsSize = _state.State.RtDepthStencilSize;
|
||||
RtDepthStencilState dsState = _state.State.RtDepthStencilState;
|
||||
Size3D dsSize = _state.State.RtDepthStencilSize;
|
||||
|
||||
depthStencil = memoryManager.Physical.TextureCache.FindOrCreateTexture(
|
||||
memoryManager,
|
||||
@@ -643,7 +644,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
if (_state.State.YControl.HasFlag(YControl.NegateY))
|
||||
{
|
||||
ref var screenScissor = ref _state.State.ScreenScissorState;
|
||||
ref ScreenScissorState screenScissor = ref _state.State.ScreenScissorState;
|
||||
y = screenScissor.Height - height - y;
|
||||
|
||||
if (y < 0)
|
||||
@@ -721,8 +722,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateViewportTransform()
|
||||
{
|
||||
var yControl = _state.State.YControl;
|
||||
var face = _state.State.FaceState;
|
||||
YControl yControl = _state.State.YControl;
|
||||
FaceState face = _state.State.FaceState;
|
||||
|
||||
bool disableTransform = _state.State.ViewportTransformEnable == 0;
|
||||
bool yNegate = yControl.HasFlag(YControl.NegateY);
|
||||
@@ -736,17 +737,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
if (disableTransform)
|
||||
{
|
||||
ref var scissor = ref _state.State.ScreenScissorState;
|
||||
ref ScreenScissorState scissor = ref _state.State.ScreenScissorState;
|
||||
|
||||
float rScale = _channel.TextureManager.RenderTargetScale;
|
||||
var scissorRect = new Rectangle<float>(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
|
||||
Rectangle<float> scissorRect = new Rectangle<float>(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
|
||||
|
||||
viewports[index] = new Viewport(scissorRect, ViewportSwizzle.PositiveX, ViewportSwizzle.PositiveY, ViewportSwizzle.PositiveZ, ViewportSwizzle.PositiveW, 0, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
ref var transform = ref _state.State.ViewportTransform[index];
|
||||
ref var extents = ref _state.State.ViewportExtents[index];
|
||||
ref ViewportTransform transform = ref _state.State.ViewportTransform[index];
|
||||
ref ViewportExtents extents = ref _state.State.ViewportExtents[index];
|
||||
|
||||
float scaleX = MathF.Abs(transform.ScaleX);
|
||||
float scaleY = transform.ScaleY;
|
||||
@@ -841,7 +842,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateDepthBiasState()
|
||||
{
|
||||
var depthBias = _state.State.DepthBiasState;
|
||||
DepthBiasState depthBias = _state.State.DepthBiasState;
|
||||
|
||||
float factor = _state.State.DepthBiasFactor;
|
||||
float units = _state.State.DepthBiasUnits;
|
||||
@@ -862,9 +863,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateStencilTestState()
|
||||
{
|
||||
var backMasks = _state.State.StencilBackMasks;
|
||||
var test = _state.State.StencilTestState;
|
||||
var backTest = _state.State.StencilBackTestState;
|
||||
StencilBackMasks backMasks = _state.State.StencilBackMasks;
|
||||
StencilTestState test = _state.State.StencilTestState;
|
||||
StencilBackTestState backTest = _state.State.StencilBackTestState;
|
||||
|
||||
CompareOp backFunc;
|
||||
StencilOp backSFail;
|
||||
@@ -934,10 +935,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateSamplerPoolState()
|
||||
{
|
||||
var texturePool = _state.State.TexturePoolState;
|
||||
var samplerPool = _state.State.SamplerPoolState;
|
||||
PoolState texturePool = _state.State.TexturePoolState;
|
||||
PoolState samplerPool = _state.State.SamplerPoolState;
|
||||
|
||||
var samplerIndex = _state.State.SamplerIndex;
|
||||
SamplerIndex samplerIndex = _state.State.SamplerIndex;
|
||||
|
||||
int maximumId = samplerIndex == SamplerIndex.ViaHeaderIndex
|
||||
? texturePool.MaximumId
|
||||
@@ -951,7 +952,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateTexturePoolState()
|
||||
{
|
||||
var texturePool = _state.State.TexturePoolState;
|
||||
PoolState texturePool = _state.State.TexturePoolState;
|
||||
|
||||
_channel.TextureManager.SetGraphicsTexturePool(texturePool.Address.Pack(), texturePool.MaximumId);
|
||||
_channel.TextureManager.SetGraphicsTextureBufferIndex((int)_state.State.TextureBufferIndex);
|
||||
@@ -971,7 +972,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
for (int index = 0; index < Constants.TotalVertexAttribs; index++)
|
||||
{
|
||||
var vertexAttrib = _state.State.VertexAttribState[index];
|
||||
VertexAttribState vertexAttrib = _state.State.VertexAttribState[index];
|
||||
|
||||
int bufferIndex = vertexAttrib.UnpackBufferIndex();
|
||||
|
||||
@@ -1065,7 +1066,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateIndexBufferState()
|
||||
{
|
||||
var indexBuffer = _state.State.IndexBufferState;
|
||||
IndexBufferState indexBuffer = _state.State.IndexBufferState;
|
||||
|
||||
if (_drawState.IndexCount == 0)
|
||||
{
|
||||
@@ -1109,7 +1110,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
for (int index = 0; index < Constants.TotalVertexBuffers; index++)
|
||||
{
|
||||
var vertexBuffer = _state.State.VertexBufferState[index];
|
||||
VertexBufferState vertexBuffer = _state.State.VertexBufferState[index];
|
||||
|
||||
if (!vertexBuffer.UnpackEnable())
|
||||
{
|
||||
@@ -1193,8 +1194,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateFaceState()
|
||||
{
|
||||
var yControl = _state.State.YControl;
|
||||
var face = _state.State.FaceState;
|
||||
YControl yControl = _state.State.YControl;
|
||||
FaceState face = _state.State.FaceState;
|
||||
|
||||
_pipeline.CullEnable = face.CullEnable;
|
||||
_pipeline.CullMode = face.CullFace;
|
||||
@@ -1233,7 +1234,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
for (int index = 0; index < Constants.TotalRenderTargets; index++)
|
||||
{
|
||||
var colorMask = _state.State.RtColorMask[rtColorMaskShared ? 0 : index];
|
||||
RtColorMask colorMask = _state.State.RtColorMask[rtColorMaskShared ? 0 : index];
|
||||
|
||||
uint componentMask;
|
||||
|
||||
@@ -1256,7 +1257,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
if (_state.State.BlendUcodeEnable != BlendUcodeEnable.Disabled)
|
||||
{
|
||||
if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out var blendDescriptor))
|
||||
if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out AdvancedBlendDescriptor blendDescriptor))
|
||||
{
|
||||
// Try to HLE it using advanced blend on the host if we can.
|
||||
_context.Renderer.Pipeline.SetBlendState(blendDescriptor);
|
||||
@@ -1278,9 +1279,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
for (int index = 0; index < Constants.TotalRenderTargets; index++)
|
||||
{
|
||||
bool enable = _state.State.BlendEnable[index];
|
||||
var blend = _state.State.BlendState[index];
|
||||
BlendState blend = _state.State.BlendState[index];
|
||||
|
||||
var descriptor = new BlendDescriptor(
|
||||
BlendDescriptor descriptor = new BlendDescriptor(
|
||||
enable,
|
||||
blendConstant,
|
||||
blend.ColorOp,
|
||||
@@ -1306,9 +1307,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
else
|
||||
{
|
||||
bool enable = _state.State.BlendEnable[0];
|
||||
var blend = _state.State.BlendStateCommon;
|
||||
BlendStateCommon blend = _state.State.BlendStateCommon;
|
||||
|
||||
var descriptor = new BlendDescriptor(
|
||||
BlendDescriptor descriptor = new BlendDescriptor(
|
||||
enable,
|
||||
blendConstant,
|
||||
blend.ColorOp,
|
||||
@@ -1409,7 +1410,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateShaderState()
|
||||
{
|
||||
var shaderCache = _channel.MemoryManager.Physical.ShaderCache;
|
||||
ShaderCache shaderCache = _channel.MemoryManager.Physical.ShaderCache;
|
||||
|
||||
_vtgWritesRtLayer = false;
|
||||
|
||||
@@ -1420,7 +1421,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
for (int index = 0; index < 6; index++)
|
||||
{
|
||||
var shader = _state.State.ShaderState[index];
|
||||
ShaderState shader = _state.State.ShaderState[index];
|
||||
if (!shader.UnpackEnable() && index != 1)
|
||||
{
|
||||
continue;
|
||||
@@ -1525,7 +1526,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// </summary>
|
||||
private void UpdateSupportBufferViewportSize()
|
||||
{
|
||||
ref var transform = ref _state.State.ViewportTransform[0];
|
||||
ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
|
||||
|
||||
float scaleX = MathF.Abs(transform.ScaleX);
|
||||
float scaleY = transform.ScaleY;
|
||||
@@ -1564,8 +1565,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
/// <returns>Current depth mode</returns>
|
||||
private DepthMode GetDepthMode()
|
||||
{
|
||||
ref var transform = ref _state.State.ViewportTransform[0];
|
||||
ref var extents = ref _state.State.ViewportExtents[0];
|
||||
ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
|
||||
ref ViewportExtents extents = ref _state.State.ViewportExtents[0];
|
||||
|
||||
DepthMode depthMode;
|
||||
|
||||
|
Reference in New Issue
Block a user