mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 03:25:17 +00:00
Merge branch 'main' into Feature/initial-ps4-ime-keyboard
This commit is contained in:
commit
52085045a7
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -97,7 +97,7 @@
|
|||||||
shallow = true
|
shallow = true
|
||||||
[submodule "externals/MoltenVK/SPIRV-Cross"]
|
[submodule "externals/MoltenVK/SPIRV-Cross"]
|
||||||
path = externals/MoltenVK/SPIRV-Cross
|
path = externals/MoltenVK/SPIRV-Cross
|
||||||
url = https://github.com/KhronosGroup/SPIRV-Cross
|
url = https://github.com/billhollings/SPIRV-Cross
|
||||||
shallow = true
|
shallow = true
|
||||||
[submodule "externals/MoltenVK/MoltenVK"]
|
[submodule "externals/MoltenVK/MoltenVK"]
|
||||||
path = externals/MoltenVK/MoltenVK
|
path = externals/MoltenVK/MoltenVK
|
||||||
|
2
externals/MoltenVK/MoltenVK
vendored
2
externals/MoltenVK/MoltenVK
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 83510e0f3835c3c43651dda087305abc42572e17
|
Subproject commit 067fc6c85b02f37dfda58eeda49d8458e093ed60
|
2
externals/MoltenVK/SPIRV-Cross
vendored
2
externals/MoltenVK/SPIRV-Cross
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 68300dc07ac3dc592dbbdb87e02d5180f984ad12
|
Subproject commit 185833a61cbe29ce3bfb5a499ffb3dfeaee3bbe7
|
@ -235,9 +235,12 @@ std::pair<const IR::Inst*, bool> TryDisableAnisoLod0(const IR::Inst* inst) {
|
|||||||
return {prod2, true};
|
return {prod2, true};
|
||||||
}
|
}
|
||||||
|
|
||||||
SharpLocation TrackSharp(const IR::Inst* inst, const Shader::Info& info) {
|
SharpLocation AttemptTrackSharp(const IR::Inst* inst, auto& visited_insts) {
|
||||||
// Search until we find a potential sharp source.
|
// Search until we find a potential sharp source.
|
||||||
const auto pred = [](const IR::Inst* inst) -> std::optional<const IR::Inst*> {
|
const auto pred = [&visited_insts](const IR::Inst* inst) -> std::optional<const IR::Inst*> {
|
||||||
|
if (std::ranges::find(visited_insts, inst) != visited_insts.end()) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
if (inst->GetOpcode() == IR::Opcode::GetUserData ||
|
if (inst->GetOpcode() == IR::Opcode::GetUserData ||
|
||||||
inst->GetOpcode() == IR::Opcode::ReadConst) {
|
inst->GetOpcode() == IR::Opcode::ReadConst) {
|
||||||
return inst;
|
return inst;
|
||||||
@ -247,6 +250,7 @@ SharpLocation TrackSharp(const IR::Inst* inst, const Shader::Info& info) {
|
|||||||
const auto result = IR::BreadthFirstSearch(inst, pred);
|
const auto result = IR::BreadthFirstSearch(inst, pred);
|
||||||
ASSERT_MSG(result, "Unable to track sharp source");
|
ASSERT_MSG(result, "Unable to track sharp source");
|
||||||
inst = result.value();
|
inst = result.value();
|
||||||
|
visited_insts.emplace_back(inst);
|
||||||
if (inst->GetOpcode() == IR::Opcode::GetUserData) {
|
if (inst->GetOpcode() == IR::Opcode::GetUserData) {
|
||||||
return static_cast<u32>(inst->Arg(0).ScalarReg());
|
return static_cast<u32>(inst->Arg(0).ScalarReg());
|
||||||
} else {
|
} else {
|
||||||
@ -256,6 +260,29 @@ SharpLocation TrackSharp(const IR::Inst* inst, const Shader::Info& info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tracks a sharp with validation of the chosen data type.
|
||||||
|
template <typename DataType>
|
||||||
|
std::pair<SharpLocation, DataType> TrackSharp(const IR::Inst* inst, const Info& info) {
|
||||||
|
boost::container::small_vector<const IR::Inst*, 4> visited_insts{};
|
||||||
|
while (true) {
|
||||||
|
const auto prev_size = visited_insts.size();
|
||||||
|
const auto sharp = AttemptTrackSharp(inst, visited_insts);
|
||||||
|
if (const auto data = info.ReadUdSharp<DataType>(sharp); data.Valid()) {
|
||||||
|
return std::make_pair(sharp, data);
|
||||||
|
}
|
||||||
|
if (prev_size == visited_insts.size()) {
|
||||||
|
// No change in visited instructions, we've run out of paths.
|
||||||
|
UNREACHABLE_MSG("Unable to find valid sharp.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Tracks a sharp without data validation.
|
||||||
|
SharpLocation TrackSharp(const IR::Inst* inst, const Info& info) {
|
||||||
|
boost::container::static_vector<const IR::Inst*, 1> visited_insts{};
|
||||||
|
return AttemptTrackSharp(inst, visited_insts);
|
||||||
|
}
|
||||||
|
|
||||||
s32 TryHandleInlineCbuf(IR::Inst& inst, Info& info, Descriptors& descriptors,
|
s32 TryHandleInlineCbuf(IR::Inst& inst, Info& info, Descriptors& descriptors,
|
||||||
AmdGpu::Buffer& cbuf) {
|
AmdGpu::Buffer& cbuf) {
|
||||||
|
|
||||||
@ -293,8 +320,8 @@ void PatchBufferSharp(IR::Block& block, IR::Inst& inst, Info& info, Descriptors&
|
|||||||
if (binding = TryHandleInlineCbuf(inst, info, descriptors, buffer); binding == -1) {
|
if (binding = TryHandleInlineCbuf(inst, info, descriptors, buffer); binding == -1) {
|
||||||
IR::Inst* handle = inst.Arg(0).InstRecursive();
|
IR::Inst* handle = inst.Arg(0).InstRecursive();
|
||||||
IR::Inst* producer = handle->Arg(0).InstRecursive();
|
IR::Inst* producer = handle->Arg(0).InstRecursive();
|
||||||
const auto sharp = TrackSharp(producer, info);
|
SharpLocation sharp;
|
||||||
buffer = info.ReadUdSharp<AmdGpu::Buffer>(sharp);
|
std::tie(sharp, buffer) = TrackSharp<AmdGpu::Buffer>(producer, info);
|
||||||
binding = descriptors.Add(BufferResource{
|
binding = descriptors.Add(BufferResource{
|
||||||
.sharp_idx = sharp,
|
.sharp_idx = sharp,
|
||||||
.used_types = BufferDataType(inst, buffer.GetNumberFmt()),
|
.used_types = BufferDataType(inst, buffer.GetNumberFmt()),
|
||||||
|
@ -249,7 +249,7 @@ bool Instance::CreateDevice() {
|
|||||||
add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
|
add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
|
||||||
add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
|
add_extension(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
|
||||||
add_extension(VK_EXT_TOOLING_INFO_EXTENSION_NAME);
|
add_extension(VK_EXT_TOOLING_INFO_EXTENSION_NAME);
|
||||||
const bool maintenance4 = add_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME);
|
add_extension(VK_KHR_MAINTENANCE_4_EXTENSION_NAME);
|
||||||
|
|
||||||
add_extension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
add_extension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||||
add_extension(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
add_extension(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
||||||
@ -422,9 +422,6 @@ bool Instance::CreateDevice() {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!maintenance4) {
|
|
||||||
device_chain.unlink<vk::PhysicalDeviceMaintenance4FeaturesKHR>();
|
|
||||||
}
|
|
||||||
if (!custom_border_color) {
|
if (!custom_border_color) {
|
||||||
device_chain.unlink<vk::PhysicalDeviceCustomBorderColorFeaturesEXT>();
|
device_chain.unlink<vk::PhysicalDeviceCustomBorderColorFeaturesEXT>();
|
||||||
}
|
}
|
||||||
|
@ -930,12 +930,17 @@ bool Rasterizer::IsMapped(VAddr addr, u64 size) {
|
|||||||
// There is no memory, so not mapped.
|
// There is no memory, so not mapped.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return mapped_ranges.find(boost::icl::interval<VAddr>::right_open(addr, addr + size)) !=
|
const auto range = decltype(mapped_ranges)::interval_type::right_open(addr, addr + size);
|
||||||
mapped_ranges.end();
|
|
||||||
|
std::shared_lock lock{mapped_ranges_mutex};
|
||||||
|
return boost::icl::contains(mapped_ranges, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rasterizer::MapMemory(VAddr addr, u64 size) {
|
void Rasterizer::MapMemory(VAddr addr, u64 size) {
|
||||||
mapped_ranges += boost::icl::interval<VAddr>::right_open(addr, addr + size);
|
{
|
||||||
|
std::unique_lock lock{mapped_ranges_mutex};
|
||||||
|
mapped_ranges += decltype(mapped_ranges)::interval_type::right_open(addr, addr + size);
|
||||||
|
}
|
||||||
page_manager.OnGpuMap(addr, size);
|
page_manager.OnGpuMap(addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,7 +948,10 @@ void Rasterizer::UnmapMemory(VAddr addr, u64 size) {
|
|||||||
buffer_cache.InvalidateMemory(addr, size);
|
buffer_cache.InvalidateMemory(addr, size);
|
||||||
texture_cache.UnmapMemory(addr, size);
|
texture_cache.UnmapMemory(addr, size);
|
||||||
page_manager.OnGpuUnmap(addr, size);
|
page_manager.OnGpuUnmap(addr, size);
|
||||||
mapped_ranges -= boost::icl::interval<VAddr>::right_open(addr, addr + size);
|
{
|
||||||
|
std::unique_lock lock{mapped_ranges_mutex};
|
||||||
|
mapped_ranges -= decltype(mapped_ranges)::interval_type::right_open(addr, addr + size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rasterizer::UpdateDynamicState(const GraphicsPipeline& pipeline) const {
|
void Rasterizer::UpdateDynamicState(const GraphicsPipeline& pipeline) const {
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <shared_mutex>
|
||||||
|
|
||||||
#include "video_core/buffer_cache/buffer_cache.h"
|
#include "video_core/buffer_cache/buffer_cache.h"
|
||||||
#include "video_core/page_manager.h"
|
#include "video_core/page_manager.h"
|
||||||
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
||||||
@ -106,6 +108,7 @@ private:
|
|||||||
AmdGpu::Liverpool* liverpool;
|
AmdGpu::Liverpool* liverpool;
|
||||||
Core::MemoryManager* memory;
|
Core::MemoryManager* memory;
|
||||||
boost::icl::interval_set<VAddr> mapped_ranges;
|
boost::icl::interval_set<VAddr> mapped_ranges;
|
||||||
|
std::shared_mutex mapped_ranges_mutex;
|
||||||
PipelineCache pipeline_cache;
|
PipelineCache pipeline_cache;
|
||||||
|
|
||||||
boost::container::static_vector<
|
boost::container::static_vector<
|
||||||
|
Loading…
Reference in New Issue
Block a user