Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
065c4e520d | ||
|
139a930407 |
@@ -79,21 +79,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
var sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples);
|
var sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples);
|
||||||
|
|
||||||
var usage = DefaultUsageFlags;
|
var usage = GetImageUsageFromFormat(info.Format);
|
||||||
|
|
||||||
if (info.Format.IsDepthOrStencil())
|
|
||||||
{
|
|
||||||
usage |= ImageUsageFlags.DepthStencilAttachmentBit;
|
|
||||||
}
|
|
||||||
else if (info.Format.IsRtColorCompatible())
|
|
||||||
{
|
|
||||||
usage |= ImageUsageFlags.ColorAttachmentBit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.Format.IsImageCompatible())
|
|
||||||
{
|
|
||||||
usage |= ImageUsageFlags.StorageBit;
|
|
||||||
}
|
|
||||||
|
|
||||||
var flags = ImageCreateFlags.CreateMutableFormatBit;
|
var flags = ImageCreateFlags.CreateMutableFormatBit;
|
||||||
|
|
||||||
@@ -306,6 +292,27 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ImageUsageFlags GetImageUsageFromFormat(GAL.Format format)
|
||||||
|
{
|
||||||
|
var usage = DefaultUsageFlags;
|
||||||
|
|
||||||
|
if (format.IsDepthOrStencil())
|
||||||
|
{
|
||||||
|
usage |= ImageUsageFlags.DepthStencilAttachmentBit;
|
||||||
|
}
|
||||||
|
else if (format.IsRtColorCompatible())
|
||||||
|
{
|
||||||
|
usage |= ImageUsageFlags.ColorAttachmentBit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format.IsImageCompatible())
|
||||||
|
{
|
||||||
|
usage |= ImageUsageFlags.StorageBit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return usage;
|
||||||
|
}
|
||||||
|
|
||||||
public static SampleCountFlags ConvertToSampleCountFlags(SampleCountFlags supportedSampleCounts, uint samples)
|
public static SampleCountFlags ConvertToSampleCountFlags(SampleCountFlags supportedSampleCounts, uint samples)
|
||||||
{
|
{
|
||||||
if (samples == 0 || samples > (uint)SampleCountFlags.Count64Bit)
|
if (samples == 0 || samples > (uint)SampleCountFlags.Count64Bit)
|
||||||
|
@@ -54,6 +54,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
gd.Textures.Add(this);
|
gd.Textures.Add(this);
|
||||||
|
|
||||||
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format);
|
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format);
|
||||||
|
var usage = TextureStorage.GetImageUsageFromFormat(info.Format);
|
||||||
var levels = (uint)info.Levels;
|
var levels = (uint)info.Levels;
|
||||||
var layers = (uint)info.GetLayers();
|
var layers = (uint)info.GetLayers();
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
var subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, layers);
|
var subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, layers);
|
||||||
var subresourceRangeDepth = new ImageSubresourceRange(aspectFlagsDepth, (uint)firstLevel, levels, (uint)firstLayer, layers);
|
var subresourceRangeDepth = new ImageSubresourceRange(aspectFlagsDepth, (uint)firstLevel, levels, (uint)firstLayer, layers);
|
||||||
|
|
||||||
unsafe Auto<DisposableImageView> CreateImageView(ComponentMapping cm, ImageSubresourceRange sr, ImageViewType viewType, ImageUsageFlags usageFlags = 0)
|
unsafe Auto<DisposableImageView> CreateImageView(ComponentMapping cm, ImageSubresourceRange sr, ImageViewType viewType, ImageUsageFlags usageFlags)
|
||||||
{
|
{
|
||||||
var usage = new ImageViewUsageCreateInfo()
|
var usage = new ImageViewUsageCreateInfo()
|
||||||
{
|
{
|
||||||
@@ -110,14 +111,14 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
Format = format,
|
Format = format,
|
||||||
Components = cm,
|
Components = cm,
|
||||||
SubresourceRange = sr,
|
SubresourceRange = sr,
|
||||||
PNext = usageFlags == 0 ? null : &usage
|
PNext = &usage
|
||||||
};
|
};
|
||||||
|
|
||||||
gd.Api.CreateImageView(device, imageCreateInfo, null, out var imageView).ThrowOnError();
|
gd.Api.CreateImageView(device, imageCreateInfo, null, out var imageView).ThrowOnError();
|
||||||
return new Auto<DisposableImageView>(new DisposableImageView(gd.Api, device, imageView), null, storage.GetImage());
|
return new Auto<DisposableImageView>(new DisposableImageView(gd.Api, device, imageView), null, storage.GetImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
_imageView = CreateImageView(componentMapping, subresourceRange, type);
|
_imageView = CreateImageView(componentMapping, subresourceRange, type, ImageUsageFlags.SampledBit);
|
||||||
|
|
||||||
// Framebuffer attachments and storage images requires a identity component mapping.
|
// Framebuffer attachments and storage images requires a identity component mapping.
|
||||||
var identityComponentMapping = new ComponentMapping(
|
var identityComponentMapping = new ComponentMapping(
|
||||||
@@ -126,7 +127,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
ComponentSwizzle.B,
|
ComponentSwizzle.B,
|
||||||
ComponentSwizzle.A);
|
ComponentSwizzle.A);
|
||||||
|
|
||||||
_imageViewIdentity = CreateImageView(identityComponentMapping, subresourceRangeDepth, type);
|
_imageViewIdentity = CreateImageView(identityComponentMapping, subresourceRangeDepth, type, usage);
|
||||||
|
|
||||||
// Framebuffer attachments also require 3D textures to be bound as 2D array.
|
// Framebuffer attachments also require 3D textures to be bound as 2D array.
|
||||||
if (info.Target == Target.Texture3D)
|
if (info.Target == Target.Texture3D)
|
||||||
@@ -144,7 +145,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
{
|
{
|
||||||
subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, (uint)info.Depth);
|
subresourceRange = new ImageSubresourceRange(aspectFlags, (uint)firstLevel, levels, (uint)firstLayer, (uint)info.Depth);
|
||||||
|
|
||||||
_imageView2dArray = CreateImageView(identityComponentMapping, subresourceRange, ImageViewType.Type2DArray);
|
_imageView2dArray = CreateImageView(identityComponentMapping, subresourceRange, ImageViewType.Type2DArray, usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
@@ -71,4 +70,4 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -10,6 +10,24 @@ namespace Ryujinx.HLE.HOS.Services.Pm
|
|||||||
{
|
{
|
||||||
public IDebugMonitorInterface(ServiceCtx context) { }
|
public IDebugMonitorInterface(ServiceCtx context) { }
|
||||||
|
|
||||||
|
[CommandHipc(4)]
|
||||||
|
// GetProgramId() -> sf::Out<ncm::ProgramId> out_process_id
|
||||||
|
public ResultCode GetApplicationProcessId(ServiceCtx context)
|
||||||
|
{
|
||||||
|
// TODO: Not correct as it shouldn't be directly using kernel objects here
|
||||||
|
foreach (KProcess process in context.Device.System.KernelContext.Processes.Values)
|
||||||
|
{
|
||||||
|
if (process.IsApplication)
|
||||||
|
{
|
||||||
|
context.ResponseData.Write(process.Pid);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultCode.ProcessNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
[CommandHipc(65000)]
|
[CommandHipc(65000)]
|
||||||
// AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status
|
// AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status
|
||||||
public ResultCode GetProcessInfo(ServiceCtx context)
|
public ResultCode GetProcessInfo(ServiceCtx context)
|
||||||
|
@@ -1,8 +1,28 @@
|
|||||||
namespace Ryujinx.HLE.HOS.Services.Pm
|
using Ryujinx.HLE.HOS.Kernel;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Pm
|
||||||
{
|
{
|
||||||
[Service("pm:info")]
|
[Service("pm:info")]
|
||||||
class IInformationInterface : IpcService
|
class IInformationInterface : IpcService
|
||||||
{
|
{
|
||||||
public IInformationInterface(ServiceCtx context) { }
|
public IInformationInterface(ServiceCtx context) { }
|
||||||
|
|
||||||
|
[CommandHipc(0)]
|
||||||
|
// GetProgramId(os::ProcessId process_id) -> sf::Out<ncm::ProgramId> out
|
||||||
|
public ResultCode GetProgramId(ServiceCtx context)
|
||||||
|
{
|
||||||
|
ulong pid = context.RequestData.ReadUInt64();
|
||||||
|
|
||||||
|
// TODO: Not correct as it shouldn't be directly using kernel objects here
|
||||||
|
if (context.Device.System.KernelContext.Processes.TryGetValue(pid, out KProcess process))
|
||||||
|
{
|
||||||
|
context.ResponseData.Write(process.TitleId);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultCode.ProcessNotFound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
17
Ryujinx.HLE/HOS/Services/Pm/ResultCode.cs
Normal file
17
Ryujinx.HLE/HOS/Services/Pm/ResultCode.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace Ryujinx.HLE.HOS.Services.Pm
|
||||||
|
{
|
||||||
|
enum ResultCode
|
||||||
|
{
|
||||||
|
ModuleId = 15,
|
||||||
|
ErrorCodeShift = 9,
|
||||||
|
|
||||||
|
Success = 0,
|
||||||
|
|
||||||
|
ProcessNotFound = (1 << ErrorCodeShift) | ModuleId,
|
||||||
|
AlreadyStarted = (2 << ErrorCodeShift) | ModuleId,
|
||||||
|
NotTerminated = (3 << ErrorCodeShift) | ModuleId,
|
||||||
|
DebugHookInUse = (4 << ErrorCodeShift) | ModuleId,
|
||||||
|
ApplicationRunning = (5 << ErrorCodeShift) | ModuleId,
|
||||||
|
InvalidSize = (6 << ErrorCodeShift) | ModuleId,
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user