Avoid page faults when using the fallback shader size

These occured in some homebrew otherwise.
This commit is contained in:
Billy Laws 2023-01-29 22:16:08 +00:00
parent 10e7e6272a
commit 198e9e8e48

View File

@ -100,7 +100,16 @@ namespace skyline::gpu::interconnect {
size_t storageOffset{splitBinaryStorage.size()}; size_t storageOffset{splitBinaryStorage.size()};
splitBinaryStorage.resize(storageOffset + FallbackSize); splitBinaryStorage.resize(storageOffset + FallbackSize);
auto shaderStorage{span{splitBinaryStorage}.subspan(storageOffset, FallbackSize)}; auto shaderStorage{span{splitBinaryStorage}.subspan(storageOffset, FallbackSize)};
ctx.channelCtx.asCtx->gmmu.Read(shaderStorage, programBase + programOffset); auto mappings{ctx.channelCtx.asCtx->gmmu.TranslateRange(programBase + programOffset, storageOffset + FallbackSize)};
u8 *shaderStoragePtr{shaderStorage.data()};
for (auto mapping : mappings) {
if (!mapping.valid())
break;
std::memcpy(shaderStoragePtr, mapping.data(), mapping.size());
shaderStoragePtr += mapping.size();
}
binary.binary = shaderStorage; binary.binary = shaderStorage;
} }
} }