summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/host_memory.cpp2
-rw-r--r--src/core/file_sys/program_metadata.cpp2
-rw-r--r--src/core/hle/kernel/k_handle_table.cpp2
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp2
-rw-r--r--src/core/hle/service/time/system_clock_core.cpp2
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp4
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp4
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h7
-rw-r--r--src/video_core/engines/maxwell_dma.cpp64
-rw-r--r--src/video_core/engines/maxwell_dma.h2
-rw-r--r--src/video_core/host_shaders/CMakeLists.txt1
-rw-r--r--src/video_core/host_shaders/opengl_copy_bgra.comp15
-rw-r--r--src/video_core/renderer_opengl/gl_buffer_cache.cpp3
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.cpp37
-rw-r--r--src/video_core/renderer_opengl/gl_texture_cache.h22
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h4
-rw-r--r--src/video_core/renderer_opengl/util_shaders.cpp76
-rw-r--r--src/video_core/renderer_opengl/util_shaders.h22
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp3
-rw-r--r--src/yuzu/configuration/configure_profile_manager.cpp2
21 files changed, 110 insertions, 168 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index 6661244cf..b44a44949 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -314,8 +314,8 @@ private:
314 } 314 }
315 315
316 void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) { 316 void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) {
317 placeholders.erase(it);
318 placeholder_host_pointers.erase(it->lower()); 317 placeholder_host_pointers.erase(it->lower());
318 placeholders.erase(it);
319 } 319 }
320 320
321 /// Return true when a given memory region is a "nieche" and the placeholders don't have to be 321 /// Return true when a given memory region is a "nieche" and the placeholders don't have to be
diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp
index 01ae1a567..35a53d36c 100644
--- a/src/core/file_sys/program_metadata.cpp
+++ b/src/core/file_sys/program_metadata.cpp
@@ -77,7 +77,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address
77 aci_header.title_id = title_id; 77 aci_header.title_id = title_id;
78 aci_file_access.permissions = filesystem_permissions; 78 aci_file_access.permissions = filesystem_permissions;
79 npdm_header.system_resource_size = system_resource_size; 79 npdm_header.system_resource_size = system_resource_size;
80 aci_kernel_capabilities = std ::move(capabilities); 80 aci_kernel_capabilities = std::move(capabilities);
81} 81}
82 82
83bool ProgramMetadata::Is64BitProgram() const { 83bool ProgramMetadata::Is64BitProgram() const {
diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp
index 6a420d5b0..44d13169f 100644
--- a/src/core/hle/kernel/k_handle_table.cpp
+++ b/src/core/hle/kernel/k_handle_table.cpp
@@ -7,7 +7,7 @@
7namespace Kernel { 7namespace Kernel {
8 8
9KHandleTable::KHandleTable(KernelCore& kernel_) : kernel{kernel_} {} 9KHandleTable::KHandleTable(KernelCore& kernel_) : kernel{kernel_} {}
10KHandleTable ::~KHandleTable() = default; 10KHandleTable::~KHandleTable() = default;
11 11
12ResultCode KHandleTable::Finalize() { 12ResultCode KHandleTable::Finalize() {
13 // Get the table and clear our record of it. 13 // Get the table and clear our record of it.
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index c930996ab..8c363142c 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -106,7 +106,7 @@ void IAppletResource::DeactivateController(HidController controller) {
106 controllers[static_cast<size_t>(controller)]->DeactivateController(); 106 controllers[static_cast<size_t>(controller)]->DeactivateController();
107} 107}
108 108
109IAppletResource ::~IAppletResource() { 109IAppletResource::~IAppletResource() {
110 system.CoreTiming().UnscheduleEvent(pad_update_event, 0); 110 system.CoreTiming().UnscheduleEvent(pad_update_event, 0);
111 system.CoreTiming().UnscheduleEvent(motion_update_event, 0); 111 system.CoreTiming().UnscheduleEvent(motion_update_event, 0);
112} 112}
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
index a33e47d0b..789000294 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
@@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices {
16 16
17nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_) 17nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_)
18 : nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {} 18 : nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {}
19nvdisp_disp0 ::~nvdisp_disp0() = default; 19nvdisp_disp0::~nvdisp_disp0() = default;
20 20
21NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, 21NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
22 std::vector<u8>& output) { 22 std::vector<u8>& output) {
diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp
index bd334bbef..5c2354cdd 100644
--- a/src/core/hle/service/time/system_clock_core.cpp
+++ b/src/core/hle/service/time/system_clock_core.cpp
@@ -13,7 +13,7 @@ SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_)
13 context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId(); 13 context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId();
14} 14}
15 15
16SystemClockCore ::~SystemClockCore() = default; 16SystemClockCore::~SystemClockCore() = default;
17 17
18ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const { 18ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const {
19 posix_time = 0; 19 posix_time = 0;
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index 5c3108768..3871e7316 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -10,8 +10,8 @@
10 10
11namespace Service::Time { 11namespace Service::Time {
12 12
13ITimeZoneService ::ITimeZoneService(Core::System& system_, 13ITimeZoneService::ITimeZoneService(Core::System& system_,
14 TimeZone::TimeZoneContentManager& time_zone_manager_) 14 TimeZone::TimeZoneContentManager& time_zone_manager_)
15 : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} { 15 : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} {
16 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
17 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, 17 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"},
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index 580063fa9..170db269a 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -58,8 +58,8 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding,
58 const auto cbuf{fmt::format("{}_cbuf{}", ctx.stage_name, binding.U32())}; 58 const auto cbuf{fmt::format("{}_cbuf{}", ctx.stage_name, binding.U32())};
59 const auto cbuf_cast{fmt::format("{}({}[{}]{{}})", cast, cbuf, index)}; 59 const auto cbuf_cast{fmt::format("{}({}[{}]{{}})", cast, cbuf, index)};
60 const auto extraction{num_bits == 32 ? cbuf_cast 60 const auto extraction{num_bits == 32 ? cbuf_cast
61 : fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast, 61 : fmt::format("bitfieldExtract({},int({}),{})", cbuf_cast,
62 bit_offset, num_bits)}; 62 bit_offset, num_bits)};
63 if (!component_indexing_bug) { 63 if (!component_indexing_bug) {
64 const auto result{fmt::format(fmt::runtime(extraction), swizzle)}; 64 const auto result{fmt::format(fmt::runtime(extraction), swizzle)};
65 ctx.Add("{}={};", ret, result); 65 ctx.Add("{}={};", ret, result);
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 7bfd57369..d350c9b36 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -570,13 +570,12 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am
570 ForEachWrittenRange(*cpu_src_address, amount, mirror); 570 ForEachWrittenRange(*cpu_src_address, amount, mirror);
571 // This subtraction in this order is important for overlapping copies. 571 // This subtraction in this order is important for overlapping copies.
572 common_ranges.subtract(subtract_interval); 572 common_ranges.subtract(subtract_interval);
573 bool atleast_1_download = tmp_intervals.size() != 0; 573 const bool has_new_downloads = tmp_intervals.size() != 0;
574 for (const IntervalType add_interval : tmp_intervals) { 574 for (const IntervalType& add_interval : tmp_intervals) {
575 common_ranges.add(add_interval); 575 common_ranges.add(add_interval);
576 } 576 }
577
578 runtime.CopyBuffer(dest_buffer, src_buffer, copies); 577 runtime.CopyBuffer(dest_buffer, src_buffer, copies);
579 if (atleast_1_download) { 578 if (has_new_downloads) {
580 dest_buffer.MarkRegionAsGpuModified(*cpu_dest_address, amount); 579 dest_buffer.MarkRegionAsGpuModified(*cpu_dest_address, amount);
581 } 580 }
582 std::vector<u8> tmp_buffer(amount); 581 std::vector<u8> tmp_buffer(amount);
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp
index c7ec1eac9..67388d980 100644
--- a/src/video_core/engines/maxwell_dma.cpp
+++ b/src/video_core/engines/maxwell_dma.cpp
@@ -82,41 +82,41 @@ void MaxwellDMA::Launch() {
82} 82}
83 83
84void MaxwellDMA::CopyPitchToPitch() { 84void MaxwellDMA::CopyPitchToPitch() {
85 // When `multi_line_enable` bit is disabled the copy is performed as if we were copying a 1D 85 // When `multi_line_enable` bit is enabled we copy a 2D image of dimensions
86 // buffer of length `line_length_in`. 86 // (line_length_in, line_count).
87 // Otherwise we copy a 2D image of dimensions (line_length_in, line_count). 87 // Otherwise the copy is performed as if we were copying a 1D buffer of length line_length_in.
88 auto& accelerate = rasterizer->AccessAccelerateDMA(); 88 const bool remap_enabled = regs.launch_dma.remap_enable != 0;
89 if (!regs.launch_dma.multi_line_enable) { 89 if (regs.launch_dma.multi_line_enable) {
90 const bool is_buffer_clear = regs.launch_dma.remap_enable != 0 && 90 UNIMPLEMENTED_IF(remap_enabled);
91 regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A; 91
92 // TODO: allow multisized components. 92 // Perform a line-by-line copy.
93 if (is_buffer_clear) { 93 // We're going to take a subrect of size (line_length_in, line_count) from the source
94 ASSERT(regs.remap_const.component_size_minus_one == 3); 94 // rectangle. There is no need to manually flush/invalidate the regions because CopyBlock
95 accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value); 95 // does that for us.
96 std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value); 96 for (u32 line = 0; line < regs.line_count; ++line) {
97 memory_manager.WriteBlockUnsafe(regs.offset_out, 97 const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in;
98 reinterpret_cast<u8*>(tmp_buffer.data()), 98 const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out;
99 regs.line_length_in * sizeof(u32)); 99 memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in);
100 return;
101 }
102 UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0);
103 if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
104 std::vector<u8> tmp_buffer(regs.line_length_in);
105 memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
106 memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
107 } 100 }
108 return; 101 return;
109 } 102 }
110 103 // TODO: allow multisized components.
111 UNIMPLEMENTED_IF(regs.launch_dma.remap_enable != 0); 104 auto& accelerate = rasterizer->AccessAccelerateDMA();
112 105 const bool is_const_a_dst = regs.remap_const.dst_x == RemapConst::Swizzle::CONST_A;
113 // Perform a line-by-line copy. 106 const bool is_buffer_clear = remap_enabled && is_const_a_dst;
114 // We're going to take a subrect of size (line_length_in, line_count) from the source rectangle. 107 if (is_buffer_clear) {
115 // There is no need to manually flush/invalidate the regions because CopyBlock does that for us. 108 ASSERT(regs.remap_const.component_size_minus_one == 3);
116 for (u32 line = 0; line < regs.line_count; ++line) { 109 accelerate.BufferClear(regs.offset_out, regs.line_length_in, regs.remap_consta_value);
117 const GPUVAddr source_line = regs.offset_in + static_cast<size_t>(line) * regs.pitch_in; 110 std::vector<u32> tmp_buffer(regs.line_length_in, regs.remap_consta_value);
118 const GPUVAddr dest_line = regs.offset_out + static_cast<size_t>(line) * regs.pitch_out; 111 memory_manager.WriteBlockUnsafe(regs.offset_out, reinterpret_cast<u8*>(tmp_buffer.data()),
119 memory_manager.CopyBlock(dest_line, source_line, regs.line_length_in); 112 regs.line_length_in * sizeof(u32));
113 return;
114 }
115 UNIMPLEMENTED_IF(remap_enabled);
116 if (!accelerate.BufferCopy(regs.offset_in, regs.offset_out, regs.line_length_in)) {
117 std::vector<u8> tmp_buffer(regs.line_length_in);
118 memory_manager.ReadBlockUnsafe(regs.offset_in, tmp_buffer.data(), regs.line_length_in);
119 memory_manager.WriteBlock(regs.offset_out, tmp_buffer.data(), regs.line_length_in);
120 } 120 }
121} 121}
122 122
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h
index 9e457ae16..a04514425 100644
--- a/src/video_core/engines/maxwell_dma.h
+++ b/src/video_core/engines/maxwell_dma.h
@@ -175,7 +175,7 @@ public:
175 static_assert(sizeof(LaunchDMA) == 4); 175 static_assert(sizeof(LaunchDMA) == 4);
176 176
177 struct RemapConst { 177 struct RemapConst {
178 enum Swizzle : u32 { 178 enum class Swizzle : u32 {
179 SRC_X = 0, 179 SRC_X = 0,
180 SRC_Y = 1, 180 SRC_Y = 1,
181 SRC_Z = 2, 181 SRC_Z = 2,
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index c9cff7450..20d748c12 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -6,7 +6,6 @@ set(SHADER_FILES
6 convert_float_to_depth.frag 6 convert_float_to_depth.frag
7 full_screen_triangle.vert 7 full_screen_triangle.vert
8 opengl_copy_bc4.comp 8 opengl_copy_bc4.comp
9 opengl_copy_bgra.comp
10 opengl_present.frag 9 opengl_present.frag
11 opengl_present.vert 10 opengl_present.vert
12 pitch_unswizzle.comp 11 pitch_unswizzle.comp
diff --git a/src/video_core/host_shaders/opengl_copy_bgra.comp b/src/video_core/host_shaders/opengl_copy_bgra.comp
deleted file mode 100644
index 2571a4abf..000000000
--- a/src/video_core/host_shaders/opengl_copy_bgra.comp
+++ /dev/null
@@ -1,15 +0,0 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#version 430 core
6
7layout (local_size_x = 4, local_size_y = 4) in;
8
9layout(binding = 0, rgba8) readonly uniform image2DArray bgr_input;
10layout(binding = 1, rgba8) writeonly uniform image2DArray bgr_output;
11
12void main() {
13 vec4 color = imageLoad(bgr_input, ivec3(gl_GlobalInvocationID));
14 imageStore(bgr_output, ivec3(gl_GlobalInvocationID), color.bgra);
15}
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
index 07a995f7d..187a28e4d 100644
--- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp
@@ -147,8 +147,7 @@ void BufferCacheRuntime::CopyBuffer(Buffer& dst_buffer, Buffer& src_buffer,
147 147
148void BufferCacheRuntime::ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value) { 148void BufferCacheRuntime::ClearBuffer(Buffer& dest_buffer, u32 offset, size_t size, u32 value) {
149 glClearNamedBufferSubData(dest_buffer.Handle(), GL_R32UI, static_cast<GLintptr>(offset), 149 glClearNamedBufferSubData(dest_buffer.Handle(), GL_R32UI, static_cast<GLintptr>(offset),
150 static_cast<GLsizeiptr>(size / sizeof(u32)), GL_RED, GL_UNSIGNED_INT, 150 static_cast<GLsizeiptr>(size), GL_RED, GL_UNSIGNED_INT, &value);
151 &value);
152} 151}
153 152
154void BufferCacheRuntime::BindIndexBuffer(Buffer& buffer, u32 offset, u32 size) { 153void BufferCacheRuntime::BindIndexBuffer(Buffer& buffer, u32 offset, u32 size) {
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp
index b0aee6cc1..54dae2c41 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp
@@ -461,7 +461,7 @@ bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) {
461 if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { 461 if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) {
462 return false; 462 return false;
463 } 463 }
464 if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { 464 if (IsPixelFormatBGR(dst.info.format) != IsPixelFormatBGR(src.info.format)) {
465 return false; 465 return false;
466 } 466 }
467 return true; 467 return true;
@@ -473,7 +473,7 @@ void TextureCacheRuntime::EmulateCopyImage(Image& dst, Image& src,
473 ASSERT(src.info.type == ImageType::e3D); 473 ASSERT(src.info.type == ImageType::e3D);
474 util_shaders.CopyBC4(dst, src, copies); 474 util_shaders.CopyBC4(dst, src, copies);
475 } else if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { 475 } else if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) {
476 util_shaders.CopyBGR(dst, src, copies); 476 bgr_copy_pass.CopyBGR(dst, src, copies);
477 } else { 477 } else {
478 UNREACHABLE(); 478 UNREACHABLE();
479 } 479 }
@@ -1112,4 +1112,37 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM
1112 framebuffer.handle = handle; 1112 framebuffer.handle = handle;
1113} 1113}
1114 1114
1115void BGRCopyPass::CopyBGR(Image& dst_image, Image& src_image,
1116 std::span<const VideoCommon::ImageCopy> copies) {
1117 static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0};
1118 const u32 requested_pbo_size =
1119 std::max(src_image.unswizzled_size_bytes, dst_image.unswizzled_size_bytes);
1120
1121 if (bgr_pbo_size < requested_pbo_size) {
1122 bgr_pbo.Create();
1123 bgr_pbo_size = requested_pbo_size;
1124 glNamedBufferData(bgr_pbo.handle, bgr_pbo_size, nullptr, GL_STREAM_COPY);
1125 }
1126 for (const ImageCopy& copy : copies) {
1127 ASSERT(copy.src_offset == zero_offset);
1128 ASSERT(copy.dst_offset == zero_offset);
1129
1130 // Copy from source to PBO
1131 glPixelStorei(GL_PACK_ALIGNMENT, 1);
1132 glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width);
1133 glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr_pbo.handle);
1134 glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height,
1135 copy.src_subresource.num_layers, src_image.GlFormat(),
1136 src_image.GlType(), static_cast<GLsizei>(bgr_pbo_size), nullptr);
1137
1138 // Copy from PBO to destination in desired GL format
1139 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1140 glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width);
1141 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr_pbo.handle);
1142 glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height,
1143 copy.dst_subresource.num_layers, dst_image.GlFormat(),
1144 dst_image.GlType(), nullptr);
1145 }
1146}
1147
1115} // namespace OpenGL 1148} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h
index 4a4f6301c..c498a8a8f 100644
--- a/src/video_core/renderer_opengl/gl_texture_cache.h
+++ b/src/video_core/renderer_opengl/gl_texture_cache.h
@@ -47,6 +47,19 @@ struct FormatProperties {
47 bool is_compressed; 47 bool is_compressed;
48}; 48};
49 49
50class BGRCopyPass {
51public:
52 BGRCopyPass() = default;
53 ~BGRCopyPass() = default;
54
55 void CopyBGR(Image& dst_image, Image& src_image,
56 std::span<const VideoCommon::ImageCopy> copies);
57
58private:
59 OGLBuffer bgr_pbo;
60 size_t bgr_pbo_size{};
61};
62
50class TextureCacheRuntime { 63class TextureCacheRuntime {
51 friend Framebuffer; 64 friend Framebuffer;
52 friend Image; 65 friend Image;
@@ -118,6 +131,7 @@ private:
118 const Device& device; 131 const Device& device;
119 StateTracker& state_tracker; 132 StateTracker& state_tracker;
120 UtilShaders util_shaders; 133 UtilShaders util_shaders;
134 BGRCopyPass bgr_copy_pass;
121 135
122 std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; 136 std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties;
123 bool has_broken_texture_view_formats = false; 137 bool has_broken_texture_view_formats = false;
@@ -162,6 +176,14 @@ public:
162 return texture.handle; 176 return texture.handle;
163 } 177 }
164 178
179 GLuint GlFormat() const noexcept {
180 return gl_format;
181 }
182
183 GLuint GlType() const noexcept {
184 return gl_type;
185 }
186
165private: 187private:
166 void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset); 188 void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset);
167 189
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index 672f94bfc..39158aa3e 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -52,7 +52,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB
52 {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT 52 {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT
53 {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT 53 {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT
54 {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM 54 {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM
55 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM 55 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_UNORM
56 {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT 56 {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT
57 {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT 57 {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT
58 {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT 58 {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT
@@ -81,7 +81,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB
81 {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM 81 {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM
82 {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM 82 {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM
83 {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM 83 {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM
84 {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_SRGB 84 {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_SRGB
85 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB 85 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB
86 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB 86 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB
87 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB 87 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB
diff --git a/src/video_core/renderer_opengl/util_shaders.cpp b/src/video_core/renderer_opengl/util_shaders.cpp
index 333f35a1c..897c380b3 100644
--- a/src/video_core/renderer_opengl/util_shaders.cpp
+++ b/src/video_core/renderer_opengl/util_shaders.cpp
@@ -14,7 +14,6 @@
14#include "video_core/host_shaders/block_linear_unswizzle_2d_comp.h" 14#include "video_core/host_shaders/block_linear_unswizzle_2d_comp.h"
15#include "video_core/host_shaders/block_linear_unswizzle_3d_comp.h" 15#include "video_core/host_shaders/block_linear_unswizzle_3d_comp.h"
16#include "video_core/host_shaders/opengl_copy_bc4_comp.h" 16#include "video_core/host_shaders/opengl_copy_bc4_comp.h"
17#include "video_core/host_shaders/opengl_copy_bgra_comp.h"
18#include "video_core/host_shaders/pitch_unswizzle_comp.h" 17#include "video_core/host_shaders/pitch_unswizzle_comp.h"
19#include "video_core/renderer_opengl/gl_shader_manager.h" 18#include "video_core/renderer_opengl/gl_shader_manager.h"
20#include "video_core/renderer_opengl/gl_shader_util.h" 19#include "video_core/renderer_opengl/gl_shader_util.h"
@@ -44,11 +43,6 @@ namespace {
44OGLProgram MakeProgram(std::string_view source) { 43OGLProgram MakeProgram(std::string_view source) {
45 return CreateProgram(source, GL_COMPUTE_SHADER); 44 return CreateProgram(source, GL_COMPUTE_SHADER);
46} 45}
47
48size_t NumPixelsInCopy(const VideoCommon::ImageCopy& copy) {
49 return static_cast<size_t>(copy.extent.width * copy.extent.height *
50 copy.src_subresource.num_layers);
51}
52} // Anonymous namespace 46} // Anonymous namespace
53 47
54UtilShaders::UtilShaders(ProgramManager& program_manager_) 48UtilShaders::UtilShaders(ProgramManager& program_manager_)
@@ -56,7 +50,6 @@ UtilShaders::UtilShaders(ProgramManager& program_manager_)
56 block_linear_unswizzle_2d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_2D_COMP)), 50 block_linear_unswizzle_2d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_2D_COMP)),
57 block_linear_unswizzle_3d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_3D_COMP)), 51 block_linear_unswizzle_3d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_3D_COMP)),
58 pitch_unswizzle_program(MakeProgram(PITCH_UNSWIZZLE_COMP)), 52 pitch_unswizzle_program(MakeProgram(PITCH_UNSWIZZLE_COMP)),
59 copy_bgra_program(MakeProgram(OPENGL_COPY_BGRA_COMP)),
60 copy_bc4_program(MakeProgram(OPENGL_COPY_BC4_COMP)) { 53 copy_bc4_program(MakeProgram(OPENGL_COPY_BC4_COMP)) {
61 const auto swizzle_table = Tegra::Texture::MakeSwizzleTable(); 54 const auto swizzle_table = Tegra::Texture::MakeSwizzleTable();
62 swizzle_table_buffer.Create(); 55 swizzle_table_buffer.Create();
@@ -255,43 +248,6 @@ void UtilShaders::CopyBC4(Image& dst_image, Image& src_image, std::span<const Im
255 program_manager.RestoreGuestCompute(); 248 program_manager.RestoreGuestCompute();
256} 249}
257 250
258void UtilShaders::CopyBGR(Image& dst_image, Image& src_image,
259 std::span<const VideoCommon::ImageCopy> copies) {
260 static constexpr GLuint BINDING_INPUT_IMAGE = 0;
261 static constexpr GLuint BINDING_OUTPUT_IMAGE = 1;
262 static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0};
263 const u32 bytes_per_block = BytesPerBlock(dst_image.info.format);
264 switch (bytes_per_block) {
265 case 2:
266 // BGR565 copy
267 for (const ImageCopy& copy : copies) {
268 ASSERT(copy.src_offset == zero_offset);
269 ASSERT(copy.dst_offset == zero_offset);
270 bgr_copy_pass.Execute(dst_image, src_image, copy);
271 }
272 break;
273 case 4: {
274 // BGRA8 copy
275 program_manager.BindComputeProgram(copy_bgra_program.handle);
276 constexpr GLenum FORMAT = GL_RGBA8;
277 for (const ImageCopy& copy : copies) {
278 ASSERT(copy.src_offset == zero_offset);
279 ASSERT(copy.dst_offset == zero_offset);
280 glBindImageTexture(BINDING_INPUT_IMAGE, src_image.StorageHandle(),
281 copy.src_subresource.base_level, GL_FALSE, 0, GL_READ_ONLY, FORMAT);
282 glBindImageTexture(BINDING_OUTPUT_IMAGE, dst_image.StorageHandle(),
283 copy.dst_subresource.base_level, GL_FALSE, 0, GL_WRITE_ONLY, FORMAT);
284 glDispatchCompute(copy.extent.width, copy.extent.height, copy.extent.depth);
285 }
286 program_manager.RestoreGuestCompute();
287 break;
288 }
289 default:
290 UNREACHABLE();
291 break;
292 }
293}
294
295GLenum StoreFormat(u32 bytes_per_block) { 251GLenum StoreFormat(u32 bytes_per_block) {
296 switch (bytes_per_block) { 252 switch (bytes_per_block) {
297 case 1: 253 case 1:
@@ -309,36 +265,4 @@ GLenum StoreFormat(u32 bytes_per_block) {
309 return GL_R8UI; 265 return GL_R8UI;
310} 266}
311 267
312void Bgr565CopyPass::Execute(const Image& dst_image, const Image& src_image,
313 const ImageCopy& copy) {
314 if (CopyBufferCreationNeeded(copy)) {
315 CreateNewCopyBuffer(copy, GL_TEXTURE_2D_ARRAY, GL_RGB565);
316 }
317 // Copy from source to PBO
318 glPixelStorei(GL_PACK_ALIGNMENT, 1);
319 glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width);
320 glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr16_pbo.handle);
321 glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height,
322 copy.src_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
323 static_cast<GLsizei>(bgr16_pbo_size), nullptr);
324
325 // Copy from PBO to destination in reverse order
326 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
327 glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width);
328 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr16_pbo.handle);
329 glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height,
330 copy.dst_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV,
331 nullptr);
332}
333
334bool Bgr565CopyPass::CopyBufferCreationNeeded(const ImageCopy& copy) {
335 return bgr16_pbo_size < NumPixelsInCopy(copy) * sizeof(u16);
336}
337
338void Bgr565CopyPass::CreateNewCopyBuffer(const ImageCopy& copy, GLenum target, GLuint format) {
339 bgr16_pbo.Create();
340 bgr16_pbo_size = NumPixelsInCopy(copy) * sizeof(u16);
341 glNamedBufferData(bgr16_pbo.handle, bgr16_pbo_size, nullptr, GL_STREAM_COPY);
342}
343
344} // namespace OpenGL 268} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/util_shaders.h b/src/video_core/renderer_opengl/util_shaders.h
index ef881e35f..5de95ea7a 100644
--- a/src/video_core/renderer_opengl/util_shaders.h
+++ b/src/video_core/renderer_opengl/util_shaders.h
@@ -19,22 +19,6 @@ class ProgramManager;
19 19
20struct ImageBufferMap; 20struct ImageBufferMap;
21 21
22class Bgr565CopyPass {
23public:
24 Bgr565CopyPass() = default;
25 ~Bgr565CopyPass() = default;
26
27 void Execute(const Image& dst_image, const Image& src_image,
28 const VideoCommon::ImageCopy& copy);
29
30private:
31 [[nodiscard]] bool CopyBufferCreationNeeded(const VideoCommon::ImageCopy& copy);
32 void CreateNewCopyBuffer(const VideoCommon::ImageCopy& copy, GLenum target, GLuint format);
33
34 OGLBuffer bgr16_pbo;
35 size_t bgr16_pbo_size{};
36};
37
38class UtilShaders { 22class UtilShaders {
39public: 23public:
40 explicit UtilShaders(ProgramManager& program_manager); 24 explicit UtilShaders(ProgramManager& program_manager);
@@ -55,9 +39,6 @@ public:
55 void CopyBC4(Image& dst_image, Image& src_image, 39 void CopyBC4(Image& dst_image, Image& src_image,
56 std::span<const VideoCommon::ImageCopy> copies); 40 std::span<const VideoCommon::ImageCopy> copies);
57 41
58 void CopyBGR(Image& dst_image, Image& src_image,
59 std::span<const VideoCommon::ImageCopy> copies);
60
61private: 42private:
62 ProgramManager& program_manager; 43 ProgramManager& program_manager;
63 44
@@ -67,10 +48,7 @@ private:
67 OGLProgram block_linear_unswizzle_2d_program; 48 OGLProgram block_linear_unswizzle_2d_program;
68 OGLProgram block_linear_unswizzle_3d_program; 49 OGLProgram block_linear_unswizzle_3d_program;
69 OGLProgram pitch_unswizzle_program; 50 OGLProgram pitch_unswizzle_program;
70 OGLProgram copy_bgra_program;
71 OGLProgram copy_bc4_program; 51 OGLProgram copy_bc4_program;
72
73 Bgr565CopyPass bgr_copy_pass;
74}; 52};
75 53
76GLenum StoreFormat(u32 bytes_per_block); 54GLenum StoreFormat(u32 bytes_per_block);
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp
index 652d99570..7d433ca50 100644
--- a/src/yuzu/applets/qt_web_browser.cpp
+++ b/src/yuzu/applets/qt_web_browser.cpp
@@ -54,6 +54,9 @@ QtNXWebEngineView::QtNXWebEngineView(QWidget* parent, Core::System& system,
54 input_interpreter(std::make_unique<InputInterpreter>(system)), 54 input_interpreter(std::make_unique<InputInterpreter>(system)),
55 default_profile{QWebEngineProfile::defaultProfile()}, 55 default_profile{QWebEngineProfile::defaultProfile()},
56 global_settings{QWebEngineSettings::globalSettings()} { 56 global_settings{QWebEngineSettings::globalSettings()} {
57 default_profile->setPersistentStoragePath(QString::fromStdString(Common::FS::PathToUTF8String(
58 Common::FS::GetYuzuPath(Common::FS::YuzuPath::YuzuDir) / "qtwebengine")));
59
57 QWebEngineScript gamepad; 60 QWebEngineScript gamepad;
58 QWebEngineScript window_nx; 61 QWebEngineScript window_nx;
59 62
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp
index ac849b01d..136614bf8 100644
--- a/src/yuzu/configuration/configure_profile_manager.cpp
+++ b/src/yuzu/configuration/configure_profile_manager.cpp
@@ -76,7 +76,7 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t
76} 76}
77} // Anonymous namespace 77} // Anonymous namespace
78 78
79ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent) 79ConfigureProfileManager::ConfigureProfileManager(QWidget* parent)
80 : QWidget(parent), ui(new Ui::ConfigureProfileManager), 80 : QWidget(parent), ui(new Ui::ConfigureProfileManager),
81 profile_manager(std::make_unique<Service::Account::ProfileManager>()) { 81 profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
82 ui->setupUi(this); 82 ui->setupUi(this);