summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/lm/lm.cpp60
-rw-r--r--src/core/hle/service/lm/lm.h15
-rw-r--r--src/video_core/gpu.h6
-rw-r--r--src/video_core/memory_manager.cpp36
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp38
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h75
-rw-r--r--src/video_core/textures/decoders.cpp3
7 files changed, 160 insertions, 73 deletions
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index e85a8bdb9..b497376d7 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -4,10 +4,12 @@
#include <sstream>
#include <string>
+
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
-#include "core/hle/kernel/client_session.h"
#include "core/hle/service/lm/lm.h"
+#include "core/hle/service/service.h"
+#include "core/memory.h"
namespace Service::LM {
@@ -15,13 +17,12 @@ class Logger final : public ServiceFramework<Logger> {
public:
Logger() : ServiceFramework("Logger") {
static const FunctionInfo functions[] = {
- {0x00000000, &Logger::Log, "Log"},
+ {0x00000000, &Logger::Initialize, "Initialize"},
+ {0x00000001, nullptr, "SetDestination"},
};
RegisterHandlers(functions);
}
- ~Logger() = default;
-
private:
struct MessageHeader {
enum Flags : u32_le {
@@ -66,13 +67,13 @@ private:
};
/**
- * LM::Log service function
+ * ILogger::Initialize service function
* Inputs:
* 0: 0x00000000
* Outputs:
* 0: ResultCode
*/
- void Log(Kernel::HLERequestContext& ctx) {
+ void Initialize(Kernel::HLERequestContext& ctx) {
// This function only succeeds - Get that out of the way
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@@ -162,30 +163,33 @@ private:
std::ostringstream log_stream;
};
-void InstallInterfaces(SM::ServiceManager& service_manager) {
- std::make_shared<LM>()->InstallAsService(service_manager);
-}
+class LM final : public ServiceFramework<LM> {
+public:
+ explicit LM() : ServiceFramework{"lm"} {
+ static const FunctionInfo functions[] = {
+ {0x00000000, &LM::OpenLogger, "OpenLogger"},
+ };
+ RegisterHandlers(functions);
+ }
-/**
- * LM::Initialize service function
- * Inputs:
- * 0: 0x00000000
- * Outputs:
- * 0: ResultCode
- */
-void LM::Initialize(Kernel::HLERequestContext& ctx) {
- IPC::ResponseBuilder rb{ctx, 2, 0, 1};
- rb.Push(RESULT_SUCCESS);
- rb.PushIpcInterface<Logger>();
-
- LOG_DEBUG(Service_LM, "called");
-}
+ /**
+ * LM::OpenLogger service function
+ * Inputs:
+ * 0: 0x00000000
+ * Outputs:
+ * 0: ResultCode
+ */
+ void OpenLogger(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushIpcInterface<Logger>();
-LM::LM() : ServiceFramework("lm") {
- static const FunctionInfo functions[] = {
- {0x00000000, &LM::Initialize, "Initialize"},
- };
- RegisterHandlers(functions);
+ LOG_DEBUG(Service_LM, "called");
+ }
+};
+
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ std::make_shared<LM>()->InstallAsService(service_manager);
}
} // namespace Service::LM
diff --git a/src/core/hle/service/lm/lm.h b/src/core/hle/service/lm/lm.h
index 63d6506fe..7806ae27b 100644
--- a/src/core/hle/service/lm/lm.h
+++ b/src/core/hle/service/lm/lm.h
@@ -4,21 +4,12 @@
#pragma once
-#include <vector>
-#include "core/hle/kernel/kernel.h"
-#include "core/hle/service/service.h"
+namespace Service::SM {
+class ServiceManager;
+}
namespace Service::LM {
-class LM final : public ServiceFramework<LM> {
-public:
- LM();
- ~LM() = default;
-
-private:
- void Initialize(Kernel::HLERequestContext& ctx);
-};
-
/// Registers all LM services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager);
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index e9d87efb4..c464fc6d1 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -23,7 +23,13 @@ enum class RenderTargetFormat : u32 {
RGB10_A2_UNORM = 0xD1,
RGBA8_UNORM = 0xD5,
RGBA8_SRGB = 0xD6,
+ RG16_UNORM = 0xDA,
+ RG16_SNORM = 0xDB,
+ RG16_SINT = 0xDC,
+ RG16_UINT = 0xDD,
+ RG16_FLOAT = 0xDE,
R11G11B10_FLOAT = 0xE0,
+ R16_FLOAT = 0xF2,
R8_UNORM = 0xF3,
};
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp
index 2f814a184..ca923d17d 100644
--- a/src/video_core/memory_manager.cpp
+++ b/src/video_core/memory_manager.cpp
@@ -13,8 +13,10 @@ GPUVAddr MemoryManager::AllocateSpace(u64 size, u64 align) {
ASSERT(gpu_addr);
for (u64 offset = 0; offset < size; offset += PAGE_SIZE) {
- ASSERT(PageSlot(*gpu_addr + offset) == static_cast<u64>(PageStatus::Unmapped));
- PageSlot(*gpu_addr + offset) = static_cast<u64>(PageStatus::Allocated);
+ VAddr& slot = PageSlot(*gpu_addr + offset);
+
+ ASSERT(slot == static_cast<u64>(PageStatus::Unmapped));
+ slot = static_cast<u64>(PageStatus::Allocated);
}
return *gpu_addr;
@@ -22,8 +24,10 @@ GPUVAddr MemoryManager::AllocateSpace(u64 size, u64 align) {
GPUVAddr MemoryManager::AllocateSpace(GPUVAddr gpu_addr, u64 size, u64 align) {
for (u64 offset = 0; offset < size; offset += PAGE_SIZE) {
- ASSERT(PageSlot(gpu_addr + offset) == static_cast<u64>(PageStatus::Unmapped));
- PageSlot(gpu_addr + offset) = static_cast<u64>(PageStatus::Allocated);
+ VAddr& slot = PageSlot(gpu_addr + offset);
+
+ ASSERT(slot == static_cast<u64>(PageStatus::Unmapped));
+ slot = static_cast<u64>(PageStatus::Allocated);
}
return gpu_addr;
@@ -34,8 +38,10 @@ GPUVAddr MemoryManager::MapBufferEx(VAddr cpu_addr, u64 size) {
ASSERT(gpu_addr);
for (u64 offset = 0; offset < size; offset += PAGE_SIZE) {
- ASSERT(PageSlot(*gpu_addr + offset) == static_cast<u64>(PageStatus::Unmapped));
- PageSlot(*gpu_addr + offset) = cpu_addr + offset;
+ VAddr& slot = PageSlot(*gpu_addr + offset);
+
+ ASSERT(slot == static_cast<u64>(PageStatus::Unmapped));
+ slot = cpu_addr + offset;
}
MappedRegion region{cpu_addr, *gpu_addr, size};
@@ -48,8 +54,10 @@ GPUVAddr MemoryManager::MapBufferEx(VAddr cpu_addr, GPUVAddr gpu_addr, u64 size)
ASSERT((gpu_addr & PAGE_MASK) == 0);
for (u64 offset = 0; offset < size; offset += PAGE_SIZE) {
- ASSERT(PageSlot(gpu_addr + offset) == static_cast<u64>(PageStatus::Allocated));
- PageSlot(gpu_addr + offset) = cpu_addr + offset;
+ VAddr& slot = PageSlot(gpu_addr + offset);
+
+ ASSERT(slot == static_cast<u64>(PageStatus::Allocated));
+ slot = cpu_addr + offset;
}
MappedRegion region{cpu_addr, gpu_addr, size};
@@ -62,9 +70,11 @@ GPUVAddr MemoryManager::UnmapBuffer(GPUVAddr gpu_addr, u64 size) {
ASSERT((gpu_addr & PAGE_MASK) == 0);
for (u64 offset = 0; offset < size; offset += PAGE_SIZE) {
- ASSERT(PageSlot(gpu_addr + offset) != static_cast<u64>(PageStatus::Allocated) &&
- PageSlot(gpu_addr + offset) != static_cast<u64>(PageStatus::Unmapped));
- PageSlot(gpu_addr + offset) = static_cast<u64>(PageStatus::Unmapped);
+ VAddr& slot = PageSlot(gpu_addr + offset);
+
+ ASSERT(slot != static_cast<u64>(PageStatus::Allocated) &&
+ slot != static_cast<u64>(PageStatus::Unmapped));
+ slot = static_cast<u64>(PageStatus::Unmapped);
}
// Delete the region mappings that are contained within the unmapped region
@@ -128,9 +138,7 @@ VAddr& MemoryManager::PageSlot(GPUVAddr gpu_addr) {
auto& block = page_table[(gpu_addr >> (PAGE_BITS + PAGE_TABLE_BITS)) & PAGE_TABLE_MASK];
if (!block) {
block = std::make_unique<PageBlock>();
- for (unsigned index = 0; index < PAGE_BLOCK_SIZE; index++) {
- (*block)[index] = static_cast<u64>(PageStatus::Unmapped);
- }
+ block->fill(static_cast<VAddr>(PageStatus::Unmapped));
}
return (*block)[(gpu_addr >> PAGE_BITS) & PAGE_BLOCK_MASK];
}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index f52ac23f1..a4d9707cb 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -104,15 +104,20 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
true}, // DXT45
{GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1
{GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
- true}, // BC7U
- {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
- {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
- {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
- {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
- {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
- {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
+ true}, // BC7U
+ {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
+ {GL_RG8, GL_RG, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // G8R8
+ {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
+ {GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
+ {GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
+ {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_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
+ {GL_RG16I, GL_RG_INTEGER, GL_SHORT, ComponentType::SInt, false}, // RG16I
+ {GL_RG16_SNORM, GL_RG, GL_SHORT, ComponentType::SNorm, false}, // RG16S
{GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ComponentType::UNorm, false}, // SRGBA8
// DepthStencil formats
@@ -210,10 +215,12 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>,
- MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::SRGBA8>,
- MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
- MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
- MortonCopy<true, PixelFormat::Z32FS8>,
+ MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>,
+ MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>,
+ MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>,
+ MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
+ MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
+ MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
};
static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -241,6 +248,11 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<false, PixelFormat::R32F>,
MortonCopy<false, PixelFormat::R16F>,
MortonCopy<false, PixelFormat::R16UNORM>,
+ MortonCopy<false, PixelFormat::RG16>,
+ MortonCopy<false, PixelFormat::RG16F>,
+ MortonCopy<false, PixelFormat::RG16UI>,
+ MortonCopy<false, PixelFormat::RG16I>,
+ MortonCopy<false, PixelFormat::RG16S>,
MortonCopy<false, PixelFormat::SRGBA8>,
MortonCopy<false, PixelFormat::Z24S8>,
MortonCopy<false, PixelFormat::S8Z24>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index ffa2019f7..bf0458b94 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -43,16 +43,21 @@ struct SurfaceParams {
R32F = 18,
R16F = 19,
R16UNORM = 20,
- SRGBA8 = 21,
+ RG16 = 21,
+ RG16F = 22,
+ RG16UI = 23,
+ RG16I = 24,
+ RG16S = 25,
+ SRGBA8 = 26,
MaxColorFormat,
// DepthStencil formats
- Z24S8 = 22,
- S8Z24 = 23,
- Z32F = 24,
- Z16 = 25,
- Z32FS8 = 26,
+ Z24S8 = 27,
+ S8Z24 = 28,
+ Z32F = 29,
+ Z16 = 30,
+ Z32FS8 = 31,
MaxDepthStencilFormat,
@@ -111,6 +116,11 @@ struct SurfaceParams {
1, // R32F
1, // R16F
1, // R16UNORM
+ 1, // RG16
+ 1, // RG16F
+ 1, // RG16UI
+ 1, // RG16I
+ 1, // RG16S
1, // SRGBA8
1, // Z24S8
1, // S8Z24
@@ -149,6 +159,11 @@ struct SurfaceParams {
32, // R32F
16, // R16F
16, // R16UNORM
+ 32, // RG16
+ 32, // RG16F
+ 32, // RG16UI
+ 32, // RG16I
+ 32, // RG16S
32, // SRGBA8
32, // Z24S8
32, // S8Z24
@@ -205,6 +220,18 @@ struct SurfaceParams {
return PixelFormat::RGBA32UI;
case Tegra::RenderTargetFormat::R8_UNORM:
return PixelFormat::R8;
+ case Tegra::RenderTargetFormat::RG16_FLOAT:
+ return PixelFormat::RG16F;
+ case Tegra::RenderTargetFormat::RG16_UINT:
+ return PixelFormat::RG16UI;
+ case Tegra::RenderTargetFormat::RG16_SINT:
+ return PixelFormat::RG16I;
+ case Tegra::RenderTargetFormat::RG16_UNORM:
+ return PixelFormat::RG16;
+ case Tegra::RenderTargetFormat::RG16_SNORM:
+ return PixelFormat::RG16S;
+ case Tegra::RenderTargetFormat::R16_FLOAT:
+ return PixelFormat::R16F;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
@@ -271,6 +298,22 @@ struct SurfaceParams {
return PixelFormat::BC7U;
case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
return PixelFormat::ASTC_2D_4X4;
+ case Tegra::Texture::TextureFormat::R16_G16:
+ switch (component_type) {
+ case Tegra::Texture::ComponentType::FLOAT:
+ return PixelFormat::RG16F;
+ case Tegra::Texture::ComponentType::UNORM:
+ return PixelFormat::RG16;
+ case Tegra::Texture::ComponentType::SNORM:
+ return PixelFormat::RG16S;
+ case Tegra::Texture::ComponentType::UINT:
+ return PixelFormat::RG16UI;
+ case Tegra::Texture::ComponentType::SINT:
+ return PixelFormat::RG16I;
+ }
+ LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}",
+ static_cast<u32>(component_type));
+ UNREACHABLE();
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}",
static_cast<u32>(format), static_cast<u32>(component_type));
@@ -329,6 +372,12 @@ struct SurfaceParams {
return Tegra::Texture::TextureFormat::ZF32;
case PixelFormat::Z24S8:
return Tegra::Texture::TextureFormat::Z24S8;
+ case PixelFormat::RG16F:
+ case PixelFormat::RG16:
+ case PixelFormat::RG16UI:
+ case PixelFormat::RG16I:
+ case PixelFormat::RG16S:
+ return Tegra::Texture::TextureFormat::R16_G16;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
@@ -360,6 +409,12 @@ struct SurfaceParams {
return ComponentType::UNorm;
case Tegra::Texture::ComponentType::FLOAT:
return ComponentType::Float;
+ case Tegra::Texture::ComponentType::SNORM:
+ return ComponentType::SNorm;
+ case Tegra::Texture::ComponentType::UINT:
+ return ComponentType::UInt;
+ case Tegra::Texture::ComponentType::SINT:
+ return ComponentType::SInt;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented component type={}", static_cast<u32>(type));
UNREACHABLE();
@@ -374,14 +429,22 @@ struct SurfaceParams {
case Tegra::RenderTargetFormat::BGRA8_UNORM:
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
case Tegra::RenderTargetFormat::R8_UNORM:
+ case Tegra::RenderTargetFormat::RG16_UNORM:
return ComponentType::UNorm;
+ case Tegra::RenderTargetFormat::RG16_SNORM:
+ return ComponentType::SNorm;
case Tegra::RenderTargetFormat::RGBA16_FLOAT:
case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
case Tegra::RenderTargetFormat::RGBA32_FLOAT:
case Tegra::RenderTargetFormat::RG32_FLOAT:
+ case Tegra::RenderTargetFormat::RG16_FLOAT:
+ case Tegra::RenderTargetFormat::R16_FLOAT:
return ComponentType::Float;
case Tegra::RenderTargetFormat::RGBA32_UINT:
+ case Tegra::RenderTargetFormat::RG16_UINT:
return ComponentType::UInt;
+ case Tegra::RenderTargetFormat::RG16_SINT:
+ return ComponentType::SInt;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 50c5a56f6..d794f8402 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -62,6 +62,7 @@ u32 BytesPerPixel(TextureFormat format) {
case TextureFormat::A2B10G10R10:
case TextureFormat::BF10GF11RF11:
case TextureFormat::R32:
+ case TextureFormat::R16_G16:
return 4;
case TextureFormat::A1B5G5R5:
case TextureFormat::B5G6R5:
@@ -127,6 +128,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
case TextureFormat::R32_G32:
case TextureFormat::R32:
case TextureFormat::R16:
+ case TextureFormat::R16_G16:
case TextureFormat::BF10GF11RF11:
case TextureFormat::ASTC_2D_4X4:
CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -187,6 +189,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
case TextureFormat::R32_G32:
case TextureFormat::R32:
case TextureFormat::R16:
+ case TextureFormat::R16_G16:
// TODO(Subv): For the time being just forward the same data without any decoding.
rgba_data = texture_data;
break;