mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-28 07:29:51 +01:00
[TEST] Unify blit helpers of msaa and depth stencil msaa
This commit is contained in:
parent
7102ff8ecb
commit
8f18e82931
2 changed files with 43 additions and 43 deletions
|
|
@ -713,24 +713,30 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlitImageHelper::BlitColorMSAA(const Framebuffer* dst_framebuffer,
|
void BlitImageHelper::BlitMSAAImpl(const Framebuffer* dst_framebuffer,
|
||||||
const ImageView& src_image_view, const Region2D& dst_region,
|
const ImageView& src_image_view, const Region2D& dst_region,
|
||||||
const Region2D& src_region) {
|
const Region2D& src_region, VkPipeline pipeline,
|
||||||
const BlitMSAAPipelineKey key{
|
VkImageView src_view, VkImageView src_stencil_view,
|
||||||
.renderpass = dst_framebuffer->RenderPass(),
|
bool blit_stencil) {
|
||||||
.samples = dst_framebuffer->Samples(),
|
VkPipelineLayout layout = *one_texture_pipeline_layout;
|
||||||
};
|
if (blit_stencil) {
|
||||||
const VkPipelineLayout layout = *one_texture_pipeline_layout;
|
layout = *two_textures_pipeline_layout;
|
||||||
|
}
|
||||||
const VkSampler sampler = *nearest_sampler;
|
const VkSampler sampler = *nearest_sampler;
|
||||||
const VkPipeline pipeline = FindOrEmplaceBlitColorMSAAPipeline(key);
|
|
||||||
const VkImageView src_view = src_image_view.Handle(Shader::TextureType::Color2D);
|
|
||||||
|
|
||||||
RecordShaderReadBarrier(scheduler, src_image_view);
|
RecordShaderReadBarrier(scheduler, src_image_view);
|
||||||
scheduler.RequestRenderpass(dst_framebuffer);
|
scheduler.RequestRenderpass(dst_framebuffer);
|
||||||
scheduler.Record([this, dst_region, src_region, pipeline, layout, sampler,
|
scheduler.Record([this, dst_region, src_region, pipeline, layout, sampler, src_view,
|
||||||
src_view](vk::CommandBuffer cmdbuf) {
|
src_stencil_view, blit_stencil](vk::CommandBuffer cmdbuf) {
|
||||||
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit();
|
VkDescriptorSet descriptor_set = VK_NULL_HANDLE;
|
||||||
UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view);
|
if (blit_stencil) {
|
||||||
|
descriptor_set = two_textures_descriptor_allocator.Commit();
|
||||||
|
UpdateTwoTexturesDescriptorSet(device, descriptor_set, sampler, src_view,
|
||||||
|
src_stencil_view);
|
||||||
|
} else {
|
||||||
|
descriptor_set = one_texture_descriptor_allocator.Commit();
|
||||||
|
UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view);
|
||||||
|
}
|
||||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
@ -740,6 +746,18 @@ void BlitImageHelper::BlitColorMSAA(const Framebuffer* dst_framebuffer,
|
||||||
scheduler.InvalidateState();
|
scheduler.InvalidateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlitImageHelper::BlitColorMSAA(const Framebuffer* dst_framebuffer,
|
||||||
|
const ImageView& src_image_view, const Region2D& dst_region,
|
||||||
|
const Region2D& src_region) {
|
||||||
|
const BlitMSAAPipelineKey key{
|
||||||
|
.renderpass = dst_framebuffer->RenderPass(),
|
||||||
|
.samples = dst_framebuffer->Samples(),
|
||||||
|
};
|
||||||
|
BlitMSAAImpl(dst_framebuffer, src_image_view, dst_region, src_region,
|
||||||
|
FindOrEmplaceBlitColorMSAAPipeline(key),
|
||||||
|
src_image_view.Handle(Shader::TextureType::Color2D), VK_NULL_HANDLE, false);
|
||||||
|
}
|
||||||
|
|
||||||
void BlitImageHelper::BlitDepthStencilMSAA(const Framebuffer* dst_framebuffer,
|
void BlitImageHelper::BlitDepthStencilMSAA(const Framebuffer* dst_framebuffer,
|
||||||
ImageView& src_image_view, const Region2D& dst_region,
|
ImageView& src_image_view, const Region2D& dst_region,
|
||||||
const Region2D& src_region) {
|
const Region2D& src_region) {
|
||||||
|
|
@ -749,35 +767,13 @@ void BlitImageHelper::BlitDepthStencilMSAA(const Framebuffer* dst_framebuffer,
|
||||||
.renderpass = dst_framebuffer->RenderPass(),
|
.renderpass = dst_framebuffer->RenderPass(),
|
||||||
.samples = dst_framebuffer->Samples(),
|
.samples = dst_framebuffer->Samples(),
|
||||||
};
|
};
|
||||||
const VkPipeline pipeline = FindOrEmplaceBlitDepthStencilMSAAPipeline(key, blit_stencil);
|
VkImageView src_stencil_view = VK_NULL_HANDLE;
|
||||||
const VkPipelineLayout layout =
|
if (blit_stencil) {
|
||||||
blit_stencil ? *two_textures_pipeline_layout : *one_texture_pipeline_layout;
|
src_stencil_view = src_image_view.StencilView();
|
||||||
const VkSampler sampler = *nearest_sampler;
|
}
|
||||||
const VkImageView src_depth_view = src_image_view.DepthView();
|
BlitMSAAImpl(dst_framebuffer, src_image_view, dst_region, src_region,
|
||||||
const VkImageView src_stencil_view =
|
FindOrEmplaceBlitDepthStencilMSAAPipeline(key, blit_stencil),
|
||||||
blit_stencil ? src_image_view.StencilView() : VK_NULL_HANDLE;
|
src_image_view.DepthView(), src_stencil_view, blit_stencil);
|
||||||
|
|
||||||
RecordShaderReadBarrier(scheduler, src_image_view);
|
|
||||||
scheduler.RequestRenderpass(dst_framebuffer);
|
|
||||||
scheduler.Record([this, dst_region, src_region, pipeline, layout, sampler, src_depth_view,
|
|
||||||
src_stencil_view, blit_stencil](vk::CommandBuffer cmdbuf) {
|
|
||||||
if (blit_stencil) {
|
|
||||||
const VkDescriptorSet descriptor_set = two_textures_descriptor_allocator.Commit();
|
|
||||||
UpdateTwoTexturesDescriptorSet(device, descriptor_set, sampler, src_depth_view,
|
|
||||||
src_stencil_view);
|
|
||||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
|
||||||
nullptr);
|
|
||||||
} else {
|
|
||||||
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit();
|
|
||||||
UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_depth_view);
|
|
||||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
|
||||||
nullptr);
|
|
||||||
}
|
|
||||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
|
||||||
BindBlitState(cmdbuf, layout, dst_region, src_region);
|
|
||||||
cmdbuf.Draw(3, 1, 0, 0);
|
|
||||||
});
|
|
||||||
scheduler.InvalidateState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlitImageHelper::BlitDepth(const Framebuffer* dst_framebuffer, ImageView& src_image_view,
|
void BlitImageHelper::BlitDepth(const Framebuffer* dst_framebuffer, ImageView& src_image_view,
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,10 @@ private:
|
||||||
VkPipelineStageFlags2 post_dst_stages;
|
VkPipelineStageFlags2 post_dst_stages;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void BlitMSAAImpl(const Framebuffer* dst_framebuffer, const ImageView& src_image_view,
|
||||||
|
const Region2D& dst_region, const Region2D& src_region, VkPipeline pipeline,
|
||||||
|
VkImageView src_view, VkImageView src_stencil_view, bool blit_stencil);
|
||||||
|
|
||||||
void CopyMSAAImpl(VkRenderPass renderpass, VkPipeline pipeline, VkPipelineLayout layout,
|
void CopyMSAAImpl(VkRenderPass renderpass, VkPipeline pipeline, VkPipelineLayout layout,
|
||||||
VkImage dst_image, VkFormat dst_vk_format, VkImage src_image,
|
VkImage dst_image, VkFormat dst_vk_format, VkImage src_image,
|
||||||
VkFormat src_vk_format, s32 scale_x, s32 scale_y,
|
VkFormat src_vk_format, s32 scale_x, s32 scale_y,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue