/**********************************************************
- * Copyright 2022 VMware, Inc. All rights reserved.
+ * Copyright 2022-2023 VMware, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
*
**********************************************************/
+#include "compiler/nir/nir.h"
+#include "compiler/glsl/gl_nir.h"
#include "nir/nir_to_tgsi.h"
+
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_bitmask.h"
struct svga_context *svga = svga_context(pipe);
struct svga_compute_shader *cs = CALLOC_STRUCT(svga_compute_shader);
+ nir_shader *nir = (nir_shader *)templ->prog;
if (!cs)
return NULL;
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CREATECS);
assert(templ->ir_type == PIPE_SHADER_IR_NIR);
- cs->base.tokens = nir_to_tgsi((void *)templ->prog, pipe->screen);
+ /* nir_to_tgsi requires lowered images */
+ NIR_PASS_V(nir, gl_nir_lower_images, false);
+
+ cs->base.tokens = nir_to_tgsi((void *)nir, pipe->screen);
struct svga_shader *shader = &cs->base;
shader->id = svga->debug.shader_id++;
/**********************************************************
- * Copyright 2008-2022 VMware, Inc. All rights reserved.
+ * Copyright 2008-2023 VMware, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
#include "svga_tgsi.h"
#include "svga_resource_texture.h"
#include "VGPU10ShaderTokens.h"
+
+#include "compiler/nir/nir.h"
+#include "compiler/glsl/gl_nir.h"
#include "nir/nir_to_tgsi.h"
{
struct svga_context *svga = svga_context(pipe);
struct svga_shader *shader = CALLOC(1, shader_structlen);
+ nir_shader *nir = (nir_shader *)templ->ir.nir;
if (shader == NULL)
return NULL;
shader->id = svga->debug.shader_id++;
shader->stage = stage;
+ if (templ->type == PIPE_SHADER_IR_NIR) {
+ /* nir_to_tgsi requires lowered images */
+ NIR_PASS_V(nir, gl_nir_lower_images, false);
+ }
shader->tokens = pipe_shader_state_to_tgsi_tokens(pipe->screen, templ);
shader->type = PIPE_SHADER_IR_TGSI;