mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 02:24:38 +00:00
renderer_vulkan: Handle line width
This commit is contained in:
parent
20ab2cabc9
commit
d487ccc93c
@ -304,6 +304,14 @@ struct Liverpool {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct LineControl {
|
||||||
|
u32 width_fixed_point;
|
||||||
|
|
||||||
|
float Width() const {
|
||||||
|
return static_cast<float>(width_fixed_point) / 8.0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct ModeControl {
|
struct ModeControl {
|
||||||
s32 msaa_enable : 1;
|
s32 msaa_enable : 1;
|
||||||
s32 vport_scissor_enable : 1;
|
s32 vport_scissor_enable : 1;
|
||||||
@ -1387,7 +1395,9 @@ struct Liverpool {
|
|||||||
PolygonControl polygon_control;
|
PolygonControl polygon_control;
|
||||||
ViewportControl viewport_control;
|
ViewportControl viewport_control;
|
||||||
VsOutputControl vs_output_control;
|
VsOutputControl vs_output_control;
|
||||||
INSERT_PADDING_WORDS(0xA287 - 0xA207 - 1);
|
INSERT_PADDING_WORDS(0xA287 - 0xA207 - 7);
|
||||||
|
LineControl line_control;
|
||||||
|
INSERT_PADDING_WORDS(5);
|
||||||
HsTessFactorClamp hs_clamp;
|
HsTessFactorClamp hs_clamp;
|
||||||
INSERT_PADDING_WORDS(0xA290 - 0xA287 - 2);
|
INSERT_PADDING_WORDS(0xA290 - 0xA287 - 2);
|
||||||
GsMode vgt_gs_mode;
|
GsMode vgt_gs_mode;
|
||||||
|
@ -123,7 +123,8 @@ GraphicsPipeline::GraphicsPipeline(
|
|||||||
},
|
},
|
||||||
vk::PipelineRasterizationDepthClipStateCreateInfoEXT{
|
vk::PipelineRasterizationDepthClipStateCreateInfoEXT{
|
||||||
.depthClipEnable = key.depth_clip_enable,
|
.depthClipEnable = key.depth_clip_enable,
|
||||||
}};
|
},
|
||||||
|
};
|
||||||
|
|
||||||
if (!instance.IsProvokingVertexSupported()) {
|
if (!instance.IsProvokingVertexSupported()) {
|
||||||
raster_chain.unlink<vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT>();
|
raster_chain.unlink<vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT>();
|
||||||
@ -172,6 +173,7 @@ GraphicsPipeline::GraphicsPipeline(
|
|||||||
vk::DynamicState::eStencilCompareMask, vk::DynamicState::eStencilWriteMask,
|
vk::DynamicState::eStencilCompareMask, vk::DynamicState::eStencilWriteMask,
|
||||||
vk::DynamicState::eStencilOp, vk::DynamicState::eCullMode,
|
vk::DynamicState::eStencilOp, vk::DynamicState::eCullMode,
|
||||||
vk::DynamicState::eFrontFace, vk::DynamicState::eRasterizerDiscardEnable,
|
vk::DynamicState::eFrontFace, vk::DynamicState::eRasterizerDiscardEnable,
|
||||||
|
vk::DynamicState::eLineWidth,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (instance.IsPrimitiveRestartDisableSupported()) {
|
if (instance.IsPrimitiveRestartDisableSupported()) {
|
||||||
|
@ -369,6 +369,7 @@ bool Instance::CreateDevice() {
|
|||||||
.depthBiasClamp = features.depthBiasClamp,
|
.depthBiasClamp = features.depthBiasClamp,
|
||||||
.fillModeNonSolid = features.fillModeNonSolid,
|
.fillModeNonSolid = features.fillModeNonSolid,
|
||||||
.depthBounds = features.depthBounds,
|
.depthBounds = features.depthBounds,
|
||||||
|
.wideLines = features.wideLines,
|
||||||
.multiViewport = features.multiViewport,
|
.multiViewport = features.multiViewport,
|
||||||
.samplerAnisotropy = features.samplerAnisotropy,
|
.samplerAnisotropy = features.samplerAnisotropy,
|
||||||
.vertexPipelineStoresAndAtomics = features.vertexPipelineStoresAndAtomics,
|
.vertexPipelineStoresAndAtomics = features.vertexPipelineStoresAndAtomics,
|
||||||
|
@ -1014,6 +1014,7 @@ void Rasterizer::UpdateDynamicState(const GraphicsPipeline& pipeline) const {
|
|||||||
UpdateViewportScissorState();
|
UpdateViewportScissorState();
|
||||||
UpdateDepthStencilState();
|
UpdateDepthStencilState();
|
||||||
UpdatePrimitiveState();
|
UpdatePrimitiveState();
|
||||||
|
UpdateRasterizationState();
|
||||||
|
|
||||||
auto& dynamic_state = scheduler.GetDynamicState();
|
auto& dynamic_state = scheduler.GetDynamicState();
|
||||||
dynamic_state.SetBlendConstants(liverpool->regs.blend_constants);
|
dynamic_state.SetBlendConstants(liverpool->regs.blend_constants);
|
||||||
@ -1230,6 +1231,12 @@ void Rasterizer::UpdatePrimitiveState() const {
|
|||||||
dynamic_state.SetFrontFace(front_face);
|
dynamic_state.SetFrontFace(front_face);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Rasterizer::UpdateRasterizationState() const {
|
||||||
|
const auto& regs = liverpool->regs;
|
||||||
|
auto& dynamic_state = scheduler.GetDynamicState();
|
||||||
|
dynamic_state.SetLineWidth(regs.line_control.Width());
|
||||||
|
}
|
||||||
|
|
||||||
void Rasterizer::ScopeMarkerBegin(const std::string_view& str, bool from_guest) {
|
void Rasterizer::ScopeMarkerBegin(const std::string_view& str, bool from_guest) {
|
||||||
if ((from_guest && !Config::getVkGuestMarkersEnabled()) ||
|
if ((from_guest && !Config::getVkGuestMarkersEnabled()) ||
|
||||||
(!from_guest && !Config::getVkHostMarkersEnabled())) {
|
(!from_guest && !Config::getVkHostMarkersEnabled())) {
|
||||||
|
@ -94,6 +94,7 @@ private:
|
|||||||
void UpdateViewportScissorState() const;
|
void UpdateViewportScissorState() const;
|
||||||
void UpdateDepthStencilState() const;
|
void UpdateDepthStencilState() const;
|
||||||
void UpdatePrimitiveState() const;
|
void UpdatePrimitiveState() const;
|
||||||
|
void UpdateRasterizationState() const;
|
||||||
|
|
||||||
bool FilterDraw();
|
bool FilterDraw();
|
||||||
|
|
||||||
|
@ -330,6 +330,10 @@ void DynamicState::Commit(const Instance& instance, const vk::CommandBuffer& cmd
|
|||||||
cmdbuf.setColorWriteMaskEXT(0, color_write_masks);
|
cmdbuf.setColorWriteMaskEXT(0, color_write_masks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (dirty_state.line_width) {
|
||||||
|
dirty_state.line_width = false;
|
||||||
|
cmdbuf.setLineWidth(line_width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
@ -102,6 +102,7 @@ struct DynamicState {
|
|||||||
|
|
||||||
bool blend_constants : 1;
|
bool blend_constants : 1;
|
||||||
bool color_write_masks : 1;
|
bool color_write_masks : 1;
|
||||||
|
bool line_width : 1;
|
||||||
} dirty_state{};
|
} dirty_state{};
|
||||||
|
|
||||||
Viewports viewports{};
|
Viewports viewports{};
|
||||||
@ -137,6 +138,7 @@ struct DynamicState {
|
|||||||
|
|
||||||
std::array<float, 4> blend_constants{};
|
std::array<float, 4> blend_constants{};
|
||||||
ColorWriteMasks color_write_masks{};
|
ColorWriteMasks color_write_masks{};
|
||||||
|
float line_width{};
|
||||||
|
|
||||||
/// Commits the dynamic state to the provided command buffer.
|
/// Commits the dynamic state to the provided command buffer.
|
||||||
void Commit(const Instance& instance, const vk::CommandBuffer& cmdbuf);
|
void Commit(const Instance& instance, const vk::CommandBuffer& cmdbuf);
|
||||||
@ -305,6 +307,13 @@ struct DynamicState {
|
|||||||
dirty_state.color_write_masks = true;
|
dirty_state.color_write_masks = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetLineWidth(const float width) {
|
||||||
|
if (line_width != width) {
|
||||||
|
line_width = width;
|
||||||
|
dirty_state.line_width = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Scheduler {
|
class Scheduler {
|
||||||
|
Loading…
Reference in New Issue
Block a user