diff --git a/src/gallium/frontends/nine/adapter9.c b/src/gallium/frontends/nine/adapter9.c index 0a1af457568..c95a271af76 100644 --- a/src/gallium/frontends/nine/adapter9.c +++ b/src/gallium/frontends/nine/adapter9.c @@ -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 = diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index f615e938ae7..f60c477b86e 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -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); diff --git a/src/gallium/frontends/nine/device9.h b/src/gallium/frontends/nine/device9.h index 2ddeff78547..404f70bb902 100644 --- a/src/gallium/frontends/nine/device9.h +++ b/src/gallium/frontends/nine/device9.h @@ -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; diff --git a/src/gallium/frontends/nine/nine_pipe.c b/src/gallium/frontends/nine/nine_pipe.c index 6a32be7c117..d2ed7f3829a 100644 --- a/src/gallium/frontends/nine/nine_pipe.c +++ b/src/gallium/frontends/nine/nine_pipe.c @@ -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; */ diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index 369da96947d..d1f08b18b38 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -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. */ diff --git a/src/gallium/frontends/nine/nine_state.h b/src/gallium/frontends/nine/nine_state.h index cfaae430ec2..a98c07c2f4a 100644 --- a/src/gallium/frontends/nine/nine_state.h +++ b/src/gallium/frontends/nine/nine_state.h @@ -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)