From b8c43b608030dd3e52b792d7d6efd72f39723901 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 9 Aug 2018 20:39:30 -0400 Subject: [PATCH 01/11] video_core: Use variable template variants of type_traits interfaces where applicable --- src/video_core/command_processor.h | 3 +-- src/video_core/engines/shader_bytecode.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h index f7214ffec9..a01153e0b3 100644 --- a/src/video_core/command_processor.h +++ b/src/video_core/command_processor.h @@ -30,8 +30,7 @@ union CommandHeader { BitField<29, 3, SubmissionMode> mode; }; -static_assert(std::is_standard_layout::value == true, - "CommandHeader does not use standard layout"); +static_assert(std::is_standard_layout_v, "CommandHeader is not standard layout"); static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); } // namespace Tegra diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 3d4557b7e8..3e409c2e1e 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -477,8 +477,7 @@ union Instruction { u64 value; }; static_assert(sizeof(Instruction) == 0x8, "Incorrect structure size"); -static_assert(std::is_standard_layout::value, - "Structure does not have standard layout"); +static_assert(std::is_standard_layout_v, "Instruction is not standard layout"); class OpCode { public: From ef41983c84fca451a7107fff677ce2ffa000348b Mon Sep 17 00:00:00 2001 From: MerryMage Date: Fri, 10 Aug 2018 10:55:16 +0100 Subject: [PATCH 02/11] dynarmic: Update to 0118ee0 0118ee0 emit_x64_vector: packusdw is SSE4.1 --- externals/dynarmic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/dynarmic b/externals/dynarmic index 4f96c63025..0118ee04f9 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit 4f96c63025af34c1490c59f6729497b9866ffa35 +Subproject commit 0118ee04f90faaff951989f3c2494bc6ffb70cf1 From a5b65df9cf0cd817585c2ccdb744c62be25cb916 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 10 Aug 2018 11:45:23 -0400 Subject: [PATCH 03/11] maxwell_to_gl: Implement VertexAttribute::Size::Size_32_32_32. - Used by Super Mario Odyssey. --- src/video_core/renderer_opengl/maxwell_to_gl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 43be69dd1c..d7345e8a41 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -45,6 +45,8 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { case Maxwell::VertexAttribute::Type::SignedNorm: { switch (attrib.size) { + case Maxwell::VertexAttribute::Size::Size_32_32_32: + return GL_INT; case Maxwell::VertexAttribute::Size::Size_8_8_8_8: return GL_BYTE; case Maxwell::VertexAttribute::Size::Size_16_16: From 6b0bc48a427043d887722b392c2e258d74134f4e Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 10 Aug 2018 12:17:49 -0400 Subject: [PATCH 04/11] maxwell_to_gl: Implement VertexAttribute::Size::Size_8_8. - Used by Super Mario Odyssey. --- src/video_core/renderer_opengl/maxwell_to_gl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index d7345e8a41..c439446b13 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -47,6 +47,7 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) { switch (attrib.size) { case Maxwell::VertexAttribute::Size::Size_32_32_32: return GL_INT; + case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8_8_8: return GL_BYTE; case Maxwell::VertexAttribute::Size::Size_16_16: From be53097577708ad51509877b8ce8a63fa942645f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:07:43 -0400 Subject: [PATCH 05/11] qt/game_list: Remove redundant base class constructor from initializer list This is called automatically anyways. --- src/yuzu/game_list_p.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 114a0fc7f0..4f7e1ab377 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -39,7 +39,6 @@ public: * If this class receives valid SMDH data, it will also display game icons and titles. */ class GameListItemPath : public GameListItem { - public: static const int FullPathRole = Qt::UserRole + 1; static const int TitleRole = Qt::UserRole + 2; @@ -48,8 +47,7 @@ public: GameListItemPath() = default; GameListItemPath(const QString& game_path, const std::vector& picture_data, - const QString& game_name, const QString& game_type, u64 program_id) - : GameListItem() { + const QString& game_name, const QString& game_type, u64 program_id) { setData(game_path, FullPathRole); setData(game_name, TitleRole); setData(qulonglong(program_id), ProgramIdRole); From aaf671a309a65f120190a72af88e3b016025d348 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:12:26 -0400 Subject: [PATCH 06/11] gt/game_list: Use std::array in GameListItemPath's data() function We don't need to use a heap-allocated std::vector here, given we explicitly know the bounds. --- src/yuzu/game_list_p.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 4f7e1ab377..039c7dc679 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -39,6 +40,7 @@ public: * If this class receives valid SMDH data, it will also display game icons and titles. */ class GameListItemPath : public GameListItem { + public: static const int FullPathRole = Qt::UserRole + 1; static const int TitleRole = Qt::UserRole + 2; @@ -68,17 +70,16 @@ public: std::string filename; Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, nullptr); - QString title = data(TitleRole).toString(); - std::vector row_data{ + const std::array row_data{{ QString::fromStdString(filename), data(FileTypeRole).toString(), QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())), data(TitleRole).toString(), - }; + }}; - auto row1 = row_data.at(UISettings::values.row_1_text_id); - auto row2 = row_data.at(UISettings::values.row_2_text_id); + const auto& row1 = row_data.at(UISettings::values.row_1_text_id); + const auto& row2 = row_data.at(UISettings::values.row_2_text_id); if (row1.isEmpty() || row1 == row2) return row2; @@ -86,9 +87,9 @@ public: return row1; return row1 + "\n " + row2; - } else { - return GameListItem::data(role); } + + return GameListItem::data(role); } }; From 8eb97706b869b2c07ac915600f41345c7fdc6479 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:15:06 -0400 Subject: [PATCH 07/11] qt/game_list: Resolve truncation warning within GameListItemPath's constructor Silences a warning about truncating from size_t to u32 --- src/yuzu/game_list_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index 039c7dc679..8fe5e8b802 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h @@ -40,7 +40,6 @@ public: * If this class receives valid SMDH data, it will also display game icons and titles. */ class GameListItemPath : public GameListItem { - public: static const int FullPathRole = Qt::UserRole + 1; static const int TitleRole = Qt::UserRole + 2; @@ -55,11 +54,12 @@ public: setData(qulonglong(program_id), ProgramIdRole); setData(game_type, FileTypeRole); - QPixmap picture; - u32 size = UISettings::values.icon_size; - if (!picture.loadFromData(picture_data.data(), picture_data.size())) - picture = GetDefaultIcon(size); + const u32 size = UISettings::values.icon_size; + QPixmap picture; + if (!picture.loadFromData(picture_data.data(), static_cast(picture_data.size()))) { + picture = GetDefaultIcon(size); + } picture = picture.scaled(size, size); setData(picture, Qt::DecorationRole); From 2e80e7480d91c7c472b9c94cd286c97eb1f8d71e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:27:37 -0400 Subject: [PATCH 08/11] video_core: Remove unused Renderer enumeration Currently we only have an OpenGL renderer, so this is unused in code (and occupies the Renderer identifier in the VideoCore namespace). --- src/video_core/video_core.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index 7c01c0b8da..9fbae8487d 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h @@ -13,8 +13,6 @@ namespace VideoCore { class RendererBase; -enum class Renderer { Software, OpenGL }; - // TODO: Wrap these in a user settings struct along with any other graphics settings (often set from // qt ui) extern std::atomic g_toggle_framelimit_enabled; From f380496728695aca47db98b59f9031c3b9c2e553 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:31:10 -0400 Subject: [PATCH 09/11] renderer_base: Remove unused kFramebuffer enumeration This is entirely unused and can be removed. --- src/video_core/renderer_base.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 235de23a1b..9dbea8b6de 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -17,9 +17,6 @@ namespace VideoCore { class RendererBase : NonCopyable { public: - /// Used to reference a framebuffer - enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; - explicit RendererBase(EmuWindow& window); virtual ~RendererBase(); From 20c2928c2b157b8a322a128732cd00cabbfa9d6d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Aug 2018 18:39:37 -0400 Subject: [PATCH 10/11] video_core; Get rid of global g_toggle_framelimit_enabled variable Instead, we make a struct for renderer settings and allow the renderer to update all of these settings, getting rid of the need for global-scoped variables. This also uncovered a few indirect inclusions for certain headers, which this commit also fixes. --- src/core/hle/service/nvflinger/buffer_queue.h | 1 + src/core/settings.cpp | 6 +----- src/video_core/gpu.cpp | 10 +++++++++ src/video_core/gpu.h | 10 +-------- src/video_core/renderer_base.cpp | 19 +++++++++++++---- src/video_core/renderer_base.h | 21 ++++++++++++++----- src/video_core/video_core.cpp | 2 -- src/video_core/video_core.h | 5 ----- 8 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index f86e1056c4..db2e17c0c6 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h @@ -6,6 +6,7 @@ #include #include +#include "common/common_funcs.h" #include "common/math_util.h" #include "common/swap.h" #include "core/hle/kernel/event.h" diff --git a/src/core/settings.cpp b/src/core/settings.cpp index a4623223d1..0da159559b 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -7,22 +7,18 @@ #include "core/hle/service/hid/hid.h" #include "core/settings.h" #include "video_core/renderer_base.h" -#include "video_core/video_core.h" namespace Settings { Values values = {}; void Apply() { - GDBStub::SetServerPort(values.gdbstub_port); GDBStub::ToggleServer(values.use_gdbstub); - VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; - auto& system_instance = Core::System::GetInstance(); if (system_instance.IsPoweredOn()) { - system_instance.Renderer().UpdateCurrentFramebufferLayout(); + system_instance.Renderer().RefreshBaseSettings(); } Service::HID::ReloadInputDevices(); diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 4ff4d71c51..40d3239567 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/assert.h" #include "video_core/engines/fermi_2d.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_compute.h" @@ -11,6 +12,15 @@ namespace Tegra { +u32 FramebufferConfig::BytesPerPixel(PixelFormat format) { + switch (format) { + case PixelFormat::ABGR8: + return 4; + } + + UNREACHABLE(); +} + GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { memory_manager = std::make_unique(); maxwell_3d = std::make_unique(rasterizer, *memory_manager); diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 874eddd78f..51c8385401 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -6,7 +6,6 @@ #include #include -#include #include "common/common_types.h" #include "core/hle/service/nvflinger/buffer_queue.h" #include "video_core/memory_manager.h" @@ -65,14 +64,7 @@ struct FramebufferConfig { /** * Returns the number of bytes per pixel. */ - static u32 BytesPerPixel(PixelFormat format) { - switch (format) { - case PixelFormat::ABGR8: - return 4; - } - - UNREACHABLE(); - } + static u32 BytesPerPixel(PixelFormat format); VAddr address; u32 offset; diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 3ca3502433..e87016429d 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -4,18 +4,23 @@ #include #include "core/frontend/emu_window.h" +#include "core/settings.h" #include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_rasterizer.h" namespace VideoCore { -RendererBase::RendererBase(EmuWindow& window) : render_window{window} {} +RendererBase::RendererBase(EmuWindow& window) : render_window{window} { + RefreshBaseSettings(); +} + RendererBase::~RendererBase() = default; -void RendererBase::UpdateCurrentFramebufferLayout() { - const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout(); +void RendererBase::RefreshBaseSettings() { + RefreshRasterizerSetting(); + UpdateCurrentFramebufferLayout(); - render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); + renderer_settings.use_framelimiter = Settings::values.toggle_framelimit; } void RendererBase::RefreshRasterizerSetting() { @@ -24,4 +29,10 @@ void RendererBase::RefreshRasterizerSetting() { } } +void RendererBase::UpdateCurrentFramebufferLayout() { + const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout(); + + render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); +} + } // namespace VideoCore diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 9dbea8b6de..fd8c475920 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -4,9 +4,9 @@ #pragma once +#include #include #include -#include "common/assert.h" #include "common/common_types.h" #include "video_core/gpu.h" #include "video_core/rasterizer_interface.h" @@ -15,6 +15,10 @@ class EmuWindow; namespace VideoCore { +struct RendererSettings { + std::atomic_bool use_framelimiter{false}; +}; + class RendererBase : NonCopyable { public: explicit RendererBase(EmuWindow& window); @@ -29,9 +33,6 @@ public: /// Shutdown the renderer virtual void ShutDown() = 0; - /// Updates the framebuffer layout of the contained render window handle. - void UpdateCurrentFramebufferLayout(); - // Getter/setter functions: // ------------------------ @@ -51,13 +52,23 @@ public: return *rasterizer; } - void RefreshRasterizerSetting(); + /// Refreshes the settings common to all renderers + void RefreshBaseSettings(); protected: + /// Refreshes settings specific to the rasterizer. + void RefreshRasterizerSetting(); + EmuWindow& render_window; ///< Reference to the render window handle. std::unique_ptr rasterizer; f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer int m_current_frame = 0; ///< Current frame, should be set by the renderer + + RendererSettings renderer_settings; + +private: + /// Updates the framebuffer layout of the contained render window handle. + void UpdateCurrentFramebufferLayout(); }; } // namespace VideoCore diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 5085ef96bd..1e686b89e7 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -9,8 +9,6 @@ namespace VideoCore { -std::atomic g_toggle_framelimit_enabled; - std::unique_ptr CreateRenderer(EmuWindow& emu_window) { return std::make_unique(emu_window); } diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index 9fbae8487d..2dc07540f6 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h @@ -4,7 +4,6 @@ #pragma once -#include #include class EmuWindow; @@ -13,10 +12,6 @@ namespace VideoCore { class RendererBase; -// TODO: Wrap these in a user settings struct along with any other graphics settings (often set from -// qt ui) -extern std::atomic g_toggle_framelimit_enabled; - /** * Creates a renderer instance. * From dfcde52f3933bab397fc8619ede00383f4a7e5e2 Mon Sep 17 00:00:00 2001 From: greggameplayer <33609333+greggameplayer@users.noreply.github.com> Date: Sat, 11 Aug 2018 20:01:50 +0200 Subject: [PATCH 11/11] Implement R16S & R16UI & R16I RenderTargetFormats & PixelFormats and more (R16_UNORM needed by Fate Extella) (#848) * Implement R16S & R16UI & R16I RenderTargetFormats & PixelFormats Do a separate function in order to get Bytes Per Pixel of DepthFormat Apply the new function in gpu.h delete unneeded white space * correct merging error --- src/video_core/gpu.cpp | 32 ++++++++++++ src/video_core/gpu.h | 7 +++ .../renderer_opengl/gl_rasterizer_cache.cpp | 21 +++++--- .../renderer_opengl/gl_rasterizer_cache.h | 51 ++++++++++++++----- 4 files changed, 92 insertions(+), 19 deletions(-) diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 4ff4d71c51..b90937d179 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -34,19 +34,51 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { switch (format) { case RenderTargetFormat::RGBA32_FLOAT: + case RenderTargetFormat::RGBA32_UINT: return 16; case RenderTargetFormat::RGBA16_FLOAT: case RenderTargetFormat::RG32_FLOAT: return 8; case RenderTargetFormat::RGBA8_UNORM: + case RenderTargetFormat::RGBA8_SRGB: case RenderTargetFormat::RGB10_A2_UNORM: case RenderTargetFormat::BGRA8_UNORM: + case RenderTargetFormat::RG16_UNORM: + case RenderTargetFormat::RG16_SNORM: + case RenderTargetFormat::RG16_UINT: + case RenderTargetFormat::RG16_SINT: + case RenderTargetFormat::RG16_FLOAT: case RenderTargetFormat::R32_FLOAT: case RenderTargetFormat::R11G11B10_FLOAT: return 4; + case RenderTargetFormat::R16_UNORM: + case RenderTargetFormat::R16_SNORM: + case RenderTargetFormat::R16_UINT: + case RenderTargetFormat::R16_SINT: + case RenderTargetFormat::R16_FLOAT: + return 2; + case RenderTargetFormat::R8_UNORM: + return 1; default: UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast(format)); } } +u32 DepthFormatBytesPerPixel(DepthFormat format) { + switch (format) { + case DepthFormat::Z32_S8_X24_FLOAT: + return 8; + case DepthFormat::Z32_FLOAT: + case DepthFormat::S8_Z24_UNORM: + case DepthFormat::Z24_X8_UNORM: + case DepthFormat::Z24_S8_UNORM: + case DepthFormat::Z24_C8_UNORM: + return 4; + case DepthFormat::Z16_UNORM: + return 2; + default: + UNIMPLEMENTED_MSG("Unimplemented Depth format {}", static_cast(format)); + } +} + } // namespace Tegra diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 874eddd78f..0164c747a2 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -35,6 +35,10 @@ enum class RenderTargetFormat : u32 { R11G11B10_FLOAT = 0xE0, R32_FLOAT = 0xE5, B5G6R5_UNORM = 0xE8, + R16_UNORM = 0xEE, + R16_SNORM = 0xEF, + R16_SINT = 0xF0, + R16_UINT = 0xF1, R16_FLOAT = 0xF2, R8_UNORM = 0xF3, }; @@ -52,6 +56,9 @@ enum class DepthFormat : u32 { /// Returns the number of bytes per pixel of each rendertarget format. u32 RenderTargetBytesPerPixel(RenderTargetFormat format); +/// Returns the number of bytes per pixel of each depth format. +u32 DepthFormatBytesPerPixel(DepthFormat format); + class DebugContext; /** diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 9fb734b77a..15a33ed9bf 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -122,6 +122,9 @@ static constexpr std::array tex_form {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM + {GL_R16_SNORM, GL_RED, GL_SHORT, ComponentType::SNorm, false}, // R16S + {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // R16UI + {GL_R16I, GL_RED_INTEGER, GL_SHORT, ComponentType::SInt, false}, // R16I {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16 {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI @@ -239,13 +242,14 @@ static constexpr std::array&, Tegra::GPU MortonCopy, MortonCopy, MortonCopy, MortonCopy, MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, MortonCopy, - MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, + MortonCopy, MortonCopy, }; static constexpr std::array&, Tegra::GPUVAddr), @@ -276,6 +280,9 @@ static constexpr std::array&, Tegra::GPU MortonCopy, MortonCopy, MortonCopy, + MortonCopy, + MortonCopy, + MortonCopy, MortonCopy, MortonCopy, MortonCopy, diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 829a76dfe4..e24ba8cfed 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -46,22 +46,25 @@ struct SurfaceParams { R32F = 20, R16F = 21, R16UNORM = 22, - RG16 = 23, - RG16F = 24, - RG16UI = 25, - RG16I = 26, - RG16S = 27, - RGB32F = 28, - SRGBA8 = 29, + R16S = 23, + R16UI = 24, + R16I = 25, + RG16 = 26, + RG16F = 27, + RG16UI = 28, + RG16I = 29, + RG16S = 30, + RGB32F = 31, + SRGBA8 = 32, MaxColorFormat, // DepthStencil formats - Z24S8 = 30, - S8Z24 = 31, - Z32F = 32, - Z16 = 33, - Z32FS8 = 34, + Z24S8 = 33, + S8Z24 = 34, + Z32F = 35, + Z16 = 36, + Z32FS8 = 37, MaxDepthStencilFormat, @@ -122,6 +125,9 @@ struct SurfaceParams { 1, // R32F 1, // R16F 1, // R16UNORM + 1, // R16S + 1, // R16UI + 1, // R16I 1, // RG16 1, // RG16F 1, // RG16UI @@ -168,6 +174,9 @@ struct SurfaceParams { 32, // R32F 16, // R16F 16, // R16UNORM + 16, // R16S + 16, // R16UI + 16, // R16I 32, // RG16 32, // RG16F 32, // RG16UI @@ -245,6 +254,14 @@ struct SurfaceParams { return PixelFormat::RG16S; case Tegra::RenderTargetFormat::R16_FLOAT: return PixelFormat::R16F; + case Tegra::RenderTargetFormat::R16_UNORM: + return PixelFormat::R16UNORM; + case Tegra::RenderTargetFormat::R16_SNORM: + return PixelFormat::R16S; + case Tegra::RenderTargetFormat::R16_UINT: + return PixelFormat::R16UI; + case Tegra::RenderTargetFormat::R16_SINT: + return PixelFormat::R16I; case Tegra::RenderTargetFormat::R32_FLOAT: return PixelFormat::R32F; default: @@ -293,6 +310,12 @@ struct SurfaceParams { return PixelFormat::R16F; case Tegra::Texture::ComponentType::UNORM: return PixelFormat::R16UNORM; + case Tegra::Texture::ComponentType::SNORM: + return PixelFormat::R16S; + case Tegra::Texture::ComponentType::UINT: + return PixelFormat::R16UI; + case Tegra::Texture::ComponentType::SINT: + return PixelFormat::R16I; } LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast(component_type)); @@ -376,9 +399,11 @@ struct SurfaceParams { case Tegra::RenderTargetFormat::RGB10_A2_UNORM: case Tegra::RenderTargetFormat::R8_UNORM: case Tegra::RenderTargetFormat::RG16_UNORM: + case Tegra::RenderTargetFormat::R16_UNORM: case Tegra::RenderTargetFormat::B5G6R5_UNORM: return ComponentType::UNorm; case Tegra::RenderTargetFormat::RG16_SNORM: + case Tegra::RenderTargetFormat::R16_SNORM: return ComponentType::SNorm; case Tegra::RenderTargetFormat::RGBA16_FLOAT: case Tegra::RenderTargetFormat::R11G11B10_FLOAT: @@ -390,8 +415,10 @@ struct SurfaceParams { return ComponentType::Float; case Tegra::RenderTargetFormat::RGBA32_UINT: case Tegra::RenderTargetFormat::RG16_UINT: + case Tegra::RenderTargetFormat::R16_UINT: return ComponentType::UInt; case Tegra::RenderTargetFormat::RG16_SINT: + case Tegra::RenderTargetFormat::R16_SINT: return ComponentType::SInt; default: LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast(format));