vk_texture_runtime: Bring back FramebufferView
* Also move the usage hint flags to the allocation. If an allocation is used as framebuffer there's a high chance it will be used again as such. In addition is helps keeping pipeline barriers correct even when the surface is destoyed and recreated (happens often with framebuffers)
This commit is contained in:
@ -1060,8 +1060,8 @@ vk::AccessFlags Surface::AccessFlags() const noexcept {
|
|||||||
|
|
||||||
return vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eTransferRead |
|
return vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eTransferRead |
|
||||||
vk::AccessFlagBits::eTransferWrite |
|
vk::AccessFlagBits::eTransferWrite |
|
||||||
(is_framebuffer ? attachment_flags : vk::AccessFlagBits::eNone) |
|
(alloc.is_framebuffer ? attachment_flags : vk::AccessFlagBits::eNone) |
|
||||||
(is_storage ? vk::AccessFlagBits::eShaderWrite : vk::AccessFlagBits::eNone);
|
(alloc.is_storage ? vk::AccessFlagBits::eShaderWrite : vk::AccessFlagBits::eNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::PipelineStageFlags Surface::PipelineStageFlags() const noexcept {
|
vk::PipelineStageFlags Surface::PipelineStageFlags() const noexcept {
|
||||||
@ -1072,8 +1072,8 @@ vk::PipelineStageFlags Surface::PipelineStageFlags() const noexcept {
|
|||||||
vk::PipelineStageFlagBits::eLateFragmentTests;
|
vk::PipelineStageFlagBits::eLateFragmentTests;
|
||||||
|
|
||||||
return vk::PipelineStageFlagBits::eTransfer | vk::PipelineStageFlagBits::eFragmentShader |
|
return vk::PipelineStageFlagBits::eTransfer | vk::PipelineStageFlagBits::eFragmentShader |
|
||||||
(is_framebuffer ? attachment_flags : vk::PipelineStageFlagBits::eNone) |
|
(alloc.is_framebuffer ? attachment_flags : vk::PipelineStageFlagBits::eNone) |
|
||||||
(is_storage ? vk::PipelineStageFlagBits::eComputeShader
|
(alloc.is_storage ? vk::PipelineStageFlagBits::eComputeShader
|
||||||
: vk::PipelineStageFlagBits::eNone);
|
: vk::PipelineStageFlagBits::eNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,6 +1129,7 @@ vk::ImageView Surface::StorageView() noexcept {
|
|||||||
return storage_view.get();
|
return storage_view.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alloc.is_storage = true;
|
||||||
ASSERT_MSG(pixel_format == VideoCore::PixelFormat::RGBA8,
|
ASSERT_MSG(pixel_format == VideoCore::PixelFormat::RGBA8,
|
||||||
"Attempted to retrieve storage view from unsupported surface with format {}",
|
"Attempted to retrieve storage view from unsupported surface with format {}",
|
||||||
VideoCore::PixelFormatAsString(pixel_format));
|
VideoCore::PixelFormatAsString(pixel_format));
|
||||||
@ -1306,7 +1307,7 @@ void Framebuffer::PrepareImages(Surface* const color, Surface* const depth_stenc
|
|||||||
height = std::min(height, surface->GetScaledHeight());
|
height = std::min(height, surface->GetScaledHeight());
|
||||||
formats[cursor] = surface->pixel_format;
|
formats[cursor] = surface->pixel_format;
|
||||||
images[cursor] = surface->Image();
|
images[cursor] = surface->Image();
|
||||||
image_views[cursor++] = surface->ImageView();
|
image_views[cursor++] = surface->FramebufferView();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup image handles
|
// Setup image handles
|
||||||
|
@ -32,6 +32,8 @@ struct Allocation {
|
|||||||
vk::ImageAspectFlags aspect;
|
vk::ImageAspectFlags aspect;
|
||||||
vk::Format format;
|
vk::Format format;
|
||||||
bool is_mutable;
|
bool is_mutable;
|
||||||
|
bool is_framebuffer{};
|
||||||
|
bool is_storage{};
|
||||||
u32 width;
|
u32 width;
|
||||||
u32 height;
|
u32 height;
|
||||||
u32 levels;
|
u32 levels;
|
||||||
@ -188,6 +190,11 @@ public:
|
|||||||
return alloc.image_view.get();
|
return alloc.image_view.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vk::ImageView FramebufferView() noexcept {
|
||||||
|
alloc.is_framebuffer = true;
|
||||||
|
return ImageView();
|
||||||
|
}
|
||||||
|
|
||||||
/// Uploads pixel data in staging to a rectangle region of the surface texture
|
/// Uploads pixel data in staging to a rectangle region of the surface texture
|
||||||
void Upload(const VideoCore::BufferTextureCopy& upload, const VideoCore::StagingData& staging);
|
void Upload(const VideoCore::BufferTextureCopy& upload, const VideoCore::StagingData& staging);
|
||||||
|
|
||||||
@ -234,8 +241,6 @@ private:
|
|||||||
const Instance* instance;
|
const Instance* instance;
|
||||||
Scheduler* scheduler;
|
Scheduler* scheduler;
|
||||||
Allocation alloc{};
|
Allocation alloc{};
|
||||||
bool is_framebuffer{};
|
|
||||||
bool is_storage{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Framebuffer : public VideoCore::FramebufferBase {
|
class Framebuffer : public VideoCore::FramebufferBase {
|
||||||
|
Reference in New Issue
Block a user