mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 16:35:29 +03:00
Utilize TextureView
rather than Texture
for presentation
`PresentationEngine` and `GraphicBufferProducer` methods that utilized textures for the surface utilized the `Texture` type rather than the `TextureView` type, this was never correct but at the time of authoring this code `TextureView` was not finalized and in a major flux which is why it was not utilized and `Texture` was utilized instead. Now that is is far more stable, it has been replaced with `TextureView`.
This commit is contained in:
parent
c25ad6e71a
commit
2d08886e4e
@ -96,9 +96,10 @@ namespace skyline::gpu {
|
||||
|
||||
frame.fence.Wait(state.soc->host1x);
|
||||
|
||||
std::scoped_lock textureLock(*frame.texture);
|
||||
if (frame.texture->format != swapchainFormat || frame.texture->dimensions != swapchainExtent)
|
||||
UpdateSwapchain(frame.texture->format, frame.texture->dimensions);
|
||||
std::scoped_lock textureLock(*frame.textureView);
|
||||
auto texture{frame.textureView->texture};
|
||||
if (frame.textureView->format != swapchainFormat || texture->dimensions != swapchainExtent)
|
||||
UpdateSwapchain(frame.textureView->format, texture->dimensions);
|
||||
|
||||
int result;
|
||||
if (frame.crop && frame.crop != windowCrop) {
|
||||
@ -131,8 +132,8 @@ namespace skyline::gpu {
|
||||
|
||||
std::ignore = gpu.vkDevice.waitForFences(*acquireFence, true, std::numeric_limits<u64>::max());
|
||||
|
||||
frame.texture->SynchronizeHost();
|
||||
images.at(nextImage.second)->CopyFrom(frame.texture, vk::ImageSubresourceRange{
|
||||
texture->SynchronizeHost();
|
||||
images.at(nextImage.second)->CopyFrom(texture, vk::ImageSubresourceRange{
|
||||
.aspectMask = vk::ImageAspectFlagBits::eColor,
|
||||
.levelCount = 1,
|
||||
.layerCount = 1,
|
||||
@ -373,7 +374,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
}
|
||||
|
||||
u64 PresentationEngine::Present(const std::shared_ptr<Texture> &texture, i64 timestamp, i64 swapInterval, AndroidRect crop, NativeWindowScalingMode scalingMode, NativeWindowTransform transform, skyline::service::hosbinder::AndroidFence fence, const std::function<void()>& presentCallback) {
|
||||
u64 PresentationEngine::Present(const std::shared_ptr<TextureView> &texture, i64 timestamp, i64 swapInterval, AndroidRect crop, NativeWindowScalingMode scalingMode, NativeWindowTransform transform, skyline::service::hosbinder::AndroidFence fence, const std::function<void()>& presentCallback) {
|
||||
if (!vkSurface.has_value()) {
|
||||
// We want this function to generally (not necessarily always) block when a surface is not present to implicitly pause the game
|
||||
std::unique_lock lock(mutex);
|
||||
|
@ -54,7 +54,7 @@ namespace skyline::gpu {
|
||||
bool choreographerStop{}; //!< If the Choreographer thread should stop on the next ALooper_wake()
|
||||
|
||||
struct PresentableFrame {
|
||||
std::shared_ptr<Texture> texture{};
|
||||
std::shared_ptr<TextureView> textureView{};
|
||||
skyline::service::hosbinder::AndroidFence fence{}; //!< The fence that must be waited on prior to using the texture
|
||||
i64 timestamp{}; //!< The earliest timestamp (relative to ARM CPU timer) that this frame must be presented at
|
||||
i64 swapInterval{}; //!< The interval between frames in terms of 60Hz display refreshes (1/60th of a second)
|
||||
@ -120,7 +120,7 @@ namespace skyline::gpu {
|
||||
* @return The ID of this frame for correlating it with presentation timing readouts
|
||||
* @note The texture **must** be locked prior to calling this
|
||||
*/
|
||||
u64 Present(const std::shared_ptr<Texture> &texture, i64 timestamp, i64 swapInterval, service::hosbinder::AndroidRect crop, service::hosbinder::NativeWindowScalingMode scalingMode, service::hosbinder::NativeWindowTransform transform, skyline::service::hosbinder::AndroidFence fence, const std::function<void()>& presentCallback);
|
||||
u64 Present(const std::shared_ptr<TextureView> &texture, i64 timestamp, i64 swapInterval, service::hosbinder::AndroidRect crop, service::hosbinder::NativeWindowScalingMode scalingMode, service::hosbinder::NativeWindowTransform transform, skyline::service::hosbinder::AndroidFence fence, const std::function<void()>& presentCallback);
|
||||
|
||||
/**
|
||||
* @return A transform that the application should render with to elide costly transforms later
|
||||
|
@ -348,7 +348,7 @@ namespace skyline::service::hosbinder {
|
||||
guestTexture.mappings[0] = span<u8>(nvMapHandleObj->GetPointer() + surface.offset, guestTexture.GetLayerStride());
|
||||
|
||||
std::scoped_lock textureLock{state.gpu->texture};
|
||||
buffer.texture = state.gpu->texture.FindOrCreate(guestTexture)->texture;
|
||||
buffer.texture = state.gpu->texture.FindOrCreate(guestTexture);
|
||||
}
|
||||
|
||||
switch (transform) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "native_window.h"
|
||||
|
||||
namespace skyline::gpu {
|
||||
class Texture;
|
||||
class TextureView;
|
||||
}
|
||||
|
||||
namespace skyline::service::nvdrv::core {
|
||||
@ -44,7 +44,7 @@ namespace skyline::service::hosbinder {
|
||||
u64 frameNumber{}; //!< The amount of frames that have been queued using this slot
|
||||
bool wasBufferRequested{}; //!< If GraphicBufferProducer::RequestBuffer has been called with this buffer
|
||||
bool isPreallocated{}; //!< If this slot's graphic buffer has been preallocated or attached
|
||||
std::shared_ptr<gpu::Texture> texture{};
|
||||
std::shared_ptr<gpu::TextureView> texture{};
|
||||
std::unique_ptr<GraphicBuffer> graphicBuffer{};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user