summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/svc.cpp11
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp29
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h27
-rw-r--r--src/video_core/textures/decoders.cpp3
5 files changed, 39 insertions, 38 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 7b41c9cfd..da7cacb57 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -165,11 +165,14 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
165 using ObjectPtr = SharedPtr<WaitObject>; 165 using ObjectPtr = SharedPtr<WaitObject>;
166 std::vector<ObjectPtr> objects(handle_count); 166 std::vector<ObjectPtr> objects(handle_count);
167 167
168 for (int i = 0; i < handle_count; ++i) { 168 for (u64 i = 0; i < handle_count; ++i) {
169 Handle handle = Memory::Read32(handles_address + i * sizeof(Handle)); 169 const Handle handle = Memory::Read32(handles_address + i * sizeof(Handle));
170 auto object = g_handle_table.Get<WaitObject>(handle); 170 const auto object = g_handle_table.Get<WaitObject>(handle);
171 if (object == nullptr) 171
172 if (object == nullptr) {
172 return ERR_INVALID_HANDLE; 173 return ERR_INVALID_HANDLE;
174 }
175
173 objects[i] = object; 176 objects[i] = object;
174 } 177 }
175 178
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 18bd62a08..b0277a875 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -6,7 +6,6 @@
6#include "common/common_funcs.h" 6#include "common/common_funcs.h"
7#include "common/file_util.h" 7#include "common/file_util.h"
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "core/file_sys/content_archive.h" 9#include "core/file_sys/content_archive.h"
11#include "core/gdbstub/gdbstub.h" 10#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/process.h" 11#include "core/hle/kernel/process.h"
@@ -18,34 +17,6 @@
18 17
19namespace Loader { 18namespace Loader {
20 19
21static std::string FindRomFS(const std::string& directory) {
22 std::string filepath_romfs;
23 const auto callback = [&filepath_romfs](u64*, const std::string& directory,
24 const std::string& virtual_name) -> bool {
25 const std::string physical_name = directory + virtual_name;
26 if (FileUtil::IsDirectory(physical_name)) {
27 // Skip directories
28 return true;
29 }
30
31 // Verify extension
32 const std::string extension = physical_name.substr(physical_name.find_last_of(".") + 1);
33 if (Common::ToLower(extension) != "romfs") {
34 return true;
35 }
36
37 // Found it - we are done
38 filepath_romfs = std::move(physical_name);
39 return false;
40 };
41
42 // Search the specified directory recursively, looking for the first .romfs file, which will
43 // be used for the RomFS
44 FileUtil::ForeachDirectoryEntry(nullptr, directory, callback);
45
46 return filepath_romfs;
47}
48
49AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file) 20AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file)
50 : AppLoader(std::move(file)) {} 21 : AppLoader(std::move(file)) {}
51 22
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 1d3aff97b..0f5006383 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -111,6 +111,8 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F 111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F 112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F 113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
114 {GL_R16F, GL_RED, GL_HALF_FLOAT, ComponentType::Float, false}, // R16F
115 {GL_R16, GL_RED, GL_UNSIGNED_SHORT, ComponentType::UNorm, false}, // R16UNORM
114 116
115 // DepthStencil formats 117 // DepthStencil formats
116 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 118 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -204,7 +206,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
204 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 206 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
205 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 207 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
206 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 208 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
207 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>, 209 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
210 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::Z24S8>,
208 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 211 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
209 MortonCopy<true, PixelFormat::Z16>, 212 MortonCopy<true, PixelFormat::Z16>,
210}; 213};
@@ -232,6 +235,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
232 MortonCopy<false, PixelFormat::RGBA32F>, 235 MortonCopy<false, PixelFormat::RGBA32F>,
233 MortonCopy<false, PixelFormat::RG32F>, 236 MortonCopy<false, PixelFormat::RG32F>,
234 MortonCopy<false, PixelFormat::R32F>, 237 MortonCopy<false, PixelFormat::R32F>,
238 MortonCopy<false, PixelFormat::R16F>,
239 MortonCopy<false, PixelFormat::R16UNORM>,
235 MortonCopy<false, PixelFormat::Z24S8>, 240 MortonCopy<false, PixelFormat::Z24S8>,
236 MortonCopy<false, PixelFormat::S8Z24>, 241 MortonCopy<false, PixelFormat::S8Z24>,
237 MortonCopy<false, PixelFormat::Z32F>, 242 MortonCopy<false, PixelFormat::Z32F>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 800d239d9..e1d3670d9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -41,14 +41,16 @@ struct SurfaceParams {
41 RGBA32F = 16, 41 RGBA32F = 16,
42 RG32F = 17, 42 RG32F = 17,
43 R32F = 18, 43 R32F = 18,
44 R16F = 19,
45 R16UNORM = 20,
44 46
45 MaxColorFormat, 47 MaxColorFormat,
46 48
47 // DepthStencil formats 49 // DepthStencil formats
48 Z24S8 = 19, 50 Z24S8 = 21,
49 S8Z24 = 20, 51 S8Z24 = 22,
50 Z32F = 21, 52 Z32F = 23,
51 Z16 = 22, 53 Z16 = 24,
52 54
53 MaxDepthStencilFormat, 55 MaxDepthStencilFormat,
54 56
@@ -105,6 +107,8 @@ struct SurfaceParams {
105 1, // RGBA32F 107 1, // RGBA32F
106 1, // RG32F 108 1, // RG32F
107 1, // R32F 109 1, // R32F
110 1, // R16F
111 1, // R16UNORM
108 1, // Z24S8 112 1, // Z24S8
109 1, // S8Z24 113 1, // S8Z24
110 1, // Z32F 114 1, // Z32F
@@ -139,6 +143,8 @@ struct SurfaceParams {
139 128, // RGBA32F 143 128, // RGBA32F
140 64, // RG32F 144 64, // RG32F
141 32, // R32F 145 32, // R32F
146 16, // R16F
147 16, // R16UNORM
142 32, // Z24S8 148 32, // Z24S8
143 32, // S8Z24 149 32, // S8Z24
144 32, // Z32F 150 32, // Z32F
@@ -226,6 +232,16 @@ struct SurfaceParams {
226 UNREACHABLE(); 232 UNREACHABLE();
227 case Tegra::Texture::TextureFormat::R32_G32: 233 case Tegra::Texture::TextureFormat::R32_G32:
228 return PixelFormat::RG32F; 234 return PixelFormat::RG32F;
235 case Tegra::Texture::TextureFormat::R16:
236 switch (component_type) {
237 case Tegra::Texture::ComponentType::FLOAT:
238 return PixelFormat::R16F;
239 case Tegra::Texture::ComponentType::UNORM:
240 return PixelFormat::R16UNORM;
241 }
242 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
243 static_cast<u32>(component_type));
244 UNREACHABLE();
229 case Tegra::Texture::TextureFormat::R32: 245 case Tegra::Texture::TextureFormat::R32:
230 return PixelFormat::R32F; 246 return PixelFormat::R32F;
231 case Tegra::Texture::TextureFormat::DXT1: 247 case Tegra::Texture::TextureFormat::DXT1:
@@ -290,6 +306,9 @@ struct SurfaceParams {
290 return Tegra::Texture::TextureFormat::R32_G32; 306 return Tegra::Texture::TextureFormat::R32_G32;
291 case PixelFormat::R32F: 307 case PixelFormat::R32F:
292 return Tegra::Texture::TextureFormat::R32; 308 return Tegra::Texture::TextureFormat::R32;
309 case PixelFormat::R16F:
310 case PixelFormat::R16UNORM:
311 return Tegra::Texture::TextureFormat::R16;
293 default: 312 default:
294 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 313 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
295 UNREACHABLE(); 314 UNREACHABLE();
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index cda2646ad..970c06e71 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -66,6 +66,7 @@ u32 BytesPerPixel(TextureFormat format) {
66 case TextureFormat::A1B5G5R5: 66 case TextureFormat::A1B5G5R5:
67 case TextureFormat::B5G6R5: 67 case TextureFormat::B5G6R5:
68 case TextureFormat::G8R8: 68 case TextureFormat::G8R8:
69 case TextureFormat::R16:
69 return 2; 70 return 2;
70 case TextureFormat::R8: 71 case TextureFormat::R8:
71 return 1; 72 return 1;
@@ -123,6 +124,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
123 case TextureFormat::R32_G32_B32_A32: 124 case TextureFormat::R32_G32_B32_A32:
124 case TextureFormat::R32_G32: 125 case TextureFormat::R32_G32:
125 case TextureFormat::R32: 126 case TextureFormat::R32:
127 case TextureFormat::R16:
126 case TextureFormat::BF10GF11RF11: 128 case TextureFormat::BF10GF11RF11:
127 case TextureFormat::ASTC_2D_4X4: 129 case TextureFormat::ASTC_2D_4X4:
128 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 130 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -181,6 +183,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
181 case TextureFormat::R32_G32_B32_A32: 183 case TextureFormat::R32_G32_B32_A32:
182 case TextureFormat::R32_G32: 184 case TextureFormat::R32_G32:
183 case TextureFormat::R32: 185 case TextureFormat::R32:
186 case TextureFormat::R16:
184 // TODO(Subv): For the time being just forward the same data without any decoding. 187 // TODO(Subv): For the time being just forward the same data without any decoding.
185 rgba_data = texture_data; 188 rgba_data = texture_data;
186 break; 189 break;