|
|
@ -11,6 +11,7 @@ |
|
|
#include "video_core/host_shaders/convert_abgr8_to_d32f_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_abgr8_to_d32f_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_d24s8_to_abgr8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_d32f_to_abgr8_frag_spv.h"
|
|
|
|
|
|
#include "video_core/host_shaders/convert_r8_to_abgr8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_depth_to_float_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_depth_to_float_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_float_to_depth_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_float_to_depth_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_s8d24_to_abgr8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_s8d24_to_abgr8_frag_spv.h"
|
|
|
@ -29,6 +30,7 @@ |
|
|
#include "video_core/vulkan_common/vulkan_device.h"
|
|
|
#include "video_core/vulkan_common/vulkan_device.h"
|
|
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
|
|
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
|
|
#include "video_core/host_shaders/convert_abgr8_srgb_to_d24s8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_abgr8_srgb_to_d24s8_frag_spv.h"
|
|
|
|
|
|
#include "video_core/host_shaders/convert_abgr8_to_r8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_rgba8_to_bgra8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_rgba8_to_bgra8_frag_spv.h"
|
|
|
#include "video_core/host_shaders/convert_yuv420_to_rgb_comp_spv.h"
|
|
|
#include "video_core/host_shaders/convert_yuv420_to_rgb_comp_spv.h"
|
|
|
#include "video_core/host_shaders/convert_rgb_to_yuv420_comp_spv.h"
|
|
|
#include "video_core/host_shaders/convert_rgb_to_yuv420_comp_spv.h"
|
|
|
@ -444,7 +446,8 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, |
|
|
descriptor_pool.Allocator(*two_textures_set_layout, TEXTURE_DESCRIPTOR_BANK_INFO<2>)}, |
|
|
descriptor_pool.Allocator(*two_textures_set_layout, TEXTURE_DESCRIPTOR_BANK_INFO<2>)}, |
|
|
one_texture_pipeline_layout(device.GetLogical().CreatePipelineLayout(PipelineLayoutCreateInfo( |
|
|
one_texture_pipeline_layout(device.GetLogical().CreatePipelineLayout(PipelineLayoutCreateInfo( |
|
|
one_texture_set_layout.address(), |
|
|
one_texture_set_layout.address(), |
|
|
PUSH_CONSTANT_RANGE<VK_SHADER_STAGE_VERTEX_BIT, sizeof(PushConstants)>))), |
|
|
|
|
|
|
|
|
PUSH_CONSTANT_RANGE<VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(PushConstants)> |
|
|
|
|
|
))), |
|
|
two_textures_pipeline_layout( |
|
|
two_textures_pipeline_layout( |
|
|
device.GetLogical().CreatePipelineLayout(PipelineLayoutCreateInfo( |
|
|
device.GetLogical().CreatePipelineLayout(PipelineLayoutCreateInfo( |
|
|
two_textures_set_layout.address(), |
|
|
two_textures_set_layout.address(), |
|
|
@ -461,6 +464,8 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, |
|
|
convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)), |
|
|
convert_float_to_depth_frag(BuildShader(device, CONVERT_FLOAT_TO_DEPTH_FRAG_SPV)), |
|
|
convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)), |
|
|
convert_abgr8_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_TO_D24S8_FRAG_SPV)), |
|
|
convert_abgr8_to_d32f_frag(BuildShader(device, CONVERT_ABGR8_TO_D32F_FRAG_SPV)), |
|
|
convert_abgr8_to_d32f_frag(BuildShader(device, CONVERT_ABGR8_TO_D32F_FRAG_SPV)), |
|
|
|
|
|
convert_abgr8_to_r8_frag(BuildShader(device, CONVERT_ABGR8_TO_R8_FRAG_SPV)), |
|
|
|
|
|
convert_r8_to_abgr8_frag(BuildShader(device, CONVERT_R8_TO_ABGR8_FRAG_SPV)), |
|
|
convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), |
|
|
convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), |
|
|
convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)), |
|
|
convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)), |
|
|
convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)), |
|
|
convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)), |
|
|
@ -588,6 +593,20 @@ void BlitImageHelper::ConvertR16ToD16(const Framebuffer* dst_framebuffer, |
|
|
Convert(*convert_r16_to_d16_pipeline, dst_framebuffer, src_image_view); |
|
|
Convert(*convert_r16_to_d16_pipeline, dst_framebuffer, src_image_view); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BlitImageHelper::ConvertR8ToABGR8(const Framebuffer* dst_framebuffer, |
|
|
|
|
|
const ImageView& src_image_view) { |
|
|
|
|
|
ConvertPipelineColorTargetEx(convert_r8_to_abgr8_pipeline, dst_framebuffer->RenderPass(), |
|
|
|
|
|
convert_r8_to_abgr8_frag); |
|
|
|
|
|
Convert(*convert_r8_to_abgr8_pipeline, dst_framebuffer, src_image_view); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BlitImageHelper::ConvertABGR8ToR8(const Framebuffer* dst_framebuffer, |
|
|
|
|
|
const ImageView& src_image_view) { |
|
|
|
|
|
ConvertPipelineColorTargetEx(convert_abgr8_to_r8_pipeline, dst_framebuffer->RenderPass(), |
|
|
|
|
|
convert_abgr8_to_r8_frag); |
|
|
|
|
|
Convert(*convert_abgr8_to_r8_pipeline, dst_framebuffer, src_image_view); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, |
|
|
void BlitImageHelper::ConvertABGR8ToD24S8(const Framebuffer* dst_framebuffer, |
|
|
const ImageView& src_image_view) { |
|
|
const ImageView& src_image_view) { |
|
|
ConvertPipelineDepthTargetEx(convert_abgr8_to_d24s8_pipeline, dst_framebuffer->RenderPass(), |
|
|
ConvertPipelineDepthTargetEx(convert_abgr8_to_d24s8_pipeline, dst_framebuffer->RenderPass(), |
|
|
@ -687,7 +706,7 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb |
|
|
const VkExtent2D extent = GetConversionExtent(src_image_view); |
|
|
const VkExtent2D extent = GetConversionExtent(src_image_view); |
|
|
|
|
|
|
|
|
scheduler.RequestRenderpass(dst_framebuffer); |
|
|
scheduler.RequestRenderpass(dst_framebuffer); |
|
|
scheduler.Record([pipeline, layout, sampler, src_view, extent, this](vk::CommandBuffer cmdbuf) { |
|
|
|
|
|
|
|
|
scheduler.Record([pipeline, layout, sampler, src_view, extent, this, dst_framebuffer](vk::CommandBuffer cmdbuf) { |
|
|
const VkOffset2D offset{ |
|
|
const VkOffset2D offset{ |
|
|
.x = 0, |
|
|
.x = 0, |
|
|
.y = 0, |
|
|
.y = 0, |
|
|
@ -704,10 +723,17 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb |
|
|
.offset = offset, |
|
|
.offset = offset, |
|
|
.extent = extent, |
|
|
.extent = extent, |
|
|
}; |
|
|
}; |
|
|
const PushConstants push_constants{ |
|
|
|
|
|
|
|
|
const PushConstants push_constants_vertex{ |
|
|
.tex_scale = {viewport.width, viewport.height}, |
|
|
.tex_scale = {viewport.width, viewport.height}, |
|
|
.tex_offset = {0.0f, 0.0f}, |
|
|
.tex_offset = {0.0f, 0.0f}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
const PushConstants push_constants_frag{ |
|
|
|
|
|
.tex_scale = { |
|
|
|
|
|
static_cast<float>(dst_framebuffer->RenderArea().width), |
|
|
|
|
|
static_cast<float>(dst_framebuffer->RenderArea().height) |
|
|
|
|
|
}, |
|
|
|
|
|
.tex_offset = {0.0f, 0.0f}, |
|
|
|
|
|
}; |
|
|
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); |
|
|
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); |
|
|
UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); |
|
|
UpdateOneTextureDescriptorSet(device, descriptor_set, sampler, src_view); |
|
|
|
|
|
|
|
|
@ -717,7 +743,8 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb |
|
|
nullptr); |
|
|
nullptr); |
|
|
cmdbuf.SetViewport(0, viewport); |
|
|
cmdbuf.SetViewport(0, viewport); |
|
|
cmdbuf.SetScissor(0, scissor); |
|
|
cmdbuf.SetScissor(0, scissor); |
|
|
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT, push_constants); |
|
|
|
|
|
|
|
|
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT, push_constants_vertex); |
|
|
|
|
|
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_FRAGMENT_BIT, push_constants_frag); |
|
|
cmdbuf.Draw(3, 1, 0, 0); |
|
|
cmdbuf.Draw(3, 1, 0, 0); |
|
|
}); |
|
|
}); |
|
|
scheduler.InvalidateState(); |
|
|
scheduler.InvalidateState(); |
|
|
|