mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 03:35:46 +00:00
[vk] reorganize and properly categorize stipple and conraster
Signed-off-by: crueter <crueter@crueter.xyz>
This commit is contained in:
parent
124858eda2
commit
82c84df204
5 changed files with 23 additions and 11 deletions
|
@ -806,12 +806,12 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
|||
.pAttachments = cb_attachments.data(),
|
||||
.blendConstants = {}
|
||||
};
|
||||
static_vector<VkDynamicState, 38> dynamic_states{
|
||||
static_vector<VkDynamicState, 34> dynamic_states{
|
||||
VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR,
|
||||
VK_DYNAMIC_STATE_DEPTH_BIAS, VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
||||
VK_DYNAMIC_STATE_DEPTH_BOUNDS, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK,
|
||||
VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, VK_DYNAMIC_STATE_STENCIL_REFERENCE,
|
||||
VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_LINE_STIPPLE,
|
||||
VK_DYNAMIC_STATE_LINE_WIDTH,
|
||||
};
|
||||
if (key.state.extended_dynamic_state) {
|
||||
static constexpr std::array extended{
|
||||
|
|
|
@ -935,7 +935,8 @@ void RasterizerVulkan::UpdateDynamicStates() {
|
|||
UpdateDepthBounds(regs);
|
||||
UpdateStencilFaces(regs);
|
||||
UpdateLineWidth(regs);
|
||||
// UpdateLineStipple(regs); // TODO
|
||||
// TODO: updating line stipple causes the cmdbuf to die
|
||||
// UpdateLineStipple(regs);
|
||||
|
||||
const u8 dynamic_state = Settings::values.dyna_state.GetValue();
|
||||
|
||||
|
@ -1353,7 +1354,7 @@ void RasterizerVulkan::UpdateConservativeRasterizationMode(Tegra::Engines::Maxwe
|
|||
|
||||
scheduler.Record([enable = regs.conservative_raster_enable](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.SetConservativeRasterizationModeEXT(
|
||||
enable ? VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT
|
||||
enable ? VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT
|
||||
: VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT);
|
||||
});
|
||||
}
|
||||
|
@ -1371,12 +1372,12 @@ void RasterizerVulkan::UpdateLineStippleEnable(Tegra::Engines::Maxwell3D::Regs&
|
|||
|
||||
void RasterizerVulkan::UpdateLineStipple(Tegra::Engines::Maxwell3D::Regs& regs)
|
||||
{
|
||||
if (!state_tracker.TouchLineStippleEnable()) {
|
||||
if (!state_tracker.TouchLineStipple()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scheduler.Record([params = regs.line_stipple_params](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.SetLineStippleEXT(params.factor, u16(params.pattern));
|
||||
cmdbuf.SetLineStippleEXT(params.factor, static_cast<uint16_t>(params.pattern));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ private:
|
|||
TypedCommand& operator=(TypedCommand&&) = delete;
|
||||
|
||||
void Execute(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf) const override {
|
||||
|
||||
command(cmdbuf, upload_cmdbuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ Flags MakeInvalidationFlags() {
|
|||
VertexInput,
|
||||
StateEnable,
|
||||
PrimitiveRestartEnable,
|
||||
LineStippleParams,
|
||||
DepthBiasEnable,
|
||||
LogicOpEnable,
|
||||
DepthClampEnable,
|
||||
|
@ -61,6 +60,9 @@ Flags MakeInvalidationFlags() {
|
|||
ColorMask,
|
||||
BlendEquations,
|
||||
BlendEnable,
|
||||
ConservativeRasterizationMode,
|
||||
LineStippleEnable,
|
||||
LineStippleParams,
|
||||
};
|
||||
Flags flags{};
|
||||
for (const int flag : INVALIDATION_FLAGS) {
|
||||
|
@ -140,14 +142,12 @@ void SetupDirtyStateEnable(Tables& tables) {
|
|||
setup(OFF(stencil_enable), StencilTestEnable);
|
||||
setup(OFF(primitive_restart.enabled), PrimitiveRestartEnable);
|
||||
setup(OFF(rasterize_enable), RasterizerDiscardEnable);
|
||||
setup(OFF(conservative_raster_enable), ConservativeRasterizationMode);
|
||||
setup(OFF(line_stipple_enable), LineStippleEnable);
|
||||
setup(OFF(line_stipple_params), LineStippleParams);
|
||||
setup(OFF(polygon_offset_point_enable), DepthBiasEnable);
|
||||
setup(OFF(polygon_offset_line_enable), DepthBiasEnable);
|
||||
setup(OFF(polygon_offset_fill_enable), DepthBiasEnable);
|
||||
setup(OFF(logic_op.enable), LogicOpEnable);
|
||||
setup(OFF(viewport_clip_control.geometry_clip), DepthClampEnable);
|
||||
setup(OFF(line_stipple_enable), LineStippleEnable);
|
||||
}
|
||||
|
||||
void SetupDirtyDepthCompareOp(Tables& tables) {
|
||||
|
@ -220,6 +220,13 @@ void SetupDirtyVertexBindings(Tables& tables) {
|
|||
tables[1][OFF(vertex_streams) + i * NUM(vertex_streams[0]) + divisor_offset] = flag;
|
||||
}
|
||||
}
|
||||
|
||||
void SetupRasterModes(Tables &tables) {
|
||||
auto& table = tables[0];
|
||||
|
||||
table[OFF(line_stipple_params)] = LineStippleParams;
|
||||
table[OFF(conservative_raster_enable)] = ConservativeRasterizationMode;
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
void StateTracker::SetupTables(Tegra::Control::ChannelState& channel_state) {
|
||||
|
@ -242,6 +249,7 @@ void StateTracker::SetupTables(Tegra::Control::ChannelState& channel_state) {
|
|||
SetupDirtyVertexAttributes(tables);
|
||||
SetupDirtyVertexBindings(tables);
|
||||
SetupDirtySpecialOps(tables);
|
||||
SetupRasterModes(tables);
|
||||
}
|
||||
|
||||
void StateTracker::ChangeChannel(Tegra::Control::ChannelState& channel_state) {
|
||||
|
|
|
@ -211,7 +211,9 @@ public:
|
|||
return Exchange(Dirty::ConservativeRasterizationMode, false);
|
||||
}
|
||||
|
||||
bool TouchLineStippleEnable() { return Exchange(Dirty::ConservativeRasterizationMode, false); }
|
||||
bool TouchLineStippleEnable() { return Exchange(Dirty::LineStippleEnable, false); }
|
||||
|
||||
bool TouchLineStipple() { return Exchange(Dirty::LineStippleParams, false); }
|
||||
|
||||
bool TouchDepthBiasEnable() { return Exchange(Dirty::DepthBiasEnable, false); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue