mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-19 06:12:02 +00:00
Fix RGB Seizure
This commit is contained in:
parent
07be20c369
commit
541cdfebb7
3 changed files with 8 additions and 4 deletions
|
@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
private MTLBuffer _indexBuffer;
|
private MTLBuffer _indexBuffer;
|
||||||
private MTLIndexType _indexType;
|
private MTLIndexType _indexType;
|
||||||
private ulong _indexBufferOffset;
|
private ulong _indexBufferOffset;
|
||||||
private MTLClearColor _clearColor = new() { alpha = 1.0f };
|
private MTLClearColor _clearColor;
|
||||||
private int frameCount = 0;
|
private int frameCount = 0;
|
||||||
|
|
||||||
public Pipeline(MTLDevice device, MTLCommandQueue commandQueue, CAMetalLayer metalLayer)
|
public Pipeline(MTLDevice device, MTLCommandQueue commandQueue, CAMetalLayer metalLayer)
|
||||||
|
@ -54,7 +54,12 @@ namespace Ryujinx.Graphics.Metal
|
||||||
renderPipelineDescriptor.VertexFunction = vertexFunction;
|
renderPipelineDescriptor.VertexFunction = vertexFunction;
|
||||||
renderPipelineDescriptor.FragmentFunction = fragmentFunction;
|
renderPipelineDescriptor.FragmentFunction = fragmentFunction;
|
||||||
// TODO: This should not be hardcoded, but a bug in SharpMetal prevents me from doing this correctly
|
// TODO: This should not be hardcoded, but a bug in SharpMetal prevents me from doing this correctly
|
||||||
|
renderPipelineDescriptor.ColorAttachments.Object(0).SetBlendingEnabled(true);
|
||||||
renderPipelineDescriptor.ColorAttachments.Object(0).PixelFormat = MTLPixelFormat.BGRA8Unorm;
|
renderPipelineDescriptor.ColorAttachments.Object(0).PixelFormat = MTLPixelFormat.BGRA8Unorm;
|
||||||
|
renderPipelineDescriptor.ColorAttachments.Object(0).SourceAlphaBlendFactor = MTLBlendFactor.SourceAlpha;
|
||||||
|
renderPipelineDescriptor.ColorAttachments.Object(0).DestinationAlphaBlendFactor = MTLBlendFactor.OneMinusSourceAlpha;
|
||||||
|
renderPipelineDescriptor.ColorAttachments.Object(0).SourceRGBBlendFactor = MTLBlendFactor.SourceAlpha;
|
||||||
|
renderPipelineDescriptor.ColorAttachments.Object(0).DestinationRGBBlendFactor = MTLBlendFactor.OneMinusSourceAlpha;
|
||||||
|
|
||||||
var renderPipelineState = _device.NewRenderPipelineState(renderPipelineDescriptor, ref error);
|
var renderPipelineState = _device.NewRenderPipelineState(renderPipelineDescriptor, ref error);
|
||||||
if (error != IntPtr.Zero)
|
if (error != IntPtr.Zero)
|
||||||
|
|
|
@ -32,6 +32,5 @@ fragment float4 fragmentMain(CopyVertexOut in [[stage_in]],
|
||||||
texture2d<float> tex) {
|
texture2d<float> tex) {
|
||||||
constexpr sampler sam(min_filter::nearest, mag_filter::nearest, mip_filter::none);
|
constexpr sampler sam(min_filter::nearest, mag_filter::nearest, mip_filter::none);
|
||||||
|
|
||||||
float3 color = tex.sample(sam, in.uv).xyz;
|
return tex.sample(sam, in.uv).xyzw;
|
||||||
return float4(color, 1.0f);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using SharpMetal.Metal;
|
|
||||||
using SharpMetal.ObjectiveCCore;
|
using SharpMetal.ObjectiveCCore;
|
||||||
using SharpMetal.QuartzCore;
|
using SharpMetal.QuartzCore;
|
||||||
using System;
|
using System;
|
||||||
|
@ -20,6 +19,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
_metalLayer = metalLayer;
|
_metalLayer = metalLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Handle ImageCrop
|
||||||
public void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
|
public void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
|
||||||
{
|
{
|
||||||
if (_renderer.Pipeline is Pipeline pipeline && texture is Texture tex)
|
if (_renderer.Pipeline is Pipeline pipeline && texture is Texture tex)
|
||||||
|
|
Loading…
Reference in a new issue