From a55aca76c676d690b9e04ef5c516f42dc070785e Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Thu, 2 Dec 2021 02:12:37 +0530 Subject: [PATCH] Rename `TextureView::backing` to `TextureView::texture` It was determined that `backing` wasn't a very descriptive name and that it conflicted with the texture's own backing, the name was changed to `texture` to make it more apparent that it was specifically the `Texture` object backing the view. --- .../skyline/gpu/interconnect/command_executor.cpp | 8 ++++---- .../cpp/skyline/gpu/interconnect/command_nodes.cpp | 14 +++++++------- .../skyline/gpu/interconnect/graphics_context.h | 10 +++++----- app/src/main/cpp/skyline/gpu/texture/texture.cpp | 12 ++++++------ app/src/main/cpp/skyline/gpu/texture/texture.h | 6 +++--- .../services/hosbinder/GraphicBufferProducer.cpp | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp index b7e18fa5..117dd7ac 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -24,9 +24,9 @@ namespace skyline::gpu::interconnect { void CommandExecutor::AddSubpass(const std::function &, GPU &)> &function, vk::Rect2D renderArea, std::vector inputAttachments, std::vector colorAttachments, std::optional depthStencilAttachment) { for (const auto &attachments : {inputAttachments, colorAttachments}) for (const auto &attachment : attachments) - syncTextures.emplace(attachment.backing.get()); + syncTextures.emplace(attachment.texture.get()); if (depthStencilAttachment) - syncTextures.emplace(depthStencilAttachment->backing.get()); + syncTextures.emplace(depthStencilAttachment->texture.get()); bool newRenderPass{CreateRenderPass(renderArea)}; renderPass->AddSubpass(inputAttachments, colorAttachments, depthStencilAttachment ? &*depthStencilAttachment : nullptr); @@ -38,7 +38,7 @@ namespace skyline::gpu::interconnect { void CommandExecutor::AddClearColorSubpass(TextureView attachment, const vk::ClearColorValue &value) { bool newRenderPass{CreateRenderPass(vk::Rect2D{ - .extent = attachment.backing->dimensions, + .extent = attachment.texture->dimensions, })}; renderPass->AddSubpass({}, attachment, nullptr); @@ -46,7 +46,7 @@ namespace skyline::gpu::interconnect { if (!newRenderPass) nodes.emplace_back(std::in_place_type_t()); } else { - auto function{[scissor = attachment.backing->dimensions, value](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &, GPU &) { + auto function{[scissor = attachment.texture->dimensions, value](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &, GPU &) { commandBuffer.clearAttachments(vk::ClearAttachment{ .aspectMask = vk::ImageAspectFlagBits::eColor, .colorAttachment = 0, diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_nodes.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_nodes.cpp index b32382f6..eb37bb83 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_nodes.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_nodes.cpp @@ -15,9 +15,9 @@ namespace skyline::gpu::interconnect::node { u32 RenderPassNode::AddAttachment(TextureView &view) { auto &textures{storage->textures}; - auto texture{std::find(textures.begin(), textures.end(), view.backing)}; + auto texture{std::find(textures.begin(), textures.end(), view.texture)}; if (texture == textures.end()) - textures.push_back(view.backing); + textures.push_back(view.texture); auto vkView{view.GetView()}; auto attachment{std::find(attachments.begin(), attachments.end(), vkView)}; @@ -26,8 +26,8 @@ namespace skyline::gpu::interconnect::node { attachments.push_back(vkView); attachmentDescriptions.push_back(vk::AttachmentDescription{ .format = *view.format, - .initialLayout = view.backing->layout, - .finalLayout = view.backing->layout, + .initialLayout = view.texture->layout, + .finalLayout = view.texture->layout, }); return static_cast(attachments.size() - 1); } else { @@ -104,7 +104,7 @@ namespace skyline::gpu::interconnect::node { for (auto &attachment : inputAttachments) { attachmentReferences.push_back(vk::AttachmentReference{ .attachment = AddAttachment(attachment), - .layout = attachment.backing->layout, + .layout = attachment.texture->layout, }); } @@ -112,7 +112,7 @@ namespace skyline::gpu::interconnect::node { for (auto &attachment : colorAttachments) { attachmentReferences.push_back(vk::AttachmentReference{ .attachment = AddAttachment(attachment), - .layout = attachment.backing->layout, + .layout = attachment.texture->layout, }); } @@ -120,7 +120,7 @@ namespace skyline::gpu::interconnect::node { if (depthStencilAttachment) { attachmentReferences.push_back(vk::AttachmentReference{ .attachment = AddAttachment(*depthStencilAttachment), - .layout = depthStencilAttachment->backing->layout, + .layout = depthStencilAttachment->texture->layout, }); } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index aecd93aa..388b4def 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -329,7 +329,7 @@ namespace skyline::gpu::interconnect { auto renderTargetPointer{GetRenderTarget(renderTargetIndex)}; if (renderTargetPointer) { auto renderTarget{*renderTargetPointer}; - std::lock_guard lock(*renderTarget.backing); + std::lock_guard lock(*renderTarget.texture); vk::ImageAspectFlags aspect{}; if (clear.depth) @@ -344,15 +344,15 @@ namespace skyline::gpu::interconnect { return; auto scissor{scissors.at(renderTargetIndex)}; - scissor.extent.width = static_cast(std::min(static_cast(renderTarget.backing->dimensions.width) - scissor.offset.x, + scissor.extent.width = static_cast(std::min(static_cast(renderTarget.texture->dimensions.width) - scissor.offset.x, static_cast(scissor.extent.width))); - scissor.extent.height = static_cast(std::min(static_cast(renderTarget.backing->dimensions.height) - scissor.offset.y, + scissor.extent.height = static_cast(std::min(static_cast(renderTarget.texture->dimensions.height) - scissor.offset.y, static_cast(scissor.extent.height))); if (scissor.extent.width == 0 || scissor.extent.height == 0) return; - if (scissor.extent.width == renderTarget.backing->dimensions.width && scissor.extent.height == renderTarget.backing->dimensions.height && renderTarget.range.baseArrayLayer == 0 && renderTarget.range.layerCount == 1 && clear.layerId == 0) { + if (scissor.extent.width == renderTarget.texture->dimensions.width && scissor.extent.height == renderTarget.texture->dimensions.height && renderTarget.range.baseArrayLayer == 0 && renderTarget.range.layerCount == 1 && clear.layerId == 0) { executor.AddClearColorSubpass(renderTarget, clearColorValue); } else { executor.AddSubpass([aspect, clearColorValue = clearColorValue, layerId = clear.layerId, scissor](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr &, GPU &) { @@ -366,7 +366,7 @@ namespace skyline::gpu::interconnect { .layerCount = 1, }); }, vk::Rect2D{ - .extent = renderTarget.backing->dimensions, + .extent = renderTarget.texture->dimensions, }, {}, {renderTarget}); } } diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.cpp b/app/src/main/cpp/skyline/gpu/texture/texture.cpp index c663b619..ad345799 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.cpp +++ b/app/src/main/cpp/skyline/gpu/texture/texture.cpp @@ -455,14 +455,14 @@ namespace skyline::gpu { WaitOnFence(); } - TextureView::TextureView(std::shared_ptr backing, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format, vk::ComponentMapping mapping) : backing(std::move(backing)), type(type), format(format), mapping(mapping), range(range) {} + TextureView::TextureView(std::shared_ptr texture, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format, vk::ComponentMapping mapping) : texture(std::move(texture)), type(type), format(format), mapping(mapping), range(range) {} vk::ImageView TextureView::GetView() { if (view) return **view; auto viewType{[&]() { - switch (backing->dimensions.GetType()) { + switch (texture->dimensions.GetType()) { case vk::ImageType::e1D: return range.layerCount > 1 ? vk::ImageViewType::e1DArray : vk::ImageViewType::e1D; case vk::ImageType::e2D: @@ -473,20 +473,20 @@ namespace skyline::gpu { }()}; vk::ImageViewCreateInfo createInfo{ - .image = backing->GetBacking(), + .image = texture->GetBacking(), .viewType = viewType, - .format = format ? *format : *backing->format, + .format = format ? *format : *texture->format, .components = mapping, .subresourceRange = range, }; - auto &views{backing->views}; + auto &views{texture->views}; auto iterator{std::find_if(views.begin(), views.end(), [&](const std::pair &item) { return item.first == createInfo; })}; if (iterator != views.end()) return *iterator->second; - return *views.emplace_back(createInfo, vk::raii::ImageView(backing->gpu.vkDevice, createInfo)).second; + return *views.emplace_back(createInfo, vk::raii::ImageView(texture->gpu.vkDevice, createInfo)).second; } } diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.h b/app/src/main/cpp/skyline/gpu/texture/texture.h index 7e7a7b30..5bbf5d68 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.h +++ b/app/src/main/cpp/skyline/gpu/texture/texture.h @@ -296,7 +296,7 @@ namespace skyline::gpu { vk::raii::ImageView *view{}; public: - std::shared_ptr backing; + std::shared_ptr texture; vk::ImageViewType type; texture::Format format; vk::ComponentMapping mapping; @@ -305,7 +305,7 @@ namespace skyline::gpu { /** * @param format A compatible format for the texture view (Defaults to the format of the backing texture) */ - TextureView(std::shared_ptr backing, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format = {}, vk::ComponentMapping mapping = {}); + TextureView(std::shared_ptr texture, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format = {}, vk::ComponentMapping mapping = {}); /** * @return A Vulkan Image View that corresponds to the properties of this view @@ -313,7 +313,7 @@ namespace skyline::gpu { vk::ImageView GetView(); bool operator==(const TextureView &rhs) { - return backing == rhs.backing && type == rhs.type && format == rhs.format && mapping == rhs.mapping && range == rhs.range; + return texture == rhs.texture && type == rhs.type && format == rhs.format && mapping == rhs.mapping && range == rhs.range; } }; diff --git a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp index bbc8191f..9f1e66fa 100644 --- a/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp +++ b/app/src/main/cpp/skyline/services/hosbinder/GraphicBufferProducer.cpp @@ -344,7 +344,7 @@ namespace skyline::service::hosbinder { } gpu::GuestTexture guestTexture(span(nvMapHandleObj->GetPointer() + surface.offset, surface.size), gpu::texture::Dimensions(surface.width, surface.height), format, tileConfig, gpu::texture::TextureType::e2D); - buffer.texture = state.gpu->texture.FindOrCreate(guestTexture).backing; + buffer.texture = state.gpu->texture.FindOrCreate(guestTexture).texture; } switch (transform) {