mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 19:15:29 +03:00
Order TextureView
Definition Correctly
The definition of the `TextureView` class was spread across `texture.cpp` and has now been moved to the top of the file above the other half of the definition.
This commit is contained in:
parent
189b9533f2
commit
daff17c776
@ -8,6 +8,34 @@
|
|||||||
#include "copy.h"
|
#include "copy.h"
|
||||||
|
|
||||||
namespace skyline::gpu {
|
namespace skyline::gpu {
|
||||||
|
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 (texture->dimensions.GetType()) {
|
||||||
|
case vk::ImageType::e1D:
|
||||||
|
return range.layerCount > 1 ? vk::ImageViewType::e1DArray : vk::ImageViewType::e1D;
|
||||||
|
case vk::ImageType::e2D:
|
||||||
|
return range.layerCount > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
|
||||||
|
case vk::ImageType::e3D:
|
||||||
|
return vk::ImageViewType::e3D;
|
||||||
|
}
|
||||||
|
}()};
|
||||||
|
|
||||||
|
vk::ImageViewCreateInfo createInfo{
|
||||||
|
.image = texture->GetBacking(),
|
||||||
|
.viewType = viewType,
|
||||||
|
.format = format ? *format : *texture->format,
|
||||||
|
.components = mapping,
|
||||||
|
.subresourceRange = range,
|
||||||
|
};
|
||||||
|
|
||||||
|
return *view.emplace(texture->gpu.vkDevice, createInfo);
|
||||||
|
}
|
||||||
|
|
||||||
void TextureView::lock() {
|
void TextureView::lock() {
|
||||||
auto backing{std::atomic_load(&texture)};
|
auto backing{std::atomic_load(&texture)};
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -521,32 +549,4 @@ namespace skyline::gpu {
|
|||||||
Texture::~Texture() {
|
Texture::~Texture() {
|
||||||
WaitOnFence();
|
WaitOnFence();
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (texture->dimensions.GetType()) {
|
|
||||||
case vk::ImageType::e1D:
|
|
||||||
return range.layerCount > 1 ? vk::ImageViewType::e1DArray : vk::ImageViewType::e1D;
|
|
||||||
case vk::ImageType::e2D:
|
|
||||||
return range.layerCount > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
|
|
||||||
case vk::ImageType::e3D:
|
|
||||||
return vk::ImageViewType::e3D;
|
|
||||||
}
|
|
||||||
}()};
|
|
||||||
|
|
||||||
vk::ImageViewCreateInfo createInfo{
|
|
||||||
.image = texture->GetBacking(),
|
|
||||||
.viewType = viewType,
|
|
||||||
.format = format ? *format : *texture->format,
|
|
||||||
.components = mapping,
|
|
||||||
.subresourceRange = range,
|
|
||||||
};
|
|
||||||
|
|
||||||
return *view.emplace(texture->gpu.vkDevice, createInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user