nv2a/vk: Scale line width by surface scale

This commit is contained in:
specialfred453@gmail.com 2025-01-09 20:58:25 -05:00 committed by mborgerson
parent 348b03d6ce
commit d8afb35c40
3 changed files with 13 additions and 4 deletions

View File

@ -810,13 +810,21 @@ static void create_pipeline(PGRAPHState *pg)
// FIXME: Handle in shader?
}
float lineWidth = 1.0f;
if(r->physical_device_features.wideLines == VK_TRUE)
{
lineWidth = MIN(r->device_props.limits.lineWidthRange[1],
MAX(r->device_props.limits.lineWidthRange[0],
(float)pg->surface_scale_factor));
}
VkPipelineRasterizationStateCreateInfo rasterizer = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO,
.depthClampEnable = VK_TRUE,
.rasterizerDiscardEnable = VK_FALSE,
.polygonMode = pgraph_polygon_mode_vk_map[r->shader_binding->state
.polygon_front_mode],
.lineWidth = 1.0f,
.lineWidth = lineWidth,
.frontFace = (pgraph_reg_r(pg, NV_PGRAPH_SETUPRASTER) &
NV_PGRAPH_SETUPRASTER_FRONTFACE) ?
VK_FRONT_FACE_COUNTER_CLOCKWISE :

View File

@ -523,15 +523,15 @@ static bool create_logical_device(PGRAPHState *pg, Error **errp)
};
// Ensure device supports required features
VkPhysicalDeviceFeatures available_features, enabled_features;
vkGetPhysicalDeviceFeatures(r->physical_device, &available_features);
VkPhysicalDeviceFeatures enabled_features;
vkGetPhysicalDeviceFeatures(r->physical_device, &r->physical_device_features);
memset(&enabled_features, 0, sizeof(enabled_features));
struct {
const char *name;
VkBool32 available, *enabled;
} required_features[] = {
#define F(n) { #n, available_features.n, &enabled_features.n }
#define F(n) { #n, r->physical_device_features.n, &enabled_features.n }
F(shaderClipDistance),
F(geometryShader),
F(shaderTessellationAndGeometryPointSize),

View File

@ -334,6 +334,7 @@ typedef struct PGRAPHVkState {
bool memory_budget_extension_enabled;
VkPhysicalDevice physical_device;
VkPhysicalDeviceFeatures physical_device_features;
VkPhysicalDeviceProperties device_props;
VkDevice device;
VmaAllocator allocator;