mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 17:55:28 +03:00
Make GuestBuffer
format-less
Buffers generally don't have formats that are fundamentally associated with them unless they're texel buffers, if that is the case it can be manually set in `BufferView`.
This commit is contained in:
parent
03314ec7d2
commit
8652edb07b
@ -12,7 +12,6 @@ namespace skyline::gpu {
|
|||||||
struct GuestBuffer {
|
struct GuestBuffer {
|
||||||
using Mappings = boost::container::small_vector<span<u8>, 3>;
|
using Mappings = boost::container::small_vector<span<u8>, 3>;
|
||||||
Mappings mappings; //!< Spans to CPU memory for the underlying data backing this buffer
|
Mappings mappings; //!< Spans to CPU memory for the underlying data backing this buffer
|
||||||
vk::Format format;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The total size of the buffer by adding up the size of all mappings
|
* @return The total size of the buffer by adding up the size of all mappings
|
||||||
@ -107,7 +106,7 @@ namespace skyline::gpu {
|
|||||||
/**
|
/**
|
||||||
* @return A cached or newly created view into this buffer with the supplied attributes
|
* @return A cached or newly created view into this buffer with the supplied attributes
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<BufferView> GetView(vk::DeviceSize offset, vk::DeviceSize range, vk::Format format);
|
std::shared_ptr<BufferView> GetView(vk::DeviceSize offset, vk::DeviceSize range, vk::Format format = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,11 +43,11 @@ namespace skyline::gpu {
|
|||||||
if (firstHostMapping == hostMappings.begin() && firstHostMapping->begin() == guestMapping.begin() && mappingMatch && endHostMapping == hostMappings.end() && lastGuestMapping.end() == lastHostMapping.end()) {
|
if (firstHostMapping == hostMappings.begin() && firstHostMapping->begin() == guestMapping.begin() && mappingMatch && endHostMapping == hostMappings.end() && lastGuestMapping.end() == lastHostMapping.end()) {
|
||||||
// We've gotten a perfect 1:1 match for *all* mappings from the start to end
|
// We've gotten a perfect 1:1 match for *all* mappings from the start to end
|
||||||
std::scoped_lock bufferLock(*hostMapping->buffer);
|
std::scoped_lock bufferLock(*hostMapping->buffer);
|
||||||
return hostMapping->buffer->GetView(0, hostMapping->buffer->size, guest.format);
|
return hostMapping->buffer->GetView(0, hostMapping->buffer->size);
|
||||||
} else if (mappingMatch && firstHostMapping->begin() > guestMapping.begin() && lastHostMapping.end() > lastGuestMapping.end()) {
|
} else if (mappingMatch && firstHostMapping->begin() > guestMapping.begin() && lastHostMapping.end() > lastGuestMapping.end()) {
|
||||||
// We've gotten a guest buffer that is located entirely within a host buffer
|
// We've gotten a guest buffer that is located entirely within a host buffer
|
||||||
std::scoped_lock bufferLock(*hostMapping->buffer);
|
std::scoped_lock bufferLock(*hostMapping->buffer);
|
||||||
return hostMapping->buffer->GetView(hostMapping->offset + static_cast<vk::DeviceSize>(hostMapping->begin() - guestMapping.begin()), guest.BufferSize(), guest.format);
|
return hostMapping->buffer->GetView(hostMapping->offset + static_cast<vk::DeviceSize>(hostMapping->begin() - guestMapping.begin()), guest.BufferSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +103,6 @@ namespace skyline::gpu {
|
|||||||
offset += mapping->size_bytes();
|
offset += mapping->size_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer->GetView(0, buffer->size, guest.format);
|
return buffer->GetView(0, buffer->size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user