summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/command_processor.h3
-rw-r--r--src/video_core/engines/shader_bytecode.h3
-rw-r--r--src/video_core/gpu.cpp32
-rw-r--r--src/video_core/gpu.h7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp21
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h51
-rw-r--r--src/yuzu/game_list_p.h25
7 files changed, 106 insertions, 36 deletions
diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h
index f7214ffec..a01153e0b 100644
--- a/src/video_core/command_processor.h
+++ b/src/video_core/command_processor.h
@@ -30,8 +30,7 @@ union CommandHeader {
30 30
31 BitField<29, 3, SubmissionMode> mode; 31 BitField<29, 3, SubmissionMode> mode;
32}; 32};
33static_assert(std::is_standard_layout<CommandHeader>::value == true, 33static_assert(std::is_standard_layout_v<CommandHeader>, "CommandHeader is not standard layout");
34 "CommandHeader does not use standard layout");
35static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); 34static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!");
36 35
37} // namespace Tegra 36} // namespace Tegra
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 3d4557b7e..3e409c2e1 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -477,8 +477,7 @@ union Instruction {
477 u64 value; 477 u64 value;
478}; 478};
479static_assert(sizeof(Instruction) == 0x8, "Incorrect structure size"); 479static_assert(sizeof(Instruction) == 0x8, "Incorrect structure size");
480static_assert(std::is_standard_layout<Instruction>::value, 480static_assert(std::is_standard_layout_v<Instruction>, "Instruction is not standard layout");
481 "Structure does not have standard layout");
482 481
483class OpCode { 482class OpCode {
484public: 483public:
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 40d323956..ceaf86654 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -44,19 +44,51 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
44 44
45 switch (format) { 45 switch (format) {
46 case RenderTargetFormat::RGBA32_FLOAT: 46 case RenderTargetFormat::RGBA32_FLOAT:
47 case RenderTargetFormat::RGBA32_UINT:
47 return 16; 48 return 16;
48 case RenderTargetFormat::RGBA16_FLOAT: 49 case RenderTargetFormat::RGBA16_FLOAT:
49 case RenderTargetFormat::RG32_FLOAT: 50 case RenderTargetFormat::RG32_FLOAT:
50 return 8; 51 return 8;
51 case RenderTargetFormat::RGBA8_UNORM: 52 case RenderTargetFormat::RGBA8_UNORM:
53 case RenderTargetFormat::RGBA8_SRGB:
52 case RenderTargetFormat::RGB10_A2_UNORM: 54 case RenderTargetFormat::RGB10_A2_UNORM:
53 case RenderTargetFormat::BGRA8_UNORM: 55 case RenderTargetFormat::BGRA8_UNORM:
56 case RenderTargetFormat::RG16_UNORM:
57 case RenderTargetFormat::RG16_SNORM:
58 case RenderTargetFormat::RG16_UINT:
59 case RenderTargetFormat::RG16_SINT:
60 case RenderTargetFormat::RG16_FLOAT:
54 case RenderTargetFormat::R32_FLOAT: 61 case RenderTargetFormat::R32_FLOAT:
55 case RenderTargetFormat::R11G11B10_FLOAT: 62 case RenderTargetFormat::R11G11B10_FLOAT:
56 return 4; 63 return 4;
64 case RenderTargetFormat::R16_UNORM:
65 case RenderTargetFormat::R16_SNORM:
66 case RenderTargetFormat::R16_UINT:
67 case RenderTargetFormat::R16_SINT:
68 case RenderTargetFormat::R16_FLOAT:
69 return 2;
70 case RenderTargetFormat::R8_UNORM:
71 return 1;
57 default: 72 default:
58 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); 73 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
59 } 74 }
60} 75}
61 76
77u32 DepthFormatBytesPerPixel(DepthFormat format) {
78 switch (format) {
79 case DepthFormat::Z32_S8_X24_FLOAT:
80 return 8;
81 case DepthFormat::Z32_FLOAT:
82 case DepthFormat::S8_Z24_UNORM:
83 case DepthFormat::Z24_X8_UNORM:
84 case DepthFormat::Z24_S8_UNORM:
85 case DepthFormat::Z24_C8_UNORM:
86 return 4;
87 case DepthFormat::Z16_UNORM:
88 return 2;
89 default:
90 UNIMPLEMENTED_MSG("Unimplemented Depth format {}", static_cast<u32>(format));
91 }
92}
93
62} // namespace Tegra 94} // namespace Tegra
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 51c838540..b57312b3b 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -34,6 +34,10 @@ enum class RenderTargetFormat : u32 {
34 R11G11B10_FLOAT = 0xE0, 34 R11G11B10_FLOAT = 0xE0,
35 R32_FLOAT = 0xE5, 35 R32_FLOAT = 0xE5,
36 B5G6R5_UNORM = 0xE8, 36 B5G6R5_UNORM = 0xE8,
37 R16_UNORM = 0xEE,
38 R16_SNORM = 0xEF,
39 R16_SINT = 0xF0,
40 R16_UINT = 0xF1,
37 R16_FLOAT = 0xF2, 41 R16_FLOAT = 0xF2,
38 R8_UNORM = 0xF3, 42 R8_UNORM = 0xF3,
39}; 43};
@@ -51,6 +55,9 @@ enum class DepthFormat : u32 {
51/// Returns the number of bytes per pixel of each rendertarget format. 55/// Returns the number of bytes per pixel of each rendertarget format.
52u32 RenderTargetBytesPerPixel(RenderTargetFormat format); 56u32 RenderTargetBytesPerPixel(RenderTargetFormat format);
53 57
58/// Returns the number of bytes per pixel of each depth format.
59u32 DepthFormatBytesPerPixel(DepthFormat format);
60
54class DebugContext; 61class DebugContext;
55 62
56/** 63/**
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 9fb734b77..15a33ed9b 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<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
122 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 122 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
123 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F 123 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
124 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM 124 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
125 {GL_R16_SNORM, GL_RED, GL_SHORT, ComponentType::SNorm, false}, // R16S
126 {GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // R16UI
127 {GL_R16I, GL_RED_INTEGER, GL_SHORT, ComponentType::SInt, false}, // R16I
125 {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16 128 {GL_RG16, GL_RG, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // RG16
126 {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F 129 {GL_RG16F, GL_RG, GL_HALF_FLOAT, ComponentType::Float, false}, // RG16F
127 {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI 130 {GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, ComponentType::UInt, false}, // RG16UI
@@ -239,13 +242,14 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
239 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 242 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
240 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 243 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
241 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, 244 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
242 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, 245 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>,
243 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, 246 MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>,
244 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, 247 MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>,
245 MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, 248 MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>,
246 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, 249 MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>,
247 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, 250 MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
248 MortonCopy<true, PixelFormat::Z32FS8>, 251 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
252 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
249}; 253};
250 254
251static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), 255static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr),
@@ -276,6 +280,9 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU
276 MortonCopy<false, PixelFormat::R32F>, 280 MortonCopy<false, PixelFormat::R32F>,
277 MortonCopy<false, PixelFormat::R16F>, 281 MortonCopy<false, PixelFormat::R16F>,
278 MortonCopy<false, PixelFormat::R16UNORM>, 282 MortonCopy<false, PixelFormat::R16UNORM>,
283 MortonCopy<false, PixelFormat::R16S>,
284 MortonCopy<false, PixelFormat::R16UI>,
285 MortonCopy<false, PixelFormat::R16I>,
279 MortonCopy<false, PixelFormat::RG16>, 286 MortonCopy<false, PixelFormat::RG16>,
280 MortonCopy<false, PixelFormat::RG16F>, 287 MortonCopy<false, PixelFormat::RG16F>,
281 MortonCopy<false, PixelFormat::RG16UI>, 288 MortonCopy<false, PixelFormat::RG16UI>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 829a76dfe..e24ba8cfe 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 {
46 R32F = 20, 46 R32F = 20,
47 R16F = 21, 47 R16F = 21,
48 R16UNORM = 22, 48 R16UNORM = 22,
49 RG16 = 23, 49 R16S = 23,
50 RG16F = 24, 50 R16UI = 24,
51 RG16UI = 25, 51 R16I = 25,
52 RG16I = 26, 52 RG16 = 26,
53 RG16S = 27, 53 RG16F = 27,
54 RGB32F = 28, 54 RG16UI = 28,
55 SRGBA8 = 29, 55 RG16I = 29,
56 RG16S = 30,
57 RGB32F = 31,
58 SRGBA8 = 32,
56 59
57 MaxColorFormat, 60 MaxColorFormat,
58 61
59 // DepthStencil formats 62 // DepthStencil formats
60 Z24S8 = 30, 63 Z24S8 = 33,
61 S8Z24 = 31, 64 S8Z24 = 34,
62 Z32F = 32, 65 Z32F = 35,
63 Z16 = 33, 66 Z16 = 36,
64 Z32FS8 = 34, 67 Z32FS8 = 37,
65 68
66 MaxDepthStencilFormat, 69 MaxDepthStencilFormat,
67 70
@@ -122,6 +125,9 @@ struct SurfaceParams {
122 1, // R32F 125 1, // R32F
123 1, // R16F 126 1, // R16F
124 1, // R16UNORM 127 1, // R16UNORM
128 1, // R16S
129 1, // R16UI
130 1, // R16I
125 1, // RG16 131 1, // RG16
126 1, // RG16F 132 1, // RG16F
127 1, // RG16UI 133 1, // RG16UI
@@ -168,6 +174,9 @@ struct SurfaceParams {
168 32, // R32F 174 32, // R32F
169 16, // R16F 175 16, // R16F
170 16, // R16UNORM 176 16, // R16UNORM
177 16, // R16S
178 16, // R16UI
179 16, // R16I
171 32, // RG16 180 32, // RG16
172 32, // RG16F 181 32, // RG16F
173 32, // RG16UI 182 32, // RG16UI
@@ -245,6 +254,14 @@ struct SurfaceParams {
245 return PixelFormat::RG16S; 254 return PixelFormat::RG16S;
246 case Tegra::RenderTargetFormat::R16_FLOAT: 255 case Tegra::RenderTargetFormat::R16_FLOAT:
247 return PixelFormat::R16F; 256 return PixelFormat::R16F;
257 case Tegra::RenderTargetFormat::R16_UNORM:
258 return PixelFormat::R16UNORM;
259 case Tegra::RenderTargetFormat::R16_SNORM:
260 return PixelFormat::R16S;
261 case Tegra::RenderTargetFormat::R16_UINT:
262 return PixelFormat::R16UI;
263 case Tegra::RenderTargetFormat::R16_SINT:
264 return PixelFormat::R16I;
248 case Tegra::RenderTargetFormat::R32_FLOAT: 265 case Tegra::RenderTargetFormat::R32_FLOAT:
249 return PixelFormat::R32F; 266 return PixelFormat::R32F;
250 default: 267 default:
@@ -293,6 +310,12 @@ struct SurfaceParams {
293 return PixelFormat::R16F; 310 return PixelFormat::R16F;
294 case Tegra::Texture::ComponentType::UNORM: 311 case Tegra::Texture::ComponentType::UNORM:
295 return PixelFormat::R16UNORM; 312 return PixelFormat::R16UNORM;
313 case Tegra::Texture::ComponentType::SNORM:
314 return PixelFormat::R16S;
315 case Tegra::Texture::ComponentType::UINT:
316 return PixelFormat::R16UI;
317 case Tegra::Texture::ComponentType::SINT:
318 return PixelFormat::R16I;
296 } 319 }
297 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", 320 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
298 static_cast<u32>(component_type)); 321 static_cast<u32>(component_type));
@@ -376,9 +399,11 @@ struct SurfaceParams {
376 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 399 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
377 case Tegra::RenderTargetFormat::R8_UNORM: 400 case Tegra::RenderTargetFormat::R8_UNORM:
378 case Tegra::RenderTargetFormat::RG16_UNORM: 401 case Tegra::RenderTargetFormat::RG16_UNORM:
402 case Tegra::RenderTargetFormat::R16_UNORM:
379 case Tegra::RenderTargetFormat::B5G6R5_UNORM: 403 case Tegra::RenderTargetFormat::B5G6R5_UNORM:
380 return ComponentType::UNorm; 404 return ComponentType::UNorm;
381 case Tegra::RenderTargetFormat::RG16_SNORM: 405 case Tegra::RenderTargetFormat::RG16_SNORM:
406 case Tegra::RenderTargetFormat::R16_SNORM:
382 return ComponentType::SNorm; 407 return ComponentType::SNorm;
383 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 408 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
384 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 409 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
@@ -390,8 +415,10 @@ struct SurfaceParams {
390 return ComponentType::Float; 415 return ComponentType::Float;
391 case Tegra::RenderTargetFormat::RGBA32_UINT: 416 case Tegra::RenderTargetFormat::RGBA32_UINT:
392 case Tegra::RenderTargetFormat::RG16_UINT: 417 case Tegra::RenderTargetFormat::RG16_UINT:
418 case Tegra::RenderTargetFormat::R16_UINT:
393 return ComponentType::UInt; 419 return ComponentType::UInt;
394 case Tegra::RenderTargetFormat::RG16_SINT: 420 case Tegra::RenderTargetFormat::RG16_SINT:
421 case Tegra::RenderTargetFormat::R16_SINT:
395 return ComponentType::SInt; 422 return ComponentType::SInt;
396 default: 423 default:
397 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 424 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 114a0fc7f..8fe5e8b80 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array>
7#include <atomic> 8#include <atomic>
8#include <utility> 9#include <utility>
9#include <QImage> 10#include <QImage>
@@ -39,7 +40,6 @@ public:
39 * If this class receives valid SMDH data, it will also display game icons and titles. 40 * If this class receives valid SMDH data, it will also display game icons and titles.
40 */ 41 */
41class GameListItemPath : public GameListItem { 42class GameListItemPath : public GameListItem {
42
43public: 43public:
44 static const int FullPathRole = Qt::UserRole + 1; 44 static const int FullPathRole = Qt::UserRole + 1;
45 static const int TitleRole = Qt::UserRole + 2; 45 static const int TitleRole = Qt::UserRole + 2;
@@ -48,18 +48,18 @@ public:
48 48
49 GameListItemPath() = default; 49 GameListItemPath() = default;
50 GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data, 50 GameListItemPath(const QString& game_path, const std::vector<u8>& picture_data,
51 const QString& game_name, const QString& game_type, u64 program_id) 51 const QString& game_name, const QString& game_type, u64 program_id) {
52 : GameListItem() {
53 setData(game_path, FullPathRole); 52 setData(game_path, FullPathRole);
54 setData(game_name, TitleRole); 53 setData(game_name, TitleRole);
55 setData(qulonglong(program_id), ProgramIdRole); 54 setData(qulonglong(program_id), ProgramIdRole);
56 setData(game_type, FileTypeRole); 55 setData(game_type, FileTypeRole);
57 56
57 const u32 size = UISettings::values.icon_size;
58
58 QPixmap picture; 59 QPixmap picture;
59 u32 size = UISettings::values.icon_size; 60 if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) {
60 if (!picture.loadFromData(picture_data.data(), picture_data.size()))
61 picture = GetDefaultIcon(size); 61 picture = GetDefaultIcon(size);
62 62 }
63 picture = picture.scaled(size, size); 63 picture = picture.scaled(size, size);
64 64
65 setData(picture, Qt::DecorationRole); 65 setData(picture, Qt::DecorationRole);
@@ -70,17 +70,16 @@ public:
70 std::string filename; 70 std::string filename;
71 Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, 71 Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename,
72 nullptr); 72 nullptr);
73 QString title = data(TitleRole).toString();
74 73
75 std::vector<QString> row_data{ 74 const std::array<QString, 4> row_data{{
76 QString::fromStdString(filename), 75 QString::fromStdString(filename),
77 data(FileTypeRole).toString(), 76 data(FileTypeRole).toString(),
78 QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())), 77 QString::fromStdString(fmt::format("0x{:016X}", data(ProgramIdRole).toULongLong())),
79 data(TitleRole).toString(), 78 data(TitleRole).toString(),
80 }; 79 }};
81 80
82 auto row1 = row_data.at(UISettings::values.row_1_text_id); 81 const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
83 auto row2 = row_data.at(UISettings::values.row_2_text_id); 82 const auto& row2 = row_data.at(UISettings::values.row_2_text_id);
84 83
85 if (row1.isEmpty() || row1 == row2) 84 if (row1.isEmpty() || row1 == row2)
86 return row2; 85 return row2;
@@ -88,9 +87,9 @@ public:
88 return row1; 87 return row1;
89 88
90 return row1 + "\n " + row2; 89 return row1 + "\n " + row2;
91 } else {
92 return GameListItem::data(role);
93 } 90 }
91
92 return GameListItem::data(role);
94 } 93 }
95}; 94};
96 95