diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-08-13 18:22:09 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-13 18:22:09 -0300 |
| commit | 09593ae6d85b204b7bded803a56f0d81fbda1127 (patch) | |
| tree | b5d3058cb80cc1605473683f5a827fff2c1b5b20 /Ryujinx.HLE/Gpu | |
| parent | 4518c52c65f64a5f7be8866a299056fdf94ef860 (diff) | |
Add partial support to the TEX.B shader instruction (#342)
* Add partial support to the TEX.B shader instruction, fix for mixed indexed and non-indexed drawing
* Better exception
Diffstat (limited to 'Ryujinx.HLE/Gpu')
| -rw-r--r-- | Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs index 0576601f..38f8d1c9 100644 --- a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs +++ b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs @@ -309,7 +309,7 @@ namespace Ryujinx.HLE.Gpu.Engines private void SetStencil(GalPipelineState State) { State.StencilTestEnabled = (ReadRegister(NvGpuEngine3dReg.StencilEnable) & 1) != 0; - + if (State.StencilTestEnabled) { State.StencilBackFuncFunc = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.StencilBackFuncFunc); @@ -364,17 +364,26 @@ namespace Ryujinx.HLE.Gpu.Engines int TextureCbIndex = ReadRegister(NvGpuEngine3dReg.TextureCbIndex); - //Note: On the emulator renderer, Texture Unit 0 is - //reserved for drawing the frame buffer. - int TexIndex = 1; + int TexIndex = 0; for (int Index = 0; Index < Keys.Length; Index++) { foreach (ShaderDeclInfo DeclInfo in Gpu.Renderer.Shader.GetTextureUsage(Keys[Index])) { - long Position = ConstBuffers[Index][TextureCbIndex].Position; + long Position; + + if (DeclInfo.IsCb) + { + Position = ConstBuffers[Index][DeclInfo.Cbuf].Position; + } + else + { + Position = ConstBuffers[Index][TextureCbIndex].Position; + } + + int TextureHandle = Vmm.ReadInt32(Position + DeclInfo.Index * 4); - UploadTexture(Vmm, Position, TexIndex, DeclInfo.Index); + UploadTexture(Vmm, TexIndex, TextureHandle); Gpu.Renderer.Shader.EnsureTextureBinding(DeclInfo.Name, TexIndex); @@ -383,12 +392,8 @@ namespace Ryujinx.HLE.Gpu.Engines } } - private void UploadTexture(NvGpuVmm Vmm, long BasePosition, int TexIndex, int HndIndex) + private void UploadTexture(NvGpuVmm Vmm, int TexIndex, int TextureHandle) { - long Position = BasePosition + HndIndex * 4; - - int TextureHandle = Vmm.ReadInt32(Position); - if (TextureHandle == 0) { //TODO: Is this correct? @@ -601,6 +606,10 @@ namespace Ryujinx.HLE.Gpu.Engines Gpu.Renderer.Rasterizer.DrawArrays(VertexFirst, VertexCount, PrimType); } + + //Is the GPU really clearing those registers after draw? + WriteRegister(NvGpuEngine3dReg.IndexBatchFirst, 0); + WriteRegister(NvGpuEngine3dReg.IndexBatchCount, 0); } private void QueryControl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry) |
