mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 09:41:14 +02:00
Reject texture descriptors with unmapped addresses
Fix an "Invalid texture format 0x25A5A (sRGB: True)" error that occurs when running OCTOPATH TRAVELER 0. The game may leave texture descriptor heap entries filled with 0x5A. Interpreting such uninitialized entries as valid texture descriptors produces an invalid format and causes texture creation to proceed with garbage descriptor data. Validate the texture address before decoding the descriptor. Descriptors with a zero or unmapped address are marked as invalid and skipped. The invalid state is cleared when the corresponding texture pool entry is modified, allowing the descriptor to be evaluated again.
This commit is contained in:
@@ -185,6 +185,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
// A pool index may point at an uninitialized guest heap slot. Validate the
|
||||
// descriptor address before decoding format, dimensions, or layout fields.
|
||||
ulong address = descriptor.UnpackAddress();
|
||||
|
||||
if (address == 0 || !_channel.MemoryManager.IsMapped(address))
|
||||
{
|
||||
_invalidMap.Set(id);
|
||||
return ref descriptor;
|
||||
}
|
||||
|
||||
if (_invalidMap.IsSet(id))
|
||||
{
|
||||
return ref descriptor;
|
||||
|
||||
@@ -54,6 +54,12 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
public void SetSamplers(int index, ISampler[] samplers)
|
||||
{
|
||||
// Buffer textures use VkBufferView descriptors and do not have samplers.
|
||||
if (_isBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < samplers.Length; i++)
|
||||
{
|
||||
ISampler sampler = samplers[i];
|
||||
@@ -109,6 +115,13 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
public void QueueWriteToReadBarriers(CommandBufferScoped cbs, PipelineStageFlags stageFlags)
|
||||
{
|
||||
// Texture-buffer arrays contain buffer views rather than image TextureStorage refs.
|
||||
// Buffer synchronization is handled when BufferManager binds their storage.
|
||||
if (_isBuffer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HashSet<TextureStorage> storages = _storages;
|
||||
|
||||
if (storages == null)
|
||||
|
||||
Reference in New Issue
Block a user