forked from etc/pineapple-src
early-access version 1356
This commit is contained in:
parent
ccc73bbbbf
commit
db32a0cb82
4 changed files with 24 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1355.
|
This is the source code for early-access 1356.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -333,17 +333,29 @@ void MemoryManager::WriteBlockUnsafe(GPUVAddr gpu_dest_addr, const void* src_buf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MemoryManager::FlushRegion(GPUVAddr gpu_addr, size_t size) const {
|
||||||
|
size_t remaining_size{size};
|
||||||
|
size_t page_index{gpu_addr >> page_bits};
|
||||||
|
size_t page_offset{gpu_addr & page_mask};
|
||||||
|
while (remaining_size > 0) {
|
||||||
|
const size_t num_bytes{std::min(page_size - page_offset, remaining_size)};
|
||||||
|
if (const auto page_addr{GpuToCpuAddress(page_index << page_bits)}; page_addr) {
|
||||||
|
rasterizer->FlushRegion(*page_addr + page_offset, num_bytes);
|
||||||
|
}
|
||||||
|
++page_index;
|
||||||
|
page_offset = 0;
|
||||||
|
remaining_size -= num_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size) {
|
void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size) {
|
||||||
std::vector<u8> tmp_buffer(size);
|
std::vector<u8> tmp_buffer(size);
|
||||||
ReadBlock(gpu_src_addr, tmp_buffer.data(), size);
|
ReadBlock(gpu_src_addr, tmp_buffer.data(), size);
|
||||||
WriteBlock(gpu_dest_addr, tmp_buffer.data(), size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryManager::CopyBlockUnsafe(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr,
|
// The output block must be flushed in case it has data modified from the GPU.
|
||||||
std::size_t size) {
|
// Fixes NPC geometry in Zombie Panic in Wonderland DX
|
||||||
std::vector<u8> tmp_buffer(size);
|
FlushRegion(gpu_dest_addr, size);
|
||||||
ReadBlockUnsafe(gpu_src_addr, tmp_buffer.data(), size);
|
WriteBlock(gpu_dest_addr, tmp_buffer.data(), size);
|
||||||
WriteBlockUnsafe(gpu_dest_addr, tmp_buffer.data(), size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const {
|
bool MemoryManager::IsGranularRange(GPUVAddr gpu_addr, std::size_t size) const {
|
||||||
|
|
|
@ -107,7 +107,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void ReadBlockUnsafe(GPUVAddr gpu_src_addr, void* dest_buffer, std::size_t size) const;
|
void ReadBlockUnsafe(GPUVAddr gpu_src_addr, void* dest_buffer, std::size_t size) const;
|
||||||
void WriteBlockUnsafe(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size);
|
void WriteBlockUnsafe(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size);
|
||||||
void CopyBlockUnsafe(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IsGranularRange checks if a gpu region can be simply read with a pointer.
|
* IsGranularRange checks if a gpu region can be simply read with a pointer.
|
||||||
|
@ -139,6 +138,8 @@ private:
|
||||||
void TryLockPage(PageEntry page_entry, std::size_t size);
|
void TryLockPage(PageEntry page_entry, std::size_t size);
|
||||||
void TryUnlockPage(PageEntry page_entry, std::size_t size);
|
void TryUnlockPage(PageEntry page_entry, std::size_t size);
|
||||||
|
|
||||||
|
void FlushRegion(GPUVAddr gpu_addr, size_t size) const;
|
||||||
|
|
||||||
[[nodiscard]] static constexpr std::size_t PageEntryIndex(GPUVAddr gpu_addr) {
|
[[nodiscard]] static constexpr std::size_t PageEntryIndex(GPUVAddr gpu_addr) {
|
||||||
return (gpu_addr >> page_bits) & page_table_mask;
|
return (gpu_addr >> page_bits) & page_table_mask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/div_ceil.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/engines/shader_type.h"
|
#include "video_core/engines/shader_type.h"
|
||||||
|
@ -855,7 +856,7 @@ private:
|
||||||
void DeclareConstantBuffers() {
|
void DeclareConstantBuffers() {
|
||||||
u32 binding = device.GetBaseBindings(stage).uniform_buffer;
|
u32 binding = device.GetBaseBindings(stage).uniform_buffer;
|
||||||
for (const auto& [index, info] : ir.GetConstantBuffers()) {
|
for (const auto& [index, info] : ir.GetConstantBuffers()) {
|
||||||
const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4;
|
const u32 num_elements = Common::DivCeil(info.GetSize(), 4 * sizeof(u32));
|
||||||
const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements;
|
const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements;
|
||||||
code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++,
|
code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++,
|
||||||
GetConstBufferBlock(index));
|
GetConstBufferBlock(index));
|
||||||
|
|
Loading…
Reference in a new issue