early-access version 2043

This commit is contained in:
pineappleEA 2021-09-12 00:45:55 +02:00
parent d189d8fac4
commit b0f4452852
14 changed files with 28 additions and 71 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2041. This is the source code for early-access 2043.
## Legal Notice ## Legal Notice

View File

@ -73,7 +73,7 @@ void LogSettings() {
log_setting("Services_BCATBackend", values.bcat_backend.GetValue()); log_setting("Services_BCATBackend", values.bcat_backend.GetValue());
log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local.GetValue()); log_setting("Services_BCATBoxcatLocal", values.bcat_boxcat_local.GetValue());
log_setting("Input_EnableMotion", values.motion_enabled.GetValue()); log_setting("Input_EnableMotion", values.motion_enabled.GetValue());
log_setting("Input_EnableVibrations", values.vibration_enabled.GetValue()); log_setting("Input_EnableVibration", values.vibration_enabled.GetValue());
log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue()); log_setting("Input_EnableRawInput", values.enable_raw_input.GetValue());
} }

View File

@ -42,15 +42,14 @@ void nvdisp_disp0::OnClose(DeviceFD fd) {}
void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height,
u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform,
const Common::Rectangle<int>& crop_rect) { const Common::Rectangle<int>& crop_rect) {
VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); const VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle);
LOG_TRACE(Service, LOG_TRACE(Service,
"Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}",
addr, offset, width, height, stride, format); addr, offset, width, height, stride, format);
using PixelFormat = Tegra::FramebufferConfig::PixelFormat; const auto pixel_format = static_cast<Tegra::FramebufferConfig::PixelFormat>(format);
const Tegra::FramebufferConfig framebuffer{ const Tegra::FramebufferConfig framebuffer{addr, offset, width, height,
addr, offset, width, height, stride, static_cast<PixelFormat>(format), stride, pixel_format, transform, crop_rect};
transform, crop_rect};
system.GetPerfStats().EndSystemFrame(); system.GetPerfStats().EndSystemFrame();
system.GPU().SwapBuffers(&framebuffer); system.GPU().SwapBuffers(&framebuffer);

View File

@ -42,7 +42,9 @@ struct IGBPBuffer {
u32_le index; u32_le index;
INSERT_PADDING_WORDS(3); INSERT_PADDING_WORDS(3);
u32_le gpu_buffer_id; u32_le gpu_buffer_id;
INSERT_PADDING_WORDS(17); INSERT_PADDING_WORDS(6);
u32_le external_format;
INSERT_PADDING_WORDS(10);
u32_le nvmap_handle; u32_le nvmap_handle;
u32_le offset; u32_le offset;
INSERT_PADDING_WORDS(60); INSERT_PADDING_WORDS(60);

View File

@ -298,7 +298,7 @@ void NVFlinger::Compose() {
auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>("/dev/nvdisp_disp0"); auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>("/dev/nvdisp_disp0");
ASSERT(nvdisp); ASSERT(nvdisp);
nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format, nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.external_format,
igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride,
buffer->get().transform, buffer->get().crop_rect); buffer->get().transform, buffer->get().crop_rect);

View File

