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.
This commit is contained in:
PixelyIon 2021-12-02 02:12:37 +05:30
parent 482c573b81
commit a55aca76c6
6 changed files with 26 additions and 26 deletions

View File

@ -24,9 +24,9 @@ namespace skyline::gpu::interconnect {
void CommandExecutor::AddSubpass(const std::function<void(vk::raii::CommandBuffer &, const std::shared_ptr<FenceCycle> &, GPU &)> &function, vk::Rect2D renderArea, std::vector<TextureView> inputAttachments, std::vector<TextureView> colorAttachments, std::optional<TextureView> 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<node::NextSubpassNode>());
} else {
auto function{[scissor = attachment.backing->dimensions, value](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &) {
auto function{[scissor = attachment.texture->dimensions, value](vk::raii::CommandBuffer &commandBuffer, const std::shared_ptr<FenceCycle> &, GPU &) {
commandBuffer.clearAttachments(vk::ClearAttachment{
.aspectMask = vk::ImageAspectFlagBits::eColor,
.colorAttachment = 0,

View File

@ -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<u32>(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,
});
}

View File

@ -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<u32>(std::min(static_cast<i32>(renderTarget.backing->dimensions.width) - scissor.offset.x,
scissor.extent.width = static_cast<u32>(std::min(static_cast<i32>(renderTarget.texture->dimensions.width) - scissor.offset.x,
static_cast<i32>(scissor.extent.width)));
scissor.extent.height = static_cast<u32>(std::min(static_cast<i32>(renderTarget.backing->dimensions.height) - scissor.offset.y,
scissor.extent.height = static_cast<u32>(std::min(static_cast<i32>(renderTarget.texture->dimensions.height) - scissor.offset.y,
static_cast<i32>(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<FenceCycle> &, GPU &) {
@ -366,7 +366,7 @@ namespace skyline::gpu::interconnect {
.layerCount = 1,
});
}, vk::Rect2D{
.extent = renderTarget.backing->dimensions,
.extent = renderTarget.texture->dimensions,
}, {}, {renderTarget});
}
}

View File

@ -455,14 +455,14 @@ namespace skyline::gpu {
WaitOnFence();
}
TextureView::TextureView(std::shared_ptr<Texture> 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> 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<vk::ImageViewCreateInfo, vk::raii::ImageView> &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;
}
}

View File

@ -296,7 +296,7 @@ namespace skyline::gpu {
vk::raii::ImageView *view{};
public:
std::shared_ptr<Texture> backing;
std::shared_ptr<Texture> 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<Texture> backing, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format = {}, vk::ComponentMapping mapping = {});
TextureView(std::shared_ptr<Texture> 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;
}
};

View File

@ -344,7 +344,7 @@ namespace skyline::service::hosbinder {
}
gpu::GuestTexture guestTexture(span<u8>(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) {