This commit is contained in:
Fred Hallock 2025-04-17 10:51:30 +02:00 committed by GitHub
commit e0cfb0e4b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 5 deletions

View File

@ -809,6 +809,14 @@ static void create_pipeline(PGRAPHState *pg)
} else {
// 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,
@ -816,7 +824,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 = lineWidth,
.frontFace = (pgraph_reg_r(pg, NV_PGRAPH_SETUPRASTER) &
NV_PGRAPH_SETUPRASTER_FRONTFACE) ?
VK_FRONT_FACE_COUNTER_CLOCKWISE :
@ -946,7 +954,7 @@ static void create_pipeline(PGRAPHState *pg)
};
VkDynamicState dynamic_states[2] = { VK_DYNAMIC_STATE_VIEWPORT,
VK_DYNAMIC_STATE_SCISSOR };
VK_DYNAMIC_STATE_SCISSOR };
VkPipelineDynamicStateCreateInfo dynamic_state = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO,

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

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

@ -0,0 +1 @@
Subproject commit 0f1b62c2b3d0898cbab7aa685c2593303ffdc1a2