diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index deef9876814..b36e9826b16 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -21,3 +21,4 @@ VK_KHR_maintenance9 on panvk VK_AMD_buffer_marker on NVK VK_EXT_ycbcr_2plane_444_formats on radv Removed VDPAU frontend +GL_NV_representative_fragment_test on zink diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index d75d5567346..5073282dbdd 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -593,6 +593,11 @@ zink_start_batch(struct zink_context *ctx) VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->bs->reordered_cmdbuf, 0); VKCTX(CmdSetAttachmentFeedbackLoopEnableEXT)(ctx->bs->unsynchronized_cmdbuf, 0); } + if (screen->info.dynamic_state3_feats.extendedDynamicState3RepresentativeFragmentTestEnable) { + VKCTX(CmdSetRepresentativeFragmentTestEnableNV)(ctx->bs->cmdbuf, 0); + VKCTX(CmdSetRepresentativeFragmentTestEnableNV)(ctx->bs->reordered_cmdbuf, 0); + VKCTX(CmdSetRepresentativeFragmentTestEnableNV)(ctx->bs->unsynchronized_cmdbuf, 0); + } } /* common operations to run post submit; split out for clarity */ diff --git a/src/gallium/drivers/zink/zink_device_info.py b/src/gallium/drivers/zink/zink_device_info.py index fd768b3a623..5533c8cf1c2 100644 --- a/src/gallium/drivers/zink/zink_device_info.py +++ b/src/gallium/drivers/zink/zink_device_info.py @@ -196,6 +196,7 @@ EXTENSIONS = [ features=True, conditions=["$feats.vertexAttributeInstanceRateDivisor"]), Extension("VK_EXT_calibrated_timestamps"), + Extension("VK_NV_representative_fragment_test"), Extension("VK_NV_linear_color_attachment", alias="linear_color", features=True), diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index d7af77109c6..199e3c7d67f 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -264,6 +264,8 @@ zink_create_gfx_pipeline(struct zink_screen *screen, } } } + if (screen->info.dynamic_state3_feats.extendedDynamicState3RepresentativeFragmentTestEnable) + dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV; } if (screen->info.have_EXT_color_write_enable) dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT; @@ -754,6 +756,8 @@ create_gfx_pipeline_library(struct zink_screen *screen, struct zink_shader_objec dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT; if (!screen->driver_workarounds.no_linestipple) dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_LINE_STIPPLE_EXT; + if (screen->info.dynamic_state3_feats.extendedDynamicState3RepresentativeFragmentTestEnable) + dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV; assert(state_count < ARRAY_SIZE(dynamicStateEnables)); VkPipelineDynamicStateCreateInfo pipelineDynamicStateCreateInfo = {0}; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 8c1ff88fe68..f3c82a7216f 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -778,6 +778,7 @@ zink_init_screen_caps(struct zink_screen *screen) caps->allow_glthread_buffer_subdata_opt = true; caps->nir_samplers_as_deref = true; caps->call_finalize_nir_in_linker = true; + caps->representative_fragment_test = screen->info.dynamic_state3_feats.extendedDynamicState3RepresentativeFragmentTestEnable; caps->draw_vertex_state = screen->info.have_EXT_vertex_input_dynamic_state; diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c index 2f2d6950ec2..db896e10eb3 100644 --- a/src/gallium/drivers/zink/zink_state.c +++ b/src/gallium/drivers/zink/zink_state.c @@ -683,6 +683,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso) bool clip_halfz = ctx->rast_state ? ctx->rast_state->hw_state.clip_halfz : false; bool rasterizer_discard = ctx->rast_state ? ctx->rast_state->base.rasterizer_discard : false; bool half_pixel_center = ctx->rast_state ? ctx->rast_state->base.half_pixel_center : true; + bool representative_fragment_test = ctx->rast_state ? ctx->rast_state->base.representative_fragment_test : false; float line_width = ctx->rast_state ? ctx->rast_state->base.line_width : 1.0; ctx->rast_state = cso; @@ -731,6 +732,9 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso) #undef STATE_CHECK } + if (representative_fragment_test != ctx->rast_state->base.representative_fragment_test) + VKCTX(CmdSetRepresentativeFragmentTestEnableNV)(ctx->bs->cmdbuf, ctx->rast_state->base.representative_fragment_test); + if (fabs(ctx->rast_state->base.line_width - line_width) > FLT_EPSILON) ctx->line_width_changed = true;