mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-13 21:47:02 +02:00
[vulkan] Removal of dynamic viewport/scissor
This commit is contained in:
parent
1d0a3e83fa
commit
e98280bee9
2 changed files with 15 additions and 42 deletions
|
|
@ -692,9 +692,9 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.viewportCount = key.state.extended_dynamic_state ? 0u : num_viewports,
|
.viewportCount = num_viewports,
|
||||||
.pViewports = nullptr,
|
.pViewports = nullptr,
|
||||||
.scissorCount = key.state.extended_dynamic_state ? 0u : num_viewports,
|
.scissorCount = num_viewports,
|
||||||
.pScissors = nullptr,
|
.pScissors = nullptr,
|
||||||
};
|
};
|
||||||
if (device.IsNvViewportSwizzleSupported()) {
|
if (device.IsNvViewportSwizzleSupported()) {
|
||||||
|
|
@ -906,8 +906,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
||||||
}
|
}
|
||||||
if (key.state.extended_dynamic_state) {
|
if (key.state.extended_dynamic_state) {
|
||||||
static constexpr std::array extended{
|
static constexpr std::array extended{
|
||||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT,
|
|
||||||
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT,
|
|
||||||
VK_DYNAMIC_STATE_CULL_MODE_EXT,
|
VK_DYNAMIC_STATE_CULL_MODE_EXT,
|
||||||
VK_DYNAMIC_STATE_FRONT_FACE_EXT,
|
VK_DYNAMIC_STATE_FRONT_FACE_EXT,
|
||||||
VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT,
|
VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT,
|
||||||
|
|
@ -923,6 +921,11 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
||||||
dynamic_states.push_back(VK_DYNAMIC_STATE_SCISSOR);
|
dynamic_states.push_back(VK_DYNAMIC_STATE_SCISSOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.state.extended_dynamic_state) {
|
||||||
|
dynamic_states.push_back(VK_DYNAMIC_STATE_VIEWPORT);
|
||||||
|
dynamic_states.push_back(VK_DYNAMIC_STATE_SCISSOR);
|
||||||
|
}
|
||||||
|
|
||||||
// EDS2 - Core (3 states)
|
// EDS2 - Core (3 states)
|
||||||
if (key.state.extended_dynamic_state_2) {
|
if (key.state.extended_dynamic_state_2) {
|
||||||
static constexpr std::array extended2{
|
static constexpr std::array extended2{
|
||||||
|
|
|
||||||
|
|
@ -1159,16 +1159,8 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
||||||
.minDepth = 0.0f,
|
.minDepth = 0.0f,
|
||||||
.maxDepth = 1.0f,
|
.maxDepth = 1.0f,
|
||||||
};
|
};
|
||||||
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline();
|
scheduler.Record([viewport](vk::CommandBuffer cmdbuf) {
|
||||||
const bool use_viewport_with_count = device.IsExtExtendedDynamicStateSupported() &&
|
cmdbuf.SetViewport(0, viewport);
|
||||||
(!pipeline || pipeline->UsesExtendedDynamicState());
|
|
||||||
scheduler.Record([viewport, use_viewport_with_count](vk::CommandBuffer cmdbuf) {
|
|
||||||
if (use_viewport_with_count) {
|
|
||||||
std::array viewports{viewport};
|
|
||||||
cmdbuf.SetViewportWithCountEXT(viewports);
|
|
||||||
} else {
|
|
||||||
cmdbuf.SetViewport(0, viewport);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1184,17 +1176,10 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
||||||
GetViewportState(device, regs, 12, scale), GetViewportState(device, regs, 13, scale),
|
GetViewportState(device, regs, 12, scale), GetViewportState(device, regs, 13, scale),
|
||||||
GetViewportState(device, regs, 14, scale), GetViewportState(device, regs, 15, scale),
|
GetViewportState(device, regs, 14, scale), GetViewportState(device, regs, 15, scale),
|
||||||
};
|
};
|
||||||
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline();
|
scheduler.Record([this, viewport_list](vk::CommandBuffer cmdbuf) {
|
||||||
const bool use_viewport_with_count = device.IsExtExtendedDynamicStateSupported() &&
|
|
||||||
(!pipeline || pipeline->UsesExtendedDynamicState());
|
|
||||||
scheduler.Record([this, viewport_list, use_viewport_with_count](vk::CommandBuffer cmdbuf) {
|
|
||||||
const u32 num_viewports = std::min<u32>(device.GetMaxViewports(), Maxwell::NumViewports);
|
const u32 num_viewports = std::min<u32>(device.GetMaxViewports(), Maxwell::NumViewports);
|
||||||
const vk::Span<VkViewport> viewports(viewport_list.data(), num_viewports);
|
const vk::Span<VkViewport> viewports(viewport_list.data(), num_viewports);
|
||||||
if (use_viewport_with_count) {
|
cmdbuf.SetViewport(0, viewports);
|
||||||
cmdbuf.SetViewportWithCountEXT(viewports);
|
|
||||||
} else {
|
|
||||||
cmdbuf.SetViewport(0, viewports);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1215,16 +1200,8 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
||||||
scissor.offset.y = static_cast<int32_t>(y);
|
scissor.offset.y = static_cast<int32_t>(y);
|
||||||
scissor.extent.width = width;
|
scissor.extent.width = width;
|
||||||
scissor.extent.height = height;
|
scissor.extent.height = height;
|
||||||
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline();
|
scheduler.Record([scissor](vk::CommandBuffer cmdbuf) {
|
||||||
const bool use_scissor_with_count = device.IsExtExtendedDynamicStateSupported() &&
|
cmdbuf.SetScissor(0, scissor);
|
||||||
(!pipeline || pipeline->UsesExtendedDynamicState());
|
|
||||||
scheduler.Record([scissor, use_scissor_with_count](vk::CommandBuffer cmdbuf) {
|
|
||||||
if (use_scissor_with_count) {
|
|
||||||
std::array scissors{scissor};
|
|
||||||
cmdbuf.SetScissorWithCountEXT(scissors);
|
|
||||||
} else {
|
|
||||||
cmdbuf.SetScissor(0, scissor);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1252,17 +1229,10 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
||||||
GetScissorState(regs, 14, up_scale, down_shift),
|
GetScissorState(regs, 14, up_scale, down_shift),
|
||||||
GetScissorState(regs, 15, up_scale, down_shift),
|
GetScissorState(regs, 15, up_scale, down_shift),
|
||||||
};
|
};
|
||||||
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline();
|
scheduler.Record([this, scissor_list](vk::CommandBuffer cmdbuf) {
|
||||||
const bool use_scissor_with_count = device.IsExtExtendedDynamicStateSupported() &&
|
|
||||||
(!pipeline || pipeline->UsesExtendedDynamicState());
|
|
||||||
scheduler.Record([this, scissor_list, use_scissor_with_count](vk::CommandBuffer cmdbuf) {
|
|
||||||
const u32 num_scissors = std::min<u32>(device.GetMaxViewports(), Maxwell::NumViewports);
|
const u32 num_scissors = std::min<u32>(device.GetMaxViewports(), Maxwell::NumViewports);
|
||||||
const vk::Span<VkRect2D> scissors(scissor_list.data(), num_scissors);
|
const vk::Span<VkRect2D> scissors(scissor_list.data(), num_scissors);
|
||||||
if (use_scissor_with_count) {
|
cmdbuf.SetScissor(0, scissors);
|
||||||
cmdbuf.SetScissorWithCountEXT(scissors);
|
|
||||||
} else {
|
|
||||||
cmdbuf.SetScissor(0, scissors);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue