aboutsummaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/memory_manager.cpp36
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h4
3 files changed, 26 insertions, 15 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index de276c559..c464fc6d1 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -29,6 +29,7 @@ enum class RenderTargetFormat : u32 {
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.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index bb39c0a6f..bf0458b94 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -230,7 +230,8 @@ struct SurfaceParams {
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();
@@ -437,6 +438,7 @@ struct SurfaceParams {
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: