shader: Handle TGSI_SEMANTIC_TEXCOORD

With that we can enable PIPE_CAP_TGSI_TEXCOORD in the guest

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
macos/master
Gert Wollny 3 years ago committed by Gert Wollny
parent 91e81d6c42
commit 341e34652e
  1. 2
      .gitlab-ci/expectations/host/piglit-virgl-gl-fails.txt
  2. 2
      .gitlab-ci/expectations/host/piglit-virgl-gles-fails.txt
  3. 2
      src/vrend_renderer.c
  4. 24
      src/vrend_shader.c

@ -739,8 +739,6 @@ spec@!opengl 2.0@vertex-program-two-side enabled back front2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled back@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2 back2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2 back2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2@vs- gs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back back2,Fail

@ -3423,8 +3423,6 @@ spec@!opengl 2.0@vertex-program-two-side enabled back front2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled back@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2 back2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2 back2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front2@vs- gs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back2,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back2@vs and fs,Fail
spec@!opengl 2.0@vertex-program-two-side enabled front back back2,Fail

@ -10654,7 +10654,7 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
* this value to avoid regressions when a guest with a new mesa version is
* run on an old virgl host. Use it also to indicate non-cap fixes on the
* host that help enable features in the guest. */
caps->v2.host_feature_check_version = 7;
caps->v2.host_feature_check_version = 8;
/* Forward host GL_RENDERER to the guest. */
strncpy(caps->v2.renderer, renderer, sizeof(caps->v2.renderer) - 1);

@ -1240,6 +1240,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
/* fallthrough */
case TGSI_SEMANTIC_PATCH:
case TGSI_SEMANTIC_GENERIC:
case TGSI_SEMANTIC_TEXCOORD:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
if (ctx->key->fs.coord_replace & (1 << ctx->inputs[i].sid)) {
if (ctx->cfg->use_gles)
@ -1254,7 +1255,8 @@ iter_declaration(struct tgsi_iterate_context *iter,
break;
}
}
/* fallthrough */
case TGSI_SEMANTIC_TESSCOORD:
if (ctx->inputs[i].first != ctx->inputs[i].last ||
ctx->inputs[i].array_id > 0) {
ctx->guest_sent_io_arrays = true;
@ -1287,6 +1289,8 @@ iter_declaration(struct tgsi_iterate_context *iter,
snprintf(ctx->inputs[i].glsl_name, 128, "%s_g%dA%d", name_prefix, ctx->inputs[i].sid, ctx->inputs[i].array_id);
else if (ctx->inputs[i].name == TGSI_SEMANTIC_PATCH)
snprintf(ctx->inputs[i].glsl_name, 128, "%s_p%dA%d", name_prefix, ctx->inputs[i].sid, ctx->inputs[i].array_id);
else if (ctx->inputs[i].name == TGSI_SEMANTIC_TEXCOORD)
snprintf(ctx->inputs[i].glsl_name, 64, "%s_t%d", name_prefix, ctx->inputs[i].sid);
else
snprintf(ctx->inputs[i].glsl_name, 128, "%s_%d", name_prefix, ctx->inputs[i].first);
}
@ -1504,6 +1508,9 @@ iter_declaration(struct tgsi_iterate_context *iter,
/* fallthrough */
case TGSI_SEMANTIC_PATCH:
case TGSI_SEMANTIC_GENERIC:
case TGSI_SEMANTIC_TEXCOORD:
case TGSI_SEMANTIC_TESSCOORD:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX)
if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC)
color_offset = -1;
@ -1542,6 +1549,8 @@ iter_declaration(struct tgsi_iterate_context *iter,
snprintf(ctx->outputs[i].glsl_name, 64, "%s_p%dA%d", name_prefix, ctx->outputs[i].sid, ctx->outputs[i].array_id);
else if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC)
snprintf(ctx->outputs[i].glsl_name, 64, "%s_g%dA%d", name_prefix, ctx->outputs[i].sid, ctx->outputs[i].array_id);
else if (ctx->outputs[i].name == TGSI_SEMANTIC_TEXCOORD)
snprintf(ctx->outputs[i].glsl_name, 64, "%s_t%d", name_prefix, ctx->outputs[i].sid);
else
snprintf(ctx->outputs[i].glsl_name, 64, "%s_%d", name_prefix, ctx->outputs[i].first + color_offset);
@ -1940,7 +1949,9 @@ get_blockvarname(char outvar[64], const char *stage_prefix, const struct vrend_s
static void get_so_name(const struct dump_ctx *ctx, bool from_block, const struct vrend_shader_io *output, int index, char out_var[255], char *wm)
{
if (output->first == output->last || output->name != TGSI_SEMANTIC_GENERIC)
if (output->first == output->last ||
(output->name != TGSI_SEMANTIC_GENERIC &&
output->name != TGSI_SEMANTIC_TEXCOORD))
snprintf(out_var, 255, "%s%s", output->glsl_name, wm);
else {
if ((output->name == TGSI_SEMANTIC_GENERIC) && prefer_generic_io_block(ctx, io_out)) {
@ -3855,6 +3866,9 @@ get_destination_info(struct dump_ctx *ctx,
struct vrend_shader_io *io = ctx->generic_ios.output_range.used ? &ctx->generic_ios.output_range.io : &ctx->outputs[j];
get_destination_info_generic(ctx, dst_reg, io, writemask, dsts[i]);
dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm;
} else if (ctx->outputs[j].name == TGSI_SEMANTIC_TEXCOORD) {
get_destination_info_generic(ctx, dst_reg, &ctx->outputs[j], writemask, dsts[i]);
dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm;
} else if (ctx->outputs[j].name == TGSI_SEMANTIC_PATCH) {
struct vrend_shader_io *io = ctx->patch_ios.output_range.used ? &ctx->patch_ios.output_range.io : &ctx->outputs[j];
char reswizzled[6] = "";
@ -4180,7 +4194,8 @@ get_source_info(struct dump_ctx *ctx,
if (ctx->inputs[j].first <= src->Register.Index &&
ctx->inputs[j].last >= src->Register.Index &&
(ctx->inputs[j].usage_mask & usage_mask)) {
if (ctx->key->color_two_side && ctx->inputs[j].name == TGSI_SEMANTIC_COLOR)
if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT &&
ctx->key->color_two_side && ctx->inputs[j].name == TGSI_SEMANTIC_COLOR)
strbuf_fmt(src_buf, "%s(%s%s%d%s%s)", get_string(stypeprefix), prefix, "realcolor", ctx->inputs[j].sid, arrayname, swizzle);
else if (ctx->inputs[j].glsl_gl_block) {
/* GS input clipdist requires a conversion */
@ -4220,6 +4235,8 @@ get_source_info(struct dump_ctx *ctx,
} else if (ctx->inputs[j].name == TGSI_SEMANTIC_GENERIC) {
struct vrend_shader_io *io = ctx->generic_ios.input_range.used ? &ctx->generic_ios.input_range.io : &ctx->inputs[j];
get_source_info_generic(ctx, io_in, srcstypeprefix, prefix, src, io, arrayname, swizzle, src_buf);
} else if (ctx->inputs[j].name == TGSI_SEMANTIC_TEXCOORD) {
get_source_info_generic(ctx, io_in, srcstypeprefix, prefix, src, &ctx->inputs[j], arrayname, swizzle, src_buf);
} else if (ctx->inputs[j].name == TGSI_SEMANTIC_PATCH) {
struct vrend_shader_io *io = ctx->patch_ios.input_range.used ? &ctx->patch_ios.input_range.io : &ctx->inputs[j];
get_source_info_patch(srcstypeprefix, prefix, src, io, arrayname, swizzle, src_buf);
@ -7580,6 +7597,7 @@ iter_vs_declaration(struct tgsi_iterate_context *iter,
case TGSI_SEMANTIC_PATCH:
case TGSI_SEMANTIC_GENERIC:
case TGSI_SEMANTIC_TESSCOORD:
if (ctx->inputs[i].first != ctx->inputs[i].last ||
ctx->inputs[i].array_id > 0) {
ctx->guest_sent_io_arrays = true;

Loading…
Cancel
Save