Mesa (main): tgsi_translate: Make the procType public when translating.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 14 23:34:34 UTC 2022


Module: Mesa
Branch: main
Commit: af19774dd4a02c8cafaccf06994683500bd58849
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=af19774dd4a02c8cafaccf06994683500bd58849

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Oct 26 13:13:34 2021 -0700

tgsi_translate: Make the procType public when translating.

This means that tgsi_translate users can check the PIPE_SHADER stage
without having to separately tgsi_scan().

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>

---

 src/gallium/auxiliary/tgsi/tgsi_transform.c | 5 ++---
 src/gallium/auxiliary/tgsi/tgsi_transform.h | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index 4b2b10f50ad..a1b66ea2faf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -108,7 +108,6 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
                       uint max_tokens_out,
                       struct tgsi_transform_context *ctx)
 {
-   uint procType;
    boolean first_instruction = TRUE;
    boolean epilog_emitted = FALSE;
    int cond_stack = 0;
@@ -139,7 +138,7 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
       debug_printf("tgsi_parse_init() failed in tgsi_transform_shader()!\n");
       return -1;
    }
-   procType = parse.FullHeader.Processor.Processor;
+   ctx->processor = parse.FullHeader.Processor.Processor;
 
    /**
     **  Setup output shader
@@ -148,7 +147,7 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
    *ctx->header = tgsi_build_header();
 
    processor = (struct tgsi_processor *) (tokens_out + 1);
-   *processor = tgsi_build_processor( procType, ctx->header );
+   *processor = tgsi_build_processor( ctx->processor, ctx->header );
 
    ctx->ti = 2;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h b/src/gallium/auxiliary/tgsi/tgsi_transform.h
index 727edeb05ac..176bc9f1bb9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
@@ -29,6 +29,7 @@
 #define TGSI_TRANSFORM_H
 
 
+#include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_build.h"
@@ -68,6 +69,7 @@ struct tgsi_transform_context
     */
    void (*epilog)(struct tgsi_transform_context *ctx);
 
+   enum pipe_shader_type processor;
 
 /*** PRIVATE ***/
 



More information about the mesa-commit mailing list