summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/file_sys/partition_filesystem.cpp6
-rw-r--r--src/core/hle/ipc_helpers.h34
-rw-r--r--src/core/hle/kernel/hle_ipc.h2
-rw-r--r--src/core/hle/kernel/mutex.cpp2
-rw-r--r--src/core/hle/service/acc/acc.cpp2
-rw-r--r--src/core/hle/service/apm/interface.h3
-rw-r--r--src/core/hle/service/service.h2
-rw-r--r--src/core/loader/elf.cpp2
-rw-r--r--src/core/loader/loader.h2
-rw-r--r--src/core/tracer/recorder.h2
-rw-r--r--src/video_core/gpu.cpp2
-rw-r--r--src/video_core/gpu.h2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp9
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp17
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h63
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp4
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h5
-rw-r--r--src/video_core/textures/decoders.cpp7
-rw-r--r--src/video_core/textures/texture.h8
20 files changed, 127 insertions, 52 deletions
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp
index 8d2bd9f6b..521e21078 100644
--- a/src/core/file_sys/partition_filesystem.cpp
+++ b/src/core/file_sys/partition_filesystem.cpp
@@ -65,8 +65,8 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) {
65 std::string name( 65 std::string name(
66 reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset])); 66 reinterpret_cast<const char*>(&file_data[strtab_offset + entry.strtab_offset]));
67 67
68 pfs_files.emplace_back( 68 pfs_files.emplace_back(std::make_shared<OffsetVfsFile>(
69 std::make_shared<OffsetVfsFile>(file, entry.size, content_offset + entry.offset, name)); 69 file, entry.size, content_offset + entry.offset, std::move(name)));
70 } 70 }
71 71
72 status = Loader::ResultStatus::Success; 72 status = Loader::ResultStatus::Success;
@@ -109,7 +109,7 @@ bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualD
109 return false; 109 return false;
110 110
111 const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter); 111 const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter);
112 pfs_files[offset] = pfs_files.back(); 112 pfs_files[offset] = std::move(pfs_files.back());
113 pfs_files.pop_back(); 113 pfs_files.pop_back();
114 114
115 pfs_dirs.emplace_back(std::move(dir)); 115 pfs_dirs.emplace_back(std::move(dir));
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 8b5b06f31..f5bd27a75 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -25,9 +25,9 @@ protected:
25 ptrdiff_t index = 0; 25 ptrdiff_t index = 0;
26 26
27public: 27public:
28 RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {} 28 explicit RequestHelperBase(u32* command_buffer) : cmdbuf(command_buffer) {}
29 29
30 RequestHelperBase(Kernel::HLERequestContext& context) 30 explicit RequestHelperBase(Kernel::HLERequestContext& context)
31 : context(&context), cmdbuf(context.CommandBuffer()) {} 31 : context(&context), cmdbuf(context.CommandBuffer()) {}
32 32
33 void Skip(unsigned size_in_words, bool set_to_null) { 33 void Skip(unsigned size_in_words, bool set_to_null) {
@@ -56,13 +56,6 @@ public:
56 56
57class ResponseBuilder : public RequestHelperBase { 57class ResponseBuilder : public RequestHelperBase {
58public: 58public:
59 ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
60
61 u32 normal_params_size{};
62 u32 num_handles_to_copy{};
63 u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
64 std::ptrdiff_t datapayload_index{};
65
66 /// Flags used for customizing the behavior of ResponseBuilder 59 /// Flags used for customizing the behavior of ResponseBuilder
67 enum class Flags : u32 { 60 enum class Flags : u32 {
68 None = 0, 61 None = 0,
@@ -71,9 +64,11 @@ public:
71 AlwaysMoveHandles = 1, 64 AlwaysMoveHandles = 1,
72 }; 65 };
73 66
74 ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size, 67 explicit ResponseBuilder(u32* command_buffer) : RequestHelperBase(command_buffer) {}
75 u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0, 68
76 Flags flags = Flags::None) 69 explicit ResponseBuilder(Kernel::HLERequestContext& context, u32 normal_params_size,
70 u32 num_handles_to_copy = 0, u32 num_objects_to_move = 0,
71 Flags flags = Flags::None)
77 72
78 : RequestHelperBase(context), normal_params_size(normal_params_size), 73 : RequestHelperBase(context), normal_params_size(normal_params_size),
79 num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) { 74 num_handles_to_copy(num_handles_to_copy), num_objects_to_move(num_objects_to_move) {
@@ -206,6 +201,12 @@ public:
206 201
207 template <typename... O> 202 template <typename... O>
208 void PushCopyObjects(Kernel::SharedPtr<O>... pointers); 203 void PushCopyObjects(Kernel::SharedPtr<O>... pointers);
204
205private:
206 u32 normal_params_size{};
207 u32 num_handles_to_copy{};
208 u32 num_objects_to_move{}; ///< Domain objects or move handles, context dependent
209 std::ptrdiff_t datapayload_index{};
209}; 210};
210 211
211/// Push /// 212/// Push ///
@@ -273,9 +274,9 @@ inline void ResponseBuilder::PushMoveObjects(Kernel::SharedPtr<O>... pointers) {
273 274
274class RequestParser : public RequestHelperBase { 275class RequestParser : public RequestHelperBase {
275public: 276public:
276 RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {} 277 explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
277 278
278 RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) { 279 explicit RequestParser(Kernel::HLERequestContext& context) : RequestHelperBase(context) {
279 ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete"); 280 ASSERT_MSG(context.GetDataPayloadOffset(), "context is incomplete");
280 Skip(context.GetDataPayloadOffset(), false); 281 Skip(context.GetDataPayloadOffset(), false);
281 // Skip the u64 command id, it's already stored in the context 282 // Skip the u64 command id, it's already stored in the context
@@ -285,8 +286,9 @@ public:
285 286
286 ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy, 287 ResponseBuilder MakeBuilder(u32 normal_params_size, u32 num_handles_to_copy,
287 u32 num_handles_to_move, 288 u32 num_handles_to_move,
288 ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) { 289 ResponseBuilder::Flags flags = ResponseBuilder::Flags::None) const {
289 return {*context, normal_params_size, num_handles_to_copy, num_handles_to_move, flags}; 290 return ResponseBuilder{*context, normal_params_size, num_handles_to_copy,
291 num_handles_to_move, flags};
290 } 292 }
291 293
292 template <typename T> 294 template <typename T>
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 01b805df8..84727f748 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -91,7 +91,7 @@ protected:
91 */ 91 */
92class HLERequestContext { 92class HLERequestContext {
93public: 93public:
94 HLERequestContext(SharedPtr<Kernel::ServerSession> session); 94 explicit HLERequestContext(SharedPtr<ServerSession> session);
95 ~HLERequestContext(); 95 ~HLERequestContext();
96 96
97 /// Returns a pointer to the IPC command buffer for this request. 97 /// Returns a pointer to the IPC command buffer for this request.
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 3f1de3258..feb7b88d2 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -19,7 +19,7 @@ namespace Kernel {
19/// Returns the number of threads that are waiting for a mutex, and the highest priority one among 19/// Returns the number of threads that are waiting for a mutex, and the highest priority one among
20/// those. 20/// those.
21static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread( 21static std::pair<SharedPtr<Thread>, u32> GetHighestPriorityMutexWaitingThread(
22 SharedPtr<Thread> current_thread, VAddr mutex_addr) { 22 const SharedPtr<Thread>& current_thread, VAddr mutex_addr) {
23 23
24 SharedPtr<Thread> highest_priority_thread; 24 SharedPtr<Thread> highest_priority_thread;
25 u32 num_waiters = 0; 25 u32 num_waiters = 0;
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 3e1c2c0a0..0b158e015 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -35,7 +35,7 @@ static constexpr u128 DEFAULT_USER_ID{1ull, 0ull};
35 35
36class IProfile final : public ServiceFramework<IProfile> { 36class IProfile final : public ServiceFramework<IProfile> {
37public: 37public:
38 IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) { 38 explicit IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) {
39 static const FunctionInfo functions[] = { 39 static const FunctionInfo functions[] = {
40 {0, nullptr, "Get"}, 40 {0, nullptr, "Get"},
41 {1, &IProfile::GetBase, "GetBase"}, 41 {1, &IProfile::GetBase, "GetBase"},
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h
index 85258a666..fa68c7d93 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/interface.h
@@ -19,7 +19,4 @@ private:
19 std::shared_ptr<Module> apm; 19 std::shared_ptr<Module> apm;
20}; 20};
21 21
22/// Registers all AM services with the specified service manager.
23void InstallInterfaces(SM::ServiceManager& service_manager);
24
25} // namespace Service::APM 22} // namespace Service::APM
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index fee841d46..180f22703 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -146,7 +146,7 @@ protected:
146 * @param max_sessions Maximum number of sessions that can be 146 * @param max_sessions Maximum number of sessions that can be
147 * connected to this service at the same time. 147 * connected to this service at the same time.
148 */ 148 */
149 ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions) 149 explicit ServiceFramework(const char* service_name, u32 max_sessions = DefaultMaxSessions)
150 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} 150 : ServiceFrameworkBase(service_name, max_sessions, Invoker) {}
151 151
152 /// Registers handlers in the service. 152 /// Registers handlers in the service.
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 4bfd5f536..352938dcb 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -190,7 +190,7 @@ private:
190 u32 entryPoint; 190 u32 entryPoint;
191 191
192public: 192public:
193 ElfReader(void* ptr); 193 explicit ElfReader(void* ptr);
194 194
195 u32 Read32(int off) const { 195 u32 Read32(int off) const {
196 return base32[off >> 2]; 196 return base32[off >> 2];
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 6f517ca8c..fbf11e5d0 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -79,7 +79,7 @@ enum class ResultStatus {
79/// Interface for loading an application 79/// Interface for loading an application
80class AppLoader : NonCopyable { 80class AppLoader : NonCopyable {
81public: 81public:
82 AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} 82 explicit AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {}
83 virtual ~AppLoader() {} 83 virtual ~AppLoader() {}
84 84
85 /** 85 /**
diff --git a/src/core/tracer/recorder.h b/src/core/tracer/recorder.h
index 629c2f6d2..e1cefd5fe 100644
--- a/src/core/tracer/recorder.h
+++ b/src/core/tracer/recorder.h
@@ -32,7 +32,7 @@ public:
32 * Recorder constructor 32 * Recorder constructor
33 * @param initial_state Initial recorder state 33 * @param initial_state Initial recorder state
34 */ 34 */
35 Recorder(const InitialState& initial_state); 35 explicit Recorder(const InitialState& initial_state);
36 36
37 /// Finish recording of this Citrace and save it using the given filename. 37 /// Finish recording of this Citrace and save it using the given filename.
38 void Finish(const std::string& filename); 38 void Finish(const std::string& filename);
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index a003bc9e3..60c49d672 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -35,9 +35,11 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
35 case RenderTargetFormat::RGBA32_FLOAT: 35 case RenderTargetFormat::RGBA32_FLOAT:
36 return 16; 36 return 16;
37 case RenderTargetFormat::RGBA16_FLOAT: 37 case RenderTargetFormat::RGBA16_FLOAT:
38 case RenderTargetFormat::RG32_FLOAT:
38 return 8; 39 return 8;
39 case RenderTargetFormat::RGBA8_UNORM: 40 case RenderTargetFormat::RGBA8_UNORM:
40 case RenderTargetFormat::RGB10_A2_UNORM: 41 case RenderTargetFormat::RGB10_A2_UNORM:
42 case RenderTargetFormat::BGRA8_UNORM:
41 return 4; 43 return 4;
42 default: 44 default:
43 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); 45 UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index a32148ecd..58501ca8b 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -18,6 +18,8 @@ enum class RenderTargetFormat : u32 {
18 RGBA32_FLOAT = 0xC0, 18 RGBA32_FLOAT = 0xC0,
19 RGBA32_UINT = 0xC2, 19 RGBA32_UINT = 0xC2,
20 RGBA16_FLOAT = 0xCA, 20 RGBA16_FLOAT = 0xCA,
21 RG32_FLOAT = 0xCB,
22 BGRA8_UNORM = 0xCF,
21 RGB10_A2_UNORM = 0xD1, 23 RGB10_A2_UNORM = 0xD1,
22 RGBA8_UNORM = 0xD5, 24 RGBA8_UNORM = 0xD5,
23 RGBA8_SRGB = 0xD6, 25 RGBA8_SRGB = 0xD6,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 56d9c575b..5d5ad84b7 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -601,7 +601,6 @@ void RasterizerOpenGL::SamplerInfo::Create() {
601 sampler.Create(); 601 sampler.Create();
602 mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear; 602 mag_filter = min_filter = Tegra::Texture::TextureFilter::Linear;
603 wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap; 603 wrap_u = wrap_v = Tegra::Texture::WrapMode::Wrap;
604 border_color_r = border_color_g = border_color_b = border_color_a = 0;
605 604
606 // default is GL_LINEAR_MIPMAP_LINEAR 605 // default is GL_LINEAR_MIPMAP_LINEAR
607 glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 606 glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -630,8 +629,12 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr
630 } 629 }
631 630
632 if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) { 631 if (wrap_u == Tegra::Texture::WrapMode::Border || wrap_v == Tegra::Texture::WrapMode::Border) {
633 // TODO(Subv): Implement border color 632 const GLvec4 new_border_color = {{config.border_color_r, config.border_color_g,
634 ASSERT(false); 633 config.border_color_b, config.border_color_a}};
634 if (border_color != new_border_color) {
635 border_color = new_border_color;
636 glSamplerParameterfv(s, GL_TEXTURE_BORDER_COLOR, border_color.data());
637 }
635 } 638 }
636} 639}
637 640
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index c406142e4..ab06e2d95 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -77,10 +77,7 @@ private:
77 Tegra::Texture::TextureFilter min_filter; 77 Tegra::Texture::TextureFilter min_filter;
78 Tegra::Texture::WrapMode wrap_u; 78 Tegra::Texture::WrapMode wrap_u;
79 Tegra::Texture::WrapMode wrap_v; 79 Tegra::Texture::WrapMode wrap_v;
80 u32 border_color_r; 80 GLvec4 border_color;
81 u32 border_color_g;
82 u32 border_color_b;
83 u32 border_color_a;
84 }; 81 };
85 82
86 /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth> 83 /// Configures the color and depth framebuffer states and returns the dirty <Color, Depth>
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 28f0bc379..1d3aff97b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -38,7 +38,8 @@ struct FormatTuple {
38 params.addr = config.tic.Address(); 38 params.addr = config.tic.Address();
39 params.is_tiled = config.tic.IsTiled(); 39 params.is_tiled = config.tic.IsTiled();
40 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, 40 params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0,
41 params.pixel_format = PixelFormatFromTextureFormat(config.tic.format); 41 params.pixel_format =
42 PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value());
42 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value()); 43 params.component_type = ComponentTypeFromTexture(config.tic.r_type.Value());
43 params.type = GetFormatType(params.pixel_format); 44 params.type = GetFormatType(params.pixel_format);
44 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format)); 45 params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
@@ -106,6 +107,10 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
106 true}, // BC7U 107 true}, // BC7U
107 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 108 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
108 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8 109 {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
110 {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
111 {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
112 {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
113 {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
109 114
110 // DepthStencil formats 115 // DepthStencil formats
111 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm, 116 {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -197,7 +202,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
197 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, 202 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
198 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 203 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
199 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 204 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
200 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::Z24S8>, 205 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
206 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
207 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>,
201 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, 208 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
202 MortonCopy<true, PixelFormat::Z16>, 209 MortonCopy<true, PixelFormat::Z16>,
203}; 210};
@@ -213,7 +220,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
213 MortonCopy<false, PixelFormat::RGBA16F>, 220 MortonCopy<false, PixelFormat::RGBA16F>,
214 MortonCopy<false, PixelFormat::R11FG11FB10F>, 221 MortonCopy<false, PixelFormat::R11FG11FB10F>,
215 MortonCopy<false, PixelFormat::RGBA32UI>, 222 MortonCopy<false, PixelFormat::RGBA32UI>,
216 // TODO(Subv): Swizzling the DXT1/DXT23/DXT45/DXN1/BC7U formats is not yet supported 223 // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported
217 nullptr, 224 nullptr,
218 nullptr, 225 nullptr,
219 nullptr, 226 nullptr,
@@ -221,6 +228,10 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
221 nullptr, 228 nullptr,
222 nullptr, 229 nullptr,
223 MortonCopy<false, PixelFormat::G8R8>, 230 MortonCopy<false, PixelFormat::G8R8>,
231 MortonCopy<false, PixelFormat::BGRA8>,
232 MortonCopy<false, PixelFormat::RGBA32F>,
233 MortonCopy<false, PixelFormat::RG32F>,
234 MortonCopy<false, PixelFormat::R32F>,
224 MortonCopy<false, PixelFormat::Z24S8>, 235 MortonCopy<false, PixelFormat::Z24S8>,
225 MortonCopy<false, PixelFormat::S8Z24>, 236 MortonCopy<false, PixelFormat::S8Z24>,
226 MortonCopy<false, PixelFormat::Z32F>, 237 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 b084c4db4..800d239d9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -37,14 +37,18 @@ struct SurfaceParams {
37 BC7U = 12, 37 BC7U = 12,
38 ASTC_2D_4X4 = 13, 38 ASTC_2D_4X4 = 13,
39 G8R8 = 14, 39 G8R8 = 14,
40 BGRA8 = 15,
41 RGBA32F = 16,
42 RG32F = 17,
43 R32F = 18,
40 44
41 MaxColorFormat, 45 MaxColorFormat,
42 46
43 // DepthStencil formats 47 // DepthStencil formats
44 Z24S8 = 15, 48 Z24S8 = 19,
45 S8Z24 = 16, 49 S8Z24 = 20,
46 Z32F = 17, 50 Z32F = 21,
47 Z16 = 18, 51 Z16 = 22,
48 52
49 MaxDepthStencilFormat, 53 MaxDepthStencilFormat,
50 54
@@ -97,6 +101,10 @@ struct SurfaceParams {
97 4, // BC7U 101 4, // BC7U
98 4, // ASTC_2D_4X4 102 4, // ASTC_2D_4X4
99 1, // G8R8 103 1, // G8R8
104 1, // BGRA8
105 1, // RGBA32F
106 1, // RG32F
107 1, // R32F
100 1, // Z24S8 108 1, // Z24S8
101 1, // S8Z24 109 1, // S8Z24
102 1, // Z32F 110 1, // Z32F
@@ -127,6 +135,10 @@ struct SurfaceParams {
127 128, // BC7U 135 128, // BC7U
128 32, // ASTC_2D_4X4 136 32, // ASTC_2D_4X4
129 16, // G8R8 137 16, // G8R8
138 32, // BGRA8
139 128, // RGBA32F
140 64, // RG32F
141 32, // R32F
130 32, // Z24S8 142 32, // Z24S8
131 32, // S8Z24 143 32, // S8Z24
132 32, // Z32F 144 32, // Z32F
@@ -162,10 +174,16 @@ struct SurfaceParams {
162 case Tegra::RenderTargetFormat::RGBA8_UNORM: 174 case Tegra::RenderTargetFormat::RGBA8_UNORM:
163 case Tegra::RenderTargetFormat::RGBA8_SRGB: 175 case Tegra::RenderTargetFormat::RGBA8_SRGB:
164 return PixelFormat::ABGR8; 176 return PixelFormat::ABGR8;
177 case Tegra::RenderTargetFormat::BGRA8_UNORM:
178 return PixelFormat::BGRA8;
165 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 179 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
166 return PixelFormat::A2B10G10R10; 180 return PixelFormat::A2B10G10R10;
167 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 181 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
168 return PixelFormat::RGBA16F; 182 return PixelFormat::RGBA16F;
183 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
184 return PixelFormat::RGBA32F;
185 case Tegra::RenderTargetFormat::RG32_FLOAT:
186 return PixelFormat::RG32F;
169 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 187 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
170 return PixelFormat::R11FG11FB10F; 188 return PixelFormat::R11FG11FB10F;
171 case Tegra::RenderTargetFormat::RGBA32_UINT: 189 case Tegra::RenderTargetFormat::RGBA32_UINT:
@@ -176,7 +194,8 @@ struct SurfaceParams {
176 } 194 }
177 } 195 }
178 196
179 static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format) { 197 static PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
198 Tegra::Texture::ComponentType component_type) {
180 // TODO(Subv): Properly implement this 199 // TODO(Subv): Properly implement this
181 switch (format) { 200 switch (format) {
182 case Tegra::Texture::TextureFormat::A8R8G8B8: 201 case Tegra::Texture::TextureFormat::A8R8G8B8:
@@ -196,7 +215,19 @@ struct SurfaceParams {
196 case Tegra::Texture::TextureFormat::BF10GF11RF11: 215 case Tegra::Texture::TextureFormat::BF10GF11RF11:
197 return PixelFormat::R11FG11FB10F; 216 return PixelFormat::R11FG11FB10F;
198 case Tegra::Texture::TextureFormat::R32_G32_B32_A32: 217 case Tegra::Texture::TextureFormat::R32_G32_B32_A32:
199 return PixelFormat::RGBA32UI; 218 switch (component_type) {
219 case Tegra::Texture::ComponentType::FLOAT:
220 return PixelFormat::RGBA32F;
221 case Tegra::Texture::ComponentType::UINT:
222 return PixelFormat::RGBA32UI;
223 }
224 LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
225 static_cast<u32>(component_type));
226 UNREACHABLE();
227 case Tegra::Texture::TextureFormat::R32_G32:
228 return PixelFormat::RG32F;
229 case Tegra::Texture::TextureFormat::R32:
230 return PixelFormat::R32F;
200 case Tegra::Texture::TextureFormat::DXT1: 231 case Tegra::Texture::TextureFormat::DXT1:
201 return PixelFormat::DXT1; 232 return PixelFormat::DXT1;
202 case Tegra::Texture::TextureFormat::DXT23: 233 case Tegra::Texture::TextureFormat::DXT23:
@@ -210,7 +241,8 @@ struct SurfaceParams {
210 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 241 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
211 return PixelFormat::ASTC_2D_4X4; 242 return PixelFormat::ASTC_2D_4X4;
212 default: 243 default:
213 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format)); 244 LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}",
245 static_cast<u32>(format), static_cast<u32>(component_type));
214 UNREACHABLE(); 246 UNREACHABLE();
215 } 247 }
216 } 248 }
@@ -248,7 +280,18 @@ struct SurfaceParams {
248 return Tegra::Texture::TextureFormat::BC7U; 280 return Tegra::Texture::TextureFormat::BC7U;
249 case PixelFormat::ASTC_2D_4X4: 281 case PixelFormat::ASTC_2D_4X4:
250 return Tegra::Texture::TextureFormat::ASTC_2D_4X4; 282 return Tegra::Texture::TextureFormat::ASTC_2D_4X4;
283 case PixelFormat::BGRA8:
284 // TODO(bunnei): This is fine for unswizzling (since we just need the right component
285 // sizes), but could be a bug if we used this function in different ways.
286 return Tegra::Texture::TextureFormat::A8R8G8B8;
287 case PixelFormat::RGBA32F:
288 return Tegra::Texture::TextureFormat::R32_G32_B32_A32;
289 case PixelFormat::RG32F:
290 return Tegra::Texture::TextureFormat::R32_G32;
291 case PixelFormat::R32F:
292 return Tegra::Texture::TextureFormat::R32;
251 default: 293 default:
294 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
252 UNREACHABLE(); 295 UNREACHABLE();
253 } 296 }
254 } 297 }
@@ -264,6 +307,7 @@ struct SurfaceParams {
264 case PixelFormat::Z16: 307 case PixelFormat::Z16:
265 return Tegra::DepthFormat::Z16_UNORM; 308 return Tegra::DepthFormat::Z16_UNORM;
266 default: 309 default:
310 LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
267 UNREACHABLE(); 311 UNREACHABLE();
268 } 312 }
269 } 313 }
@@ -273,6 +317,8 @@ struct SurfaceParams {
273 switch (type) { 317 switch (type) {
274 case Tegra::Texture::ComponentType::UNORM: 318 case Tegra::Texture::ComponentType::UNORM:
275 return ComponentType::UNorm; 319 return ComponentType::UNorm;
320 case Tegra::Texture::ComponentType::FLOAT:
321 return ComponentType::Float;
276 default: 322 default:
277 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type)); 323 LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
278 UNREACHABLE(); 324 UNREACHABLE();
@@ -284,10 +330,13 @@ struct SurfaceParams {
284 switch (format) { 330 switch (format) {
285 case Tegra::RenderTargetFormat::RGBA8_UNORM: 331 case Tegra::RenderTargetFormat::RGBA8_UNORM:
286 case Tegra::RenderTargetFormat::RGBA8_SRGB: 332 case Tegra::RenderTargetFormat::RGBA8_SRGB:
333 case Tegra::RenderTargetFormat::BGRA8_UNORM:
287 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 334 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
288 return ComponentType::UNorm; 335 return ComponentType::UNorm;
289 case Tegra::RenderTargetFormat::RGBA16_FLOAT: 336 case Tegra::RenderTargetFormat::RGBA16_FLOAT:
290 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 337 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
338 case Tegra::RenderTargetFormat::RGBA32_FLOAT:
339 case Tegra::RenderTargetFormat::RG32_FLOAT:
291 return ComponentType::Float; 340 return ComponentType::Float;
292 case Tegra::RenderTargetFormat::RGBA32_UINT: 341 case Tegra::RenderTargetFormat::RGBA32_UINT:
293 return ComponentType::UInt; 342 return ComponentType::UInt;
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index d4b1a6f33..acf067050 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -756,8 +756,8 @@ private:
756 } 756 }
757 } 757 }
758 758
759 std::string WriteTexsInstruction(const Instruction& instr, const std::string& coord, 759 void WriteTexsInstruction(const Instruction& instr, const std::string& coord,
760 const std::string& texture) { 760 const std::string& texture) {
761 // Add an extra scope and declare the texture coords inside to prevent 761 // Add an extra scope and declare the texture coords inside to prevent
762 // overwriting them in case they are used as outputs of the texs instruction. 762 // overwriting them in case they are used as outputs of the texs instruction.
763 shader.AddLine('{'); 763 shader.AddLine('{');
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index e19c3b280..16b1bd606 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -56,6 +56,9 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
56 return {}; 56 return {};
57 } 57 }
58 58
59 case Maxwell::VertexAttribute::Type::UnsignedInt:
60 return GL_UNSIGNED_INT;
61
59 case Maxwell::VertexAttribute::Type::Float: 62 case Maxwell::VertexAttribute::Type::Float:
60 return GL_FLOAT; 63 return GL_FLOAT;
61 } 64 }
@@ -112,6 +115,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
112 return GL_MIRRORED_REPEAT; 115 return GL_MIRRORED_REPEAT;
113 case Tegra::Texture::WrapMode::ClampToEdge: 116 case Tegra::Texture::WrapMode::ClampToEdge:
114 return GL_CLAMP_TO_EDGE; 117 return GL_CLAMP_TO_EDGE;
118 case Tegra::Texture::WrapMode::Border:
119 return GL_CLAMP_TO_BORDER;
115 case Tegra::Texture::WrapMode::ClampOGL: 120 case Tegra::Texture::WrapMode::ClampOGL:
116 // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use 121 // TODO(Subv): GL_CLAMP was removed as of OpenGL 3.1, to implement GL_CLAMP, we can use
117 // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to 122 // GL_CLAMP_TO_BORDER to get the border color of the texture, and then sample the edge to
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index a3e67d105..cda2646ad 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -61,6 +61,7 @@ u32 BytesPerPixel(TextureFormat format) {
61 case TextureFormat::A8R8G8B8: 61 case TextureFormat::A8R8G8B8:
62 case TextureFormat::A2B10G10R10: 62 case TextureFormat::A2B10G10R10:
63 case TextureFormat::BF10GF11RF11: 63 case TextureFormat::BF10GF11RF11:
64 case TextureFormat::R32:
64 return 4; 65 return 4;
65 case TextureFormat::A1B5G5R5: 66 case TextureFormat::A1B5G5R5:
66 case TextureFormat::B5G6R5: 67 case TextureFormat::B5G6R5:
@@ -72,6 +73,8 @@ u32 BytesPerPixel(TextureFormat format) {
72 return 8; 73 return 8;
73 case TextureFormat::R32_G32_B32_A32: 74 case TextureFormat::R32_G32_B32_A32:
74 return 16; 75 return 16;
76 case TextureFormat::R32_G32:
77 return 8;
75 default: 78 default:
76 UNIMPLEMENTED_MSG("Format not implemented"); 79 UNIMPLEMENTED_MSG("Format not implemented");
77 break; 80 break;
@@ -118,6 +121,8 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
118 case TextureFormat::G8R8: 121 case TextureFormat::G8R8:
119 case TextureFormat::R16_G16_B16_A16: 122 case TextureFormat::R16_G16_B16_A16:
120 case TextureFormat::R32_G32_B32_A32: 123 case TextureFormat::R32_G32_B32_A32:
124 case TextureFormat::R32_G32:
125 case TextureFormat::R32:
121 case TextureFormat::BF10GF11RF11: 126 case TextureFormat::BF10GF11RF11:
122 case TextureFormat::ASTC_2D_4X4: 127 case TextureFormat::ASTC_2D_4X4:
123 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data, 128 CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -174,6 +179,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
174 case TextureFormat::G8R8: 179 case TextureFormat::G8R8:
175 case TextureFormat::BF10GF11RF11: 180 case TextureFormat::BF10GF11RF11:
176 case TextureFormat::R32_G32_B32_A32: 181 case TextureFormat::R32_G32_B32_A32:
182 case TextureFormat::R32_G32:
183 case TextureFormat::R32:
177 // TODO(Subv): For the time being just forward the same data without any decoding. 184 // TODO(Subv): For the time being just forward the same data without any decoding.
178 rgba_data = texture_data; 185 rgba_data = texture_data;
179 break; 186 break;
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index d1c755033..c6bd2f4b9 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -242,10 +242,10 @@ struct TSCEntry {
242 BitField<6, 2, TextureMipmapFilter> mip_filter; 242 BitField<6, 2, TextureMipmapFilter> mip_filter;
243 }; 243 };
244 INSERT_PADDING_BYTES(8); 244 INSERT_PADDING_BYTES(8);
245 u32 border_color_r; 245 float border_color_r;
246 u32 border_color_g; 246 float border_color_g;
247 u32 border_color_b; 247 float border_color_b;
248 u32 border_color_a; 248 float border_color_a;
249}; 249};
250static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size"); 250static_assert(sizeof(TSCEntry) == 0x20, "TSCEntry has wrong size");
251 251