Renaming part 9
This commit is contained in:
parent
e7e11ef741
commit
bed93cc871
3 changed files with 88 additions and 88 deletions
|
@ -5,64 +5,64 @@ namespace Ryujinx.Graphics.Vic
|
|||
{
|
||||
class StructUnpacker
|
||||
{
|
||||
private NvGpuVmm Vmm;
|
||||
private NvGpuVmm _vmm;
|
||||
|
||||
private long Position;
|
||||
private long _position;
|
||||
|
||||
private ulong Buffer;
|
||||
private int BuffPos;
|
||||
private ulong _buffer;
|
||||
private int _buffPos;
|
||||
|
||||
public StructUnpacker(NvGpuVmm Vmm, long Position)
|
||||
public StructUnpacker(NvGpuVmm vmm, long position)
|
||||
{
|
||||
this.Vmm = Vmm;
|
||||
this.Position = Position;
|
||||
this._vmm = vmm;
|
||||
this._position = position;
|
||||
|
||||
BuffPos = 64;
|
||||
_buffPos = 64;
|
||||
}
|
||||
|
||||
public int Read(int Bits)
|
||||
public int Read(int bits)
|
||||
{
|
||||
if ((uint)Bits > 32)
|
||||
if ((uint)bits > 32)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(Bits));
|
||||
throw new ArgumentOutOfRangeException(nameof(bits));
|
||||
}
|
||||
|
||||
int Value = 0;
|
||||
int value = 0;
|
||||
|
||||
while (Bits > 0)
|
||||
while (bits > 0)
|
||||
{
|
||||
RefillBufferIfNeeded();
|
||||
|
||||
int ReadBits = Bits;
|
||||
int readBits = bits;
|
||||
|
||||
int MaxReadBits = 64 - BuffPos;
|
||||
int maxReadBits = 64 - _buffPos;
|
||||
|
||||
if (ReadBits > MaxReadBits)
|
||||
if (readBits > maxReadBits)
|
||||
{
|
||||
ReadBits = MaxReadBits;
|
||||
readBits = maxReadBits;
|
||||
}
|
||||
|
||||
Value <<= ReadBits;
|
||||
value <<= readBits;
|
||||
|
||||
Value |= (int)(Buffer >> BuffPos) & (int)(0xffffffff >> (32 - ReadBits));
|
||||
value |= (int)(_buffer >> _buffPos) & (int)(0xffffffff >> (32 - readBits));
|
||||
|
||||
BuffPos += ReadBits;
|
||||
_buffPos += readBits;
|
||||
|
||||
Bits -= ReadBits;
|
||||
bits -= readBits;
|
||||
}
|
||||
|
||||
return Value;
|
||||
return value;
|
||||
}
|
||||
|
||||
private void RefillBufferIfNeeded()
|
||||
{
|
||||
if (BuffPos >= 64)
|
||||
if (_buffPos >= 64)
|
||||
{
|
||||
Buffer = Vmm.ReadUInt64(Position);
|
||||
_buffer = _vmm.ReadUInt64(_position);
|
||||
|
||||
Position += 8;
|
||||
_position += 8;
|
||||
|
||||
BuffPos = 0;
|
||||
_buffPos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,21 +13,21 @@ namespace Ryujinx.Graphics.Vic
|
|||
public long SurfaceChromaVAddress;
|
||||
|
||||
public SurfaceOutputConfig(
|
||||
SurfacePixelFormat PixelFormat,
|
||||
int SurfaceWidth,
|
||||
int SurfaceHeight,
|
||||
int GobBlockHeight,
|
||||
long OutputSurfaceLumaAddress,
|
||||
long OutputSurfaceChromaUAddress,
|
||||
long OutputSurfaceChromaVAddress)
|
||||
SurfacePixelFormat pixelFormat,
|
||||
int surfaceWidth,
|
||||
int surfaceHeight,
|
||||
int gobBlockHeight,
|
||||
long outputSurfaceLumaAddress,
|
||||
long outputSurfaceChromaUAddress,
|
||||
long outputSurfaceChromaVAddress)
|
||||
{
|
||||
this.PixelFormat = PixelFormat;
|
||||
this.SurfaceWidth = SurfaceWidth;
|
||||
this.SurfaceHeight = SurfaceHeight;
|
||||
this.GobBlockHeight = GobBlockHeight;
|
||||
this.SurfaceLumaAddress = OutputSurfaceLumaAddress;
|
||||
this.SurfaceChromaUAddress = OutputSurfaceChromaUAddress;
|
||||
this.SurfaceChromaVAddress = OutputSurfaceChromaVAddress;
|
||||
this.PixelFormat = pixelFormat;
|
||||
this.SurfaceWidth = surfaceWidth;
|
||||
this.SurfaceHeight = surfaceHeight;
|
||||
this.GobBlockHeight = gobBlockHeight;
|
||||
this.SurfaceLumaAddress = outputSurfaceLumaAddress;
|
||||
this.SurfaceChromaUAddress = outputSurfaceChromaUAddress;
|
||||
this.SurfaceChromaVAddress = outputSurfaceChromaVAddress;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,104 +4,104 @@ namespace Ryujinx.Graphics.Vic
|
|||
{
|
||||
class VideoImageComposer
|
||||
{
|
||||
private NvGpu Gpu;
|
||||
private NvGpu _gpu;
|
||||
|
||||
private long ConfigStructAddress;
|
||||
private long OutputSurfaceLumaAddress;
|
||||
private long OutputSurfaceChromaUAddress;
|
||||
private long OutputSurfaceChromaVAddress;
|
||||
private long _configStructAddress;
|
||||
private long _outputSurfaceLumaAddress;
|
||||
private long _outputSurfaceChromaUAddress;
|
||||
private long _outputSurfaceChromaVAddress;
|
||||
|
||||
public VideoImageComposer(NvGpu Gpu)
|
||||
public VideoImageComposer(NvGpu gpu)
|
||||
{
|
||||
this.Gpu = Gpu;
|
||||
this._gpu = gpu;
|
||||
}
|
||||
|
||||
public void Process(NvGpuVmm Vmm, int MethodOffset, int[] Arguments)
|
||||
public void Process(NvGpuVmm vmm, int methodOffset, int[] arguments)
|
||||
{
|
||||
VideoImageComposerMeth Method = (VideoImageComposerMeth)MethodOffset;
|
||||
VideoImageComposerMeth method = (VideoImageComposerMeth)methodOffset;
|
||||
|
||||
switch (Method)
|
||||
switch (method)
|
||||
{
|
||||
case VideoImageComposerMeth.Execute:
|
||||
Execute(Vmm, Arguments);
|
||||
Execute(vmm, arguments);
|
||||
break;
|
||||
|
||||
case VideoImageComposerMeth.SetConfigStructOffset:
|
||||
SetConfigStructOffset(Vmm, Arguments);
|
||||
SetConfigStructOffset(vmm, arguments);
|
||||
break;
|
||||
|
||||
case VideoImageComposerMeth.SetOutputSurfaceLumaOffset:
|
||||
SetOutputSurfaceLumaOffset(Vmm, Arguments);
|
||||
SetOutputSurfaceLumaOffset(vmm, arguments);
|
||||
break;
|
||||
|
||||
case VideoImageComposerMeth.SetOutputSurfaceChromaUOffset:
|
||||
SetOutputSurfaceChromaUOffset(Vmm, Arguments);
|
||||
SetOutputSurfaceChromaUOffset(vmm, arguments);
|
||||
break;
|
||||
|
||||
case VideoImageComposerMeth.SetOutputSurfaceChromaVOffset:
|
||||
SetOutputSurfaceChromaVOffset(Vmm, Arguments);
|
||||
SetOutputSurfaceChromaVOffset(vmm, arguments);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Execute(NvGpuVmm Vmm, int[] Arguments)
|
||||
private void Execute(NvGpuVmm vmm, int[] arguments)
|
||||
{
|
||||
StructUnpacker Unpacker = new StructUnpacker(Vmm, ConfigStructAddress + 0x20);
|
||||
StructUnpacker unpacker = new StructUnpacker(vmm, _configStructAddress + 0x20);
|
||||
|
||||
SurfacePixelFormat PixelFormat = (SurfacePixelFormat)Unpacker.Read(7);
|
||||
SurfacePixelFormat pixelFormat = (SurfacePixelFormat)unpacker.Read(7);
|
||||
|
||||
int ChromaLocHoriz = Unpacker.Read(2);
|
||||
int ChromaLocVert = Unpacker.Read(2);
|
||||
int chromaLocHoriz = unpacker.Read(2);
|
||||
int chromaLocVert = unpacker.Read(2);
|
||||
|
||||
int BlockLinearKind = Unpacker.Read(4);
|
||||
int BlockLinearHeightLog2 = Unpacker.Read(4);
|
||||
int blockLinearKind = unpacker.Read(4);
|
||||
int blockLinearHeightLog2 = unpacker.Read(4);
|
||||
|
||||
int Reserved0 = Unpacker.Read(3);
|
||||
int Reserved1 = Unpacker.Read(10);
|
||||
int reserved0 = unpacker.Read(3);
|
||||
int reserved1 = unpacker.Read(10);
|
||||
|
||||
int SurfaceWidthMinus1 = Unpacker.Read(14);
|
||||
int SurfaceHeightMinus1 = Unpacker.Read(14);
|
||||
int surfaceWidthMinus1 = unpacker.Read(14);
|
||||
int surfaceHeightMinus1 = unpacker.Read(14);
|
||||
|
||||
int GobBlockHeight = 1 << BlockLinearHeightLog2;
|
||||
int gobBlockHeight = 1 << blockLinearHeightLog2;
|
||||
|
||||
int SurfaceWidth = SurfaceWidthMinus1 + 1;
|
||||
int SurfaceHeight = SurfaceHeightMinus1 + 1;
|
||||
int surfaceWidth = surfaceWidthMinus1 + 1;
|
||||
int surfaceHeight = surfaceHeightMinus1 + 1;
|
||||
|
||||
SurfaceOutputConfig OutputConfig = new SurfaceOutputConfig(
|
||||
PixelFormat,
|
||||
SurfaceWidth,
|
||||
SurfaceHeight,
|
||||
GobBlockHeight,
|
||||
OutputSurfaceLumaAddress,
|
||||
OutputSurfaceChromaUAddress,
|
||||
OutputSurfaceChromaVAddress);
|
||||
SurfaceOutputConfig outputConfig = new SurfaceOutputConfig(
|
||||
pixelFormat,
|
||||
surfaceWidth,
|
||||
surfaceHeight,
|
||||
gobBlockHeight,
|
||||
_outputSurfaceLumaAddress,
|
||||
_outputSurfaceChromaUAddress,
|
||||
_outputSurfaceChromaVAddress);
|
||||
|
||||
Gpu.VideoDecoder.CopyPlanes(Vmm, OutputConfig);
|
||||
_gpu.VideoDecoder.CopyPlanes(vmm, outputConfig);
|
||||
}
|
||||
|
||||
private void SetConfigStructOffset(NvGpuVmm Vmm, int[] Arguments)
|
||||
private void SetConfigStructOffset(NvGpuVmm vmm, int[] arguments)
|
||||
{
|
||||
ConfigStructAddress = GetAddress(Arguments);
|
||||
_configStructAddress = GetAddress(arguments);
|
||||
}
|
||||
|
||||
private void SetOutputSurfaceLumaOffset(NvGpuVmm Vmm, int[] Arguments)
|
||||
private void SetOutputSurfaceLumaOffset(NvGpuVmm vmm, int[] arguments)
|
||||
{
|
||||
OutputSurfaceLumaAddress = GetAddress(Arguments);
|
||||
_outputSurfaceLumaAddress = GetAddress(arguments);
|
||||
}
|
||||
|
||||
private void SetOutputSurfaceChromaUOffset(NvGpuVmm Vmm, int[] Arguments)
|
||||
private void SetOutputSurfaceChromaUOffset(NvGpuVmm vmm, int[] arguments)
|
||||
{
|
||||
OutputSurfaceChromaUAddress = GetAddress(Arguments);
|
||||
_outputSurfaceChromaUAddress = GetAddress(arguments);
|
||||
}
|
||||
|
||||
private void SetOutputSurfaceChromaVOffset(NvGpuVmm Vmm, int[] Arguments)
|
||||
private void SetOutputSurfaceChromaVOffset(NvGpuVmm vmm, int[] arguments)
|
||||
{
|
||||
OutputSurfaceChromaVAddress = GetAddress(Arguments);
|
||||
_outputSurfaceChromaVAddress = GetAddress(arguments);
|
||||
}
|
||||
|
||||
private static long GetAddress(int[] Arguments)
|
||||
private static long GetAddress(int[] arguments)
|
||||
{
|
||||
return (long)(uint)Arguments[0] << 8;
|
||||
return (long)(uint)arguments[0] << 8;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue