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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12218>
This commit is contained in:
Emma Anholt 2021-09-02 17:07:11 -07:00 committed by Marge Bot
parent d5254601c9
commit 682d08a6ea
5 changed files with 14 additions and 1 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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:

View File

@ -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;
}

View File

@ -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: