Separate UploadVertex call

This commit is contained in:
ReinUsesLisp 2018-07-31 22:40:52 -03:00
commit 9111888824
2 changed files with 22 additions and 9 deletions

View file

@ -2,6 +2,8 @@
{ {
public struct GalPipelineState public struct GalPipelineState
{ {
public GalFrontFace FrontFace; public GalFrontFace FrontFace;
public bool CullFaceEnabled; public bool CullFaceEnabled;

View file

@ -101,12 +101,12 @@ namespace Ryujinx.HLE.Gpu.Engines
SetAlphaBlending(); SetAlphaBlending();
SetPrimitiveRestart(); SetPrimitiveRestart();
Gpu.Renderer.Pipeline.Bind(ref State);
UploadTextures(Vmm, Keys); UploadTextures(Vmm, Keys);
UploadUniforms(Vmm); UploadUniforms(Vmm);
UploadVertexArrays(Vmm); UploadVertexArrays(Vmm);
DispatchRender(Vmm);
UnlockCaches(); UnlockCaches();
} }
@ -477,7 +477,6 @@ namespace Ryujinx.HLE.Gpu.Engines
long IboKey = Vmm.GetPhysicalAddress(IndexPosition); long IboKey = Vmm.GetPhysicalAddress(IndexPosition);
int IndexEntryFmt = ReadRegister(NvGpuEngine3dReg.IndexArrayFormat); int IndexEntryFmt = ReadRegister(NvGpuEngine3dReg.IndexArrayFormat);
int IndexFirst = ReadRegister(NvGpuEngine3dReg.IndexBatchFirst);
int IndexCount = ReadRegister(NvGpuEngine3dReg.IndexBatchCount); int IndexCount = ReadRegister(NvGpuEngine3dReg.IndexBatchCount);
GalIndexFormat IndexFormat = (GalIndexFormat)IndexEntryFmt; GalIndexFormat IndexFormat = (GalIndexFormat)IndexEntryFmt;
@ -527,11 +526,6 @@ namespace Ryujinx.HLE.Gpu.Engines
((Packed >> 31) & 0x1) != 0)); ((Packed >> 31) & 0x1) != 0));
} }
int VertexFirst = ReadRegister(NvGpuEngine3dReg.VertexArrayFirst);
int VertexCount = ReadRegister(NvGpuEngine3dReg.VertexArrayCount);
int PrimCtrl = ReadRegister(NvGpuEngine3dReg.VertexBeginGl);
for (int Index = 0; Index < 32; Index++) for (int Index = 0; Index < 32; Index++)
{ {
if (Attribs[Index] == null) if (Attribs[Index] == null)
@ -568,17 +562,34 @@ namespace Ryujinx.HLE.Gpu.Engines
Gpu.Renderer.Rasterizer.SetVertexArray(Stride, VboKey, Attribs[Index].ToArray()); Gpu.Renderer.Rasterizer.SetVertexArray(Stride, VboKey, Attribs[Index].ToArray());
} }
}
private void DispatchRender(NvGpuVmm Vmm)
{
int IndexCount = ReadRegister(NvGpuEngine3dReg.IndexBatchCount);
int PrimCtrl = ReadRegister(NvGpuEngine3dReg.VertexBeginGl);
GalPrimitiveType PrimType = (GalPrimitiveType)(PrimCtrl & 0xffff); GalPrimitiveType PrimType = (GalPrimitiveType)(PrimCtrl & 0xffff);
Gpu.Renderer.Pipeline.Bind(ref State);
if (IndexCount != 0) if (IndexCount != 0)
{ {
int VertexBase = ReadRegister(NvGpuEngine3dReg.VertexArrayElemBase); int IndexEntryFmt = ReadRegister(NvGpuEngine3dReg.IndexArrayFormat);
int IndexFirst = ReadRegister(NvGpuEngine3dReg.IndexBatchFirst);
int VertexBase = ReadRegister(NvGpuEngine3dReg.VertexArrayElemBase);
long IndexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.IndexArrayAddress);
long IboKey = Vmm.GetPhysicalAddress(IndexPosition);
Gpu.Renderer.Rasterizer.DrawElements(IboKey, IndexFirst, VertexBase, PrimType); Gpu.Renderer.Rasterizer.DrawElements(IboKey, IndexFirst, VertexBase, PrimType);
} }
else else
{ {
int VertexFirst = ReadRegister(NvGpuEngine3dReg.VertexArrayFirst);
int VertexCount = ReadRegister(NvGpuEngine3dReg.VertexArrayCount);
Gpu.Renderer.Rasterizer.DrawArrays(VertexFirst, VertexCount, PrimType); Gpu.Renderer.Rasterizer.DrawArrays(VertexFirst, VertexCount, PrimType);
} }
} }