diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-06-02 00:50:56 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-06-02 00:50:56 -0300 |
| commit | 53a6922f872b9380d6c2867254a2465dc7c1ea92 (patch) | |
| tree | abd3945ba8c64ac99c5b3eb0048e9a7bdaa957ca /Ryujinx.Core/Gpu | |
| parent | aeb1bbf50c9996ab53a17e354798be3137ba2ae2 (diff) | |
Some small gpu improvements and shader improvements, add support for ASTC 4x4 textures (slow!)
Diffstat (limited to 'Ryujinx.Core/Gpu')
| -rw-r--r-- | Ryujinx.Core/Gpu/NvGpuEngine3d.cs | 70 | ||||
| -rw-r--r-- | Ryujinx.Core/Gpu/TextureReader.cs | 1 |
2 files changed, 10 insertions, 61 deletions
diff --git a/Ryujinx.Core/Gpu/NvGpuEngine3d.cs b/Ryujinx.Core/Gpu/NvGpuEngine3d.cs index 5639dd02..b827debe 100644 --- a/Ryujinx.Core/Gpu/NvGpuEngine3d.cs +++ b/Ryujinx.Core/Gpu/NvGpuEngine3d.cs @@ -182,6 +182,13 @@ namespace Ryujinx.Core.Gpu Gpu.Renderer.SetBlendEnable(Enable); + if (!Enable) + { + //If blend is not enabled, then the other values have no effect. + //Note that if it is disabled, the register may contain invalid values. + return; + } + bool BlendSeparateAlpha = (ReadRegister(NvGpuEngine3dReg.IBlendNSeparateAlpha) & 1) != 0; GalBlendEquation EquationRgb = (GalBlendEquation)ReadRegister(NvGpuEngine3dReg.IBlendNEquationRgb); @@ -362,6 +369,7 @@ namespace Ryujinx.Core.Gpu bool Enable = (Control & 0x1000) != 0; long VertexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + Index * 4); + long VertexEndPos = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNEndAddr + Index * 2); if (!Enable) { @@ -374,11 +382,7 @@ namespace Ryujinx.Core.Gpu if (IndexCount != 0) { - Size = GetVertexCountFromIndexBuffer( - Vmm, - IndexPosition, - IndexCount, - IndexSize); + Size = (VertexEndPos - VertexPosition) + 1; } else { @@ -410,62 +414,6 @@ namespace Ryujinx.Core.Gpu } } - private int GetVertexCountFromIndexBuffer( - NvGpuVmm Vmm, - long IndexPosition, - int IndexCount, - int IndexSize) - { - int MaxIndex = -1; - - if (IndexSize == 2) - { - while (IndexCount -- > 0) - { - ushort Value = Vmm.ReadUInt16(IndexPosition); - - IndexPosition += 2; - - if (MaxIndex < Value) - { - MaxIndex = Value; - } - } - } - else if (IndexSize == 1) - { - while (IndexCount -- > 0) - { - byte Value = Vmm.ReadByte(IndexPosition++); - - if (MaxIndex < Value) - { - MaxIndex = Value; - } - } - } - else if (IndexSize == 4) - { - while (IndexCount -- > 0) - { - uint Value = Vmm.ReadUInt32(IndexPosition); - - IndexPosition += 2; - - if (MaxIndex < Value) - { - MaxIndex = (int)Value; - } - } - } - else - { - throw new ArgumentOutOfRangeException(nameof(IndexSize)); - } - - return MaxIndex + 1; - } - private void QueryControl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry) { long Position = MakeInt64From2xInt32(NvGpuEngine3dReg.QueryAddress); diff --git a/Ryujinx.Core/Gpu/TextureReader.cs b/Ryujinx.Core/Gpu/TextureReader.cs index 0c1c83d5..ae3b0000 100644 --- a/Ryujinx.Core/Gpu/TextureReader.cs +++ b/Ryujinx.Core/Gpu/TextureReader.cs @@ -23,6 +23,7 @@ namespace Ryujinx.Core.Gpu case GalTextureFormat.BC3: return Read16Bpt4x4(Memory, Texture); case GalTextureFormat.BC4: return Read8Bpt4x4 (Memory, Texture); case GalTextureFormat.BC5: return Read16Bpt4x4(Memory, Texture); + case GalTextureFormat.Astc2D4x4: return Read16Bpt4x4(Memory, Texture); } throw new NotImplementedException(Texture.Format.ToString()); |
