Skip to content

Commit

Permalink
Add image, extent arguments to vkpt_final_blit_simple()
Browse files Browse the repository at this point in the history
  • Loading branch information
res2k committed Sep 16, 2021
1 parent 0d52171 commit b068eee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/refresh/vkpt/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ vkpt_draw_submit_stretch_pics(VkCommandBuffer cmd_buf)
}

VkResult
vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
vkpt_final_blit_simple(VkCommandBuffer cmd_buf, VkImage image, VkExtent2D extent)
{
VkImageSubresourceRange subresource_range = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
Expand All @@ -554,10 +554,8 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
);

int output_img = VKPT_IMG_TAA_OUTPUT;

IMAGE_BARRIER(cmd_buf,
.image = qvk.images[output_img],
.image = image,
.subresourceRange = subresource_range,
.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
Expand All @@ -566,8 +564,8 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
);

VkOffset3D blit_size = {
.x = qvk.extent_taa_output.width,
.y = qvk.extent_taa_output.height,
.x = extent.width,
.y = extent.height,
.z = 1
};
VkOffset3D blit_size_unscaled = {
Expand All @@ -580,7 +578,7 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
.dstOffsets = { [1] = blit_size_unscaled },
};
vkCmdBlitImage(cmd_buf,
qvk.images[output_img], VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
qvk.swap_chain_images[qvk.current_swap_chain_image_index], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &img_blit, VK_FILTER_NEAREST);

Expand All @@ -594,7 +592,7 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf)
);

IMAGE_BARRIER(cmd_buf,
.image = qvk.images[output_img],
.image = image,
.subresourceRange = subresource_range,
.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT,
.dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
Expand Down
4 changes: 2 additions & 2 deletions src/refresh/vkpt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3188,7 +3188,7 @@ R_EndFrame_RTX(void)
{
if (qvk.effective_aa_mode == AA_MODE_UPSCALE)
{
vkpt_final_blit_simple(cmd_buf);
vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output);
}
else
{
Expand All @@ -3198,7 +3198,7 @@ R_EndFrame_RTX(void)

if (extents_equal(qvk.extent_render, qvk.extent_unscaled) ||
extents_equal(qvk.extent_render, extent_unscaled_half) && drs_effective_scale == 0) // don't do nearest filter 2x upscale with DRS enabled
vkpt_final_blit_simple(cmd_buf);
vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output);
else
vkpt_final_blit_filtered(cmd_buf);
}
Expand Down
2 changes: 1 addition & 1 deletion src/refresh/vkpt/vkpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ VkResult vkpt_draw_destroy();
VkResult vkpt_draw_destroy_pipelines();
VkResult vkpt_draw_create_pipelines();
VkResult vkpt_draw_submit_stretch_pics(VkCommandBuffer cmd_buf);
VkResult vkpt_final_blit_simple(VkCommandBuffer cmd_buf);
VkResult vkpt_final_blit_simple(VkCommandBuffer cmd_buf, VkImage image, VkExtent2D extent);
VkResult vkpt_final_blit_filtered(VkCommandBuffer cmd_buf);
VkResult vkpt_draw_clear_stretch_pics();

Expand Down

0 comments on commit b068eee

Please sign in to comment.