|
|
@ -277,8 +277,9 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) { |
|
|
if (!pipeline->Configure(is_indexed)) |
|
|
if (!pipeline->Configure(is_indexed)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
if (pipeline->UsesExtendedDynamicState()) { |
|
|
|
|
|
state_tracker.InvalidateStateEnableFlag(); |
|
|
|
|
|
|
|
|
if (pipeline->UsesExtendedDynamicState() || pipeline->UsesExtendedDynamicState2() || |
|
|
|
|
|
pipeline->UsesExtendedDynamicState2LogicOp()) { |
|
|
|
|
|
state_tracker.InvalidateExtendedDynamicStates(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
HandleTransformFeedback(); |
|
|
HandleTransformFeedback(); |
|
|
@ -1078,16 +1079,18 @@ void RasterizerVulkan::UpdateDynamicStates() { |
|
|
UpdateLineWidth(regs); |
|
|
UpdateLineWidth(regs); |
|
|
UpdateLineStipple(regs); |
|
|
UpdateLineStipple(regs); |
|
|
|
|
|
|
|
|
// EDS1: DepthCompare, StencilOp, DepthBoundsTest, DepthTest, DepthWrite, StencilTest
|
|
|
|
|
|
|
|
|
// EDS1: CullMode, DepthCompare, FrontFace, PrimitiveTopology, StencilOp,
|
|
|
|
|
|
// DepthBoundsTest, DepthTest, DepthWrite, StencilTest
|
|
|
if (device.IsExtExtendedDynamicStateSupported() && pipeline && pipeline->UsesExtendedDynamicState()) { |
|
|
if (device.IsExtExtendedDynamicStateSupported() && pipeline && pipeline->UsesExtendedDynamicState()) { |
|
|
|
|
|
UpdateCullMode(regs); |
|
|
UpdateDepthCompareOp(regs); |
|
|
UpdateDepthCompareOp(regs); |
|
|
|
|
|
UpdateFrontFace(regs); |
|
|
|
|
|
UpdatePrimitiveTopology(regs); |
|
|
UpdateStencilOp(regs); |
|
|
UpdateStencilOp(regs); |
|
|
if (state_tracker.TouchStateEnable()) { |
|
|
|
|
|
UpdateDepthBoundsTestEnable(regs); |
|
|
|
|
|
UpdateDepthTestEnable(regs); |
|
|
|
|
|
UpdateDepthWriteEnable(regs); |
|
|
|
|
|
UpdateStencilTestEnable(regs); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
UpdateDepthBoundsTestEnable(regs); |
|
|
|
|
|
UpdateDepthTestEnable(regs); |
|
|
|
|
|
UpdateDepthWriteEnable(regs); |
|
|
|
|
|
UpdateStencilTestEnable(regs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
UpdateStencilFaces(regs); |
|
|
UpdateStencilFaces(regs); |
|
|
@ -1157,8 +1160,16 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg |
|
|
.minDepth = 0.0f, |
|
|
.minDepth = 0.0f, |
|
|
.maxDepth = 1.0f, |
|
|
.maxDepth = 1.0f, |
|
|
}; |
|
|
}; |
|
|
scheduler.Record([viewport](vk::CommandBuffer cmdbuf) { |
|
|
|
|
|
cmdbuf.SetViewport(0, viewport); |
|
|
|
|
|
|
|
|
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline(); |
|
|
|
|
|
const bool use_viewport_with_count = device.IsExtExtendedDynamicStateSupported() && |
|
|
|
|
|
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; |
|
|
} |
|
|
} |
|
|
@ -1174,10 +1185,17 @@ 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), |
|
|
}; |
|
|
}; |
|
|
scheduler.Record([this, viewport_list](vk::CommandBuffer cmdbuf) { |
|
|
|
|
|
|
|
|
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline(); |
|
|
|
|
|
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); |
|
|
cmdbuf.SetViewport(0, viewports); |
|
|
|
|
|
|
|
|
if (use_viewport_with_count) { |
|
|
|
|
|
cmdbuf.SetViewportWithCountEXT(viewports); |
|
|
|
|
|
} else { |
|
|
|
|
|
cmdbuf.SetViewport(0, viewports); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1198,8 +1216,16 @@ 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; |
|
|
scheduler.Record([scissor](vk::CommandBuffer cmdbuf) { |
|
|
|
|
|
cmdbuf.SetScissor(0, scissor); |
|
|
|
|
|
|
|
|
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline(); |
|
|
|
|
|
const bool use_scissor_with_count = device.IsExtExtendedDynamicStateSupported() && |
|
|
|
|
|
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; |
|
|
} |
|
|
} |
|
|
@ -1227,10 +1253,17 @@ 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), |
|
|
}; |
|
|
}; |
|
|
scheduler.Record([this, scissor_list](vk::CommandBuffer cmdbuf) { |
|
|
|
|
|
|
|
|
GraphicsPipeline* pipeline = pipeline_cache.CurrentGraphicsPipeline(); |
|
|
|
|
|
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); |
|
|
cmdbuf.SetScissor(0, scissors); |
|
|
|
|
|
|
|
|
if (use_scissor_with_count) { |
|
|
|
|
|
cmdbuf.SetScissorWithCountEXT(scissors); |
|
|
|
|
|
} else { |
|
|
|
|
|
cmdbuf.SetScissor(0, scissors); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|