v1 implemented by Erik Faye-Lund <erik.faye-lund@collabora.com>
v2: Use different call for FS
v3: Use file scope defined depth_range_state
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Marek Olšák <marek.olsak@amd.com>
st->ctx->Multisample.MinSampleShadingValue *
_mesa_geometric_samples(st->ctx->DrawBuffer) > 1;
+ key.lower_depth_clamp =
+ st->clamp_frag_depth_in_shader &&
+ (st->ctx->Transform.DepthClampNear ||
+ st->ctx->Transform.DepthClampFar);
+
if (stfp->ati_fs) {
key.fog = st->ctx->Fog._PackedEnabledMode;
}
}
+ if (key->lower_depth_clamp) {
+ unsigned depth_range_const = _mesa_add_state_reference(params, depth_range_state);
+
+ const struct tgsi_token *tokens;
+ tokens = st_tgsi_lower_depth_clamp_fs(tgsi.tokens, depth_range_const);
+ if (tgsi.tokens != stfp->tgsi.tokens)
+ tgsi_free_tokens(tgsi.tokens);
+ tgsi.tokens = tokens;
+ }
+
if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump(tgsi.tokens, 0);
debug_printf("\n");
/** needed for ATI_fragment_shader */
GLuint fog:2;
+ /** for ARB_depth_clamp */
+ GLuint lower_depth_clamp:1;
+
/** needed for ATI_fragment_shader */
char texture_targets[MAX_NUM_FRAGMENT_REGISTERS_ATI];