Browse Source

[vulkan] Removed bresenham line mode for driver issues + adjusted LineLoop to LineStrip handling

vkexperiments1
CamilleLaVey 2 days ago
parent
commit
7fe40a37ef
  1. 8
      src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
  2. 2
      src/video_core/renderer_vulkan/vk_query_cache.cpp
  3. 27
      src/video_core/renderer_vulkan/vk_rasterizer.cpp

8
src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp

@ -757,8 +757,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
IsLine(input_assembly_topology) && any_stippled_lines_supported; IsLine(input_assembly_topology) && any_stippled_lines_supported;
const bool supports_rectangular_lines = const bool supports_rectangular_lines =
line_rasterization_supported && device.SupportsRectangularLines(); line_rasterization_supported && device.SupportsRectangularLines();
const bool supports_bresenham_lines =
line_rasterization_supported && device.SupportsBresenhamLines();
const bool supports_smooth_lines = line_rasterization_supported && device.SupportsSmoothLines(); const bool supports_smooth_lines = line_rasterization_supported && device.SupportsSmoothLines();
VkLineRasterizationModeEXT line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT; VkLineRasterizationModeEXT line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
@ -768,14 +766,10 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT; line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
} else if (supports_rectangular_lines) { } else if (supports_rectangular_lines) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} else if (supports_bresenham_lines) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
} }
} else { } else {
if (supports_rectangular_lines) { if (supports_rectangular_lines) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} else if (supports_bresenham_lines) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
} else if (supports_smooth_lines) { } else if (supports_smooth_lines) {
line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT; line_rasterization_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
} }
@ -789,8 +783,6 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
switch (line_rasterization_mode) { switch (line_rasterization_mode) {
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT: case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT:
return device.SupportsStippledRectangularLines(); return device.SupportsStippledRectangularLines();
case VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT:
return device.SupportsStippledBresenhamLines();
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT: case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT:
return device.SupportsStippledSmoothLines(); return device.SupportsStippledSmoothLines();
default: default:

2
src/video_core/renderer_vulkan/vk_query_cache.cpp

@ -1518,7 +1518,7 @@ bool QueryCacheRuntime::HostConditionalRenderingCompareValues(VideoCommon::Looku
if (driver_blocks_pair_resolve || !is_gpu_high) { if (driver_blocks_pair_resolve || !is_gpu_high) {
EndHostConditionalRendering(); EndHostConditionalRendering();
return false;
return true;
} }
if (!is_in_bc[0] && !is_in_bc[1]) { if (!is_in_bc[0] && !is_in_bc[1]) {

27
src/video_core/renderer_vulkan/vk_rasterizer.cpp

@ -237,7 +237,6 @@ bool IsLineRasterizationTopology(const Device& device, Maxwell::PrimitiveTopolog
VkLineRasterizationModeEXT SelectLineRasterizationMode(const Device& device, bool smooth_lines) { VkLineRasterizationModeEXT SelectLineRasterizationMode(const Device& device, bool smooth_lines) {
const bool supports_rectangular_lines = device.SupportsRectangularLines(); const bool supports_rectangular_lines = device.SupportsRectangularLines();
const bool supports_bresenham_lines = device.SupportsBresenhamLines();
const bool supports_smooth_lines = device.SupportsSmoothLines(); const bool supports_smooth_lines = device.SupportsSmoothLines();
if (smooth_lines) { if (smooth_lines) {
@ -247,16 +246,10 @@ VkLineRasterizationModeEXT SelectLineRasterizationMode(const Device& device, boo
if (supports_rectangular_lines) { if (supports_rectangular_lines) {
return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} }
if (supports_bresenham_lines) {
return VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
}
} else { } else {
if (supports_rectangular_lines) { if (supports_rectangular_lines) {
return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} }
if (supports_bresenham_lines) {
return VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
}
if (supports_smooth_lines) { if (supports_smooth_lines) {
return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT; return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
} }
@ -269,8 +262,6 @@ bool SupportsStippleForMode(const Device& device, VkLineRasterizationModeEXT mod
switch (mode) { switch (mode) {
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT: case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT:
return device.SupportsStippledRectangularLines(); return device.SupportsStippledRectangularLines();
case VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT:
return device.SupportsStippledBresenhamLines();
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT: case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT:
return device.SupportsStippledSmoothLines(); return device.SupportsStippledSmoothLines();
default: default:
@ -403,15 +394,9 @@ void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
if (maxwell3d->regs.transform_feedback_enabled != 0) { if (maxwell3d->regs.transform_feedback_enabled != 0) {
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false); query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false);
} }
scheduler.Record([](vk::CommandBuffer cmdbuf) {
cmdbuf.SetPrimitiveTopologyEXT(VK_PRIMITIVE_TOPOLOGY_LINE_LIST);
});
DrawLineLoopClosure(draw_state, draw_params.base_instance, draw_params.num_instances, DrawLineLoopClosure(draw_state, draw_params.base_instance, draw_params.num_instances,
static_cast<s32>(draw_params.base_vertex), static_cast<s32>(draw_params.base_vertex),
draw_params.num_vertices, draw_params.is_indexed); draw_params.num_vertices, draw_params.is_indexed);
scheduler.Record([](vk::CommandBuffer cmdbuf) {
cmdbuf.SetPrimitiveTopologyEXT(VK_PRIMITIVE_TOPOLOGY_LINE_STRIP);
});
} }
}); });
} }
@ -590,9 +575,6 @@ void RasterizerVulkan::DrawIndirectLineLoopClosures(
if (maxwell3d->regs.transform_feedback_enabled != 0) { if (maxwell3d->regs.transform_feedback_enabled != 0) {
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false); query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false);
} }
scheduler.Record([](vk::CommandBuffer cmdbuf) {
cmdbuf.SetPrimitiveTopologyEXT(VK_PRIMITIVE_TOPOLOGY_LINE_LIST);
});
emitted_closure = true; emitted_closure = true;
} }
@ -622,9 +604,6 @@ void RasterizerVulkan::DrawIndirectLineLoopClosures(
if (maxwell3d->regs.transform_feedback_enabled != 0) { if (maxwell3d->regs.transform_feedback_enabled != 0) {
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false); query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount, false);
} }
scheduler.Record([](vk::CommandBuffer cmdbuf) {
cmdbuf.SetPrimitiveTopologyEXT(VK_PRIMITIVE_TOPOLOGY_LINE_LIST);
});
emitted_closure = true; emitted_closure = true;
} }
DrawLineLoopClosure(draw_state, command.firstInstance, command.instanceCount, DrawLineLoopClosure(draw_state, command.firstInstance, command.instanceCount,
@ -632,12 +611,6 @@ void RasterizerVulkan::DrawIndirectLineLoopClosures(
false); false);
} }
} }
if (emitted_closure) {
scheduler.Record([](vk::CommandBuffer cmdbuf) {
cmdbuf.SetPrimitiveTopologyEXT(VK_PRIMITIVE_TOPOLOGY_LINE_STRIP);
});
}
} }
void RasterizerVulkan::DrawTexture() { void RasterizerVulkan::DrawTexture() {

Loading…
Cancel
Save