Simple GPU fixes (#1093)
* Implement RasterizeEnable * Match viewport count to hardware * Simplify ScissorTest tracking around Blits * Disable RasterizerDiscard around Blits and track its state * Read RasterizeEnable reg as bool and add doc
This commit is contained in:
parent
e99e6d0ad1
commit
468d8f841f
9 changed files with 66 additions and 18 deletions
|
@ -53,6 +53,6 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// <summary>
|
||||
/// Maximum number of viewports.
|
||||
/// </summary>
|
||||
public const int TotalViewports = 8;
|
||||
public const int TotalViewports = 16;
|
||||
}
|
||||
}
|
|
@ -108,6 +108,11 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
UpdateShaderState(state);
|
||||
}
|
||||
|
||||
if (state.QueryModified(MethodOffset.RasterizeEnable))
|
||||
{
|
||||
UpdateRasterizerState(state);
|
||||
}
|
||||
|
||||
if (state.QueryModified(MethodOffset.RtColorState,
|
||||
MethodOffset.RtDepthStencilState,
|
||||
MethodOffset.RtControl,
|
||||
|
@ -211,6 +216,16 @@ namespace Ryujinx.Graphics.Gpu.Engine
|
|||
CommitBindings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates Rasterizer primitive discard state based on guest gpu state.
|
||||
/// </summary>
|
||||
/// <param name="state">Current GPU state</param>
|
||||
private void UpdateRasterizerState(GpuState state)
|
||||
{
|
||||
Boolean32 enable = state.Get<Boolean32>(MethodOffset.RasterizeEnable);
|
||||
_context.Renderer.Pipeline.SetRasterizerDiscard(!enable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the bindings are visible to the host GPU.
|
||||
/// Note: this actually performs the binding using the host graphics API.
|
||||
|
|
|
@ -117,6 +117,9 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
/// </summary>
|
||||
private void InitializeDefaultState()
|
||||
{
|
||||
// Enable Rasterizer
|
||||
_backingMemory[(int)MethodOffset.RasterizeEnable] = 1;
|
||||
|
||||
// Depth ranges.
|
||||
for (int index = 0; index < 8; index++)
|
||||
{
|
||||
|
|
|
@ -53,11 +53,11 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
public static TableItem[] Table = new TableItem[]
|
||||
{
|
||||
new TableItem(MethodOffset.RtColorState, typeof(RtColorState), 8),
|
||||
new TableItem(MethodOffset.ViewportTransform, typeof(ViewportTransform), 8),
|
||||
new TableItem(MethodOffset.ViewportExtents, typeof(ViewportExtents), 8),
|
||||
new TableItem(MethodOffset.ViewportTransform, typeof(ViewportTransform), Constants.TotalViewports),
|
||||
new TableItem(MethodOffset.ViewportExtents, typeof(ViewportExtents), Constants.TotalViewports),
|
||||
new TableItem(MethodOffset.VertexBufferDrawState, typeof(VertexBufferDrawState), 1),
|
||||
new TableItem(MethodOffset.DepthBiasState, typeof(DepthBiasState), 1),
|
||||
new TableItem(MethodOffset.ScissorState, typeof(ScissorState), 8),
|
||||
new TableItem(MethodOffset.ScissorState, typeof(ScissorState), Constants.TotalViewports),
|
||||
new TableItem(MethodOffset.StencilBackMasks, typeof(StencilBackMasks), 1),
|
||||
new TableItem(MethodOffset.RtDepthStencilState, typeof(RtDepthStencilState), 1),
|
||||
new TableItem(MethodOffset.VertexAttribState, typeof(VertexAttribState), 16),
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Ryujinx.Graphics.Gpu.State
|
|||
DispatchParamsAddress = 0xad,
|
||||
Dispatch = 0xaf,
|
||||
CopyBuffer = 0xc0,
|
||||
RasterizeEnable = 0xdf,
|
||||
CopyBufferParams = 0x100,
|
||||
CopyBufferSwizzle = 0x1c2,
|
||||
CopyBufferDstTexture = 0x1c3,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue