VARYING_SLOT_BFC0 |
VARYING_SLOT_BFC1));
+ key.lower_depth_clamp =
+ !st->gp && !st->tep &&
+ st->clamp_frag_depth_in_shader &&
+ (st->ctx->Transform.DepthClampNear ||
+ st->ctx->Transform.DepthClampFar);
+
+ if (key.lower_depth_clamp)
+ key.clip_negative_one_to_one =
+ st->ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE;
+
st->vp_variant = st_get_vp_variant(st, stvp, &key);
}
struct draw_stage *rastpos_stage; /**< For glRasterPos */
GLboolean clamp_frag_color_in_shader;
GLboolean clamp_vert_color_in_shader;
+ boolean clamp_frag_depth_in_shader;
boolean has_stencil_export; /**< can do shader stencil export? */
boolean has_time_elapsed;
boolean has_etc1;
#include "st_cb_bitmap.h"
#include "st_cb_drawpixels.h"
#include "st_context.h"
+#include "st_tgsi_lower_depth_clamp.h"
#include "st_tgsi_lower_yuv.h"
#include "st_program.h"
#include "st_mesa_to_tgsi.h"
return stvp->tgsi.tokens != NULL;
}
+static const gl_state_index16 depth_range_state[STATE_LENGTH] =
+ { STATE_DEPTH_RANGE };
+
static struct st_vp_variant *
st_create_vp_variant(struct st_context *st,
struct st_vertex_program *stvp,
{
struct st_vp_variant *vpv = CALLOC_STRUCT(st_vp_variant);
struct pipe_context *pipe = st->pipe;
+ struct gl_program_parameter_list *params = stvp->Base.Parameters;
vpv->key = *key;
vpv->tgsi.stream_output = stvp->tgsi.stream_output;
fprintf(stderr, "mesa: cannot emulate deprecated features\n");
}
+ 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(vpv->tgsi.tokens, depth_range_const,
+ key->clip_negative_one_to_one);
+ if (tokens != vpv->tgsi.tokens)
+ tgsi_free_tokens(vpv->tgsi.tokens);
+ vpv->tgsi.tokens = tokens;
+ }
+
if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump(vpv->tgsi.tokens, 0);
debug_printf("\n");