mirror of https://github.com/Ryujinx/Ryujinx.git
Compare commits
9 Commits
f0cbd568fd
...
8568119e27
Author | SHA1 | Date |
---|---|---|
sunshineinabox | 8568119e27 | |
gdkchan | ef81658fbd | |
sunshineinabox | feb915321d | |
sunshineinabox | ab9025286d | |
sunshineinabox | 48ad342ee9 | |
sunshineinabox | 20101e2ea3 | |
sunshineinabox | a7a49cc8fe | |
sunshineinabox | 10506afc23 | |
sunshineinabox | 7404d782ce |
|
@ -5,6 +5,7 @@ namespace Ryujinx.Graphics.GAL
|
|||
[Flags]
|
||||
public enum PolygonModeMask
|
||||
{
|
||||
None = 0,
|
||||
Point = 1 << 0,
|
||||
Line = 1 << 1,
|
||||
Fill = 1 << 2,
|
||||
|
|
|
@ -841,19 +841,35 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
|||
/// </summary>
|
||||
private void UpdateDepthBiasState()
|
||||
{
|
||||
if (_state.State.DepthBiasFactor == 0 && _state.State.DepthBiasUnits == 0)
|
||||
{
|
||||
if (_pipeline.BiasEnable != PolygonModeMask.None)
|
||||
{
|
||||
_pipeline.BiasEnable = PolygonModeMask.None;
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthBias(PolygonModeMask.None, 0, 0, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var depthBias = _state.State.DepthBiasState;
|
||||
|
||||
float factor = _state.State.DepthBiasFactor;
|
||||
float units = _state.State.DepthBiasUnits;
|
||||
float clamp = _state.State.DepthBiasClamp;
|
||||
|
||||
PolygonModeMask enables;
|
||||
PolygonModeMask enables = PolygonModeMask.None;
|
||||
|
||||
enables = (depthBias.PointEnable ? PolygonModeMask.Point : 0);
|
||||
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
||||
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
||||
if (factor != 0 && units != 0)
|
||||
{
|
||||
enables = (depthBias.PointEnable ? PolygonModeMask.Point : 0);
|
||||
enables |= (depthBias.LineEnable ? PolygonModeMask.Line : 0);
|
||||
enables |= (depthBias.FillEnable ? PolygonModeMask.Fill : 0);
|
||||
}
|
||||
|
||||
_pipeline.BiasEnable = enables;
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthBias(enables, factor, units / 2f, clamp);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
private const ushort FileFormatVersionMajor = 1;
|
||||
private const ushort FileFormatVersionMinor = 2;
|
||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||
private const uint CodeGenVersion = 7131;
|
||||
private const uint CodeGenVersion = 7320;
|
||||
|
||||
private const string SharedTocFileName = "shared.toc";
|
||||
private const string SharedDataFileName = "shared.data";
|
||||
|
|
|
@ -833,6 +833,15 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||
{
|
||||
if (enables == PolygonModeMask.None || (factor == 0 && units == 0))
|
||||
{
|
||||
GL.Disable(EnableCap.PolygonOffsetPoint);
|
||||
GL.Disable(EnableCap.PolygonOffsetLine);
|
||||
GL.Disable(EnableCap.PolygonOffsetFill);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ((enables & PolygonModeMask.Point) != 0)
|
||||
{
|
||||
GL.Enable(EnableCap.PolygonOffsetPoint);
|
||||
|
@ -860,11 +869,6 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
GL.Disable(EnableCap.PolygonOffsetFill);
|
||||
}
|
||||
|
||||
if (enables == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (HwCapabilities.SupportsPolygonOffsetClamp)
|
||||
{
|
||||
GL.PolygonOffsetClamp(factor, units, clamp);
|
||||
|
|
|
@ -222,30 +222,14 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.And:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
case AtomOp.Min:
|
||||
if (type == AtomSize.S32)
|
||||
{
|
||||
res = context.AtomicAnd(storageKind, e0, e1, value);
|
||||
res = context.AtomicMinS32(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
else if (type == AtomSize.U32)
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Xor:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicXor(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Or:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicOr(storageKind, e0, e1, value);
|
||||
res = context.AtomicMinU32(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -266,20 +250,49 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Min:
|
||||
if (type == AtomSize.S32)
|
||||
case AtomOp.And:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicMinS32(storageKind, e0, e1, value);
|
||||
}
|
||||
else if (type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicMinU32(storageKind, e0, e1, value);
|
||||
res = context.AtomicAnd(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Or:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicOr(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Xor:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicXor(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
case AtomOp.Exch:
|
||||
if (type == AtomSize.S32 || type == AtomSize.U32)
|
||||
{
|
||||
res = context.AtomicSwap(storageKind, e0, e1, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
context.TranslatorContext.GpuAccessor.Log($"Invalid atomic operation: {op}.");
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -792,10 +792,30 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public void SetDepthBias(PolygonModeMask enables, float factor, float units, float clamp)
|
||||
{
|
||||
DynamicState.SetDepthBias(factor, units, clamp);
|
||||
if (factor == 0 && units == 0 && !_newState.DepthBiasEnable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_newState.DepthBiasEnable = enables != 0;
|
||||
SignalStateChange();
|
||||
bool depthBiasEnable = (enables != PolygonModeMask.None) && (factor != 0 && units != 0);
|
||||
bool changed = false;
|
||||
|
||||
if (_newState.DepthBiasEnable != depthBiasEnable)
|
||||
{
|
||||
_newState.DepthBiasEnable = depthBiasEnable;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (depthBiasEnable)
|
||||
{
|
||||
DynamicState.SetDepthBias(factor, units, clamp);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
SignalStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDepthClamp(bool clamp)
|
||||
|
|
|
@ -571,6 +571,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
|
||||
bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
|
||||
|
||||
bool supportsFeedbackLoopDynamicState = gd.Capabilities.SupportsDynamicAttachmentFeedbackLoop;
|
||||
|
||||
DynamicState* dynamicStates = stackalloc DynamicState[MaxDynamicStatesCount];
|
||||
|
@ -579,11 +580,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
dynamicStates[0] = DynamicState.Viewport;
|
||||
dynamicStates[1] = DynamicState.Scissor;
|
||||
dynamicStates[2] = DynamicState.DepthBias;
|
||||
dynamicStates[3] = DynamicState.StencilCompareMask;
|
||||
dynamicStates[4] = DynamicState.StencilWriteMask;
|
||||
dynamicStates[5] = DynamicState.StencilReference;
|
||||
dynamicStates[6] = DynamicState.BlendConstants;
|
||||
dynamicStates[2] = DynamicState.StencilCompareMask;
|
||||
dynamicStates[3] = DynamicState.StencilWriteMask;
|
||||
dynamicStates[4] = DynamicState.StencilReference;
|
||||
dynamicStates[5] = DynamicState.BlendConstants;
|
||||
dynamicStates[6] = DynamicState.DepthBias;
|
||||
|
||||
if (supportsExtDynamicState)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue