Compare commits
31 Commits
android-88
...
android-94
Author | SHA1 | Date | |
---|---|---|---|
9ffb91e8f4 | |||
bd42bba71c | |||
a27f94830a | |||
bd6f9f1d91 | |||
bf15aa093c | |||
0e9b839b6f | |||
15a5bdd979 | |||
fc4cde7513 | |||
ff3859d482 | |||
10de8f2c60 | |||
51b89fddd0 | |||
f585dec48d | |||
ad1a9f3d3a | |||
71044f6def | |||
a17cde7b2c | |||
a84c928827 | |||
9568d3bc60 | |||
0fe935a5de | |||
c84c35ac74 | |||
b32940d3ea | |||
7a0da729b4 | |||
0448eb6f0f | |||
ff57c66773 | |||
c6d552f29b | |||
7f9b64519d | |||
d89ef6280c | |||
8fb13372c2 | |||
f9521f5bd4 | |||
38394f36d7 | |||
2f0db2708c | |||
1a246bf135 |
@ -1,7 +1,7 @@
|
||||
# SPDX-FileCopyrightText: 2019 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Gets a UTC timstamp and sets the provided variable to it
|
||||
# Gets a UTC timestamp and sets the provided variable to it
|
||||
function(get_timestamp _var)
|
||||
string(TIMESTAMP timestamp UTC)
|
||||
set(${_var} "${timestamp}" PARENT_SCOPE)
|
||||
|
@ -1,3 +1,11 @@
|
||||
| Pull Request | Commit | Title | Author | Merged? |
|
||||
|----|----|----|----|----|
|
||||
|
||||
|
||||
End of merge log. You can find the original README.md below the break.
|
||||
|
||||
-----
|
||||
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2018 yuzu Emulator Project
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
@ -218,7 +218,6 @@ public:
|
||||
return;
|
||||
}
|
||||
m_window->OnSurfaceChanged(m_native_window);
|
||||
m_system.Renderer().NotifySurfaceChanged();
|
||||
}
|
||||
|
||||
void ConfigureFilesystemProvider(const std::string& filepath) {
|
||||
|
@ -16,7 +16,7 @@ namespace AudioCore::Renderer {
|
||||
|
||||
/**
|
||||
* AudioRenderer command for preparing depop.
|
||||
* Adds the previusly output last samples to the depop buffer.
|
||||
* Adds the previously output last samples to the depop buffer.
|
||||
*/
|
||||
struct DepopPrepareCommand : ICommand {
|
||||
/**
|
||||
|
@ -135,6 +135,11 @@ std::u16string UTF8ToUTF16(std::string_view input) {
|
||||
return convert.from_bytes(input.data(), input.data() + input.size());
|
||||
}
|
||||
|
||||
std::u32string UTF8ToUTF32(std::string_view input) {
|
||||
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert;
|
||||
return convert.from_bytes(input.data(), input.data() + input.size());
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static std::wstring CPToUTF16(u32 code_page, std::string_view input) {
|
||||
const auto size =
|
||||
|
@ -38,6 +38,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
|
||||
|
||||
[[nodiscard]] std::string UTF16ToUTF8(std::u16string_view input);
|
||||
[[nodiscard]] std::u16string UTF8ToUTF16(std::string_view input);
|
||||
[[nodiscard]] std::u32string UTF8ToUTF32(std::string_view input);
|
||||
|
||||
#ifdef _WIN32
|
||||
[[nodiscard]] std::string UTF16ToUTF8(std::wstring_view input);
|
||||
|
@ -1078,6 +1078,10 @@ void System::ApplySettings() {
|
||||
impl->RefreshTime();
|
||||
|
||||
if (IsPoweredOn()) {
|
||||
if (Settings::values.custom_rtc_enabled) {
|
||||
const s64 posix_time{Settings::values.custom_rtc.GetValue()};
|
||||
GetTimeManager().UpdateLocalSystemClockTime(posix_time);
|
||||
}
|
||||
Renderer().RefreshBaseSettings();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <atomic>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <thread>
|
||||
@ -12,6 +14,7 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/debugger/gdbstub.h"
|
||||
@ -68,10 +71,16 @@ static std::string EscapeGDB(std::string_view data) {
|
||||
}
|
||||
|
||||
static std::string EscapeXML(std::string_view data) {
|
||||
std::u32string converted = U"[Encoding error]";
|
||||
try {
|
||||
converted = Common::UTF8ToUTF32(data);
|
||||
} catch (std::range_error&) {
|
||||
}
|
||||
|
||||
std::string escaped;
|
||||
escaped.reserve(data.size());
|
||||
|
||||
for (char c : data) {
|
||||
for (char32_t c : converted) {
|
||||
switch (c) {
|
||||
case '&':
|
||||
escaped += "&";
|
||||
@ -86,7 +95,11 @@ static std::string EscapeXML(std::string_view data) {
|
||||
escaped += ">";
|
||||
break;
|
||||
default:
|
||||
escaped += c;
|
||||
if (c > 0x7f) {
|
||||
escaped += fmt::format("&#{};", static_cast<u32>(c));
|
||||
} else {
|
||||
escaped += static_cast<char>(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "core/file_sys/program_metadata.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/loader/loader.h"
|
||||
@ -95,6 +96,13 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) {
|
||||
return Loader::ResultStatus::Success;
|
||||
}
|
||||
|
||||
Loader::ResultStatus ProgramMetadata::Reload(VirtualFile file) {
|
||||
const u64 original_program_id = aci_header.title_id;
|
||||
SCOPE_EXIT({ aci_header.title_id = original_program_id; });
|
||||
|
||||
return this->Load(file);
|
||||
}
|
||||
|
||||
/*static*/ ProgramMetadata ProgramMetadata::GetDefault() {
|
||||
// Allow use of cores 0~3 and thread priorities 1~63.
|
||||
constexpr u32 default_thread_info_capability = 0x30007F7;
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
static ProgramMetadata GetDefault();
|
||||
|
||||
Loader::ResultStatus Load(VirtualFile file);
|
||||
Loader::ResultStatus Reload(VirtualFile file);
|
||||
|
||||
/// Load from parameters instead of NPDM file, used for KIP
|
||||
void LoadManual(bool is_64_bit, ProgramAddressSpaceType address_space, s32 main_thread_prio,
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
return Write(reinterpret_cast<const u8*>(&data), sizeof(T), offset);
|
||||
}
|
||||
|
||||
// Renames the file to name. Returns whether or not the operation was successsful.
|
||||
// Renames the file to name. Returns whether or not the operation was successful.
|
||||
virtual bool Rename(std::string_view name) = 0;
|
||||
|
||||
// Returns the full path of this file as a string, recursively
|
||||
|
@ -61,7 +61,7 @@ bool KMemoryRegionTree::Insert(u64 address, size_t size, u32 type_id, u32 new_at
|
||||
found->Reset(address, inserted_region_last, old_pair, new_attr, type_id);
|
||||
this->insert(*found);
|
||||
} else {
|
||||
// If we can't re-use, adjust the old region.
|
||||
// If we can't reuse, adjust the old region.
|
||||
found->Reset(old_address, address - 1, old_pair, old_attr, old_type);
|
||||
this->insert(*found);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "common/assert.h"
|
||||
#include "common/literals.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_address_space_info.h"
|
||||
#include "core/hle/kernel/k_memory_block.h"
|
||||
@ -337,11 +338,14 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type
|
||||
}
|
||||
|
||||
void KPageTable::Finalize() {
|
||||
auto HostUnmapCallback = [&](KProcessAddress addr, u64 size) {
|
||||
if (Settings::IsFastmemEnabled()) {
|
||||
m_system.DeviceMemory().buffer.Unmap(GetInteger(addr), size);
|
||||
}
|
||||
};
|
||||
|
||||
// Finalize memory blocks.
|
||||
m_memory_block_manager.Finalize(m_memory_block_slab_manager,
|
||||
[&](KProcessAddress addr, u64 size) {
|
||||
m_memory->UnmapRegion(*m_page_table_impl, addr, size);
|
||||
});
|
||||
m_memory_block_manager.Finalize(m_memory_block_slab_manager, std::move(HostUnmapCallback));
|
||||
|
||||
// Release any insecure mapped memory.
|
||||
if (m_mapped_insecure_memory) {
|
||||
|
@ -855,6 +855,9 @@ FSP_SRV::FSP_SRV(Core::System& system_)
|
||||
if (Settings::values.enable_fs_access_log) {
|
||||
access_log_mode = AccessLogMode::SdCard;
|
||||
}
|
||||
|
||||
// This should be true on creation
|
||||
fsc.SetAutoSaveDataCreation(true);
|
||||
}
|
||||
|
||||
FSP_SRV::~FSP_SRV() = default;
|
||||
|
@ -118,7 +118,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
||||
return {ResultStatus::ErrorMissingNPDM, {}};
|
||||
}
|
||||
|
||||
const ResultStatus result2 = metadata.Load(npdm);
|
||||
const ResultStatus result2 = metadata.Reload(npdm);
|
||||
if (result2 != ResultStatus::Success) {
|
||||
return {result2, {}};
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
* @param player_index the player number that will take this action
|
||||
* @param delta_timestamp time passed since last reading
|
||||
* @param gyro_x,gyro_y,gyro_z the gyro sensor readings
|
||||
* @param accel_x,accel_y,accel_z the acelerometer reading
|
||||
* @param accel_x,accel_y,accel_z the accelerometer reading
|
||||
*/
|
||||
void SetMotionState(std::size_t player_index, u64 delta_timestamp, float gyro_x, float gyro_y,
|
||||
float gyro_z, float accel_x, float accel_y, float accel_z);
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
/**
|
||||
* Configures the motion sensor with the specified parameters
|
||||
* @param gsen gyroscope sensor sensitvity in degrees per second
|
||||
* @param gsen gyroscope sensor sensitivity in degrees per second
|
||||
* @param gfrec gyroscope sensor frequency in hertz
|
||||
* @param asen accelerometer sensitivity in G force
|
||||
* @param afrec accelerometer frequency in hertz
|
||||
|
@ -55,7 +55,7 @@ void CompositeInsert(EmitContext& ctx, IR::Inst& inst, Register composite, Objec
|
||||
"MOV.{} {}.{},{};",
|
||||
type, ret, composite, type, ret, swizzle, object);
|
||||
} else {
|
||||
// The return value is alised so we can just insert the object, it doesn't matter if it's
|
||||
// The return value is aliased so we can just insert the object, it doesn't matter if it's
|
||||
// aliased
|
||||
ctx.Add("MOV.{} {}.{},{};", type, ret, swizzle, object);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ private:
|
||||
u32 method_count; ///< Current method count
|
||||
u32 length_pending; ///< Large NI command length pending
|
||||
GPUVAddr dma_get; ///< Currently read segment
|
||||
u64 dma_word_offset; ///< Current word ofset from address
|
||||
u64 dma_word_offset; ///< Current word offset from address
|
||||
bool non_incrementing; ///< Current command's NI flag
|
||||
bool is_last_call;
|
||||
};
|
||||
|
@ -19,6 +19,7 @@ set(SHADER_FILES
|
||||
block_linear_unswizzle_2d.comp
|
||||
block_linear_unswizzle_3d.comp
|
||||
convert_abgr8_to_d24s8.frag
|
||||
convert_d32f_to_abgr8.frag
|
||||
convert_d24s8_to_abgr8.frag
|
||||
convert_depth_to_float.frag
|
||||
convert_float_to_depth.frag
|
||||
|
14
src/video_core/host_shaders/convert_d32f_to_abgr8.frag
Normal file
14
src/video_core/host_shaders/convert_d32f_to_abgr8.frag
Normal file
@ -0,0 +1,14 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#version 450
|
||||
|
||||
layout(binding = 0) uniform sampler2D depth_tex;
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
void main() {
|
||||
ivec2 coord = ivec2(gl_FragCoord.xy);
|
||||
float depth = textureLod(depth_tex, coord, 0).r;
|
||||
color = vec4(depth, depth, depth, 1.0);
|
||||
}
|
@ -89,9 +89,6 @@ public:
|
||||
void RequestScreenshot(void* data, std::function<void(bool)> callback,
|
||||
const Layout::FramebufferLayout& layout);
|
||||
|
||||
/// This is called to notify the rendering backend of a surface change
|
||||
virtual void NotifySurfaceChanged() {}
|
||||
|
||||
protected:
|
||||
Core::Frontend::EmuWindow& render_window; ///< Reference to the render window handle.
|
||||
std::unique_ptr<Core::Frontend::GraphicsContext> context;
|
||||
|
@ -116,6 +116,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB
|
||||
{GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV}, // E5B9G9R9_FLOAT
|
||||
{GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}, // D32_FLOAT
|
||||
{GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}, // D16_UNORM
|
||||
{GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8}, // X8_D24_UNORM
|
||||
{GL_STENCIL_INDEX8, GL_STENCIL, GL_UNSIGNED_BYTE}, // S8_UINT
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // D24_UNORM_S8_UINT
|
||||
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, // S8_UINT_D24_UNORM
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "video_core/host_shaders/blit_color_float_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_abgr8_to_d24s8_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_depth_to_float_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_float_to_depth_frag_spv.h"
|
||||
#include "video_core/host_shaders/convert_s8d24_to_abgr8_frag_spv.h"
|
||||
@ -433,6 +434,7 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_,
|
||||
convert_depth_to_float_frag(BuildShader(device, CONVERT_DEPTH_TO_FLOAT_FRAG_SPV)),
|
||||
convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)),
|
||||
convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)),
|
||||
convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)),
|
||||
convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)),
|
||||
convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)),
|
||||
linear_sampler(device.GetLogical().CreateSampler(SAMPLER_CREATE_INFO<VK_FILTER_LINEAR>)),
|
||||
@ -557,6 +559,13 @@ void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer,
|
||||
Convert(*convert_abgr8_to_d24s8_pipeline, dst_framebuffer, src_image_view);
|
||||
}
|
||||
|
||||
void BlitImageHelper::ConvertD32FToABGR8(const Framebuffer* dst_framebuffer,
|
||||
ImageView& src_image_view) {
|
||||
ConvertPipelineColorTargetEx(convert_d32f_to_abgr8_pipeline, dst_framebuffer->RenderPass(),
|
||||
convert_d32f_to_abgr8_frag);
|
||||
ConvertDepthStencil(*convert_d32f_to_abgr8_pipeline, dst_framebuffer, src_image_view);
|
||||
}
|
||||
|
||||
void BlitImageHelper::ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer,
|
||||
ImageView& src_image_view) {
|
||||
ConvertPipelineColorTargetEx(convert_d24s8_to_abgr8_pipeline, dst_framebuffer->RenderPass(),
|
||||
@ -609,6 +618,8 @@ void BlitImageHelper::ClearDepthStencil(const Framebuffer* dst_framebuffer, bool
|
||||
const VkPipelineLayout layout = *clear_color_pipeline_layout;
|
||||
scheduler.RequestRenderpass(dst_framebuffer);
|
||||
scheduler.Record([pipeline, layout, clear_depth, dst_region](vk::CommandBuffer cmdbuf) {
|
||||
constexpr std::array blend_constants{0.0f, 0.0f, 0.0f, 0.0f};
|
||||
cmdbuf.SetBlendConstants(blend_constants.data());
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
BindBlitState(cmdbuf, dst_region);
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_FRAGMENT_BIT, clear_depth);
|
||||
@ -865,7 +876,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearStencilPipeline(
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.depthTestEnable = VK_FALSE,
|
||||
.depthTestEnable = key.depth_clear,
|
||||
.depthWriteEnable = key.depth_clear,
|
||||
.depthCompareOp = VK_COMPARE_OP_ALWAYS,
|
||||
.depthBoundsTestEnable = VK_FALSE,
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
|
||||
void ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, const ImageView& src_image_view);
|
||||
|
||||
void ConvertD32FToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
||||
|
||||
void ConvertD24S8ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
||||
|
||||
void ConvertS8D24ToABGR8(const Framebuffer* dst_framebuffer, ImageView& src_image_view);
|
||||
@ -128,6 +130,7 @@ private:
|
||||
vk::ShaderModule convert_depth_to_float_frag;
|
||||
vk::ShaderModule convert_float_to_depth_frag;
|
||||
vk::ShaderModule convert_abgr8_to_d24s8_frag;
|
||||
vk::ShaderModule convert_d32f_to_abgr8_frag;
|
||||
vk::ShaderModule convert_d24s8_to_abgr8_frag;
|
||||
vk::ShaderModule convert_s8d24_to_abgr8_frag;
|
||||
vk::Sampler linear_sampler;
|
||||
@ -146,6 +149,7 @@ private:
|
||||
vk::Pipeline convert_d16_to_r16_pipeline;
|
||||
vk::Pipeline convert_r16_to_d16_pipeline;
|
||||
vk::Pipeline convert_abgr8_to_d24s8_pipeline;
|
||||
vk::Pipeline convert_d32f_to_abgr8_pipeline;
|
||||
vk::Pipeline convert_d24s8_to_abgr8_pipeline;
|
||||
vk::Pipeline convert_s8d24_to_abgr8_pipeline;
|
||||
};
|
||||
|
@ -214,8 +214,9 @@ struct FormatTuple {
|
||||
{VK_FORMAT_E5B9G9R9_UFLOAT_PACK32}, // E5B9G9R9_FLOAT
|
||||
|
||||
// Depth formats
|
||||
{VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT
|
||||
{VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM
|
||||
{VK_FORMAT_D32_SFLOAT, Attachable}, // D32_FLOAT
|
||||
{VK_FORMAT_D16_UNORM, Attachable}, // D16_UNORM
|
||||
{VK_FORMAT_X8_D24_UNORM_PACK32, Attachable}, // X8_D24_UNORM
|
||||
|
||||
// Stencil formats
|
||||
{VK_FORMAT_S8_UINT, Attachable}, // S8_UINT
|
||||
|
@ -56,10 +56,6 @@ public:
|
||||
return device.GetDriverName();
|
||||
}
|
||||
|
||||
void NotifySurfaceChanged() override {
|
||||
present_manager.NotifySurfaceChanged();
|
||||
}
|
||||
|
||||
private:
|
||||
void Report() const;
|
||||
|
||||
|
@ -96,6 +96,7 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) {
|
||||
VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
|
||||
switch (framebuffer.pixel_format) {
|
||||
case Service::android::PixelFormat::Rgba8888:
|
||||
case Service::android::PixelFormat::Rgbx8888:
|
||||
return VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||
case Service::android::PixelFormat::Rgb565:
|
||||
return VK_FORMAT_R5G6B5_UNORM_PACK16;
|
||||
|
@ -103,8 +103,7 @@ PresentManager::PresentManager(const vk::Instance& instance_,
|
||||
surface{surface_}, blit_supported{CanBlitToSwapchain(device.GetPhysical(),
|
||||
swapchain.GetImageViewFormat())},
|
||||
use_present_thread{Settings::values.async_presentation.GetValue()},
|
||||
image_count{swapchain.GetImageCount()}, last_render_surface{
|
||||
render_window_.GetWindowInfo().render_surface} {
|
||||
image_count{swapchain.GetImageCount()} {
|
||||
|
||||
auto& dld = device.GetLogical();
|
||||
cmdpool = dld.CreateCommandPool({
|
||||
@ -289,44 +288,36 @@ void PresentManager::PresentThread(std::stop_token token) {
|
||||
}
|
||||
}
|
||||
|
||||
void PresentManager::NotifySurfaceChanged() {
|
||||
#ifdef ANDROID
|
||||
std::scoped_lock lock{recreate_surface_mutex};
|
||||
recreate_surface_cv.notify_one();
|
||||
#endif
|
||||
void PresentManager::RecreateSwapchain(Frame* frame) {
|
||||
swapchain.Create(*surface, frame->width, frame->height, frame->is_srgb);
|
||||
image_count = swapchain.GetImageCount();
|
||||
}
|
||||
|
||||
void PresentManager::CopyToSwapchain(Frame* frame) {
|
||||
MICROPROFILE_SCOPE(Vulkan_CopyToSwapchain);
|
||||
bool requires_recreation = false;
|
||||
|
||||
const auto recreate_swapchain = [&] {
|
||||
swapchain.Create(*surface, frame->width, frame->height, frame->is_srgb);
|
||||
image_count = swapchain.GetImageCount();
|
||||
};
|
||||
while (true) {
|
||||
try {
|
||||
// Recreate surface and swapchain if needed.
|
||||
if (requires_recreation) {
|
||||
surface = CreateSurface(instance, render_window.GetWindowInfo());
|
||||
RecreateSwapchain(frame);
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
std::unique_lock lock{recreate_surface_mutex};
|
||||
// Draw to swapchain.
|
||||
return CopyToSwapchainImpl(frame);
|
||||
} catch (const vk::Exception& except) {
|
||||
if (except.GetResult() != VK_ERROR_SURFACE_LOST_KHR) {
|
||||
throw;
|
||||
}
|
||||
|
||||
const auto needs_recreation = [&] {
|
||||
if (last_render_surface != render_window.GetWindowInfo().render_surface) {
|
||||
return true;
|
||||
requires_recreation = true;
|
||||
}
|
||||
if (swapchain.NeedsRecreation(frame->is_srgb)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
recreate_surface_cv.wait_for(lock, std::chrono::milliseconds(400),
|
||||
[&]() { return !needs_recreation(); });
|
||||
|
||||
// If the frontend recreated the surface, recreate the renderer surface and swapchain.
|
||||
if (last_render_surface != render_window.GetWindowInfo().render_surface) {
|
||||
last_render_surface = render_window.GetWindowInfo().render_surface;
|
||||
surface = CreateSurface(instance, render_window.GetWindowInfo());
|
||||
recreate_swapchain();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PresentManager::CopyToSwapchainImpl(Frame* frame) {
|
||||
MICROPROFILE_SCOPE(Vulkan_CopyToSwapchain);
|
||||
|
||||
// If the size or colorspace of the incoming frames has changed, recreate the swapchain
|
||||
// to account for that.
|
||||
@ -334,11 +325,11 @@ void PresentManager::CopyToSwapchain(Frame* frame) {
|
||||
const bool size_changed =
|
||||
swapchain.GetWidth() != frame->width || swapchain.GetHeight() != frame->height;
|
||||
if (srgb_changed || size_changed) {
|
||||
recreate_swapchain();
|
||||
RecreateSwapchain(frame);
|
||||
}
|
||||
|
||||
while (swapchain.AcquireNextImage()) {
|
||||
recreate_swapchain();
|
||||
RecreateSwapchain(frame);
|
||||
}
|
||||
|
||||
const vk::CommandBuffer cmdbuf{frame->cmdbuf};
|
||||
@ -488,4 +479,4 @@ void PresentManager::CopyToSwapchain(Frame* frame) {
|
||||
swapchain.Present(render_semaphore);
|
||||
}
|
||||
|
||||
} // namespace Vulkan
|
||||
} // namespace Vulkan
|
||||
|
@ -54,14 +54,15 @@ public:
|
||||
/// Waits for the present thread to finish presenting all queued frames.
|
||||
void WaitPresent();
|
||||
|
||||
/// This is called to notify the rendering backend of a surface change
|
||||
void NotifySurfaceChanged();
|
||||
|
||||
private:
|
||||
void PresentThread(std::stop_token token);
|
||||
|
||||
void CopyToSwapchain(Frame* frame);
|
||||
|
||||
void CopyToSwapchainImpl(Frame* frame);
|
||||
|
||||
void RecreateSwapchain(Frame* frame);
|
||||
|
||||
private:
|
||||
const vk::Instance& instance;
|
||||
Core::Frontend::EmuWindow& render_window;
|
||||
@ -76,16 +77,13 @@ private:
|
||||
std::queue<Frame*> free_queue;
|
||||
std::condition_variable_any frame_cv;
|
||||
std::condition_variable free_cv;
|
||||
std::condition_variable recreate_surface_cv;
|
||||
std::mutex swapchain_mutex;
|
||||
std::mutex recreate_surface_mutex;
|
||||
std::mutex queue_mutex;
|
||||
std::mutex free_mutex;
|
||||
std::jthread present_thread;
|
||||
bool blit_supported;
|
||||
bool use_present_thread;
|
||||
std::size_t image_count{};
|
||||
void* last_render_surface{};
|
||||
};
|
||||
|
||||
} // namespace Vulkan
|
||||
|
@ -422,7 +422,8 @@ void RasterizerVulkan::Clear(u32 layer_count) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (use_stencil && regs.stencil_front_mask != 0xFF && regs.stencil_front_mask != 0) {
|
||||
if (use_stencil && framebuffer->HasAspectStencilBit() && regs.stencil_front_mask != 0xFF &&
|
||||
regs.stencil_front_mask != 0) {
|
||||
Region2D dst_region = {
|
||||
Offset2D{.x = clear_rect.rect.offset.x, .y = clear_rect.rect.offset.y},
|
||||
Offset2D{.x = clear_rect.rect.offset.x + static_cast<s32>(clear_rect.rect.extent.width),
|
||||
|
@ -24,25 +24,38 @@ using namespace Common::Literals;
|
||||
|
||||
// Maximum potential alignment of a Vulkan buffer
|
||||
constexpr VkDeviceSize MAX_ALIGNMENT = 256;
|
||||
// Maximum size to put elements in the stream buffer
|
||||
constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8_MiB;
|
||||
// Stream buffer size in bytes
|
||||
constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128_MiB;
|
||||
constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
|
||||
constexpr VkDeviceSize MAX_STREAM_BUFFER_SIZE = 128_MiB;
|
||||
|
||||
size_t Region(size_t iterator) noexcept {
|
||||
return iterator / REGION_SIZE;
|
||||
size_t GetStreamBufferSize(const Device& device) {
|
||||
VkDeviceSize size{0};
|
||||
if (device.HasDebuggingToolAttached()) {
|
||||
ForEachDeviceLocalHostVisibleHeap(device, [&size](size_t index, VkMemoryHeap& heap) {
|
||||
size = std::max(size, heap.size);
|
||||
});
|
||||
// If rebar is not supported, cut the max heap size to 40%. This will allow 2 captures to be
|
||||
// loaded at the same time in RenderDoc. If rebar is supported, this shouldn't be an issue
|
||||
// as the heap will be much larger.
|
||||
if (size <= 256_MiB) {
|
||||
size = size * 40 / 100;
|
||||
}
|
||||
} else {
|
||||
size = MAX_STREAM_BUFFER_SIZE;
|
||||
}
|
||||
return std::min(Common::AlignUp(size, MAX_ALIGNMENT), MAX_STREAM_BUFFER_SIZE);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& memory_allocator_,
|
||||
Scheduler& scheduler_)
|
||||
: device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_} {
|
||||
: device{device_}, memory_allocator{memory_allocator_}, scheduler{scheduler_},
|
||||
stream_buffer_size{GetStreamBufferSize(device)}, region_size{stream_buffer_size /
|
||||
StagingBufferPool::NUM_SYNCS} {
|
||||
VkBufferCreateInfo stream_ci = {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.size = STREAM_BUFFER_SIZE,
|
||||
.size = stream_buffer_size,
|
||||
.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
|
||||
VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
|
||||
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
||||
@ -63,7 +76,7 @@ StagingBufferPool::StagingBufferPool(const Device& device_, MemoryAllocator& mem
|
||||
StagingBufferPool::~StagingBufferPool() = default;
|
||||
|
||||
StagingBufferRef StagingBufferPool::Request(size_t size, MemoryUsage usage, bool deferred) {
|
||||
if (!deferred && usage == MemoryUsage::Upload && size <= MAX_STREAM_BUFFER_REQUEST_SIZE) {
|
||||
if (!deferred && usage == MemoryUsage::Upload && size <= region_size) {
|
||||
return GetStreamBuffer(size);
|
||||
}
|
||||
return GetStagingBuffer(size, usage, deferred);
|
||||
@ -101,7 +114,7 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
||||
used_iterator = iterator;
|
||||
free_iterator = std::max(free_iterator, iterator + size);
|
||||
|
||||
if (iterator + size >= STREAM_BUFFER_SIZE) {
|
||||
if (iterator + size >= stream_buffer_size) {
|
||||
std::fill(sync_ticks.begin() + Region(used_iterator), sync_ticks.begin() + NUM_SYNCS,
|
||||
current_tick);
|
||||
used_iterator = 0;
|
||||
|
@ -90,6 +90,9 @@ private:
|
||||
void ReleaseCache(MemoryUsage usage);
|
||||
|
||||
void ReleaseLevel(StagingBuffersCache& cache, size_t log2);
|
||||
size_t Region(size_t iter) const noexcept {
|
||||
return iter / region_size;
|
||||
}
|
||||
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
@ -97,6 +100,8 @@ private:
|
||||
|
||||
vk::Buffer stream_buffer;
|
||||
std::span<u8> stream_pointer;
|
||||
VkDeviceSize stream_buffer_size;
|
||||
VkDeviceSize region_size;
|
||||
|
||||
size_t iterator = 0;
|
||||
size_t used_iterator = 0;
|
||||
|
@ -238,6 +238,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||
return any_r ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
case PixelFormat::D16_UNORM:
|
||||
case PixelFormat::D32_FLOAT:
|
||||
case PixelFormat::X8_D24_UNORM:
|
||||
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
case PixelFormat::S8_UINT:
|
||||
return VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
@ -1200,6 +1201,9 @@ void TextureCacheRuntime::ConvertImage(Framebuffer* dst, ImageView& dst_view, Im
|
||||
if (src_view.format == PixelFormat::D24_UNORM_S8_UINT) {
|
||||
return blit_image_helper.ConvertS8D24ToABGR8(dst, src_view);
|
||||
}
|
||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
||||
return blit_image_helper.ConvertD32FToABGR8(dst, src_view);
|
||||
}
|
||||
break;
|
||||
case PixelFormat::R32_FLOAT:
|
||||
if (src_view.format == PixelFormat::D32_FLOAT) {
|
||||
|
@ -85,6 +85,8 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format) {
|
||||
return PixelFormat::S8_UINT;
|
||||
case Tegra::DepthFormat::Z32_FLOAT_X24S8_UINT:
|
||||
return PixelFormat::D32_FLOAT_S8_UINT;
|
||||
case Tegra::DepthFormat::X8Z24_UNORM:
|
||||
return PixelFormat::X8_D24_UNORM;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unimplemented format={}", format);
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
@ -202,6 +204,7 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
|
||||
PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format) {
|
||||
switch (format) {
|
||||
case Service::android::PixelFormat::Rgba8888:
|
||||
case Service::android::PixelFormat::Rgbx8888:
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
case Service::android::PixelFormat::Rgb565:
|
||||
return PixelFormat::R5G6B5_UNORM;
|
||||
|
@ -115,6 +115,7 @@ enum class PixelFormat {
|
||||
// Depth formats
|
||||
D32_FLOAT = MaxColorFormat,
|
||||
D16_UNORM,
|
||||
X8_D24_UNORM,
|
||||
|
||||
MaxDepthFormat,
|
||||
|
||||
@ -251,6 +252,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{
|
||||
1, // E5B9G9R9_FLOAT
|
||||
1, // D32_FLOAT
|
||||
1, // D16_UNORM
|
||||
1, // X8_D24_UNORM
|
||||
1, // S8_UINT
|
||||
1, // D24_UNORM_S8_UINT
|
||||
1, // S8_UINT_D24_UNORM
|
||||
@ -360,6 +362,7 @@ constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{
|
||||
1, // E5B9G9R9_FLOAT
|
||||
1, // D32_FLOAT
|
||||
1, // D16_UNORM
|
||||
1, // X8_D24_UNORM
|
||||
1, // S8_UINT
|
||||
1, // D24_UNORM_S8_UINT
|
||||
1, // S8_UINT_D24_UNORM
|
||||
@ -469,6 +472,7 @@ constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{
|
||||
32, // E5B9G9R9_FLOAT
|
||||
32, // D32_FLOAT
|
||||
16, // D16_UNORM
|
||||
32, // X8_D24_UNORM
|
||||
8, // S8_UINT
|
||||
32, // D24_UNORM_S8_UINT
|
||||
32, // S8_UINT_D24_UNORM
|
||||
|
@ -142,6 +142,10 @@ PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red,
|
||||
return PixelFormat::D16_UNORM;
|
||||
case Hash(TextureFormat::Z16, UNORM, UINT, UINT, UINT, LINEAR):
|
||||
return PixelFormat::D16_UNORM;
|
||||
case Hash(TextureFormat::X8Z24, UNORM):
|
||||
return PixelFormat::X8_D24_UNORM;
|
||||
case Hash(TextureFormat::X8Z24, UNORM, UINT, UINT, UINT, LINEAR):
|
||||
return PixelFormat::X8_D24_UNORM;
|
||||
case Hash(TextureFormat::Z24S8, UINT, UNORM, UNORM, UNORM, LINEAR):
|
||||
return PixelFormat::S8_UINT_D24_UNORM;
|
||||
case Hash(TextureFormat::Z24S8, UINT, UNORM, UINT, UINT, LINEAR):
|
||||
|
@ -211,6 +211,8 @@ struct fmt::formatter<VideoCore::Surface::PixelFormat> : fmt::formatter<fmt::str
|
||||
return "D32_FLOAT";
|
||||
case PixelFormat::D16_UNORM:
|
||||
return "D16_UNORM";
|
||||
case PixelFormat::X8_D24_UNORM:
|
||||
return "X8_D24_UNORM";
|
||||
case PixelFormat::S8_UINT:
|
||||
return "S8_UINT";
|
||||
case PixelFormat::D24_UNORM_S8_UINT:
|
||||
|
@ -41,7 +41,7 @@ enum class ImageFlagBits : u32 {
|
||||
IsRescalable = 1 << 15,
|
||||
|
||||
AsynchronousDecode = 1 << 16,
|
||||
IsDecoding = 1 << 17, ///< Is currently being decoded asynchornously.
|
||||
IsDecoding = 1 << 17, ///< Is currently being decoded asynchronously.
|
||||
};
|
||||
DECLARE_ENUM_FLAG_OPERATORS(ImageFlagBits)
|
||||
|
||||
|
@ -85,6 +85,7 @@ bool ImageViewBase::SupportsAnisotropy() const noexcept {
|
||||
// Depth formats
|
||||
case PixelFormat::D32_FLOAT:
|
||||
case PixelFormat::D16_UNORM:
|
||||
case PixelFormat::X8_D24_UNORM:
|
||||
// Stencil formats
|
||||
case PixelFormat::S8_UINT:
|
||||
// DepthStencil formats
|
||||
|
@ -1195,7 +1195,7 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const
|
||||
return std::nullopt;
|
||||
}
|
||||
} else {
|
||||
// Format comaptibility is not relaxed, ensure we are creating a view on a compatible format
|
||||
// Format compatibility is not relaxed, ensure we are creating a view on a compatible format
|
||||
if (!IsViewCompatible(existing.format, candidate.format, broken_views, native_bgr)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@ -84,9 +84,12 @@ constexpr std::array VK_FORMAT_A4B4G4R4_UNORM_PACK16{
|
||||
} // namespace Alternatives
|
||||
|
||||
enum class NvidiaArchitecture {
|
||||
AmpereOrNewer,
|
||||
KeplerOrOlder,
|
||||
Maxwell,
|
||||
Pascal,
|
||||
Volta,
|
||||
Turing,
|
||||
VoltaOrOlder,
|
||||
AmpereOrNewer,
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -200,6 +203,7 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(vk::Physica
|
||||
VK_FORMAT_BC7_UNORM_BLOCK,
|
||||
VK_FORMAT_D16_UNORM,
|
||||
VK_FORMAT_D16_UNORM_S8_UINT,
|
||||
VK_FORMAT_X8_D24_UNORM_PACK32,
|
||||
VK_FORMAT_D24_UNORM_S8_UINT,
|
||||
VK_FORMAT_D32_SFLOAT,
|
||||
VK_FORMAT_D32_SFLOAT_S8_UINT,
|
||||
@ -321,13 +325,38 @@ NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical,
|
||||
physical.GetProperties2(physical_properties);
|
||||
if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) {
|
||||
// Only Ampere and newer support this feature
|
||||
// TODO: Find a way to differentiate Ampere and Ada
|
||||
return NvidiaArchitecture::AmpereOrNewer;
|
||||
}
|
||||
}
|
||||
if (exts.contains(VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME)) {
|
||||
return NvidiaArchitecture::Turing;
|
||||
}
|
||||
return NvidiaArchitecture::VoltaOrOlder;
|
||||
|
||||
if (exts.contains(VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME)) {
|
||||
VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT advanced_blending_props{};
|
||||
advanced_blending_props.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT;
|
||||
VkPhysicalDeviceProperties2 physical_properties{};
|
||||
physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
physical_properties.pNext = &advanced_blending_props;
|
||||
physical.GetProperties2(physical_properties);
|
||||
if (advanced_blending_props.advancedBlendMaxColorAttachments == 1) {
|
||||
return NvidiaArchitecture::Maxwell;
|
||||
}
|
||||
|
||||
if (exts.contains(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME)) {
|
||||
VkPhysicalDeviceConservativeRasterizationPropertiesEXT conservative_raster_props{};
|
||||
conservative_raster_props.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT;
|
||||
physical_properties.pNext = &conservative_raster_props;
|
||||
physical.GetProperties2(physical_properties);
|
||||
if (conservative_raster_props.degenerateLinesRasterized) {
|
||||
return NvidiaArchitecture::Volta;
|
||||
}
|
||||
return NvidiaArchitecture::Pascal;
|
||||
}
|
||||
}
|
||||
|
||||
return NvidiaArchitecture::KeplerOrOlder;
|
||||
}
|
||||
|
||||
std::vector<const char*> ExtensionListForVulkan(
|
||||
@ -504,19 +533,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
if (is_nvidia) {
|
||||
const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;
|
||||
const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
|
||||
switch (arch) {
|
||||
case NvidiaArchitecture::AmpereOrNewer:
|
||||
if (arch >= NvidiaArchitecture::AmpereOrNewer) {
|
||||
LOG_WARNING(Render_Vulkan, "Ampere and newer have broken float16 math");
|
||||
features.shader_float16_int8.shaderFloat16 = false;
|
||||
break;
|
||||
case NvidiaArchitecture::Turing:
|
||||
break;
|
||||
case NvidiaArchitecture::VoltaOrOlder:
|
||||
} else if (arch <= NvidiaArchitecture::Volta) {
|
||||
if (nv_major_version < 527) {
|
||||
LOG_WARNING(Render_Vulkan, "Volta and older have broken VK_KHR_push_descriptor");
|
||||
RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (nv_major_version >= 510) {
|
||||
LOG_WARNING(Render_Vulkan, "NVIDIA Drivers >= 510 do not support MSAA image blits");
|
||||
@ -661,7 +685,15 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
"ANV drivers 22.3.0 to 23.1.0 have broken VK_KHR_push_descriptor");
|
||||
RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
||||
}
|
||||
} else if (extensions.push_descriptor && is_nvidia) {
|
||||
const auto arch = GetNvidiaArchitecture(physical, supported_extensions);
|
||||
if (arch <= NvidiaArchitecture::Pascal) {
|
||||
LOG_WARNING(Render_Vulkan,
|
||||
"Pascal and older architectures have broken VK_KHR_push_descriptor");
|
||||
RemoveExtension(extensions.push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mvk) {
|
||||
LOG_WARNING(Render_Vulkan,
|
||||
"MVK driver breaks when using more than 16 vertex attributes/bindings");
|
||||
|
@ -314,7 +314,7 @@ public:
|
||||
return GetDriverID() != VK_DRIVER_ID_QUALCOMM_PROPRIETARY;
|
||||
}
|
||||
|
||||
/// Returns true if the device suppors float64 natively.
|
||||
/// Returns true if the device supports float64 natively.
|
||||
bool IsFloat64Supported() const {
|
||||
return features.features.shaderFloat64;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "common/alignment.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/literals.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/polyfill_ranges.h"
|
||||
#include "video_core/vulkan_common/vma.h"
|
||||
@ -69,8 +70,7 @@ struct Range {
|
||||
case MemoryUsage::Download:
|
||||
return VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
|
||||
case MemoryUsage::DeviceLocal:
|
||||
return VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT |
|
||||
VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT;
|
||||
return {};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@ -212,7 +212,20 @@ MemoryAllocator::MemoryAllocator(const Device& device_)
|
||||
: device{device_}, allocator{device.GetAllocator()},
|
||||
properties{device_.GetPhysical().GetMemoryProperties().memoryProperties},
|
||||
buffer_image_granularity{
|
||||
device_.GetPhysical().GetProperties().limits.bufferImageGranularity} {}
|
||||
device_.GetPhysical().GetProperties().limits.bufferImageGranularity} {
|
||||
// GPUs not supporting rebar may only have a region with less than 256MB host visible/device
|
||||
// local memory. In that case, opening 2 RenderDoc captures side-by-side is not possible due to
|
||||
// the heap running out of memory. With RenderDoc attached and only a small host/device region,
|
||||
// only allow the stream buffer in this memory heap.
|
||||
if (device.HasDebuggingToolAttached()) {
|
||||
using namespace Common::Literals;
|
||||
ForEachDeviceLocalHostVisibleHeap(device, [this](size_t index, VkMemoryHeap& heap) {
|
||||
if (heap.size <= 256_MiB) {
|
||||
valid_memory_types &= ~(1u << index);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MemoryAllocator::~MemoryAllocator() = default;
|
||||
|
||||
@ -244,7 +257,7 @@ vk::Buffer MemoryAllocator::CreateBuffer(const VkBufferCreateInfo& ci, MemoryUsa
|
||||
.usage = MemoryUsageVma(usage),
|
||||
.requiredFlags = 0,
|
||||
.preferredFlags = MemoryUsagePreferedVmaFlags(usage),
|
||||
.memoryTypeBits = 0,
|
||||
.memoryTypeBits = usage == MemoryUsage::Stream ? 0u : valid_memory_types,
|
||||
.pool = VK_NULL_HANDLE,
|
||||
.pUserData = nullptr,
|
||||
.priority = 0.f,
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <span>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
#include "video_core/vulkan_common/vulkan_device.h"
|
||||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
||||
|
||||
VK_DEFINE_HANDLE(VmaAllocator)
|
||||
@ -26,6 +27,18 @@ enum class MemoryUsage {
|
||||
Stream, ///< Requests device local host visible buffer, falling back host memory.
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
void ForEachDeviceLocalHostVisibleHeap(const Device& device, F&& f) {
|
||||
auto memory_props = device.GetPhysical().GetMemoryProperties().memoryProperties;
|
||||
for (size_t i = 0; i < memory_props.memoryTypeCount; i++) {
|
||||
auto& memory_type = memory_props.memoryTypes[i];
|
||||
if ((memory_type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) &&
|
||||
(memory_type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
|
||||
f(memory_type.heapIndex, memory_props.memoryHeaps[memory_type.heapIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ownership handle of a memory commitment.
|
||||
/// Points to a subregion of a memory allocation.
|
||||
class MemoryCommit {
|
||||
@ -124,6 +137,7 @@ private:
|
||||
std::vector<std::unique_ptr<MemoryAllocation>> allocations; ///< Current allocations.
|
||||
VkDeviceSize buffer_image_granularity; // The granularity for adjacent offsets between buffers
|
||||
// and optimal images
|
||||
u32 valid_memory_types{~0u};
|
||||
};
|
||||
|
||||
} // namespace Vulkan
|
||||
|
@ -117,6 +117,9 @@ public:
|
||||
virtual ~Exception() = default;
|
||||
|
||||
const char* what() const noexcept override;
|
||||
VkResult GetResult() const noexcept {
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
VkResult result;
|
||||
|
@ -42,6 +42,9 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) {
|
||||
for (auto* setting : Settings::values.linkage.by_category[category]) {
|
||||
settings.push_back(setting);
|
||||
}
|
||||
for (auto* setting : UISettings::values.linkage.by_category[category]) {
|
||||
settings.push_back(setting);
|
||||
}
|
||||
};
|
||||
|
||||
push(Settings::Category::Audio);
|
||||
|
@ -29,9 +29,10 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
|
||||
INSERT(Settings, sink_id, "Output Engine:", "");
|
||||
INSERT(Settings, audio_output_device_id, "Output Device:", "");
|
||||
INSERT(Settings, audio_input_device_id, "Input Device:", "");
|
||||
INSERT(Settings, audio_muted, "Mute audio when in background", "");
|
||||
INSERT(Settings, audio_muted, "Mute audio", "");
|
||||
INSERT(Settings, volume, "Volume:", "");
|
||||
INSERT(Settings, dump_audio_commands, "", "");
|
||||
INSERT(UISettings, mute_when_in_background, "Mute audio when in background", "");
|
||||
|
||||
// Core
|
||||
INSERT(Settings, use_multi_core, "Multicore CPU Emulation", "");
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
// VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
|
||||
#include "applets/qt_amiibo_settings.h"
|
||||
#include "applets/qt_controller.h"
|
||||
@ -1445,6 +1447,7 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
||||
Settings::values.audio_muted = false;
|
||||
auto_muted = false;
|
||||
}
|
||||
UpdateVolumeUI();
|
||||
}
|
||||
}
|
||||
|
||||
@ -4649,8 +4652,8 @@ bool GMainWindow::CheckFirmwarePresence() {
|
||||
|
||||
bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, u64 program_id,
|
||||
u64* selected_title_id, u8* selected_content_record_type) {
|
||||
using ContentInfo = std::pair<FileSys::TitleType, FileSys::ContentRecordType>;
|
||||
boost::container::flat_map<u64, ContentInfo> available_title_ids;
|
||||
using ContentInfo = std::tuple<u64, FileSys::TitleType, FileSys::ContentRecordType>;
|
||||
boost::container::flat_set<ContentInfo> available_title_ids;
|
||||
|
||||
const auto RetrieveEntries = [&](FileSys::TitleType title_type,
|
||||
FileSys::ContentRecordType record_type) {
|
||||
@ -4658,12 +4661,14 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe
|
||||
for (const auto& entry : entries) {
|
||||
if (FileSys::GetBaseTitleID(entry.title_id) == program_id &&
|
||||
installed.GetEntry(entry)->GetStatus() == Loader::ResultStatus::Success) {
|
||||
available_title_ids[entry.title_id] = {title_type, record_type};
|
||||
available_title_ids.insert({entry.title_id, title_type, record_type});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::Program);
|
||||
RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::HtmlDocument);
|
||||
RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::LegalInformation);
|
||||
RetrieveEntries(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
|
||||
|
||||
if (available_title_ids.empty()) {
|
||||
@ -4674,10 +4679,14 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe
|
||||
|
||||
if (available_title_ids.size() > 1) {
|
||||
QStringList list;
|
||||
for (auto& [title_id, content_info] : available_title_ids) {
|
||||
for (auto& [title_id, title_type, record_type] : available_title_ids) {
|
||||
const auto hex_title_id = QString::fromStdString(fmt::format("{:X}", title_id));
|
||||
if (content_info.first == FileSys::TitleType::Application) {
|
||||
list.push_back(QStringLiteral("Application [%1]").arg(hex_title_id));
|
||||
if (record_type == FileSys::ContentRecordType::Program) {
|
||||
list.push_back(QStringLiteral("Program [%1]").arg(hex_title_id));
|
||||
} else if (record_type == FileSys::ContentRecordType::HtmlDocument) {
|
||||
list.push_back(QStringLiteral("HTML document [%1]").arg(hex_title_id));
|
||||
} else if (record_type == FileSys::ContentRecordType::LegalInformation) {
|
||||
list.push_back(QStringLiteral("Legal information [%1]").arg(hex_title_id));
|
||||
} else {
|
||||
list.push_back(
|
||||
QStringLiteral("DLC %1 [%2]").arg(title_id & 0x7FF).arg(hex_title_id));
|
||||
@ -4695,9 +4704,9 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe
|
||||
title_index = list.indexOf(res);
|
||||
}
|
||||
|
||||
const auto selected_info = available_title_ids.nth(title_index);
|
||||
*selected_title_id = selected_info->first;
|
||||
*selected_content_record_type = static_cast<u8>(selected_info->second.second);
|
||||
const auto& [title_id, title_type, record_type] = *available_title_ids.nth(title_index);
|
||||
*selected_title_id = title_id;
|
||||
*selected_content_record_type = static_cast<u8>(record_type);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ struct Values {
|
||||
true,
|
||||
true};
|
||||
Setting<bool> mute_when_in_background{
|
||||
linkage, false, "muteWhenInBackground", Category::Ui, Settings::Specialization::Default,
|
||||
linkage, false, "muteWhenInBackground", Category::Audio, Settings::Specialization::Default,
|
||||
true, true};
|
||||
Setting<bool> hide_mouse{
|
||||
linkage, true, "hideInactiveMouse", Category::UiGeneral, Settings::Specialization::Default,
|
||||
|
Reference in New Issue
Block a user