@ -358,7 +358,7 @@ void VKBlitScreen::CreateDescriptorPool() {
void VKBlitScreen::CreateRenderPass() { void VKBlitScreen::CreateRenderPass() {
const VkAttachmentDescription color_attachment{ const VkAttachmentDescription color_attachment{
.flags = 0, .flags = 0,
.format = swapchain.GetImageViewFormat(), .format = swapchain.GetImageFormat(),
.samples = VK_SAMPLE_COUNT_1_BIT, .samples = VK_SAMPLE_COUNT_1_BIT,
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE, .storeOp = VK_ATTACHMENT_STORE_OP_STORE,

View File

@ -228,7 +228,9 @@ void RasterizerVulkan::Clear() {
}; };
const u32 color_attachment = regs.clear_buffers.RT; const u32 color_attachment = regs.clear_buffers.RT;
if (use_color && framebuffer->HasAspectColorBit(color_attachment)) { const auto attachment_aspect_mask = framebuffer->ImageRanges()[color_attachment].aspectMask;
const bool is_color_rt = (attachment_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
if (use_color && is_color_rt) {
VkClearValue clear_value; VkClearValue clear_value;
std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color)); std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color));
@ -246,15 +248,12 @@ void RasterizerVulkan::Clear() {
return; return;
} }
VkImageAspectFlags aspect_flags = 0; VkImageAspectFlags aspect_flags = 0;
if (use_depth && framebuffer->HasAspectDepthBit()) { if (use_depth) {
aspect_flags |= VK_IMAGE_ASPECT_DEPTH_BIT; aspect_flags |= VK_IMAGE_ASPECT_DEPTH_BIT;
} }
if (use_stencil && framebuffer->HasAspectStencilBit()) { if (use_stencil) {
aspect_flags |= VK_IMAGE_ASPECT_STENCIL_BIT; aspect_flags |= VK_IMAGE_ASPECT_STENCIL_BIT;
} }
if (aspect_flags == 0) {
return;
}
scheduler.Record([clear_depth = regs.clear_depth, clear_stencil = regs.clear_stencil, scheduler.Record([clear_depth = regs.clear_depth, clear_stencil = regs.clear_stencil,
clear_rect, aspect_flags](vk::CommandBuffer cmdbuf) { clear_rect, aspect_flags](vk::CommandBuffer cmdbuf) {
VkClearAttachment attachment; VkClearAttachment attachment;

View File

@ -20,15 +20,16 @@ namespace Vulkan {
namespace { namespace {
VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats) { VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats, bool srgb) {
if (formats.size() == 1 && formats[0].format == VK_FORMAT_UNDEFINED) { if (formats.size() == 1 && formats[0].format == VK_FORMAT_UNDEFINED) {
VkSurfaceFormatKHR format; VkSurfaceFormatKHR format;
format.format = VK_FORMAT_B8G8R8A8_UNORM; format.format = VK_FORMAT_B8G8R8A8_UNORM;
format.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; format.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
return format; return format;
} }
const auto& found = std::find_if(formats.begin(), formats.end(), [](const auto& format) { const auto& found = std::find_if(formats.begin(), formats.end(), [srgb](const auto& format) {
return format.format == VK_FORMAT_B8G8R8A8_UNORM && const auto request_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM;
return format.format == request_format &&
format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
}); });
return found != formats.end() ? *found : formats[0]; return found != formats.end() ? *found : formats[0];
@ -142,7 +143,7 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities,
const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; const auto formats{physical_device.GetSurfaceFormatsKHR(surface)};
const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)};
const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats)}; const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats, srgb)};
const VkPresentModeKHR present_mode{ChooseSwapPresentMode(present_modes)}; const VkPresentModeKHR present_mode{ChooseSwapPresentMode(present_modes)};
u32 requested_image_count{capabilities.minImageCount + 1}; u32 requested_image_count{capabilities.minImageCount + 1};
@ -177,17 +178,6 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities,
swapchain_ci.queueFamilyIndexCount = static_cast<u32>(queue_indices.size()); swapchain_ci.queueFamilyIndexCount = static_cast<u32>(queue_indices.size());
swapchain_ci.pQueueFamilyIndices = queue_indices.data(); swapchain_ci.pQueueFamilyIndices = queue_indices.data();
} }
static constexpr std::array view_formats{VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SRGB};
VkImageFormatListCreateInfo format_list{
.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR,
.pNext = nullptr,
.viewFormatCount = static_cast<u32>(view_formats.size()),
.pViewFormats = view_formats.data(),
};
if (device.IsKhrSwapchainMutableFormatEnabled()) {
format_list.pNext = std::exchange(swapchain_ci.pNext, &format_list);
swapchain_ci.flags |= VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR;
}
// Request the size again to reduce the possibility of a TOCTOU race condition. // Request the size again to reduce the possibility of a TOCTOU race condition.
const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface); const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface);
swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height); swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height);
@ -199,7 +189,7 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities,
images = swapchain.GetImages(); images = swapchain.GetImages();
image_count = static_cast<u32>(images.size()); image_count = static_cast<u32>(images.size());
image_view_format = srgb ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_B8G8R8A8_UNORM; image_format = surface_format.format;
} }
void VKSwapchain::CreateSemaphores() { void VKSwapchain::CreateSemaphores() {
@ -215,7 +205,7 @@ void VKSwapchain::CreateImageViews() {
.flags = 0, .flags = 0,
.image = {}, .image = {},
.viewType = VK_IMAGE_VIEW_TYPE_2D, .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = image_view_format, .format = image_format,
.components = .components =
{ {
.r = VK_COMPONENT_SWIZZLE_IDENTITY, .r = VK_COMPONENT_SWIZZLE_IDENTITY,

View File

@ -68,8 +68,8 @@ public:
return *image_views[index]; return *image_views[index];
} }
VkFormat GetImageViewFormat() const { VkFormat GetImageFormat() const {
return image_view_format; return image_format;
} }
VkSemaphore CurrentPresentSemaphore() const { VkSemaphore CurrentPresentSemaphore() const {
@ -100,7 +100,7 @@ private:
u32 image_index{}; u32 image_index{};
u32 frame_index{}; u32 frame_index{};
VkFormat image_view_format{}; VkFormat image_format{};
VkExtent2D extent{}; VkExtent2D extent{};
bool current_srgb{}; bool current_srgb{};

View File

@ -1186,12 +1186,9 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM
renderpass_key.depth_format = depth_buffer->format; renderpass_key.depth_format = depth_buffer->format;
num_layers = std::max(num_layers, depth_buffer->range.extent.layers); num_layers = std::max(num_layers, depth_buffer->range.extent.layers);
images[num_images] = depth_buffer->ImageHandle(); images[num_images] = depth_buffer->ImageHandle();
const VkImageSubresourceRange subresource_range = MakeSubresourceRange(depth_buffer); image_ranges[num_images] = MakeSubresourceRange(depth_buffer);
image_ranges[num_images] = subresource_range;
samples = depth_buffer->Samples(); samples = depth_buffer->Samples();
++num_images; ++num_images;
has_depth = (subresource_range.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != 0;
has_stencil = (subresource_range.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != 0;
} else { } else {
renderpass_key.depth_format = PixelFormat::Invalid; renderpass_key.depth_format = PixelFormat::Invalid;
} }

View File

@ -232,18 +232,6 @@ public:
return image_ranges; return image_ranges;
} }
[[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept {
return (image_ranges.at(index).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
}
[[nodiscard]] bool HasAspectDepthBit() const noexcept {
return has_depth;
}
[[nodiscard]] bool HasAspectStencilBit() const noexcept {
return has_stencil;
}
private: private:
vk::Framebuffer framebuffer; vk::Framebuffer framebuffer;
VkRenderPass renderpass{}; VkRenderPass renderpass{};
@ -253,8 +241,6 @@ private:
u32 num_images = 0; u32 num_images = 0;
std::array<VkImage, 9> images{}; std::array<VkImage, 9> images{};
std::array<VkImageSubresourceRange, 9> image_ranges{}; std::array<VkImageSubresourceRange, 9> image_ranges{};
bool has_depth{};
bool has_stencil{};
}; };
struct TextureCacheParams { struct TextureCacheParams {

View File

@ -851,8 +851,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
bool has_khr_shader_float16_int8{}; bool has_khr_shader_float16_int8{};
bool has_khr_workgroup_memory_explicit_layout{}; bool has_khr_workgroup_memory_explicit_layout{};
bool has_khr_pipeline_executable_properties{}; bool has_khr_pipeline_executable_properties{};
bool has_khr_image_format_list{};
bool has_khr_swapchain_mutable_format{};
bool has_ext_subgroup_size_control{}; bool has_ext_subgroup_size_control{};
bool has_ext_transform_feedback{}; bool has_ext_transform_feedback{};
bool has_ext_custom_border_color{}; bool has_ext_custom_border_color{};
@ -902,9 +900,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
test(has_ext_shader_atomic_int64, VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME, false); test(has_ext_shader_atomic_int64, VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME, false);
test(has_khr_workgroup_memory_explicit_layout, test(has_khr_workgroup_memory_explicit_layout,
VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME, false); VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME, false);
test(has_khr_image_format_list, VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, false);
test(has_khr_swapchain_mutable_format, VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME,
false);
test(has_ext_line_rasterization, VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME, false); test(has_ext_line_rasterization, VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME, false);
if (Settings::values.enable_nsight_aftermath) { if (Settings::values.enable_nsight_aftermath) {
test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME,
@ -1083,11 +1078,6 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
khr_pipeline_executable_properties = true; khr_pipeline_executable_properties = true;
} }
} }
if (has_khr_image_format_list && has_khr_swapchain_mutable_format) {
extensions.push_back(VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
extensions.push_back(VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME);
khr_swapchain_mutable_format = true;
}
if (khr_push_descriptor) { if (khr_push_descriptor) {
VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor; VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor;
push_descriptor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR; push_descriptor.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;

View File

@ -224,11 +224,6 @@ public:
return khr_pipeline_executable_properties; return khr_pipeline_executable_properties;
} }
/// Returns true if VK_KHR_swapchain_mutable_format is enabled.
bool IsKhrSwapchainMutableFormatEnabled() const {
return khr_swapchain_mutable_format;
}
/// Returns true if the device supports VK_KHR_workgroup_memory_explicit_layout. /// Returns true if the device supports VK_KHR_workgroup_memory_explicit_layout.
bool IsKhrWorkgroupMemoryExplicitLayoutSupported() const { bool IsKhrWorkgroupMemoryExplicitLayoutSupported() const {
return khr_workgroup_memory_explicit_layout; return khr_workgroup_memory_explicit_layout;
@ -400,7 +395,6 @@ private:
bool khr_workgroup_memory_explicit_layout{}; ///< Support for explicit workgroup layouts. bool khr_workgroup_memory_explicit_layout{}; ///< Support for explicit workgroup layouts.
bool khr_push_descriptor{}; ///< Support for VK_KHR_push_descritor. bool khr_push_descriptor{}; ///< Support for VK_KHR_push_descritor.
bool khr_pipeline_executable_properties{}; ///< Support for executable properties. bool khr_pipeline_executable_properties{}; ///< Support for executable properties.
bool khr_swapchain_mutable_format{}; ///< Support for VK_KHR_swapchain_mutable_format.
bool ext_index_type_uint8{}; ///< Support for VK_EXT_index_type_uint8. bool ext_index_type_uint8{}; ///< Support for VK_EXT_index_type_uint8.
bool ext_sampler_filter_minmax{}; ///< Support for VK_EXT_sampler_filter_minmax. bool ext_sampler_filter_minmax{}; ///< Support for VK_EXT_sampler_filter_minmax.
bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted. bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted.

View File

@ -2684,7 +2684,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Enable Xinput 8 player support (disables web applet)</string> <string>Enable XInput 8 player support (disables web applet)</string>
</property> </property>
</widget> </widget>
</item> </item>