mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Implement Display Settings + Attach Texture to FenceCycle
This commit is contained in:
@ -114,35 +114,20 @@ namespace skyline::gpu {
|
||||
*/
|
||||
void AttachObjects(std::initializer_list<std::shared_ptr<FenceCycleDependency>> dependencies) {
|
||||
if (!signalled.test(std::memory_order_consume)) {
|
||||
{
|
||||
auto it{dependencies.begin()};
|
||||
while (it != dependencies.end()) {
|
||||
auto next{std::next(it)};
|
||||
auto it{dependencies.begin()}, next{std::next(it)};
|
||||
if (it != dependencies.end()) {
|
||||
while (next != dependencies.end()) {
|
||||
(*it)->next = *next;
|
||||
it = next;
|
||||
next = std::next(next);
|
||||
}
|
||||
}
|
||||
|
||||
const auto &first{*dependencies.begin()};
|
||||
const auto &last{*dependencies.end()};
|
||||
std::shared_ptr<FenceCycleDependency> next{std::atomic_load_explicit(&list, std::memory_order_consume)};
|
||||
do {
|
||||
last->next = next;
|
||||
if (!next && signalled.test(std::memory_order_consume)) {
|
||||
std::shared_ptr<FenceCycleDependency> current{first};
|
||||
while (current) {
|
||||
next.swap(first->next);
|
||||
current.swap(next);
|
||||
next.reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
} while (std::atomic_compare_exchange_strong(&list, &next, first));
|
||||
AttachObject(*dependencies.begin());
|
||||
}
|
||||
}
|
||||
|
||||
template<typename... Dependencies>
|
||||
void AttachObjects(Dependencies... dependencies) {
|
||||
void AttachObjects(Dependencies &&... dependencies) {
|
||||
AttachObjects(std::initializer_list<std::shared_ptr<FenceCycleDependency>>{std::forward<Dependencies>(dependencies)...});
|
||||
}
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
void PresentationEngine::UpdateSwapchain(texture::Format format, texture::Dimensions extent) {
|
||||
auto minImageCount{std::max(vkSurfaceCapabilities.minImageCount, state.settings->forceTripleBuffering ? 3U : 0U)};
|
||||
auto minImageCount{std::max(vkSurfaceCapabilities.minImageCount, state.settings->forceTripleBuffering ? 3U : 2U)};
|
||||
if (minImageCount > MaxSwapchainImageCount)
|
||||
throw exception("Requesting swapchain with higher image count ({}) than maximum slot count ({})", minImageCount, MaxSwapchainImageCount);
|
||||
|
||||
@ -99,13 +99,14 @@ namespace skyline::gpu {
|
||||
.imageUsage = presentUsage,
|
||||
.imageSharingMode = vk::SharingMode::eExclusive,
|
||||
.compositeAlpha = vk::CompositeAlphaFlagBitsKHR::eInherit,
|
||||
.presentMode = vk::PresentModeKHR::eMailbox,
|
||||
.presentMode = state.settings->disableFrameThrottling ? vk::PresentModeKHR::eMailbox : vk::PresentModeKHR::eFifo,
|
||||
.clipped = true,
|
||||
});
|
||||
|
||||
auto vkImages{vkSwapchain->getImages()};
|
||||
if (vkImages.size() > MaxSwapchainImageCount)
|
||||
throw exception("Swapchain has higher image count ({}) than maximum slot count ({})", minImageCount, MaxSwapchainImageCount);
|
||||
state.logger->Error("Buffer Count: {}", vkImages.size());
|
||||
|
||||
for (size_t index{}; index < vkImages.size(); index++) {
|
||||
auto &slot{images[index]};
|
||||
|
@ -262,8 +262,7 @@ namespace skyline::gpu {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
cycle->AttachObject(stagingBuffer);
|
||||
cycle->AttachObjects(stagingBuffer, shared_from_this());
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,6 +375,6 @@ namespace skyline::gpu {
|
||||
},
|
||||
});
|
||||
});
|
||||
cycle->AttachObject(source);
|
||||
cycle->AttachObjects(source, shared_from_this());
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace skyline::gpu {
|
||||
* @brief A texture which is backed by host constructs while being synchronized with the underlying guest texture
|
||||
* @note This class conforms to the Lockable and BasicLockable C++ named requirements
|
||||
*/
|
||||
class Texture : public FenceCycleDependency {
|
||||
class Texture : public std::enable_shared_from_this<Texture>, public FenceCycleDependency {
|
||||
private:
|
||||
GPU &gpu;
|
||||
std::mutex mutex; //!< Synchronizes any mutations to the texture or its backing
|
||||
|
Reference in New Issue
Block a user