shader: rely on the shader key for clip_dist in GS

If we always emit the glip distance in GS we might end up
having too many outputs, which will result in failures.

Hence, for GS only emit the clip distance evaluation code
when the clip planes are enabled.

Fixes: 072f30955b
    shader: Always write code to toggle clip plane

Closes: #254
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
macos/master
Gert Wollny 3 years ago committed by Gert Wollny
parent ac2efab539
commit 94335ebabd
  1. 3
      src/vrend_renderer.c
  2. 2
      src/vrend_shader.c
  3. 4
      src/vrend_shader.h

@ -3581,6 +3581,9 @@ static inline void vrend_fill_shader_key(struct vrend_sub_context *sub_ctx,
if (type != PIPE_SHADER_COMPUTE)
vrend_sync_shader_io(sub_ctx, sel, key);
if (type == PIPE_SHADER_GEOMETRY)
key->gs.emit_clip_distance = sub_ctx->rs_state.clip_plane_enable != 0;
for (int i = 0; i < sub_ctx->views[type].num_views; i++) {
struct vrend_sampler_view *view = sub_ctx->views[type].views[i];
if (view && view->texture->target == GL_TEXTURE_BUFFER &&

@ -5438,7 +5438,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
struct immed *imd = &ctx->imm[(inst->Src[0].Register.Index)];
if (ctx->so && ctx->key->gs_present)
emit_so_movs(ctx, &ctx->glsl_strbufs, &ctx->has_clipvertex_so);
if (ctx->cfg->has_cull_distance)
if (ctx->cfg->has_cull_distance && ctx->key->gs.emit_clip_distance)
emit_clip_dist_movs(ctx, &ctx->glsl_strbufs);
emit_prescale(&ctx->glsl_strbufs);
if (imd->val[inst->Src[0].Register.SwizzleX].ui > 0) {

@ -173,6 +173,10 @@ struct vrend_shader_key {
uint32_t attrib_unsigned_int_bitmask;
uint32_t fog_fixup_mask;
} vs;
struct {
uint32_t emit_clip_distance : 1;
} gs;
};
uint32_t sampler_views_lower_swizzle_mask;

Loading…
Cancel
Save