From 98570a402a87ebf4f87206c034b48cd162d8398b Mon Sep 17 00:00:00 2001 From: "specialfred453@gmail.com" Date: Thu, 9 Jan 2025 20:58:25 -0500 Subject: [PATCH 1/2] Implemented Line Width Scaling in Vulkan (not working at the moment) --- hw/xbox/nv2a/pgraph/vk/display.c | 5 +++-- hw/xbox/nv2a/pgraph/vk/draw.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/xbox/nv2a/pgraph/vk/display.c b/hw/xbox/nv2a/pgraph/vk/display.c index e1993d41867..1b10f5ff004 100644 --- a/hw/xbox/nv2a/pgraph/vk/display.c +++ b/hw/xbox/nv2a/pgraph/vk/display.c @@ -413,7 +413,7 @@ static void create_display_pipeline(PGRAPHState *pg) .depthClampEnable = VK_FALSE, .rasterizerDiscardEnable = VK_FALSE, .polygonMode = VK_POLYGON_MODE_FILL, - .lineWidth = 1.0f, + .lineWidth = (float)pg->surface_scale_factor, .cullMode = VK_CULL_MODE_BACK_BIT, .frontFace = VK_FRONT_FACE_CLOCKWISE, .depthBiasEnable = VK_FALSE, @@ -447,7 +447,8 @@ static void create_display_pipeline(PGRAPHState *pg) }; VkDynamicState dynamic_states[] = { VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR }; + VK_DYNAMIC_STATE_SCISSOR, + VK_DYNAMIC_STATE_LINE_WIDTH }; VkPipelineDynamicStateCreateInfo dynamic_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, .dynamicStateCount = 2, diff --git a/hw/xbox/nv2a/pgraph/vk/draw.c b/hw/xbox/nv2a/pgraph/vk/draw.c index 4cde028b1f4..dba37eb0d16 100644 --- a/hw/xbox/nv2a/pgraph/vk/draw.c +++ b/hw/xbox/nv2a/pgraph/vk/draw.c @@ -500,7 +500,7 @@ static void create_clear_pipeline(PGRAPHState *pg) .depthClampEnable = VK_FALSE, .rasterizerDiscardEnable = VK_FALSE, .polygonMode = VK_POLYGON_MODE_FILL, - .lineWidth = 1.0f, + .lineWidth = (float)pg->surface_scale_factor, .cullMode = VK_CULL_MODE_BACK_BIT, .frontFace = VK_FRONT_FACE_CLOCKWISE, .depthBiasEnable = VK_FALSE, @@ -820,7 +820,7 @@ static void create_pipeline(PGRAPHState *pg) .rasterizerDiscardEnable = VK_FALSE, .polygonMode = pgraph_polygon_mode_vk_map[r->shader_binding->state .polygon_front_mode], - .lineWidth = 1.0f, + .lineWidth = (float)pg->surface_scale_factor, .frontFace = (pgraph_reg_r(pg, NV_PGRAPH_SETUPRASTER) & NV_PGRAPH_SETUPRASTER_FRONTFACE) ? VK_FRONT_FACE_COUNTER_CLOCKWISE : @@ -949,8 +949,9 @@ static void create_pipeline(PGRAPHState *pg) .blendConstants[3] = blend_constant[3], }; - VkDynamicState dynamic_states[2] = { VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR }; + VkDynamicState dynamic_states[] = { VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_SCISSOR, + VK_DYNAMIC_STATE_LINE_WIDTH }; VkPipelineDynamicStateCreateInfo dynamic_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, From cf40733206dba1b3a1446c98d4e15ce7ee202ba9 Mon Sep 17 00:00:00 2001 From: "specialfred453@gmail.com" Date: Wed, 15 Jan 2025 07:42:43 -0500 Subject: [PATCH 2/2] Fixed it by removing the VK_DYNAMIC_STATE_LINE_WIDTH dynamic state --- hw/xbox/nv2a/pgraph/vk/display.c | 3 +-- hw/xbox/nv2a/pgraph/vk/draw.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/xbox/nv2a/pgraph/vk/display.c b/hw/xbox/nv2a/pgraph/vk/display.c index 1b10f5ff004..0314eced674 100644 --- a/hw/xbox/nv2a/pgraph/vk/display.c +++ b/hw/xbox/nv2a/pgraph/vk/display.c @@ -447,8 +447,7 @@ static void create_display_pipeline(PGRAPHState *pg) }; VkDynamicState dynamic_states[] = { VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR, - VK_DYNAMIC_STATE_LINE_WIDTH }; + VK_DYNAMIC_STATE_SCISSOR }; VkPipelineDynamicStateCreateInfo dynamic_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, .dynamicStateCount = 2, diff --git a/hw/xbox/nv2a/pgraph/vk/draw.c b/hw/xbox/nv2a/pgraph/vk/draw.c index dba37eb0d16..b5d9a09881a 100644 --- a/hw/xbox/nv2a/pgraph/vk/draw.c +++ b/hw/xbox/nv2a/pgraph/vk/draw.c @@ -950,8 +950,7 @@ static void create_pipeline(PGRAPHState *pg) }; VkDynamicState dynamic_states[] = { VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR, - VK_DYNAMIC_STATE_LINE_WIDTH }; + VK_DYNAMIC_STATE_SCISSOR }; VkPipelineDynamicStateCreateInfo dynamic_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,