Required by Nine. Tested with util_run_tests.
It's added to softpipe, llvmpipe, and r300g/swtcl.
Tested-by: David Heidelberg <david@ixit.cz>
}
-static void update_clip_flags( struct draw_context *draw )
+static bool
+draw_is_vs_window_space(struct draw_context *draw)
{
- draw->clip_xy = !draw->driver.bypass_clip_xy;
+ if (draw->vs.vertex_shader) {
+ struct tgsi_shader_info *info = &draw->vs.vertex_shader->info;
+
+ return info->properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION] != 0;
+ }
+ return false;
+}
+
+
+void
+draw_update_clip_flags(struct draw_context *draw)
+{
+ bool window_space = draw_is_vs_window_space(draw);
+
+ draw->clip_xy = !draw->driver.bypass_clip_xy && !window_space;
draw->guard_band_xy = (!draw->driver.bypass_clip_xy &&
draw->driver.guard_band_xy);
draw->clip_z = (!draw->driver.bypass_clip_z &&
- draw->rasterizer && draw->rasterizer->depth_clip);
+ draw->rasterizer && draw->rasterizer->depth_clip) &&
+ !window_space;
draw->clip_user = draw->rasterizer &&
- draw->rasterizer->clip_plane_enable != 0;
+ draw->rasterizer->clip_plane_enable != 0 &&
+ !window_space;
draw->guard_band_points_xy = draw->guard_band_xy ||
(draw->driver.bypass_clip_points &&
(draw->rasterizer &&
draw->rasterizer->point_tri_clip));
}
+
+void
+draw_update_viewport_flags(struct draw_context *draw)
+{
+ bool window_space = draw_is_vs_window_space(draw);
+
+ draw->bypass_viewport = window_space || draw->identity_viewport;
+}
+
+
/**
* Register new primitive rasterization/rendering state.
* This causes the drawing pipeline to be rebuilt.
draw->rasterizer = raster;
draw->rast_handle = rast_handle;
- update_clip_flags(draw);
+ draw_update_clip_flags(draw);
}
}
draw->driver.bypass_clip_z = bypass_clip_z;
draw->driver.guard_band_xy = guard_band_xy;
draw->driver.bypass_clip_points = bypass_clip_points;
- update_clip_flags(draw);
+ draw_update_clip_flags(draw);
}
viewport->translate[0] == 0.0f &&
viewport->translate[1] == 0.0f &&
viewport->translate[2] == 0.0f);
+ draw_update_viewport_flags(draw);
}
key->clip_xy = llvm->draw->clip_xy;
key->clip_z = llvm->draw->clip_z;
key->clip_user = llvm->draw->clip_user;
- key->bypass_viewport = llvm->draw->identity_viewport;
+ key->bypass_viewport = llvm->draw->bypass_viewport;
key->clip_halfz = llvm->draw->rasterizer->clip_halfz;
key->need_edgeflags = (llvm->draw->vs.edgeflag_output ? TRUE : FALSE);
key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable;
struct pipe_viewport_state viewports[PIPE_MAX_VIEWPORTS];
boolean identity_viewport;
+ boolean bypass_viewport;
/** Vertex shader state */
struct {
draw_stats_clipper_primitives(struct draw_context *draw,
const struct draw_prim_info *prim_info);
+void draw_update_clip_flags(struct draw_context *draw);
+void draw_update_viewport_flags(struct draw_context *draw);
+
/**
* Return index i from the index buffer.
* If the index buffer would overflow we return the
fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */
fse->key.nr_inputs); /* inputs - fetch from api format */
- fse->key.viewport = !draw->identity_viewport;
+ fse->key.viewport = !draw->bypass_viewport;
fse->key.clip = draw->clip_xy || draw->clip_z || draw->clip_user;
fse->key.const_vbuffers = 0;
draw->clip_user,
point_clip ? draw->guard_band_points_xy :
draw->guard_band_xy,
- draw->identity_viewport,
+ draw->bypass_viewport,
draw->rasterizer->clip_halfz,
(draw->vs.edgeflag_output ? TRUE : FALSE) );
draw->clip_user,
point_clip ? draw->guard_band_points_xy :
draw->guard_band_xy,
- draw->identity_viewport,
+ draw->bypass_viewport,
draw->rasterizer->clip_halfz,
(draw->vs.edgeflag_output ? TRUE : FALSE) );
draw->vs.clipdistance_output[0] = dvs->clipdistance_output[0];
draw->vs.clipdistance_output[1] = dvs->clipdistance_output[1];
dvs->prepare( dvs, draw );
+ draw_update_clip_flags(draw);
+ draw_update_viewport_flags(draw);
}
else {
draw->vs.vertex_shader = NULL;
case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
+ return 0;
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
+ return 1;
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
return 0;
case PIPE_CAP_FAKE_SW_MSAA:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
- case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
/* SWTCL-only features. */
case PIPE_CAP_PRIMITIVE_RESTART:
case PIPE_CAP_USER_VERTEX_BUFFERS:
+ case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
return !r300screen->caps.has_tcl;
/* HWTCL-only features / limitations. */
case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
+ return 0;
case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
+ return 1;
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
return 0;