From 682d08a6ea49cf1f375c1e72b0cd2ce866c29ed3 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 2 Sep 2021 17:07:11 -0700 Subject: [PATCH] i915g: Expose PIPE_CAP_TGSI_TEXCOORD. We want to be able to use finalize_nir, but doing so requires this flag to be set because not having it is incompatible with being able to finalize twice (since the texcoord workaround varyings shift happens at variant time rather than link time). Part-of: --- src/gallium/drivers/i915/i915_context.h | 2 ++ src/gallium/drivers/i915/i915_fpc_translate.c | 5 +++++ src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/i915/i915_state.c | 4 ++++ src/gallium/drivers/i915/i915_state_derived.c | 3 ++- 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 0ad22f8b286..d3ea29d1b41 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -129,6 +129,8 @@ struct i915_fragment_shader { enum tgsi_semantic semantic; int index; } texcoords[I915_TEX_UNITS]; + + bool reads_pntc; }; struct i915_cache_context; diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index b1e7c84bba3..dc1832aa76e 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -162,7 +162,12 @@ src_vector(struct i915_fp_compile *p, switch (sem_name) { case TGSI_SEMANTIC_GENERIC: + case TGSI_SEMANTIC_TEXCOORD: + case TGSI_SEMANTIC_PCOORD: case TGSI_SEMANTIC_POSITION: { + if (sem_name == TGSI_SEMANTIC_PCOORD) + fs->reads_pntc = true; + int real_tex_unit = get_mapping(fs, sem_name, sem_ind); src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + real_tex_unit, D0_CHANNEL_ALL); diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 345dbdcee95..44e36298fc7 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -304,6 +304,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_VERTEX_COLOR_CLAMPED: case PIPE_CAP_USER_VERTEX_BUFFERS: case PIPE_CAP_MIXED_COLOR_DEPTH_BITS: + case PIPE_CAP_TGSI_TEXCOORD: return 1; case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 32681771c4e..c0c5ce5e648 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -580,6 +580,10 @@ i915_bind_fs_state(struct pipe_context *pipe, void *shader) draw_bind_fragment_shader(i915->draw, (i915->fs ? i915->fs->draw_data : NULL)); + /* Tell draw if we need to do point sprites so we can get PNTC. */ + if (i915->fs) + draw_wide_point_sprites(i915->draw, i915->fs->reads_pntc); + i915->dirty |= I915_NEW_FS; } diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c index 51e02e0ecec..37a0d16181e 100644 --- a/src/gallium/drivers/i915/i915_state_derived.c +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -59,6 +59,7 @@ calculate_vertex_layout(struct i915_context *i915) for (i = 0; i < fs->info.num_inputs; i++) { switch (fs->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: + case TGSI_SEMANTIC_PCOORD: case TGSI_SEMANTIC_FACE: /* Handled as texcoord inputs below */ break; @@ -66,8 +67,8 @@ calculate_vertex_layout(struct i915_context *i915) assert(fs->info.input_semantic_index[i] < 2); colors[fs->info.input_semantic_index[i]] = true; break; + case TGSI_SEMANTIC_TEXCOORD: case TGSI_SEMANTIC_GENERIC: - /* texcoords/varyings/other generic */ needW = true; break; case TGSI_SEMANTIC_FOG: