OSDN Git Service

i965: Move ClipPlanesEnabled state to VS cache key.
authorPaul Berry <stereotype441@gmail.com>
Wed, 28 Sep 2011 18:26:57 +0000 (11:26 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 7 Oct 2011 02:29:02 +0000 (19:29 -0700)
commit8f6920a7b69bd20f04f807e88c22cf1eb78b4e79
tree79d41590ad5c958207bcec04d31773e670338573
parenta1b37ebe757f7a74d69612d7c32fbdbbe3405989
i965: Move ClipPlanesEnabled state to VS cache key.

Previous to this patch, setup_uniform_clipplane_values() was setting
up clip plane uniforms based on ctx->Transform.ClipPlanesEnabled, a
piece of state not stored in the vertex shader cache key.  As a
result, a change to this piece of state might not trigger a necessary
vertex shader recompile.

The patch adds a field to the vertex shader cache key,
userclip_planes_enabled, to store the current value of
ctx->Transform.ClipPlanesEnabled.  Also, it changes
setup_uniform_clipplane_values() to read from this new field, so that
it's manifestly clear that the vertex shader isn't depending on state
not stored in the cache key.

Note: when the vertex shader uses gl_ClipDistance, the VS backend
doesn't need to know which clip planes are in use, so we leave the
field as zero in that case to avoid unnecessary recompiles.

Fixes Piglit test vs-clip-vertex-enables.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs.h