mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 08:51:52 +01:00
Support partially mapped cbufs
Buggy games sometimes supply an incorrect cbuf size so limit buffers to the first unmapped region.
This commit is contained in:
parent
6a6f51ea84
commit
99652c5eda
@ -89,7 +89,7 @@ namespace skyline {
|
|||||||
/**
|
/**
|
||||||
* @return If the span is valid by not being null
|
* @return If the span is valid by not being null
|
||||||
*/
|
*/
|
||||||
constexpr bool valid() {
|
constexpr bool valid() const {
|
||||||
return this->data() != nullptr;
|
return this->data() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/container/static_vector.hpp>
|
#include <boost/container/static_vector.hpp>
|
||||||
|
#include <range/v3/algorithm.hpp>
|
||||||
#include <gpu/texture/format.h>
|
#include <gpu/texture/format.h>
|
||||||
#include <gpu/buffer_manager.h>
|
#include <gpu/buffer_manager.h>
|
||||||
#include <soc/gm20b/channel.h>
|
#include <soc/gm20b/channel.h>
|
||||||
@ -603,6 +604,10 @@ namespace skyline::gpu::interconnect {
|
|||||||
return constantBufferSelector;
|
return constantBufferSelector;
|
||||||
|
|
||||||
auto mappings{channelCtx.asCtx->gmmu.TranslateRange(constantBufferSelector.iova, constantBufferSelector.size)};
|
auto mappings{channelCtx.asCtx->gmmu.TranslateRange(constantBufferSelector.iova, constantBufferSelector.size)};
|
||||||
|
|
||||||
|
// Ignore unmapped areas from mappings due to buggy games setting the wrong cbuf size
|
||||||
|
mappings.erase(ranges::find_if(mappings, [](const auto &mapping) { return !mapping.valid(); }), mappings.end());
|
||||||
|
|
||||||
constantBufferSelector.guest.mappings.assign(mappings.begin(), mappings.end());
|
constantBufferSelector.guest.mappings.assign(mappings.begin(), mappings.end());
|
||||||
|
|
||||||
constantBufferSelector.view = gpu.buffer.FindOrCreate(constantBufferSelector.guest);
|
constantBufferSelector.view = gpu.buffer.FindOrCreate(constantBufferSelector.guest);
|
||||||
|
Loading…
Reference in New Issue
Block a user