From ade8b26bf515fa4f0cbf43e9df4885368e984277 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 12 Dec 2014 04:13:43 +0100 Subject: gallium: add TGSI_SEMANTIC_VERTEXID_NOBASE and TGSI_SEMANTIC_BASEVERTEX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plus a new PIPE_CAP_VERTEXID_NOBASE query. The idea is that drivers not supporting vertex ids with base vertex offset applied (so, only support d3d10-style vertex ids) will get such a d3d10-style vertex id instead - with the caveat they'll also need to handle the basevertex system value too (this follows what core mesa already does). Additionally, this is also useful for other state trackers (for instance llvmpipe / draw right now implement the d3d10 behavior on purpose, but with different semantics it can just do both). Doesn't do anything yet. And fix up the docs wrt similar values. v2: incorporate feedback from Brian and others, better names, better docs. Reviewed-by: Brian Paul Reviewed-by: Jose Fonseca Reviewed-by: Marek Olšák --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 ++++++ src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 ++ src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 ++ 3 files changed, 10 insertions(+) (limited to 'src/gallium/auxiliary/tgsi') diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 649c327d9c9..eb313e430d6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -213,6 +213,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens, else if (semName == TGSI_SEMANTIC_VERTEXID) { info->uses_vertexid = TRUE; } + else if (semName == TGSI_SEMANTIC_VERTEXID_NOBASE) { + info->uses_vertexid_nobase = TRUE; + } + else if (semName == TGSI_SEMANTIC_BASEVERTEX) { + info->uses_basevertex = TRUE; + } else if (semName == TGSI_SEMANTIC_PRIMID) { info->uses_primid = TRUE; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 61ce81342a4..375f75a3b98 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -74,6 +74,8 @@ struct tgsi_shader_info boolean uses_kill; /**< KILL or KILL_IF instruction used? */ boolean uses_instanceid; boolean uses_vertexid; + boolean uses_vertexid_nobase; + boolean uses_basevertex; boolean uses_primid; boolean uses_frontface; boolean writes_psize; diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 01fa5a9f345..bd975448773 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -86,6 +86,8 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = "SAMPLEPOS", "SAMPLEMASK", "INVOCATIONID", + "VERTEXID_NOBASE", + "BASEVERTEX", }; const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = -- cgit v1.2.3