mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-06 12:13:57 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| be67a31c93 |
@@ -83,3 +83,16 @@ Once your request is processed, you will receive a confirmation email with your
|
||||
Alongside the other contribution methods listed up top, you can also choose to contribute through documentation, organization, or community guides. These can be done either through the code contribution methods described above, or created externally and shared via our Discord community.
|
||||
|
||||
If you have an external tool/page that you believe would be handy to integrate/link into Eden, please additionally email our developers at [`developers@eden-emu.dev`](mailto:developers@eden-emu.dev). **Do not submit vibe-coded or AI generated tools or applications**.
|
||||
|
||||
### Non-English Contributions
|
||||
|
||||
If you can't speak English or find more comfortable speaking in your native tongue, you may submit PR, commits, comments, and reviews in other languages. There is no restriction what languages are allowed, but maintainers will use translators if they're unable to understand.
|
||||
|
||||
Triage can speak:
|
||||
|
||||
- Chinese
|
||||
- Portuguese
|
||||
- Russian
|
||||
- Spanish
|
||||
|
||||
Documentation must be in American English, we don't have the capacity to support multilingual manuals. Code comments must remain in English for future referral.
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include "video_core/renderer_vulkan/vk_texture_cache.h"
|
||||
|
||||
@@ -159,18 +158,15 @@ VkPipelineInputAssemblyStateCreateInfo GetPipelineInputAssemblyStateCreateInfo(c
|
||||
.primitiveRestartEnable = device.IsMoltenVK() ? VK_TRUE : VK_FALSE,
|
||||
};
|
||||
}
|
||||
VkPipelineViewportStateCreateInfo GetPipelineViewportStateCreateInfo(const Device& device) {
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
return VkPipelineViewportStateCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.viewportCount = viewport_count,
|
||||
.pViewports = nullptr,
|
||||
.scissorCount = viewport_count,
|
||||
.pScissors = nullptr,
|
||||
};
|
||||
}
|
||||
constexpr VkPipelineViewportStateCreateInfo PIPELINE_VIEWPORT_STATE_CREATE_INFO{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.viewportCount = 1,
|
||||
.pViewports = nullptr,
|
||||
.scissorCount = 1,
|
||||
.pScissors = nullptr,
|
||||
};
|
||||
constexpr VkPipelineRasterizationStateCreateInfo PIPELINE_RASTERIZATION_STATE_CREATE_INFO{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -403,7 +399,7 @@ void UpdateTwoTexturesDescriptorSet(const Device& device, VkDescriptorSet descri
|
||||
device.GetLogical().UpdateDescriptorSets(write_descriptor_sets, nullptr);
|
||||
}
|
||||
|
||||
void BindBlitState(const Device& device, vk::CommandBuffer cmdbuf, const Region2D& dst_region) {
|
||||
void BindBlitState(vk::CommandBuffer cmdbuf, const Region2D& dst_region) {
|
||||
const VkOffset2D offset{
|
||||
.x = (std::min)(dst_region.start.x, dst_region.end.x),
|
||||
.y = (std::min)(dst_region.start.y, dst_region.end.y),
|
||||
@@ -425,17 +421,13 @@ void BindBlitState(const Device& device, vk::CommandBuffer cmdbuf, const Region2
|
||||
.offset = offset,
|
||||
.extent = extent,
|
||||
};
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
const std::array<VkViewport, 2> viewports{viewport, viewport};
|
||||
const std::array<VkRect2D, 2> scissors{scissor, scissor};
|
||||
cmdbuf.SetViewport(0, vk::Span<VkViewport>(viewports.data(), viewport_count));
|
||||
cmdbuf.SetScissor(0, vk::Span<VkRect2D>(scissors.data(), viewport_count));
|
||||
cmdbuf.SetViewport(0, viewport);
|
||||
cmdbuf.SetScissor(0, scissor);
|
||||
}
|
||||
|
||||
void BindBlitState(const Device& device, vk::CommandBuffer cmdbuf, VkPipelineLayout layout,
|
||||
const Region2D& dst_region, const Region2D& src_region,
|
||||
const Extent3D& src_size = {1, 1, 1}) {
|
||||
BindBlitState(device, cmdbuf, dst_region);
|
||||
void BindBlitState(vk::CommandBuffer cmdbuf, VkPipelineLayout layout, const Region2D& dst_region,
|
||||
const Region2D& src_region, const Extent3D& src_size = {1, 1, 1}) {
|
||||
BindBlitState(cmdbuf, dst_region);
|
||||
const float scale_x = static_cast<float>(src_region.end.x - src_region.start.x) /
|
||||
static_cast<float>(src_size.width);
|
||||
const float scale_y = static_cast<float>(src_region.end.y - src_region.start.y) /
|
||||
@@ -704,7 +696,7 @@ void BlitImageHelper::BlitColor(const Framebuffer* dst_framebuffer, VkImageView
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
||||
nullptr);
|
||||
BindBlitState(device, cmdbuf, layout, dst_region, src_region, src_size);
|
||||
BindBlitState(cmdbuf, layout, dst_region, src_region, src_size);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
cmdbuf.EndRenderPass();
|
||||
});
|
||||
@@ -736,7 +728,7 @@ void BlitImageHelper::BlitImpl(const Framebuffer* dst_framebuffer,
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
||||
nullptr);
|
||||
BindBlitState(device, cmdbuf, layout, dst_region, src_region);
|
||||
BindBlitState(cmdbuf, layout, dst_region, src_region);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
});
|
||||
scheduler.InvalidateState();
|
||||
@@ -893,13 +885,13 @@ void BlitImageHelper::ClearColor(const Framebuffer* dst_framebuffer, u8 color_ma
|
||||
const VkPipelineLayout layout = *clear_color_pipeline_layout;
|
||||
scheduler.RequestRenderpass(dst_framebuffer);
|
||||
scheduler.Record(
|
||||
[pipeline, layout, color_mask, clear_color, dst_region, this](vk::CommandBuffer cmdbuf) {
|
||||
[pipeline, layout, color_mask, clear_color, dst_region](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
const std::array blend_color = {
|
||||
(color_mask & 0x1) ? 1.0f : 0.0f, (color_mask & 0x2) ? 1.0f : 0.0f,
|
||||
(color_mask & 0x4) ? 1.0f : 0.0f, (color_mask & 0x8) ? 1.0f : 0.0f};
|
||||
cmdbuf.SetBlendConstants(blend_color.data());
|
||||
BindBlitState(device, cmdbuf, dst_region);
|
||||
BindBlitState(cmdbuf, dst_region);
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_FRAGMENT_BIT, clear_color);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
});
|
||||
@@ -919,11 +911,11 @@ void BlitImageHelper::ClearDepthStencil(const Framebuffer* dst_framebuffer, bool
|
||||
const VkPipeline pipeline = FindOrEmplaceClearStencilPipeline(key);
|
||||
const VkPipelineLayout layout = *clear_color_pipeline_layout;
|
||||
scheduler.RequestRenderpass(dst_framebuffer);
|
||||
scheduler.Record([pipeline, layout, clear_depth, dst_region, this](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([pipeline, layout, clear_depth, dst_region](vk::CommandBuffer cmdbuf) {
|
||||
constexpr std::array blend_constants{0.0f, 0.0f, 0.0f, 0.0f};
|
||||
cmdbuf.SetBlendConstants(blend_constants.data());
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
BindBlitState(device, cmdbuf, dst_region);
|
||||
BindBlitState(cmdbuf, dst_region);
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_FRAGMENT_BIT, clear_depth);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
});
|
||||
@@ -1184,11 +1176,8 @@ void BlitImageHelper::Convert(VkPipeline pipeline, const Framebuffer* dst_frameb
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
||||
nullptr);
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
const std::array<VkViewport, 2> viewports{viewport, viewport};
|
||||
const std::array<VkRect2D, 2> scissors{scissor, scissor};
|
||||
cmdbuf.SetViewport(0, vk::Span<VkViewport>(viewports.data(), viewport_count));
|
||||
cmdbuf.SetScissor(0, vk::Span<VkRect2D>(scissors.data(), viewport_count));
|
||||
cmdbuf.SetViewport(0, viewport);
|
||||
cmdbuf.SetScissor(0, scissor);
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT, push_constants);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
});
|
||||
@@ -1233,11 +1222,8 @@ void BlitImageHelper::ConvertDepthStencil(VkPipeline pipeline, const Framebuffer
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set,
|
||||
nullptr);
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
const std::array<VkViewport, 2> viewports{viewport, viewport};
|
||||
const std::array<VkRect2D, 2> scissors{scissor, scissor};
|
||||
cmdbuf.SetViewport(0, vk::Span<VkViewport>(viewports.data(), viewport_count));
|
||||
cmdbuf.SetScissor(0, vk::Span<VkRect2D>(scissors.data(), viewport_count));
|
||||
cmdbuf.SetViewport(0, viewport);
|
||||
cmdbuf.SetScissor(0, scissor);
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT, push_constants);
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
});
|
||||
@@ -1275,7 +1261,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceColorPipeline(const BlitImagePipelineKe
|
||||
.blendConstants = {0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
blit_color_pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1285,7 +1270,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceColorPipeline(const BlitImagePipelineKe
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = nullptr,
|
||||
@@ -1308,7 +1293,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceDepthStencilPipeline(const BlitImagePip
|
||||
blit_depth_stencil_keys.push_back(key);
|
||||
const std::array stages = MakeStages(*full_screen_vert, *blit_depth_stencil_frag);
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
blit_depth_stencil_pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1318,7 +1302,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceDepthStencilPipeline(const BlitImagePip
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
|
||||
@@ -1362,7 +1346,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearColorPipeline(const BlitImagePipel
|
||||
.blendConstants = {0.0f, 0.0f, 0.0f, 0.0f},
|
||||
};
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
clear_color_pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1372,7 +1355,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearColorPipeline(const BlitImagePipel
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
|
||||
@@ -1419,7 +1402,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearStencilPipeline(
|
||||
.maxDepthBounds = 0.0f,
|
||||
};
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
clear_stencil_pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1429,7 +1411,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceClearStencilPipeline(
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = &depth_stencil_ci,
|
||||
@@ -1544,7 +1526,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceBlitDepthPipeline(VkRenderPass renderpa
|
||||
blit_depth_keys.push_back(renderpass);
|
||||
const std::array stages = MakeStages(*full_screen_vert, *blit_depth_frag);
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
blit_depth_pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1554,7 +1535,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceBlitDepthPipeline(VkRenderPass renderpa
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = &PIPELINE_DEPTH_ONLY_STATE_CREATE_INFO,
|
||||
@@ -1582,7 +1563,6 @@ VkPipeline BlitImageHelper::FindOrEmplaceResolveDepthStencilPipeline(VkRenderPas
|
||||
MakeStages(*full_screen_vert,
|
||||
resolve_stencil ? *blit_depth_stencil_msaa_frag : *blit_depth_msaa_frag);
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
pipelines.push_back(device.GetLogical().CreateGraphicsPipeline({
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1592,7 +1572,7 @@ VkPipeline BlitImageHelper::FindOrEmplaceResolveDepthStencilPipeline(VkRenderPas
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = resolve_stencil ? &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO
|
||||
@@ -1816,7 +1796,6 @@ void BlitImageHelper::ConvertPipelineEx(vk::Pipeline& pipeline, VkRenderPass ren
|
||||
}
|
||||
const std::array stages = MakeStages(*full_screen_vert, *module);
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1826,7 +1805,7 @@ void BlitImageHelper::ConvertPipelineEx(vk::Pipeline& pipeline, VkRenderPass ren
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = is_target_depth ? &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO : nullptr,
|
||||
@@ -1860,7 +1839,6 @@ void BlitImageHelper::ConvertPipeline(vk::Pipeline& pipeline, VkRenderPass rende
|
||||
is_target_depth ? *convert_float_to_depth_frag : *convert_depth_to_float_frag;
|
||||
const std::array stages = MakeStages(*full_screen_vert, frag_shader);
|
||||
const VkPipelineInputAssemblyStateCreateInfo input_assembly_ci = GetPipelineInputAssemblyStateCreateInfo(device);
|
||||
const VkPipelineViewportStateCreateInfo viewport_ci = GetPipelineViewportStateCreateInfo(device);
|
||||
pipeline = device.GetLogical().CreateGraphicsPipeline(VkGraphicsPipelineCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -1870,7 +1848,7 @@ void BlitImageHelper::ConvertPipeline(vk::Pipeline& pipeline, VkRenderPass rende
|
||||
.pVertexInputState = &PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.pInputAssemblyState = &input_assembly_ci,
|
||||
.pTessellationState = nullptr,
|
||||
.pViewportState = &viewport_ci,
|
||||
.pViewportState = &PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pRasterizationState = &PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
|
||||
.pMultisampleState = &PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.pDepthStencilState = is_target_depth ? &PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO : nullptr,
|
||||
|
||||
@@ -183,10 +183,10 @@ VkImageView FSR::Draw(const Device& device, Scheduler& scheduler, size_t image_i
|
||||
UpdateDescriptorSets(device, source_image_view, image_index);
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([=, &device](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([=](vk::CommandBuffer cmdbuf) {
|
||||
TransitionImageLayout(cmdbuf, source_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, easu_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, renderpass, easu_framebuffer, extent);
|
||||
BeginRenderPass(cmdbuf, renderpass, easu_framebuffer, extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, easu_pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0,
|
||||
easu_descriptor_set, {});
|
||||
@@ -196,7 +196,7 @@ VkImageView FSR::Draw(const Device& device, Scheduler& scheduler, size_t image_i
|
||||
|
||||
TransitionImageLayout(cmdbuf, easu_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, rcas_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, renderpass, rcas_framebuffer, extent);
|
||||
BeginRenderPass(cmdbuf, renderpass, rcas_framebuffer, extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, rcas_pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0,
|
||||
rcas_descriptor_set, {});
|
||||
|
||||
@@ -129,10 +129,10 @@ void FXAA::Draw(const Device& device, Scheduler& scheduler, size_t image_index,
|
||||
UpdateDescriptorSets(device, *inout_image_view, image_index);
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([=, &device](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([=](vk::CommandBuffer cmdbuf) {
|
||||
TransitionImageLayout(cmdbuf, input_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, output_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, renderpass, framebuffer, extent);
|
||||
BeginRenderPass(cmdbuf, renderpass, framebuffer, extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set, {});
|
||||
cmdbuf.Draw(3, 1, 0, 0);
|
||||
|
||||
@@ -129,10 +129,10 @@ VkImageView SGSR::Draw(const Device& device, Scheduler& scheduler, size_t image_
|
||||
UpdateDescriptorSets(device, source_image_view, image_index);
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([=, &device](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([=](vk::CommandBuffer cmdbuf) {
|
||||
TransitionImageLayout(cmdbuf, source_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, output_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, renderpass, framebuffer, extent);
|
||||
BeginRenderPass(cmdbuf, renderpass, framebuffer, extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, descriptor_set, {});
|
||||
cmdbuf.PushConstants(layout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, viewport_con);
|
||||
|
||||
@@ -237,10 +237,10 @@ void SMAA::Draw(const Device& device, Scheduler& scheduler, size_t image_index,
|
||||
UpdateDescriptorSets(device, *inout_image_view, image_index);
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([=, this, &device](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([=, this](vk::CommandBuffer cmdbuf) {
|
||||
TransitionImageLayout(cmdbuf, input_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, edges_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, *m_renderpasses[EdgeDetection], edge_detection_framebuffer,
|
||||
BeginRenderPass(cmdbuf, *m_renderpasses[EdgeDetection], edge_detection_framebuffer,
|
||||
m_extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipelines[EdgeDetection]);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -251,7 +251,7 @@ void SMAA::Draw(const Device& device, Scheduler& scheduler, size_t image_index,
|
||||
|
||||
TransitionImageLayout(cmdbuf, edges_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, blend_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, *m_renderpasses[BlendingWeightCalculation],
|
||||
BeginRenderPass(cmdbuf, *m_renderpasses[BlendingWeightCalculation],
|
||||
blending_weight_calculation_framebuffer, m_extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
*m_pipelines[BlendingWeightCalculation]);
|
||||
@@ -263,7 +263,7 @@ void SMAA::Draw(const Device& device, Scheduler& scheduler, size_t image_index,
|
||||
|
||||
TransitionImageLayout(cmdbuf, blend_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
TransitionImageLayout(cmdbuf, output_image, VK_IMAGE_LAYOUT_GENERAL);
|
||||
BeginRenderPass(device, cmdbuf, *m_renderpasses[NeighborhoodBlending],
|
||||
BeginRenderPass(cmdbuf, *m_renderpasses[NeighborhoodBlending],
|
||||
neighborhood_blending_framebuffer, m_extent);
|
||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *m_pipelines[NeighborhoodBlending]);
|
||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include <array>
|
||||
#include <ranges>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include "video_core/renderer_vulkan/present/util.h"
|
||||
@@ -439,14 +438,14 @@ static vk::Pipeline CreateWrappedPipelineImpl(
|
||||
.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
|
||||
.primitiveRestartEnable = device.IsMoltenVK() ? VK_TRUE : VK_FALSE,
|
||||
};
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
const VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
|
||||
constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = 0,
|
||||
.viewportCount = viewport_count,
|
||||
.viewportCount = 1,
|
||||
.pViewports = nullptr,
|
||||
.scissorCount = viewport_count,
|
||||
.scissorCount = 1,
|
||||
.pScissors = nullptr,
|
||||
};
|
||||
|
||||
@@ -700,8 +699,8 @@ void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) {
|
||||
cmdbuf.ClearColorImage(image, VK_IMAGE_LAYOUT_GENERAL, {}, subresources);
|
||||
}
|
||||
|
||||
void BeginRenderPass(const Device& device, vk::CommandBuffer& cmdbuf, VkRenderPass render_pass,
|
||||
VkFramebuffer framebuffer, VkExtent2D extent) {
|
||||
void BeginRenderPass(vk::CommandBuffer& cmdbuf, VkRenderPass render_pass, VkFramebuffer framebuffer,
|
||||
VkExtent2D extent) {
|
||||
const VkRenderPassBeginInfo renderpass_bi{
|
||||
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
|
||||
.pNext = nullptr,
|
||||
@@ -728,11 +727,8 @@ void BeginRenderPass(const Device& device, vk::CommandBuffer& cmdbuf, VkRenderPa
|
||||
.offset = {0, 0},
|
||||
.extent = extent,
|
||||
};
|
||||
const u32 viewport_count = device.GetViewportCount();
|
||||
const std::array<VkViewport, 2> viewports{viewport, viewport};
|
||||
const std::array<VkRect2D, 2> scissors{scissor, scissor};
|
||||
cmdbuf.SetViewport(0, vk::Span<VkViewport>(viewports.data(), viewport_count));
|
||||
cmdbuf.SetScissor(0, vk::Span<VkRect2D>(scissors.data(), viewport_count));
|
||||
cmdbuf.SetViewport(0, viewport);
|
||||
cmdbuf.SetScissor(0, scissor);
|
||||
}
|
||||
|
||||
} // namespace Vulkan
|
||||
|
||||
@@ -65,7 +65,7 @@ vk::Sampler CreateBilinearSampler(const Device& device);
|
||||
vk::Sampler CreateNearestNeighborSampler(const Device& device);
|
||||
vk::Sampler CreateCubicSampler(const Device& device, VkCubicFilterWeightsQCOM qcom_weights);
|
||||
|
||||
void BeginRenderPass(const Device& device, vk::CommandBuffer& cmdbuf, VkRenderPass render_pass,
|
||||
VkFramebuffer framebuffer, VkExtent2D extent);
|
||||
void BeginRenderPass(vk::CommandBuffer& cmdbuf, VkRenderPass render_pass, VkFramebuffer framebuffer,
|
||||
VkExtent2D extent);
|
||||
|
||||
} // namespace Vulkan
|
||||
|
||||
@@ -69,7 +69,7 @@ void WindowAdaptPass::Draw(const Device& device, RasterizerVulkan& rasterizer, S
|
||||
layer_it++;
|
||||
}
|
||||
|
||||
scheduler.Record([=, &device](vk::CommandBuffer cmdbuf) {
|
||||
scheduler.Record([=](vk::CommandBuffer cmdbuf) {
|
||||
const f32 bg_red = Settings::values.bg_red.GetValue() / 255.0f;
|
||||
const f32 bg_green = Settings::values.bg_green.GetValue() / 255.0f;
|
||||
const f32 bg_blue = Settings::values.bg_blue.GetValue() / 255.0f;
|
||||
@@ -91,7 +91,7 @@ void WindowAdaptPass::Draw(const Device& device, RasterizerVulkan& rasterizer, S
|
||||
.layerCount = 1,
|
||||
};
|
||||
|
||||
BeginRenderPass(device, cmdbuf, renderpass, host_framebuffer, render_area);
|
||||
BeginRenderPass(cmdbuf, renderpass, host_framebuffer, render_area);
|
||||
cmdbuf.ClearAttachments({clear_attachment}, {clear_rect});
|
||||
|
||||
for (size_t i = 0; i < layer_count; i++) {
|
||||
|
||||
@@ -469,7 +469,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
const bool is_mvk = driver_id == VK_DRIVER_ID_MOLTENVK;
|
||||
const bool is_qualcomm = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY;
|
||||
const bool is_turnip = driver_id == VK_DRIVER_ID_MESA_TURNIP;
|
||||
const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY;
|
||||
|
||||
if (!is_suitable)
|
||||
LOG_WARNING(Render_Vulkan, "Unsuitable driver - continuing anyways");
|
||||
@@ -662,11 +661,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
properties.properties.limits.maxVertexInputBindings = 32;
|
||||
}
|
||||
|
||||
if (is_arm && SupportsMultiViewport()) {
|
||||
LOG_WARNING(Render_Vulkan, "ARM driver requires setting multiple viewports on command buffer reuse");
|
||||
requires_setting_multi_viewports_on_cmdbuf_reuse = true;
|
||||
}
|
||||
|
||||
const auto dyna_state = Settings::values.dyna_state.GetValue();
|
||||
switch (dyna_state) {
|
||||
case Settings::ExtendedDynamicState::Disabled:
|
||||
|
||||
@@ -1000,10 +1000,6 @@ FN_MAX_LIMIT_LIST
|
||||
return features2.features.multiViewport;
|
||||
}
|
||||
|
||||
u32 GetViewportCount() const noexcept {
|
||||
return requires_setting_multi_viewports_on_cmdbuf_reuse ? 2U : 1U;
|
||||
}
|
||||
|
||||
/// Returns true if the device supports VK_KHR_maintenance1.
|
||||
bool IsKhrMaintenance1Supported() const {
|
||||
return extensions.maintenance1;
|
||||
@@ -1224,7 +1220,6 @@ private:
|
||||
bool has_radeon_gpu_profiler{}; ///< Has Radeon GPU Profiler attached.
|
||||
bool supports_d24_depth{}; ///< Supports D24 depth buffers.
|
||||
bool must_emulate_scaled_formats{}; ///< Requires scaled vertex format emulation
|
||||
bool requires_setting_multi_viewports_on_cmdbuf_reuse{}; ///< ARM workaround to always set 2+ viewports.
|
||||
bool dynamic_state3_blending{}; ///< Has blending features of dynamic_state3.
|
||||
bool dynamic_state3_enables{}; ///< Has at least one enable feature of dynamic_state3.
|
||||
bool dynamic_state3_depth_clamp_enable{};
|
||||
|
||||
Reference in New Issue
Block a user