iris: add support for tgsi_to_nir
authorAndre Heider <a.heider@gmail.com>
Sun, 10 Feb 2019 17:31:59 +0000 (18:31 +0100)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 7 Mar 2019 08:38:13 +0000 (00:38 -0800)
The Gallium Nine state tracker now works on iris.

Also tested with GALLIUM_HUD and Star Wars: Knights of the Old
Republic on WINE (GL_ATI_fragment_shader).

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_program.c

index 2feb43a367f14fa64890f03d9cef0081f5fd68ac..0ceaeb22d27ca84e6fadd2e8443f8699d731f4e7 100644 (file)
@@ -41,6 +41,7 @@
 #include "intel/compiler/brw_compiler.h"
 #include "intel/compiler/brw_nir.h"
 #include "iris_context.h"
+#include "nir/tgsi_to_nir.h"
 
 #define KEY_INIT_NO_ID(gen)                       \
    .tex.swizzles[0 ... MAX_SAMPLERS - 1] = 0x688, \
@@ -1410,10 +1411,14 @@ static struct iris_uncompiled_shader *
 iris_create_shader_state(struct pipe_context *ctx,
                          const struct pipe_shader_state *state)
 {
-   assert(state->type == PIPE_SHADER_IR_NIR);
+   struct nir_shader *nir;
 
-   return iris_create_uncompiled_shader(ctx, state->ir.nir,
-                                        &state->stream_output);
+   if (state->type == PIPE_SHADER_IR_TGSI)
+      nir = tgsi_to_nir(state->tokens, ctx->screen);
+   else
+      nir = state->ir.nir;
+
+   return iris_create_uncompiled_shader(ctx, nir, &state->stream_output);
 }
 
 static void *