early-access version 3308

This commit is contained in:
pineappleEA 2023-01-13 10:52:29 +01:00
parent 215bc2b128
commit 862510daee
8 changed files with 97 additions and 19 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3307. This is the source code for early-access 3308.
## Legal Notice ## Legal Notice

View file

@ -129,6 +129,10 @@ void UpdateRescalingInfo() {
info.up_scale = 1; info.up_scale = 1;
info.down_shift = 0; info.down_shift = 0;
break; break;
case ResolutionSetup::Res3_2X:
info.up_scale = 3;
info.down_shift = 1;
break;
case ResolutionSetup::Res2X: case ResolutionSetup::Res2X:
info.up_scale = 2; info.up_scale = 2;
info.down_shift = 0; info.down_shift = 0;
@ -149,6 +153,14 @@ void UpdateRescalingInfo() {
info.up_scale = 6; info.up_scale = 6;
info.down_shift = 0; info.down_shift = 0;
break; break;
case ResolutionSetup::Res7X:
info.up_scale = 7;
info.down_shift = 0;
break;
case ResolutionSetup::Res8X:
info.up_scale = 8;
info.down_shift = 0;
break;
default: default:
ASSERT(false); ASSERT(false);
info.up_scale = 1; info.up_scale = 1;

View file

@ -56,11 +56,14 @@ enum class ResolutionSetup : u32 {
Res1_2X = 0, Res1_2X = 0,
Res3_4X = 1, Res3_4X = 1,
Res1X = 2, Res1X = 2,
Res2X = 3, Res3_2X = 3,
Res3X = 4, Res2X = 4,
Res4X = 5, Res3X = 5,
Res5X = 6, Res4X = 6,
Res6X = 7, Res5X = 7,
Res6X = 8,
Res7X = 9,
Res8X = 10,
}; };
enum class ScalingFilter : u32 { enum class ScalingFilter : u32 {

View file

@ -199,10 +199,10 @@ void DrawManager::DrawTexture() {
draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f; draw_texture_state.src_x0 = static_cast<float>(regs.draw_texture.src_x0) / 4096.f;
draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f; draw_texture_state.src_y0 = static_cast<float>(regs.draw_texture.src_y0) / 4096.f;
draw_texture_state.src_x1 = draw_texture_state.src_x1 =
(static_cast<float>(regs.draw_texture.dx_du) / 4294967295.f) * dst_width + (static_cast<float>(regs.draw_texture.dx_du) / 4294967296.f) * dst_width +
draw_texture_state.src_x0; draw_texture_state.src_x0;
draw_texture_state.src_y1 = draw_texture_state.src_y1 =
(static_cast<float>(regs.draw_texture.dy_dv) / 4294967295.f) * dst_height + (static_cast<float>(regs.draw_texture.dy_dv) / 4294967296.f) * dst_height +
draw_texture_state.src_y0; draw_texture_state.src_y0;
draw_texture_state.src_sampler = regs.draw_texture.src_sampler; draw_texture_state.src_sampler = regs.draw_texture.src_sampler;
draw_texture_state.src_texture = regs.draw_texture.src_texture; draw_texture_state.src_texture = regs.draw_texture.src_texture;

View file

@ -350,6 +350,51 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) {
.height = is_rescaled ? resolution.ScaleUp(height) : height, .height = is_rescaled ? resolution.ScaleUp(height) : height,
}; };
} }
void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout,
VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) {
constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT};
const VkImageMemoryBarrier barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
.srcAccessMask = flags,
.dstAccessMask = flags,
.oldLayout = source_layout,
.newLayout = target_layout,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = image,
.subresourceRange{
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.levelCount = 1,
.baseArrayLayer = 0,
.layerCount = 1,
},
};
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
0, barrier);
}
void BeginRenderPass(vk::CommandBuffer& cmdbuf, const Framebuffer* framebuffer) {
const VkRenderPass render_pass = framebuffer->RenderPass();
const VkFramebuffer framebuffer_handle = framebuffer->Handle();
const VkExtent2D render_area = framebuffer->RenderArea();
const VkRenderPassBeginInfo renderpass_bi{
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
.pNext = nullptr,
.renderPass = render_pass,
.framebuffer = framebuffer_handle,
.renderArea{
.offset{},
.extent = render_area,
},
.clearValueCount = 0,
.pClearValues = nullptr,
};
cmdbuf.BeginRenderPass(renderpass_bi, VK_SUBPASS_CONTENTS_INLINE);
}
} // Anonymous namespace } // Anonymous namespace
BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_,
@ -408,18 +453,20 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView
} }
void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView src_image_view, void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView src_image_view,
VkSampler src_sampler, const Region2D& dst_region, VkImage src_image, VkSampler src_sampler,
const Region2D& src_region, const Extent3D& src_size) { const Region2D& dst_region, const Region2D& src_region,
const Extent3D& src_size) {
const BlitImagePipelineKey key{ const BlitImagePipelineKey key{
.renderpass = dst_framebuffer->RenderPass(), .renderpass = dst_framebuffer->RenderPass(),
.operation = Tegra::Engines::Fermi2D::Operation::SrcCopy, .operation = Tegra::Engines::Fermi2D::Operation::SrcCopy,
}; };
const VkPipelineLayout layout = *one_texture_pipeline_layout; const VkPipelineLayout layout = *one_texture_pipeline_layout;
const VkPipeline pipeline = FindOrEmplaceColorPipeline(key); const VkPipeline pipeline = FindOrEmplaceColorPipeline(key);
scheduler.RequestRenderpass(dst_framebuffer); scheduler.RequestOutsideRenderPassOperationContext();
scheduler.Record([this, dst_region, src_region, src_size, pipeline, layout, src_sampler, scheduler.Record([this, dst_framebuffer, src_image_view, src_image, src_sampler, dst_region,
src_image_view](vk::CommandBuffer cmdbuf) { src_region, src_size, pipeline, layout](vk::CommandBuffer cmdbuf) {
// TODO: Barriers TransitionImageLayout(cmdbuf, src_image, VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL);
BeginRenderPass(cmdbuf, dst_framebuffer);
const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit(); const VkDescriptorSet descriptor_set = one_texture_descriptor_allocator.Commit();
UpdateOneTextureDescriptorSet(device, descriptor_set, src_sampler, src_image_view); UpdateOneTextureDescriptorSet(device, descriptor_set, src_sampler, src_image_view);
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
@ -427,8 +474,8 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView
nullptr); nullptr);
BindBlitState(cmdbuf, layout, dst_region, src_region, src_size); BindBlitState(cmdbuf, layout, dst_region, src_region, src_size);
cmdbuf.Draw(3, 1, 0, 0); cmdbuf.Draw(3, 1, 0, 0);
cmdbuf.EndRenderPass();
}); });
scheduler.InvalidateState();
} }
void BlitImageHelper::BlitDepthStencil(const Framebuffer* dst_framebuffer, void BlitImageHelper::BlitDepthStencil(const Framebuffer* dst_framebuffer,

View file

@ -39,8 +39,8 @@ public:
Tegra::Engines::Fermi2D::Operation operation); Tegra::Engines::Fermi2D::Operation operation);
void BlitColor(const Framebuffer* dst_framebuffer, VkImageView src_image_view, void BlitColor(const Framebuffer* dst_framebuffer, VkImageView src_image_view,
VkSampler src_sampler, const Region2D& dst_region, const Region2D& src_region, VkImage src_image, VkSampler src_sampler, const Region2D& dst_region,
const Extent3D& src_size); const Region2D& src_region, const Extent3D& src_size);
void BlitDepthStencil(const Framebuffer* dst_framebuffer, VkImageView src_depth_view, void BlitDepthStencil(const Framebuffer* dst_framebuffer, VkImageView src_depth_view,
VkImageView src_stencil_view, const Region2D& dst_region, VkImageView src_stencil_view, const Region2D& dst_region,

View file

@ -290,8 +290,9 @@ void RasterizerVulkan::DrawTexture() {
.y = static_cast<s32>(draw_texture_state.src_y0)}, .y = static_cast<s32>(draw_texture_state.src_y0)},
Offset2D{.x = static_cast<s32>(draw_texture_state.src_x1), Offset2D{.x = static_cast<s32>(draw_texture_state.src_x1),
.y = static_cast<s32>(draw_texture_state.src_y1)}}; .y = static_cast<s32>(draw_texture_state.src_y1)}};
blit_image.BlitColor(texture_cache.GetFramebuffer(), texture.RenderTarget(), sampler->Handle(), blit_image.BlitColor(texture_cache.GetFramebuffer(), texture.RenderTarget(),
dst_region, src_region, texture.size); texture.ImageHandle(), sampler->Handle(), dst_region, src_region,
texture.size);
} }
void RasterizerVulkan::Clear(u32 layer_count) { void RasterizerVulkan::Clear(u32 layer_count) {

View file

@ -364,6 +364,11 @@
<string>1X (720p/1080p)</string> <string>1X (720p/1080p)</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>1.5X (1080p/1620p) [EXPERIMENTAL]</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>2X (1440p/2160p)</string> <string>2X (1440p/2160p)</string>
@ -389,6 +394,16 @@
<string>6X (4320p/6480p)</string> <string>6X (4320p/6480p)</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>7X (5040p/7560p)</string>
</property>
</item>
<item>
<property name="text">
<string>8X (5760p/8640p)</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>