frontend/nine: Improve VS_WINDOW_SPACE_POSITION fallback
Previously we would implement position_t by applying the inverse of the viewport, and advertising clipping was going to occur with the cap CLIPTLVERTS. However when the cap is advertised, clipping is supposed to be disabled via sw emulation when D3DRS_CLIPPING is set to FALSE. Since we don't support that either, instead take the approach of disabling at least depth clipping, and not advertising the cap. Ideally, clipping should be totally disabled. Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Signed-off-by: Axel Davy <davyaxel0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22644>
This commit is contained in:
@@ -649,7 +649,8 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
|
||||
D3DPIPECAP(MIXED_COLORBUFFER_FORMATS, D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) |
|
||||
D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING |
|
||||
D3DPMISCCAPS_FOGVERTEXCLAMPED;
|
||||
if (!screen->get_param(screen, PIPE_CAP_VS_WINDOW_SPACE_POSITION))
|
||||
if (!screen->get_param(screen, PIPE_CAP_VS_WINDOW_SPACE_POSITION) &&
|
||||
!screen->get_param(screen, PIPE_CAP_DEPTH_CLIP_DISABLE))
|
||||
pCaps->PrimitiveMiscCaps |= D3DPMISCCAPS_CLIPTLVERTS;
|
||||
|
||||
pCaps->RasterCaps =
|
||||
|
||||
@@ -555,6 +555,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
|
||||
This->driver_caps.user_sw_vbufs = This->screen_sw->get_param(This->screen_sw, PIPE_CAP_USER_VERTEX_BUFFERS);
|
||||
This->vertex_uploader = This->csmt_active ? This->pipe_secondary->stream_uploader : This->context.pipe->stream_uploader;
|
||||
This->driver_caps.window_space_position_support = GET_PCAP(VS_WINDOW_SPACE_POSITION);
|
||||
This->driver_caps.disabling_depth_clipping_support = GET_PCAP(DEPTH_CLIP_DISABLE);
|
||||
This->driver_caps.vs_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS);
|
||||
This->driver_caps.ps_integer = pScreen->get_shader_param(pScreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS);
|
||||
This->driver_caps.offset_units_unscaled = GET_PCAP(POLYGON_OFFSET_UNITS_UNSCALED);
|
||||
|
||||
@@ -129,6 +129,7 @@ struct NineDevice9
|
||||
struct {
|
||||
boolean user_sw_vbufs;
|
||||
boolean window_space_position_support;
|
||||
boolean disabling_depth_clipping_support;
|
||||
boolean vs_integer;
|
||||
boolean ps_integer;
|
||||
boolean offset_units_unscaled;
|
||||
|
||||
@@ -108,8 +108,17 @@ nine_convert_rasterizer_state(struct NineDevice9 *device,
|
||||
/* rast.lower_left_origin = 0; */
|
||||
/* rast.bottom_edge_rule = 0; */
|
||||
/* rast.rasterizer_discard = 0; */
|
||||
rast.depth_clip_near = 1;
|
||||
rast.depth_clip_far = 1;
|
||||
if (rs[NINED3DRS_POSITIONT] &&
|
||||
!device->driver_caps.window_space_position_support &&
|
||||
device->driver_caps.disabling_depth_clipping_support) {
|
||||
/* rast.depth_clip_near = 0; */
|
||||
/* rast.depth_clip_far = 0; */
|
||||
rast.depth_clamp = 1;
|
||||
} else {
|
||||
rast.depth_clip_near = 1;
|
||||
rast.depth_clip_far = 1;
|
||||
/* rast.depth_clamp = 0; */
|
||||
}
|
||||
rast.clip_halfz = 1;
|
||||
rast.clip_plane_enable = rs[D3DRS_CLIPPLANEENABLE];
|
||||
/* rast.line_stipple_factor = 0; */
|
||||
|
||||
@@ -673,6 +673,12 @@ prepare_vs(struct NineDevice9 *device, uint8_t shader_changed)
|
||||
context->rs[NINED3DRS_VSPOINTSIZE] = vs->point_size;
|
||||
changed_group |= NINE_STATE_RASTERIZER;
|
||||
}
|
||||
if (context->rs[NINED3DRS_POSITIONT] != vs->position_t) {
|
||||
context->rs[NINED3DRS_POSITIONT] = vs->position_t;
|
||||
if (!device->driver_caps.window_space_position_support &&
|
||||
device->driver_caps.disabling_depth_clipping_support)
|
||||
changed_group |= NINE_STATE_RASTERIZER;
|
||||
}
|
||||
|
||||
if ((context->bound_samplers_mask_vs & vs->sampler_mask) != vs->sampler_mask)
|
||||
/* Bound dummy sampler. */
|
||||
|
||||
@@ -43,10 +43,11 @@
|
||||
#define NINED3DRS_MULTISAMPLE (D3DRS_BLENDOPALPHA + 4)
|
||||
#define NINED3DRS_FETCH4 (D3DRS_BLENDOPALPHA + 5)
|
||||
#define NINED3DRS_EMULATED_ALPHATEST (D3DRS_BLENDOPALPHA + 6)
|
||||
#define NINED3DRS_POSITIONT (D3DRS_BLENDOPALPHA + 7)
|
||||
|
||||
#define D3DRS_LAST D3DRS_BLENDOPALPHA
|
||||
#define D3DSAMP_LAST D3DSAMP_DMAPOFFSET
|
||||
#define NINED3DRS_LAST NINED3DRS_EMULATED_ALPHATEST /* 216 */
|
||||
#define NINED3DRS_LAST NINED3DRS_POSITIONT /* 217 */
|
||||
#define NINED3DSAMP_LAST NINED3DSAMP_CUBETEX /* 16 */
|
||||
#define NINED3DTSS_LAST D3DTSS_CONSTANT
|
||||
#define NINED3DTS_LAST D3DTS_WORLDMATRIX(255)
|
||||
|
||||
Reference in New Issue
Block a user