mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 00:40:25 +01:00
nvk: Enable dynamic clip/clamp enable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25356>
This commit is contained in:
parent
07091f0f94
commit
d7f3fdc262
3 changed files with 34 additions and 32 deletions
|
|
@ -1115,7 +1115,7 @@ vk_to_nv9097_provoking_vertex(VkProvokingVertexModeEXT vk_mode)
|
|||
static void
|
||||
nvk_flush_rs_state(struct nvk_cmd_buffer *cmd)
|
||||
{
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, 34);
|
||||
struct nv_push *p = nvk_cmd_buffer_push(cmd, 36);
|
||||
|
||||
const struct vk_dynamic_graphics_state *dyn =
|
||||
&cmd->vk.dynamic_graphics_state;
|
||||
|
|
@ -1123,6 +1123,35 @@ nvk_flush_rs_state(struct nvk_cmd_buffer *cmd)
|
|||
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_RASTERIZER_DISCARD_ENABLE))
|
||||
P_IMMD(p, NV9097, SET_RASTER_ENABLE, !dyn->rs.rasterizer_discard_enable);
|
||||
|
||||
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_CLIP_ENABLE) ||
|
||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_CLAMP_ENABLE)) {
|
||||
const bool z_clamp = dyn->rs.depth_clamp_enable;
|
||||
const bool z_clip = vk_rasterization_state_depth_clip_enable(&dyn->rs);
|
||||
P_IMMD(p, NVC397, SET_VIEWPORT_CLIP_CONTROL, {
|
||||
/* TODO: Fix pre-Volta
|
||||
*
|
||||
* This probably involves a few macros, one which stases viewport
|
||||
* min/maxDepth in scratch states and one which goes here and
|
||||
* emits either min/maxDepth or -/+INF as needed.
|
||||
*/
|
||||
.min_z_zero_max_z_one = MIN_Z_ZERO_MAX_Z_ONE_FALSE,
|
||||
.z_clip_range = nvk_cmd_buffer_3d_cls(cmd) >= VOLTA_A
|
||||
? ((z_clamp || z_clip)
|
||||
? Z_CLIP_RANGE_MIN_Z_MAX_Z
|
||||
:Z_CLIP_RANGE_MINUS_INF_PLUS_INF)
|
||||
: Z_CLIP_RANGE_USE_FIELD_MIN_Z_ZERO_MAX_Z_ONE,
|
||||
|
||||
.pixel_min_z = z_clip ? PIXEL_MIN_Z_CLIP : PIXEL_MIN_Z_CLAMP,
|
||||
.pixel_max_z = z_clip ? PIXEL_MAX_Z_CLIP : PIXEL_MAX_Z_CLAMP,
|
||||
|
||||
.geometry_guardband = GEOMETRY_GUARDBAND_SCALE_256,
|
||||
.line_point_cull_guardband = LINE_POINT_CULL_GUARDBAND_SCALE_256,
|
||||
.geometry_clip = z_clip ? GEOMETRY_CLIP_FRUSTUM_XYZ_CLIP :
|
||||
GEOMETRY_CLIP_FRUSTUM_XY_CLIP,
|
||||
.geometry_guardband_z = GEOMETRY_GUARDBAND_Z_SCALE_256,
|
||||
});
|
||||
}
|
||||
|
||||
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_POLYGON_MODE)) {
|
||||
uint32_t polygon_mode = vk_to_nv9097_polygon_mode(dyn->rs.polygon_mode);
|
||||
P_MTHD(p, NV9097, SET_FRONT_POLYGON_MODE);
|
||||
|
|
|
|||
|
|
@ -35,36 +35,9 @@ emit_pipeline_vp_state(struct nv_push *p,
|
|||
}
|
||||
|
||||
static void
|
||||
emit_pipeline_rs_state(struct nv_push *p, struct nvk_device *dev,
|
||||
emit_pipeline_rs_state(struct nv_push *p,
|
||||
const struct vk_rasterization_state *rs)
|
||||
{
|
||||
bool z_clamp = rs->depth_clamp_enable;
|
||||
bool z_clip = vk_rasterization_state_depth_clip_enable(rs);
|
||||
|
||||
P_IMMD(p, NVC397, SET_VIEWPORT_CLIP_CONTROL, {
|
||||
/* TODO: Fix pre-Volta
|
||||
*
|
||||
* This probably involves a few macros, one which stases viewport
|
||||
* min/maxDepth in scratch states and one which goes here and
|
||||
* emits either min/maxDepth or -/+INF as needed.
|
||||
*/
|
||||
.min_z_zero_max_z_one = MIN_Z_ZERO_MAX_Z_ONE_FALSE,
|
||||
.z_clip_range = dev->pdev->info.cls_eng3d >= VOLTA_A
|
||||
? ((z_clamp || z_clip)
|
||||
? Z_CLIP_RANGE_MIN_Z_MAX_Z
|
||||
:Z_CLIP_RANGE_MINUS_INF_PLUS_INF)
|
||||
: Z_CLIP_RANGE_USE_FIELD_MIN_Z_ZERO_MAX_Z_ONE,
|
||||
|
||||
.pixel_min_z = z_clip ? PIXEL_MIN_Z_CLIP : PIXEL_MIN_Z_CLAMP,
|
||||
.pixel_max_z = z_clip ? PIXEL_MAX_Z_CLIP : PIXEL_MAX_Z_CLAMP,
|
||||
|
||||
.geometry_guardband = GEOMETRY_GUARDBAND_SCALE_256,
|
||||
.line_point_cull_guardband = LINE_POINT_CULL_GUARDBAND_SCALE_256,
|
||||
.geometry_clip = z_clip ? GEOMETRY_CLIP_FRUSTUM_XYZ_CLIP :
|
||||
GEOMETRY_CLIP_FRUSTUM_XY_CLIP,
|
||||
.geometry_guardband_z = GEOMETRY_GUARDBAND_Z_SCALE_256,
|
||||
});
|
||||
|
||||
P_IMMD(p, NV9097, SET_RASTER_INPUT, rs->rasterization_stream);
|
||||
}
|
||||
|
||||
|
|
@ -501,7 +474,7 @@ nvk_graphics_pipeline_create(struct nvk_device *dev,
|
|||
|
||||
if (state.ts) emit_pipeline_ts_state(&push, state.ts);
|
||||
if (state.vp) emit_pipeline_vp_state(&push, state.vp);
|
||||
if (state.rs) emit_pipeline_rs_state(&push, dev, state.rs);
|
||||
if (state.rs) emit_pipeline_rs_state(&push, state.rs);
|
||||
if (state.ms) emit_pipeline_ms_state(&push, state.ms, force_max_samples);
|
||||
if (state.cb) emit_pipeline_cb_state(&push, state.cb);
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ nvk_get_device_features(const struct nv_device_info *info,
|
|||
|
||||
/* VK_EXT_extended_dynamic_state3 */
|
||||
.extendedDynamicState3TessellationDomainOrigin = false,
|
||||
.extendedDynamicState3DepthClampEnable = false,
|
||||
.extendedDynamicState3DepthClampEnable = true,
|
||||
.extendedDynamicState3PolygonMode = true,
|
||||
.extendedDynamicState3RasterizationSamples = false,
|
||||
.extendedDynamicState3SampleMask = false,
|
||||
|
|
@ -296,7 +296,7 @@ nvk_get_device_features(const struct nv_device_info *info,
|
|||
.extendedDynamicState3RasterizationStream = false,
|
||||
.extendedDynamicState3ConservativeRasterizationMode = false,
|
||||
.extendedDynamicState3ExtraPrimitiveOverestimationSize = false,
|
||||
.extendedDynamicState3DepthClipEnable = false,
|
||||
.extendedDynamicState3DepthClipEnable = true,
|
||||
.extendedDynamicState3SampleLocationsEnable = info->cls_eng3d >= MAXWELL_B,
|
||||
.extendedDynamicState3ColorBlendAdvanced = false,
|
||||
.extendedDynamicState3ProvokingVertexMode = true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue